Skip to content

Commit cd2b886

Browse files
committed
v0.6.0
redis-6.2
1 parent 758504a commit cd2b886

File tree

7 files changed

+76
-9
lines changed

7 files changed

+76
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 0.6.0
2+
3+
Redis 6.2 support.
4+
5+
`rst` command support `COPY,BLMOVE,LMOVE,ZDIFFSTORE,GEOSEARCHSTORE` commands.
6+
17
### 0.5.1
28

39
Fix `RedisURI` `setAuthUser` bug.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ migrate_flush=yes
524524
## Limitation of migration
525525

526526
1. We use cluster's `nodes.conf` to migrate data to cluster. because of we did't handle the `MOVED` `ASK` redirection. so limitation of cluster migration is that the cluster **MUST** in stable state during the migration. this means the cluster **MUST** have no `migrating`, `importing` slot and no switch slave to master.
527-
2. If use `rst` migrate data to cluster. the following commands not supported `SWAPDB,MOVE,FLUSHALL,FLUSHDB,PUBLISH,MULTI,EXEC,SCRIPT FLUSH,SCRIPT LOAD,EVAL,EVALSHA`. and the following commands `RPOPLPUSH,SDIFFSTORE,SINTERSTORE,SMOVE,ZINTERSTORE,ZUNIONSTORE,DEL,UNLINK,RENAME,RENAMENX,PFMERGE,PFCOUNT,MSETNX,BRPOPLPUSH,BITOP,MSET` **ONLY SUPPORT WHEN THESE COMMAND KEYS IN THE SAME SLOT**(eg: `del {user}:1 {user}:2`)
527+
2. If use `rst` migrate data to cluster. the following commands not supported `SWAPDB,MOVE,FLUSHALL,FLUSHDB,PUBLISH,MULTI,EXEC,SCRIPT FLUSH,SCRIPT LOAD,EVAL,EVALSHA`. and the following commands `RPOPLPUSH,SDIFFSTORE,SINTERSTORE,SMOVE,ZINTERSTORE,ZUNIONSTORE,DEL,UNLINK,RENAME,RENAMENX,PFMERGE,PFCOUNT,MSETNX,BRPOPLPUSH,BITOP,MSET,COPY,BLMOVE,LMOVE,ZDIFFSTORE,GEOSEARCHSTORE` **ONLY SUPPORT WHEN THESE COMMAND KEYS IN THE SAME SLOT**(eg: `del {user}:1 {user}:2`)
528528

529529
## Hack ret
530530

@@ -561,13 +561,13 @@ User should follow the steps below to implement a sink service.
561561
<dependency>
562562
<groupId>com.moilioncircle</groupId>
563563
<artifactId>redis-rdb-cli-api</artifactId>
564-
<version>1.4.1</version>
564+
<version>1.5.0</version>
565565
<scope>provided</scope>
566566
</dependency>
567567
<dependency>
568568
<groupId>com.moilioncircle</groupId>
569569
<artifactId>redis-replicator</artifactId>
570-
<version>3.4.0</version>
570+
<version>[3.4.0, )</version>
571571
<scope>provided</scope>
572572
</dependency>
573573
<dependency>

README.zh_CN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ migrate_flush=yes
524524
## 同步的限制
525525

