From 971c18a0bb7d543b5aeb353b968ace600193660c Mon Sep 17 00:00:00 2001 From: helyho Date: Thu, 26 Mar 2020 03:45:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20RocksMap.startWith?= =?UTF-8?q?=20=20=E4=B8=80=E8=87=B4=E8=BF=AD=E4=BB=A3=E5=88=B0=E5=B0=BE?= =?UTF-8?q?=E9=83=A8=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Common/pom.xml | 2 +- Common/src/main/java/org/voovan/tools/collection/RocksMap.java | 2 ++ .../java/org/voovan/test/tools/collection/RocksMapTest.java | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Common/pom.xml b/Common/pom.xml index 2fd7b1f23..d8bb7ec65 100644 --- a/Common/pom.xml +++ b/Common/pom.xml @@ -37,7 +37,7 @@ org.rocksdb rocksdbjni - 6.2.4 + 6.6.4 true diff --git a/Common/src/main/java/org/voovan/tools/collection/RocksMap.java b/Common/src/main/java/org/voovan/tools/collection/RocksMap.java index 8add23977..756bdbd02 100644 --- a/Common/src/main/java/org/voovan/tools/collection/RocksMap.java +++ b/Common/src/main/java/org/voovan/tools/collection/RocksMap.java @@ -1524,6 +1524,8 @@ public Map startWith(K key, int skipSize, int size) { iterator.directNext(); if (TByte.byteArrayStartWith(iterator.keyBytes(), keyBytes)) { entryMap.put((K) iterator.key(), (V) iterator.value()); + } else { + break; } } diff --git a/Common/src/test/java/org/voovan/test/tools/collection/RocksMapTest.java b/Common/src/test/java/org/voovan/test/tools/collection/RocksMapTest.java index 50942cf46..054910d5a 100644 --- a/Common/src/test/java/org/voovan/test/tools/collection/RocksMapTest.java +++ b/Common/src/test/java/org/voovan/test/tools/collection/RocksMapTest.java @@ -94,7 +94,7 @@ public void testWal() throws RocksDBException { // columnFamilyOptions.setWriteBufferSize(1024*1024*512); RocksMap rocksMap = new RocksMap("waltest", "cfname", columnFamilyOptions, dbOptions, readOptions, writeOptions, false); - for(int i=0;i<300000;i++){ + for(int i=0;i<30;i++){ rocksMap.put(i, i); } rocksMap.compact();