Fix jni WriteBatchThreadedTest

Summary:
WriteBatchThreadedTest is failing, at least on Mac. The problem seems to be `wb` is getting GC before we finish write. Explicitly close it seems to fix it.
Closes https://github.com/facebook/rocksdb/pull/2482

Differential Revision: D5307379

Pulled By: yiwu-arbug

fbshipit-source-id: 8ff7f8170451078c941951f5aafae83afffb7933
main
Yi Wu 8 years ago committed by Facebook Github Bot
parent 0025a36409
commit 2a9cd87997
  1. 13
      java/src/test/java/org/rocksdb/WriteBatchThreadedTest.java

@ -59,13 +59,14 @@ public class WriteBatchThreadedTest {
callables.add(new Callable<Void>() {
@Override
public Void call() throws RocksDBException {
final WriteBatch wb = new WriteBatch();
for (int i = offset; i < offset + 100; i++) {
wb.put(ByteBuffer.allocate(4).putInt(i).array(),
"parallel rocks test".getBytes());
try (final WriteBatch wb = new WriteBatch();
final WriteOptions w_opt = new WriteOptions()) {
for (int i = offset; i < offset + 100; i++) {
wb.put(ByteBuffer.allocate(4).putInt(i).array(),
"parallel rocks test".getBytes());
}
db.write(w_opt, wb);
}
db.write(new WriteOptions(), wb);
return null;
}
});

Loading…
Cancel
Save