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
main
Andres Noetzli 9 years ago
parent 14f4137602
commit f73c801432
  1. 18
      java/rocksjni/options.cc
  2. 6
      java/src/main/java/org/rocksdb/ColumnFamilyOptions.java
  3. 24
      java/src/main/java/org/rocksdb/ColumnFamilyOptionsInterface.java
  4. 6
      java/src/main/java/org/rocksdb/Options.java
  5. 15
      java/src/test/java/org/rocksdb/ColumnFamilyOptionsTest.java
  6. 15
      java/src/test/java/org/rocksdb/OptionsTest.java
  7. 6
      java/src/test/java/org/rocksdb/TtlDBTest.java

@ -1247,24 +1247,6 @@ void Java_org_rocksdb_Options_setLevelZeroStopWritesTrigger(
static_cast<int>(jlevel0_stop_writes_trigger); static_cast<int>(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 * Class: org_rocksdb_Options
* Method: targetFileSizeBase * Method: targetFileSizeBase

@ -276,13 +276,12 @@ public class ColumnFamilyOptions extends RocksObject
@Override @Override
public ColumnFamilyOptions setMaxMemCompactionLevel( public ColumnFamilyOptions setMaxMemCompactionLevel(
final int maxMemCompactionLevel) { final int maxMemCompactionLevel) {
setMaxMemCompactionLevel(nativeHandle_, maxMemCompactionLevel);
return this; return this;
} }
@Override @Override
public int maxMemCompactionLevel() { public int maxMemCompactionLevel() {
return maxMemCompactionLevel(nativeHandle_); return 0;
} }
@Override @Override
@ -708,9 +707,6 @@ public class ColumnFamilyOptions extends RocksObject
private native void setLevelZeroStopWritesTrigger( private native void setLevelZeroStopWritesTrigger(
long handle, int numFiles); long handle, int numFiles);
private native int levelZeroStopWritesTrigger(long handle); private native int levelZeroStopWritesTrigger(long handle);
private native void setMaxMemCompactionLevel(
long handle, int maxMemCompactionLevel);
private native int maxMemCompactionLevel(long handle);
private native void setTargetFileSizeBase( private native void setTargetFileSizeBase(
long handle, long targetFileSizeBase); long handle, long targetFileSizeBase);
private native long targetFileSizeBase(long handle); private native long targetFileSizeBase(long handle);

@ -381,30 +381,22 @@ public interface ColumnFamilyOptionsInterface {
int levelZeroStopWritesTrigger(); int levelZeroStopWritesTrigger();
/** /**
* The highest level to which a new compacted memtable is pushed if it * This does nothing anymore. Deprecated.
* does not create overlap. We try to push to level 2 to avoid the *
* relatively expensive level 0&ge;1 compactions and to avoid some * @param maxMemCompactionLevel Unused.
* 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.
* @return the reference to the current option. * @return the reference to the current option.
*/ */
@Deprecated
Object setMaxMemCompactionLevel( Object setMaxMemCompactionLevel(
int maxMemCompactionLevel); int maxMemCompactionLevel);
/** /**
* The highest level to which a new compacted memtable is pushed if it * This does nothing anymore. Deprecated.
* does not create overlap. We try to push to level 2 to avoid the
* relatively expensive level 0&ge;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.
* *
* @return the highest level where a new compacted memtable will be pushed. * @return Always returns 0.
*/ */
@Deprecated
int maxMemCompactionLevel(); int maxMemCompactionLevel();
/** /**

@ -763,13 +763,12 @@ public class Options extends RocksObject
@Override @Override
public int maxMemCompactionLevel() { public int maxMemCompactionLevel() {
return maxMemCompactionLevel(nativeHandle_); return 0;
} }
@Override @Override
public Options setMaxMemCompactionLevel( public Options setMaxMemCompactionLevel(
final int maxMemCompactionLevel) { final int maxMemCompactionLevel) {
setMaxMemCompactionLevel(nativeHandle_, maxMemCompactionLevel);
return this; return this;
} }
@ -1227,9 +1226,6 @@ public class Options extends RocksObject
private native void setLevelZeroStopWritesTrigger( private native void setLevelZeroStopWritesTrigger(
long handle, int numFiles); long handle, int numFiles);
private native int levelZeroStopWritesTrigger(long handle); private native int levelZeroStopWritesTrigger(long handle);
private native void setMaxMemCompactionLevel(
long handle, int maxMemCompactionLevel);
private native int maxMemCompactionLevel(long handle);
private native void setTargetFileSizeBase( private native void setTargetFileSizeBase(
long handle, long targetFileSizeBase); long handle, long targetFileSizeBase);
private native long targetFileSizeBase(long handle); private native long targetFileSizeBase(long handle);

@ -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 @Test
public void targetFileSizeBase() { public void targetFileSizeBase() {
ColumnFamilyOptions opt = null; ColumnFamilyOptions opt = null;

@ -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 @Test
public void targetFileSizeBase() { public void targetFileSizeBase() {
Options opt = null; Options opt = null;

@ -33,8 +33,7 @@ public class TtlDBTest {
try { try {
options = new Options(). options = new Options().
setCreateIfMissing(true). setCreateIfMissing(true).
setMaxGrandparentOverlapFactor(0). setMaxGrandparentOverlapFactor(0);
setMaxMemCompactionLevel(0);
ttlDB = TtlDB.open(options, ttlDB = TtlDB.open(options,
dbFolder.getRoot().getAbsolutePath()); dbFolder.getRoot().getAbsolutePath());
ttlDB.put("key".getBytes(), "value".getBytes()); ttlDB.put("key".getBytes(), "value".getBytes());
@ -59,8 +58,7 @@ public class TtlDBTest {
try { try {
options = new Options(). options = new Options().
setCreateIfMissing(true). setCreateIfMissing(true).
setMaxGrandparentOverlapFactor(0). setMaxGrandparentOverlapFactor(0);
setMaxMemCompactionLevel(0);
ttlDB = TtlDB.open(options, dbFolder.getRoot().getAbsolutePath(), ttlDB = TtlDB.open(options, dbFolder.getRoot().getAbsolutePath(),
1, false); 1, false);
ttlDB.put("key".getBytes(), "value".getBytes()); ttlDB.put("key".getBytes(), "value".getBytes());

Loading…
Cancel
Save