526526
1. 我们通过集群的 `nodes.conf` 文件来同步数据到集群. 因为我们没有处理 `MOVED` `ASK` 重定向. 因此唯一的限制是集群在同步期间 **必须** 是稳定的状态. 这意味着集群 **必须** 不存在 `migrating`, `importing` 这样的slot. 而且没有主从切换.
527-
2. 当使用 `rst` 命令迁移数据到集群的时候. 下面的命令不支持: `SWAPDB,MOVE,FLUSHALL,FLUSHDB,PUBLISH,MULTI,EXEC,SCRIPT FLUSH,SCRIPT LOAD,EVAL,EVALSHA`. 下面的命令**有限支持** `RPOPLPUSH,SDIFFSTORE,SINTERSTORE,SMOVE,ZINTERSTORE,ZUNIONSTORE,DEL,UNLINK,RENAME,RENAMENX,PFMERGE,PFCOUNT,MSETNX,BRPOPLPUSH,BITOP,MSET`.**只有这些命令里包含的 keys 在同一个slot的时候**(eg: `del {user}:1 {user}:2`)才支持.
527+
2. 当使用 `rst` 命令迁移数据到集群的时候. 下面的命令不支持: `SWAPDB,MOVE,FLUSHALL,FLUSHDB,PUBLISH,MULTI,EXEC,SCRIPT FLUSH,SCRIPT LOAD,EVAL,EVALSHA`. 下面的命令**有限支持** `RPOPLPUSH,SDIFFSTORE,SINTERSTORE,SMOVE,ZINTERSTORE,ZUNIONSTORE,DEL,UNLINK,RENAME,RENAMENX,PFMERGE,PFCOUNT,MSETNX,BRPOPLPUSH,BITOP,MSET,COPY,BLMOVE,LMOVE,ZDIFFSTORE,GEOSEARCHSTORE`.**只有这些命令里包含的 keys 在同一个slot的时候**(eg: `del {user}:1 {user}:2`)才支持.
528528

529529
## Hack ret
530530

@@ -561,13 +561,13 @@ migrate_flush=yes
561561
<dependency>
562562
<groupId>com.moilioncircle</groupId>
563563
<artifactId>redis-rdb-cli-api</artifactId>
564-
<version>1.4.1</version>
564+
<version>1.5.0</version>
565565
<scope>provided</scope>
566566
</dependency>
567567
<dependency>
568568
<groupId>com.moilioncircle</groupId>
569569
<artifactId>redis-replicator</artifactId>
570-
<version>3.4.0</version>
570+
<version>[3.4.0, )</version>
571571
<scope>provided</scope>
572572
</dependency>
573573
<dependency>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<dependency>
7171
<groupId>com.moilioncircle</groupId>
7272
<artifactId>redis-replicator</artifactId>
73-
<version>3.4.4</version>
73+
<version>3.5.0</version>
7474
<exclusions>
7575
<exclusion>
7676
<groupId>org.slf4j</groupId>
@@ -81,7 +81,7 @@
8181
<dependency>
8282
<groupId>com.moilioncircle</groupId>
8383
<artifactId>redis-rdb-cli-api</artifactId>
84-
<version>1.4.1</version>
84+
<version>1.5.0</version>
8585
</dependency>
8686

8787
<dependency>

