From ab163a9eac464bfe86a70bb8c0e2e6fd2b9b99c4 Mon Sep 17 00:00:00 2001 From: Adam Retter Date: Thu, 21 Dec 2023 22:25:49 +0100 Subject: [PATCH] Fix JavaDoc after rebase on main --- .../utilities/table_properties_collectors.h | 2 +- java/src/main/java/org/rocksdb/Options.java | 3 +- .../org/rocksdb/RocksIteratorInterface.java | 5 + .../TablePropertiesCollectorFactory.java | 109 +++++++++++------- .../test/java/org/rocksdb/OptionsTest.java | 3 +- 5 files changed, 75 insertions(+), 47 deletions(-) diff --git a/include/rocksdb/utilities/table_properties_collectors.h b/include/rocksdb/utilities/table_properties_collectors.h index f9d8d5dcdd70..a4ace42d6808 100644 --- a/include/rocksdb/utilities/table_properties_collectors.h +++ b/include/rocksdb/utilities/table_properties_collectors.h @@ -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. // diff --git a/java/src/main/java/org/rocksdb/Options.java b/java/src/main/java/org/rocksdb/Options.java index 6639ea3b7802..e28358222243 100644 --- a/java/src/main/java/org/rocksdb/Options.java +++ b/java/src/main/java/org/rocksdb/Options.java @@ -2143,7 +2143,8 @@ public List 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 factories) { long[] factoryHandlers = new long[factories.size()]; diff --git a/java/src/main/java/org/rocksdb/RocksIteratorInterface.java b/java/src/main/java/org/rocksdb/RocksIteratorInterface.java index 78f35e3f86a0..454ff95d6e62 100644 --- a/java/src/main/java/org/rocksdb/RocksIteratorInterface.java +++ b/java/src/main/java/org/rocksdb/RocksIteratorInterface.java @@ -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; } diff --git a/java/src/main/java/org/rocksdb/TablePropertiesCollectorFactory.java b/java/src/main/java/org/rocksdb/TablePropertiesCollectorFactory.java index ae2789ef8263..fbf521408017 100644 --- a/java/src/main/java/org/rocksdb/TablePropertiesCollectorFactory.java +++ b/java/src/main/java/org/rocksdb/TablePropertiesCollectorFactory.java @@ -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 slidingWindowSize "N".Note that this number will be + * round up to the smallest multiple of 128 that is no less + * than the specified size. + * @param deletionTrigger "D". Note that even when "N" is changed, + * the specified number for "D" will not be changed. + * @param deletionRatio if <= 0 or > 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 slidingWindowSize, final long deletionTrigger, final double deletionRatio) { + final long handle = + newCompactOnDeletionCollectorFactory(slidingWindowSize, deletionTrigger, deletionRatio); + 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); +} diff --git a/java/src/test/java/org/rocksdb/OptionsTest.java b/java/src/test/java/org/rocksdb/OptionsTest.java index 5de42a13e758..a18aeff587d7 100644 --- a/java/src/test/java/org/rocksdb/OptionsTest.java +++ b/java/src/test/java/org/rocksdb/OptionsTest.java @@ -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 factories = Arrays.asList(collectorFactory); options.setTablePropertiesCollectorFactory(factories); }