You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by do...@apache.org on 2022/02/02 21:09:25 UTC

[geode] 01/02: GEODE-10011: Do not perform second scan if first scanned entire map (#7333)

This is an automated email from the ASF dual-hosted git repository.

donalevans pushed a commit to branch support/1.15
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 41e4ef9014755a13f17dccc3fc83997fce37b5c6
Author: Donal Evans <do...@vmware.com>
AuthorDate: Wed Feb 2 08:34:40 2022 -0800

    GEODE-10011: Do not perform second scan if first scanned entire map (#7333)
    
    - The test scanWithNoModificationsDoesNotReturnDuplicates in
     SizeableBytes2ObjectOpenCustomHashMapWithCursorQuickCheckTest should
     only perform a second scan if the first one was not a complete scan of
     the map
    
    Authored-by: Donal Evans <do...@vmware.com>
    (cherry picked from commit dcba954c1e8060b409409f67b6a2e55a1e2c37b2)
---
 ...zeableBytes2ObjectOpenCustomHashMapWithCursorQuickCheckTest.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/geode-for-redis/src/test/java/org/apache/geode/redis/internal/data/collections/SizeableBytes2ObjectOpenCustomHashMapWithCursorQuickCheckTest.java b/geode-for-redis/src/test/java/org/apache/geode/redis/internal/data/collections/SizeableBytes2ObjectOpenCustomHashMapWithCursorQuickCheckTest.java
index 191f83a..316da92 100644
--- a/geode-for-redis/src/test/java/org/apache/geode/redis/internal/data/collections/SizeableBytes2ObjectOpenCustomHashMapWithCursorQuickCheckTest.java
+++ b/geode-for-redis/src/test/java/org/apache/geode/redis/internal/data/collections/SizeableBytes2ObjectOpenCustomHashMapWithCursorQuickCheckTest.java
@@ -78,7 +78,11 @@ public class SizeableBytes2ObjectOpenCustomHashMapWithCursorQuickCheckTest {
     int cursor =
         map.scan(0, initialData.size() / 2, (data, key, value) -> data.add(value), scanned);
 
-    cursor = map.scan(cursor, 100000, (data, key, value) -> data.add(value), scanned);
+    // It's possible to scan the entire map in the first scan if the map is small and there are hash
+    // collisions, so only do a second scan if the first one was not a complete scan
+    if (cursor != 0) {
+      cursor = map.scan(cursor, 100000, (data, key, value) -> data.add(value), scanned);
+    }
     assertThat(cursor).isEqualTo(0);
 
     // Test that no duplicate entries were added and no entries were missed.