Skip to content

Commit

Permalink
fix: --key-slot help
Browse files Browse the repository at this point in the history
  • Loading branch information
jruaux committed Sep 5, 2024
1 parent 6cfff07 commit 5908aad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class KeyFilterArgs {
@Option(names = "--key-exclude", arity = "1..*", description = "Glob pattern to match keys for exclusion. E.g. 'mykey:*' will exclude keys starting with 'mykey:'.", paramLabel = "<exp>")
private List<String> excludes;

@Option(names = "--key-slot", arity = "1..*", description = "Ranges of key slots to consider for processing. For example '0:8000' will only consider keys that fall within the range 0 to 8000.", paramLabel = "<range>")
@Option(names = "--key-slot", arity = "1..*", description = "Ranges of key slots to consider for processing. For example '0-8000' will only consider keys that fall within the range 0 to 8000.", paramLabel = "<range>")
private List<Range> slots;

public <K> Optional<Predicate<K>> predicate(RedisCodec<K, ?> codec) {
Expand Down
7 changes: 5 additions & 2 deletions plugins/riot/src/test/java/com/redis/riot/StackRiotTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ void replicateLiveThreads(TestInfo info) throws Exception {
void replicateLive(TestInfo info) throws Exception {
runLiveReplication(info, "replicate-live");
}

@Test
void replicateLiveReadThreads(TestInfo info) throws Exception {
runLiveReplication(info, "replicate-live-read-threads");
Expand All @@ -719,10 +719,13 @@ void replicateLiveReadThreads(TestInfo info) throws Exception {
void replicateLiveKeySlot(TestInfo info) throws Exception {
String filename = "replicate-live-keyslot";
enableKeyspaceNotifications();
GeneratorItemReader generator = generator(300);
int count = 300;
GeneratorItemReader generator = generator(count);
generateAsync(info, generator);
execute(info, filename);
awaitNoSubscribers();
List<String> keys = targetRedisCommands.keys("*");
Assertions.assertEquals(148, keys.size());
for (String key : keys) {
int slot = SlotHash.getSlot(key);
Assertions.assertTrue(slot >= 0 && slot <= 8000);
Expand Down
2 changes: 1 addition & 1 deletion plugins/riot/src/test/resources/replicate-live-keyslot
Original file line number Diff line number Diff line change
@@ -1 +1 @@
riot replicate --mode liveonly --key-slot 0:8000 redis://source redis://target
riot replicate --mode liveonly --key-slot 0-8000 redis://source redis://target

0 comments on commit 5908aad

Please sign in to comment.