src/main/java/com/moilioncircle/redis/rdb/cli/cmd/RstCommand.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@
3737
import com.moilioncircle.redis.replicator.Replicators;
3838
import com.moilioncircle.redis.replicator.cmd.CommandName;
3939
import com.moilioncircle.redis.replicator.cmd.parser.AppendParser;
40+
import com.moilioncircle.redis.replicator.cmd.parser.BLMoveParser;
4041
import com.moilioncircle.redis.replicator.cmd.parser.BRPopLPushParser;
4142
import com.moilioncircle.redis.replicator.cmd.parser.BitFieldParser;
4243
import com.moilioncircle.redis.replicator.cmd.parser.BitOpParser;
44+
import com.moilioncircle.redis.replicator.cmd.parser.CopyParser;
4345
import com.moilioncircle.redis.replicator.cmd.parser.DecrByParser;
4446
import com.moilioncircle.redis.replicator.cmd.parser.DecrParser;
4547
import com.moilioncircle.redis.replicator.cmd.parser.DelParser;
@@ -51,6 +53,7 @@
5153
import com.moilioncircle.redis.replicator.cmd.parser.FlushAllParser;
5254
import com.moilioncircle.redis.replicator.cmd.parser.FlushDBParser;
5355
import com.moilioncircle.redis.replicator.cmd.parser.GeoAddParser;
56+
import com.moilioncircle.redis.replicator.cmd.parser.GeoSearchStoreParser;
5457
import com.moilioncircle.redis.replicator.cmd.parser.GetSetParser;
5558
import com.moilioncircle.redis.replicator.cmd.parser.HDelParser;
5659
import com.moilioncircle.redis.replicator.cmd.parser.HIncrByParser;
@@ -60,6 +63,7 @@
6063
import com.moilioncircle.redis.replicator.cmd.parser.IncrByParser;
6164
import com.moilioncircle.redis.replicator.cmd.parser.IncrParser;
6265
import com.moilioncircle.redis.replicator.cmd.parser.LInsertParser;
66+
import com.moilioncircle.redis.replicator.cmd.parser.LMoveParser;
6367
import com.moilioncircle.redis.replicator.cmd.parser.LPopParser;
6468
import com.moilioncircle.redis.replicator.cmd.parser.LPushParser;
6569
import com.moilioncircle.redis.replicator.cmd.parser.LPushXParser;
@@ -111,6 +115,7 @@
111115
import com.moilioncircle.redis.replicator.cmd.parser.XSetIdParser;
112116
import com.moilioncircle.redis.replicator.cmd.parser.XTrimParser;
113117
import com.moilioncircle.redis.replicator.cmd.parser.ZAddParser;
118+
import com.moilioncircle.redis.replicator.cmd.parser.ZDiffStoreParser;
114119
import com.moilioncircle.redis.replicator.cmd.parser.ZIncrByParser;
115120
import com.moilioncircle.redis.replicator.cmd.parser.ZInterStoreParser;
116121
import com.moilioncircle.redis.replicator.cmd.parser.ZPopMaxParser;
@@ -335,6 +340,12 @@ private Replicator dress(Replicator replicator) {
335340
replicator.addCommandParser(CommandName.name("XGROUP"), new CombineCommandParser(new XGroupParser()));
336341
replicator.addCommandParser(CommandName.name("XTRIM"), new CombineCommandParser(new XTrimParser()));
337342
replicator.addCommandParser(CommandName.name("XSETID"), new CombineCommandParser(new XSetIdParser()));
343+
// since redis 6.2
344+
replicator.addCommandParser(CommandName.name("COPY"), new CombineCommandParser(new CopyParser()));
345+
replicator.addCommandParser(CommandName.name("LMOVE"), new CombineCommandParser(new LMoveParser()));
346+
replicator.addCommandParser(CommandName.name("BLMOVE"), new CombineCommandParser(new BLMoveParser()));
347+
replicator.addCommandParser(CommandName.name("ZDIFFSTORE"), new CombineCommandParser(new ZDiffStoreParser()));
348+
replicator.addCommandParser(CommandName.name("GEOSEARCHSTORE"), new CombineCommandParser(new GeoSearchStoreParser()));
338349
return replicator;
339350
}
340351

