Skip to content

Commit

Permalink
Fix JavaDoc after rebase on main
Browse files Browse the repository at this point in the history
  • Loading branch information
adamretter committed Dec 21, 2023
1 parent 94bb076 commit 9043721
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 47 deletions.
2 changes: 1 addition & 1 deletion include/rocksdb/utilities/table_properties_collectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class CompactOnDeletionCollectorFactory
};

// Creates a factory of a table property collector that marks a SST
// file as need-compaction when it observe at least "D" deletion
// file as need-compaction when it observes at least "D" deletion
// entries in any "N" consecutive entries, or the ratio of tombstone
// entries >= deletion_ratio.
//
Expand Down
3 changes: 2 additions & 1 deletion java/src/main/java/org/rocksdb/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,8 @@ public List<TablePropertiesCollectorFactory> tablePropertiesCollectorFactory() {
* Set TablePropertiesCollectorFactory in underlying C++ object.
* This method create its own copy of the list. Caller is responsible for
* closing all the instances in the list.
* @param factories
*
* @param factories the collector factories.
*/
public void setTablePropertiesCollectorFactory(List<TablePropertiesCollectorFactory> factories) {
long[] factoryHandlers = new long[factories.size()];
Expand Down
5 changes: 5 additions & 0 deletions java/src/main/java/org/rocksdb/RocksIteratorInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ public interface RocksIteratorInterface {
/**
* Similar to {@link #refresh()} but the iterator will be reading the latest DB state under the
* given snapshot.
*
* @param snapshot the snapshot.
*
* @throws RocksDBException thrown if the operation is not supported or an error happens in the
* underlying native library
*/
void refresh(Snapshot snapshot) throws RocksDBException;
}
109 changes: 65 additions & 44 deletions java/src/main/java/org/rocksdb/TablePropertiesCollectorFactory.java
Original file line number Diff line number Diff line change
@@ -1,44 +1,65 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).

package org.rocksdb;

public abstract class TablePropertiesCollectorFactory extends RocksObject {
private TablePropertiesCollectorFactory(final long nativeHandle) {
super(nativeHandle);
}

public static TablePropertiesCollectorFactory NewCompactOnDeletionCollectorFactory(
final long sliding_window_size, final long deletion_trigger, final double deletion_ratio) {
long handle =
newCompactOnDeletionCollectorFactory(sliding_window_size, deletion_trigger, deletion_ratio);
return new TablePropertiesCollectorFactory(handle) {
@Override
protected void disposeInternal(long handle) {
TablePropertiesCollectorFactory.deleteCompactOnDeletionCollectorFactory(handle);
}
};
}

/**
* Internal API. Do not use.
* @param nativeHandle
* @return
*/
static TablePropertiesCollectorFactory newWrapper(final long nativeHandle) {
return new TablePropertiesCollectorFactory(nativeHandle) {
@Override
protected void disposeInternal(long handle) {
TablePropertiesCollectorFactory.deleteCompactOnDeletionCollectorFactory(handle);
}
};
}

private static native long newCompactOnDeletionCollectorFactory(
final long slidingWindowSize, final long deletionTrigger, final double deletionRatio);

private static native void deleteCompactOnDeletionCollectorFactory(final long handle);
}
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).

package org.rocksdb;

/**
* Table Properties Collector Factory.
*/
public abstract class TablePropertiesCollectorFactory extends RocksObject {
private TablePropertiesCollectorFactory(final long nativeHandle) {
super(nativeHandle);
}

/**
* Creates a factory of a table property collector that marks a SST
* file as need-compaction when it observes at least "D" deletion
* entries in any "N" consecutive entries, or the ratio of tombstone
* entries >= deletion_ratio.
*
* @param sliding_window_size "N".Note that this number will be
* round up to the smallest multiple of 128 that is no less
* than the specified size.
* @param deletion_trigger "D". Note that even when "N" is changed,
* the specified number for "D" will not be changed.
* @param deletion_ratio, if &lt;= 0 or &gt; 1, disable triggering compaction
* based on deletion ratio. Disabled by default.
*
* @return the new compact on deletion collector factory.
*/
public static TablePropertiesCollectorFactory createNewCompactOnDeletionCollectorFactory(
final long sliding_window_size, final long deletion_trigger, final double deletion_ratio) {
final long handle =
newCompactOnDeletionCollectorFactory(sliding_window_size, deletion_trigger, deletion_ratio);
return new TablePropertiesCollectorFactory(handle) {
@Override
protected void disposeInternal(final long handle) {
TablePropertiesCollectorFactory.deleteCompactOnDeletionCollectorFactory(handle);
}
};
}

/**
* Internal API. Do not use.
*
* @param nativeHandle the native handle to wrap.
*
* @return the new TablePropertiesCollectorFactory.
*/
static TablePropertiesCollectorFactory newWrapper(final long nativeHandle) {
return new TablePropertiesCollectorFactory(nativeHandle) {
@Override
protected void disposeInternal(long handle) {
TablePropertiesCollectorFactory.deleteCompactOnDeletionCollectorFactory(handle);
}
};
}

private static native long newCompactOnDeletionCollectorFactory(
final long slidingWindowSize, final long deletionTrigger, final double deletionRatio);

private static native void deleteCompactOnDeletionCollectorFactory(final long handle);
}
3 changes: 2 additions & 1 deletion java/src/test/java/org/rocksdb/OptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,8 @@ public void onMemTableSealed(final MemTableInfo memTableInfo) {
public void tablePropertiesCollectorFactory() {
try (final Options options = new Options()) {
try (TablePropertiesCollectorFactory collectorFactory =
TablePropertiesCollectorFactory.NewCompactOnDeletionCollectorFactory(10, 10, 1.0)) {
TablePropertiesCollectorFactory.createNewCompactOnDeletionCollectorFactory(
10, 10, 1.0)) {
List<TablePropertiesCollectorFactory> factories = Arrays.asList(collectorFactory);
options.setTablePropertiesCollectorFactory(factories);
}
Expand Down

0 comments on commit 9043721

Please sign in to comment.