DATAREDIS-803 - Retrieve DefaultRedisMap.entrySet() via HGETALL.
Redis has a limitation of 1024 * 1024 parameters]() for bulk operations. To receive more than 1024 * 1024 - 1 entries with entrySet(), we can directly use the HGETALL command instead of first fetching the keys with HKEYS and then fetching the values with HMGET. See also: https://github.com/antirez/redis/blob/4.0.9/src/networking.c#L1200 Original pull request: #326.
This commit is contained in:
committed by
Mark Paluch
parent
cd340448b2
commit
8ed4703d46
@@ -25,6 +25,7 @@ import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
@@ -62,6 +63,7 @@ import org.springframework.test.annotation.IfProfileValue;
|
||||
* @author Jennifer Hickey
|
||||
* @author Christoph Strobl
|
||||
* @author Thomas Darimont
|
||||
* @author Christian Bühler
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
public abstract class AbstractRedisMapTests<K, V> {
|
||||
@@ -396,6 +398,27 @@ public abstract class AbstractRedisMapTests<K, V> {
|
||||
assertThat(values, not(hasItem(v2)));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-803
|
||||
@IfProfileValue(name = "runLongTests", value = "true")
|
||||
public void testBigEntrySet() {
|
||||
|
||||
Set<Entry<K, V>> entries = map.entrySet();
|
||||
assertTrue(entries.isEmpty());
|
||||
|
||||
for (int j = 0; j < 2; j++) {
|
||||
Map<K, V> m = new HashMap<>();
|
||||
for (int i = 0; i < 1024 * 1024 / 2 - 1; i++) {
|
||||
m.put(getKey(), getValue());
|
||||
}
|
||||
map.putAll(m);
|
||||
}
|
||||
map.put(getKey(), getValue());
|
||||
|
||||
entries = map.entrySet();
|
||||
|
||||
assertEquals(1024 * 1024 - 1, entries.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutIfAbsent() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user