DATAREDIS-756 - Order results of partitioned multi-key commands by positional keys.
We now order and assemble results of multi-key commands (e.g. MGET with cross-slot keys) that are executed on different nodes by positional keys to retain duplicate keys in the requested order and retain the server response. Previously duplicate keys were treated as set of keys and the response didn't match the requested keys. Original Pull Request: #303
This commit is contained in:
committed by
Christoph Strobl
parent
6d4acdef4c
commit
c20d9ca742
@@ -300,9 +300,15 @@ public interface ClusterConnectionTests {
|
||||
// DATAREDIS-315
|
||||
void mGetShouldReturnCorrectlyWhenKeysDoNotMapToSameSlot();
|
||||
|
||||
// DATAREDIS-756
|
||||
void mGetShouldReturnMultipleSameKeysWhenKeysDoNotMapToSameSlot();
|
||||
|
||||
// DATAREDIS-315
|
||||
void mGetShouldReturnCorrectlyWhenKeysMapToSameSlot();
|
||||
|
||||
// DATAREDIS-756
|
||||
void mGetShouldReturnMultipleSameKeysWhenKeysMapToSameSlot();
|
||||
|
||||
// DATAREDIS-315
|
||||
void mSetNXShouldReturnFalseIfNotAllKeysSet();
|
||||
|
||||
|
||||
@@ -1069,6 +1069,17 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.mGet(KEY_1_BYTES, KEY_2_BYTES), contains(VALUE_1_BYTES, VALUE_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-756
|
||||
public void mGetShouldReturnMultipleSameKeysWhenKeysDoNotMapToSameSlot() {
|
||||
|
||||
nativeConnection.set(KEY_1_BYTES, VALUE_1_BYTES);
|
||||
nativeConnection.set(KEY_2_BYTES, VALUE_2_BYTES);
|
||||
nativeConnection.set(KEY_3_BYTES, VALUE_3_BYTES);
|
||||
|
||||
List<byte[]> result = clusterConnection.mGet(KEY_1_BYTES, KEY_2_BYTES, KEY_3_BYTES, KEY_1_BYTES);
|
||||
assertThat(result, contains(VALUE_1_BYTES, VALUE_2_BYTES, VALUE_3_BYTES, VALUE_1_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void mGetShouldReturnCorrectlyWhenKeysMapToSameSlot() {
|
||||
|
||||
@@ -1079,6 +1090,16 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
contains(VALUE_1_BYTES, VALUE_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-756
|
||||
public void mGetShouldReturnMultipleSameKeysWhenKeysMapToSameSlot() {
|
||||
|
||||
nativeConnection.set(SAME_SLOT_KEY_1_BYTES, VALUE_1_BYTES);
|
||||
nativeConnection.set(SAME_SLOT_KEY_2_BYTES, VALUE_2_BYTES);
|
||||
|
||||
List<byte[]> result = clusterConnection.mGet(SAME_SLOT_KEY_1_BYTES, SAME_SLOT_KEY_2_BYTES, SAME_SLOT_KEY_1_BYTES);
|
||||
assertThat(result, contains(VALUE_1_BYTES, VALUE_2_BYTES, VALUE_1_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void mSetNXShouldReturnFalseIfNotAllKeysSet() {
|
||||
|
||||
|
||||
@@ -1038,6 +1038,16 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.mGet(KEY_1_BYTES, KEY_2_BYTES), contains(VALUE_1_BYTES, VALUE_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-756
|
||||
public void mGetShouldReturnMultipleSameKeysWhenKeysDoNotMapToSameSlot() {
|
||||
|
||||
nativeConnection.set(KEY_1, VALUE_1);
|
||||
nativeConnection.set(KEY_2, VALUE_2);
|
||||
|
||||
assertThat(clusterConnection.mGet(KEY_1_BYTES, KEY_2_BYTES, KEY_1_BYTES),
|
||||
contains(VALUE_1_BYTES, VALUE_2_BYTES, VALUE_1_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void mGetShouldReturnCorrectlyWhenKeysMapToSameSlot() {
|
||||
|
||||
@@ -1048,6 +1058,16 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
contains(VALUE_1_BYTES, VALUE_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-756
|
||||
public void mGetShouldReturnMultipleSameKeysWhenKeysMapToSameSlot() {
|
||||
|
||||
nativeConnection.set(SAME_SLOT_KEY_1, VALUE_1);
|
||||
nativeConnection.set(SAME_SLOT_KEY_2, VALUE_2);
|
||||
|
||||
assertThat(clusterConnection.mGet(SAME_SLOT_KEY_1_BYTES, SAME_SLOT_KEY_2_BYTES, SAME_SLOT_KEY_1_BYTES),
|
||||
contains(VALUE_1_BYTES, VALUE_2_BYTES, VALUE_1_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
public void mSetNXShouldReturnFalseIfNotAllKeysSet() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user