You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by xi...@apache.org on 2018/05/10 19:16:40 UTC

samza git commit: Fixed test failure for TestRocksDbKeyValueStoreJava#testPerf

Repository: samza
Updated Branches:
  refs/heads/master fed8212bd -> 54c690e6f


Fixed test failure for TestRocksDbKeyValueStoreJava#testPerf

Iterators (incl. those obtained from snapshots) must be closed before store close.

Author: Prateek Maheshwari <pm...@linkedin.com>

Reviewers: Xinyu Liu <xi...@gmail.com>

Closes #514 from prateekm/rocksdb-test-fi


Project: http://git-wip-us.apache.org/repos/asf/samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/samza/commit/54c690e6
Tree: http://git-wip-us.apache.org/repos/asf/samza/tree/54c690e6
Diff: http://git-wip-us.apache.org/repos/asf/samza/diff/54c690e6

Branch: refs/heads/master
Commit: 54c690e6fc52ac13d1c59fe1bd1c34f35f710164
Parents: fed8212
Author: Prateek Maheshwari <pm...@linkedin.com>
Authored: Thu May 10 12:16:33 2018 -0700
Committer: xiliu <xi...@linkedin.com>
Committed: Thu May 10 12:16:33 2018 -0700

----------------------------------------------------------------------
 .../storage/kv/TestRocksDbKeyValueStoreJava.java     | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/samza/blob/54c690e6/samza-kv-rocksdb/src/test/java/org/apache/samza/storage/kv/TestRocksDbKeyValueStoreJava.java
----------------------------------------------------------------------
diff --git a/samza-kv-rocksdb/src/test/java/org/apache/samza/storage/kv/TestRocksDbKeyValueStoreJava.java b/samza-kv-rocksdb/src/test/java/org/apache/samza/storage/kv/TestRocksDbKeyValueStoreJava.java
index a69010c..96a26ff 100644
--- a/samza-kv-rocksdb/src/test/java/org/apache/samza/storage/kv/TestRocksDbKeyValueStoreJava.java
+++ b/samza-kv-rocksdb/src/test/java/org/apache/samza/storage/kv/TestRocksDbKeyValueStoreJava.java
@@ -103,24 +103,27 @@ public class TestRocksDbKeyValueStoreJava {
     byte[] lastKey = genKey(outputStream, prefix, Integer.MAX_VALUE);
 
     long start;
-    KeyValueIterator iter;
 
     start = System.currentTimeMillis();
-    iter = store.range(firstKey, lastKey);
+    KeyValueIterator<byte[], byte[]> iterator1 = store.range(firstKey, lastKey);
     long rangeTime = System.currentTimeMillis() - start;
     start = System.currentTimeMillis();
-    Iterators.size(iter);
+    Iterators.size(iterator1);
     long rangeIterTime = System.currentTimeMillis() - start;
     System.out.println("range iter create time: " + rangeTime + ", iterate time: " + rangeIterTime);
-
+    iterator1.close();
     // Please comment out range query part in order to do an accurate perf test for snapshot
     start = System.currentTimeMillis();
-    iter = store.snapshot(firstKey, lastKey).iterator();
+    KeyValueSnapshot<byte[], byte[]> snapshot = store.snapshot(firstKey, lastKey);
+    KeyValueIterator<byte[], byte[]> iterator2 = snapshot.iterator();
     long snapshotTime = System.currentTimeMillis() - start;
     start = System.currentTimeMillis();
-    Iterators.size(iter);
+    Iterators.size(iterator2);
     long snapshotIterTime = System.currentTimeMillis() - start;
     System.out.println("snapshot iter create time: " + snapshotTime + ", iterate time: " + snapshotIterTime);
+    iterator2.close();
+    snapshot.close();
+    store.close();
   }
 
   private byte[] genKey(ByteArrayOutputStream outputStream, String prefix, int i) throws Exception {