From f73c801432bed1482b52ae8efdc699b00d7fcbdf Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Fri, 24 Jul 2015 16:56:26 -0700 Subject: [PATCH] Fixing Java tests. Summary: While working on https://reviews.facebook.net/D43017 , I realized that some Java tests are failing due to a deprecated option. This patch removes the offending tests, adds @Deprecated annotations to the Java interface and removes the corresponding functions in rocksjni Test Plan: make jtest (all tests are passing now) Reviewers: rven, igor, sdong, anthony, yhchiang Reviewed By: yhchiang Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D43035 --- java/rocksjni/options.cc | 18 -------------- .../java/org/rocksdb/ColumnFamilyOptions.java | 6 +---- .../rocksdb/ColumnFamilyOptionsInterface.java | 24 +++++++------------ java/src/main/java/org/rocksdb/Options.java | 6 +---- .../org/rocksdb/ColumnFamilyOptionsTest.java | 15 ------------ .../test/java/org/rocksdb/OptionsTest.java | 15 ------------ java/src/test/java/org/rocksdb/TtlDBTest.java | 6 ++--- 7 files changed, 12 insertions(+), 78 deletions(-) diff --git a/java/rocksjni/options.cc b/java/rocksjni/options.cc index 724fb8810..ef5b4bffd 100644 --- a/java/rocksjni/options.cc +++ b/java/rocksjni/options.cc @@ -1247,24 +1247,6 @@ void Java_org_rocksdb_Options_setLevelZeroStopWritesTrigger( static_cast(jlevel0_stop_writes_trigger); } -/* - * Class: org_rocksdb_Options - * Method: maxMemCompactionLevel - * Signature: (J)I - */ -jint Java_org_rocksdb_Options_maxMemCompactionLevel( - JNIEnv* env, jobject jobj, jlong jhandle) { - return 0; -} - -/* - * Class: org_rocksdb_Options - * Method: setMaxMemCompactionLevel - * Signature: (JI)V - */ -void Java_org_rocksdb_Options_setMaxMemCompactionLevel( - JNIEnv* env, jobject jobj, jlong jhandle, jint jmax_mem_compaction_level) {} - /* * Class: org_rocksdb_Options * Method: targetFileSizeBase diff --git a/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java b/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java index c916ccbd8..cdb97167c 100644 --- a/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java +++ b/java/src/main/java/org/rocksdb/ColumnFamilyOptions.java @@ -276,13 +276,12 @@ public class ColumnFamilyOptions extends RocksObject @Override public ColumnFamilyOptions setMaxMemCompactionLevel( final int maxMemCompactionLevel) { - setMaxMemCompactionLevel(nativeHandle_, maxMemCompactionLevel); return this; } @Override public int maxMemCompactionLevel() { - return maxMemCompactionLevel(nativeHandle_); + return 0; } @Override @@ -708,9 +707,6 @@ public class ColumnFamilyOptions extends RocksObject private native void setLevelZeroStopWritesTrigger( long handle, int numFiles); private native int levelZeroStopWritesTrigger(long handle); - private native void setMaxMemCompactionLevel( - long handle, int maxMemCompactionLevel); - private native int maxMemCompactionLevel(long handle); private native void setTargetFileSizeBase( long handle, long targetFileSizeBase); private native long targetFileSizeBase(long handle); diff --git a/java/src/main/java/org/rocksdb/ColumnFamilyOptionsInterface.java b/java/src/main/java/org/rocksdb/ColumnFamilyOptionsInterface.java index 5eaef4edd..ad296f111 100644 --- a/java/src/main/java/org/rocksdb/ColumnFamilyOptionsInterface.java +++ b/java/src/main/java/org/rocksdb/ColumnFamilyOptionsInterface.java @@ -381,30 +381,22 @@ public interface ColumnFamilyOptionsInterface { int levelZeroStopWritesTrigger(); /** - * The highest level to which a new compacted memtable is pushed if it - * does not create overlap. We try to push to level 2 to avoid the - * relatively expensive level 0≥1 compactions and to avoid some - * expensive manifest file operations. We do not push all the way to - * the largest level since that can generate a lot of wasted disk - * space if the same key space is being repeatedly overwritten. - * - * @param maxMemCompactionLevel the highest level to which a new compacted - * mem-table will be pushed. + * This does nothing anymore. Deprecated. + * + * @param maxMemCompactionLevel Unused. + * * @return the reference to the current option. */ + @Deprecated Object setMaxMemCompactionLevel( int maxMemCompactionLevel); /** - * The highest level to which a new compacted memtable is pushed if it - * does not create overlap. We try to push to level 2 to avoid the - * relatively expensive level 0≥1 compactions and to avoid some - * expensive manifest file operations. We do not push all the way to - * the largest level since that can generate a lot of wasted disk - * space if the same key space is being repeatedly overwritten. + * This does nothing anymore. Deprecated. * - * @return the highest level where a new compacted memtable will be pushed. + * @return Always returns 0. */ + @Deprecated int maxMemCompactionLevel(); /** diff --git a/java/src/main/java/org/rocksdb/Options.java b/java/src/main/java/org/rocksdb/Options.java index fdd7fe903..92efc7887 100644 --- a/java/src/main/java/org/rocksdb/Options.java +++ b/java/src/main/java/org/rocksdb/Options.java @@ -763,13 +763,12 @@ public class Options extends RocksObject @Override public int maxMemCompactionLevel() { - return maxMemCompactionLevel(nativeHandle_); + return 0; } @Override public Options setMaxMemCompactionLevel( final int maxMemCompactionLevel) { - setMaxMemCompactionLevel(nativeHandle_, maxMemCompactionLevel); return this; } @@ -1227,9 +1226,6 @@ public class Options extends RocksObject private native void setLevelZeroStopWritesTrigger( long handle, int numFiles); private native int levelZeroStopWritesTrigger(long handle); - private native void setMaxMemCompactionLevel( - long handle, int maxMemCompactionLevel); - private native int maxMemCompactionLevel(long handle); private native void setTargetFileSizeBase( long handle, long targetFileSizeBase); private native long targetFileSizeBase(long handle); diff --git a/java/src/test/java/org/rocksdb/ColumnFamilyOptionsTest.java b/java/src/test/java/org/rocksdb/ColumnFamilyOptionsTest.java index 531a1d0f8..1a0b4df3b 100644 --- a/java/src/test/java/org/rocksdb/ColumnFamilyOptionsTest.java +++ b/java/src/test/java/org/rocksdb/ColumnFamilyOptionsTest.java @@ -180,21 +180,6 @@ public class ColumnFamilyOptionsTest { } } - @Test - public void maxMemCompactionLevel() { - ColumnFamilyOptions opt = null; - try { - opt = new ColumnFamilyOptions(); - int intValue = rand.nextInt(); - opt.setMaxMemCompactionLevel(intValue); - assertThat(opt.maxMemCompactionLevel()).isEqualTo(intValue); - } finally { - if (opt != null) { - opt.dispose(); - } - } - } - @Test public void targetFileSizeBase() { ColumnFamilyOptions opt = null; diff --git a/java/src/test/java/org/rocksdb/OptionsTest.java b/java/src/test/java/org/rocksdb/OptionsTest.java index 5f950eaa2..611e37c51 100644 --- a/java/src/test/java/org/rocksdb/OptionsTest.java +++ b/java/src/test/java/org/rocksdb/OptionsTest.java @@ -142,21 +142,6 @@ public class OptionsTest { } } - @Test - public void maxMemCompactionLevel() { - Options opt = null; - try { - opt = new Options(); - int intValue = rand.nextInt(); - opt.setMaxMemCompactionLevel(intValue); - assertThat(opt.maxMemCompactionLevel()).isEqualTo(intValue); - } finally { - if (opt != null) { - opt.dispose(); - } - } - } - @Test public void targetFileSizeBase() { Options opt = null; diff --git a/java/src/test/java/org/rocksdb/TtlDBTest.java b/java/src/test/java/org/rocksdb/TtlDBTest.java index 0b816d66a..c60b1d512 100644 --- a/java/src/test/java/org/rocksdb/TtlDBTest.java +++ b/java/src/test/java/org/rocksdb/TtlDBTest.java @@ -33,8 +33,7 @@ public class TtlDBTest { try { options = new Options(). setCreateIfMissing(true). - setMaxGrandparentOverlapFactor(0). - setMaxMemCompactionLevel(0); + setMaxGrandparentOverlapFactor(0); ttlDB = TtlDB.open(options, dbFolder.getRoot().getAbsolutePath()); ttlDB.put("key".getBytes(), "value".getBytes()); @@ -59,8 +58,7 @@ public class TtlDBTest { try { options = new Options(). setCreateIfMissing(true). - setMaxGrandparentOverlapFactor(0). - setMaxMemCompactionLevel(0); + setMaxGrandparentOverlapFactor(0); ttlDB = TtlDB.open(options, dbFolder.getRoot().getAbsolutePath(), 1, false); ttlDB.put("key".getBytes(), "value".getBytes());