src/main/java/com/moilioncircle/redis/rdb/cli/ext/rst/ClusterRdbVisitor.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@
4141
import com.moilioncircle.redis.replicator.Configuration;
4242
import com.moilioncircle.redis.replicator.Replicator;
4343
import com.moilioncircle.redis.replicator.cmd.Command;
44+
import com.moilioncircle.redis.replicator.cmd.impl.BLMoveCommand;
4445
import com.moilioncircle.redis.replicator.cmd.impl.BRPopLPushCommand;
4546
import com.moilioncircle.redis.replicator.cmd.impl.BitOpCommand;
47+
import com.moilioncircle.redis.replicator.cmd.impl.CopyCommand;
4648
import com.moilioncircle.redis.replicator.cmd.impl.DefaultCommand;
4749
import com.moilioncircle.redis.replicator.cmd.impl.DelCommand;
4850
import com.moilioncircle.redis.replicator.cmd.impl.GenericKeyCommand;
51+
import com.moilioncircle.redis.replicator.cmd.impl.GeoSearchStoreCommand;
52+
import com.moilioncircle.redis.replicator.cmd.impl.LMoveCommand;
4953
import com.moilioncircle.redis.replicator.cmd.impl.MSetCommand;
5054
import com.moilioncircle.redis.replicator.cmd.impl.MSetNxCommand;
5155
import com.moilioncircle.redis.replicator.cmd.impl.PFCountCommand;
@@ -59,6 +63,7 @@
5963
import com.moilioncircle.redis.replicator.cmd.impl.SMoveCommand;
6064
import com.moilioncircle.redis.replicator.cmd.impl.SelectCommand;
6165
import com.moilioncircle.redis.replicator.cmd.impl.UnLinkCommand;
66+
import com.moilioncircle.redis.replicator.cmd.impl.ZDiffStoreCommand;
6267
import com.moilioncircle.redis.replicator.cmd.impl.ZInterStoreCommand;
6368
import com.moilioncircle.redis.replicator.cmd.impl.ZUnionStoreCommand;
6469
import com.moilioncircle.redis.replicator.event.Event;
@@ -359,6 +364,51 @@ public void retry(CombineCommand command, int times) {
359364
monitor.add("failure_slot", 1);
360365
logger.error("failure[slot] [{}]", command);
361366
}
367+
} else if (parsedCommand instanceof CopyCommand) {
368+
CopyCommand cmd = (CopyCommand) parsedCommand;
369+
short slot = slot1(cmd.getDestination(), cmd.getSource());
370+
if (slot != -1) {
371+
retry(command, slot, times);
372+
} else {
373+
monitor.add("failure_slot", 1);
374+
logger.error("failure[slot] [{}]", command);
375+
}
376+
} else if (parsedCommand instanceof BLMoveCommand) {
377+
BLMoveCommand cmd = (BLMoveCommand) parsedCommand;
378+
short slot = slot1(cmd.getDestination(), cmd.getSource());
379+
if (slot != -1) {
380+
retry(command, slot, times);
381+
} else {
382+
monitor.add("failure_slot", 1);
383+
logger.error("failure[slot] [{}]", command);
384+
}
385+
} else if (parsedCommand instanceof LMoveCommand) {
386+
LMoveCommand cmd = (LMoveCommand) parsedCommand;
387+
short slot = slot1(cmd.getDestination(), cmd.getSource());
388+
if (slot != -1) {
389+
retry(command, slot, times);
390+
} else {
391+
monitor.add("failure_slot", 1);
392+
logger.error("failure[slot] [{}]", command);
393+
}
394+
} else if (parsedCommand instanceof ZDiffStoreCommand) {
395+
ZDiffStoreCommand cmd = (ZDiffStoreCommand) parsedCommand;
396+
short slot = slot1(cmd.getDestination(), cmd.getKeys());
397+
if (slot != -1) {
398+
retry(command, slot, times);
399+
} else {
400+
monitor.add("failure_slot", 1);
401+
logger.error("failure[slot] [{}]", command);
402+
}
403+
} else if (parsedCommand instanceof GeoSearchStoreCommand) {
404+
GeoSearchStoreCommand cmd = (GeoSearchStoreCommand) parsedCommand;
405+
short slot = slot1(cmd.getDestination(), cmd.getSource());
406+
if (slot != -1) {
407+
retry(command, slot, times);
408+
} else {
409+
monitor.add("failure_slot", 1);
410+
logger.error("failure[slot] [{}]", command);
411+
}
362412
} else if (parsedCommand instanceof GenericKeyCommand) {
363413
GenericKeyCommand cmd = (GenericKeyCommand) parsedCommand;
364414
retry(command, slot(cmd.getKey()), times);

src/main/resources/.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.5.1
1+
v0.6.0

0 commit comments

Comments
 (0)