Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/xredis-gtid
46 changes: 23 additions & 23 deletions src/ctrip_swap_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"getex",getexCommand,-2,
"write fast @string @swap_string",
"write fast gtid-non-determinism @string @swap_string",
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"getdel",getdelCommand,2,
"write fast @string @swap_string",
"write fast gtid-non-determinism @string @swap_string",
0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0},

/* Note that we can't flag set as fast, since it may perform an
Expand All @@ -58,15 +58,15 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"setex",setexCommand,4,
"write use-memory @string @swap_string @swap_keyspace",
"write use-memory gtid-non-determinism @string @swap_string @swap_keyspace",
0,NULL,NULL,SWAP_IN,SWAP_IN_OVERWRITE,1,1,1,0,0,0},

{"psetex",psetexCommand,4,
"write use-memory @string @swap_string @swap_keyspace",
"write use-memory gtid-non-determinism @string @swap_string @swap_keyspace",
0,NULL,NULL,SWAP_IN,SWAP_IN_OVERWRITE,1,1,1,0,0,0},

{"append",appendCommand,3,
"write use-memory fast @string @swap_string",
"write use-memory fast gtid-non-determinism @string @swap_string",
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"strlen",strlenCommand,2,
Expand Down Expand Up @@ -102,7 +102,7 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,getKeyRequestsBitField,SWAP_IN,0,1,1,1,0,0,0},

{"setrange",setrangeCommand,4,
"write use-memory @string @swap_string",
"write use-memory gtid-non-determinism @string @swap_string",
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"getrange",getrangeCommand,4,
Expand All @@ -114,11 +114,11 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"incr",incrCommand,2,
"write use-memory fast @string @swap_string",
"write use-memory fast gtid-non-determinism @string @swap_string",
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"decr",decrCommand,2,
"write use-memory fast @string @swap_string",
"write use-memory fast gtid-non-determinism @string @swap_string",
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"mget",mgetCommand,-2,
Expand Down Expand Up @@ -154,19 +154,19 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,getKeyRequestsLpop,SWAP_IN,0,1,1,1,0,0,0},

{"brpop",brpopCommand,-3,
"write no-script @list @blocking @swap_list",
"write no-script gtid-non-determinism @list @blocking @swap_list",
0,NULL,getKeyRequestsBrpop,SWAP_IN,0,1,-2,1,0,0,0},

{"brpoplpush",brpoplpushCommand,4,
"write use-memory no-script @list @blocking @swap_list ",
"write use-memory no-script gtid-non-determinism @list @blocking @swap_list ",
0,NULL,getKeyRequestsRpoplpush,SWAP_IN,0,1,2,1,0,0,0},

{"blmove",blmoveCommand,6,
"write use-memory no-script @list @blocking @swap_list",
"write use-memory no-script gtid-non-determinism @list @blocking @swap_list",
0,NULL,getKeyRequestsLmove,SWAP_IN,0,1,2,1,0,0,0},

{"blpop",blpopCommand,-3,
"write no-script @list @blocking @swap_list",
"write no-script gtid-non-determinism @list @blocking @swap_list",
0,NULL,getKeyRequestsBlpop,SWAP_IN,0,1,-2,1,0,0,0},

{"llen",llenCommand,2,
Expand Down Expand Up @@ -231,7 +231,7 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0},

{"spop",spopCommand,-2,
"write random fast @set @swap_set",
"write random fast gtid-non-determinism @set @swap_set",
0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0},

{"srandmember",srandmemberCommand,-2,
Expand Down Expand Up @@ -387,11 +387,11 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0},

{"bzpopmin",bzpopminCommand,-3,
"write no-script fast @sortedset @blocking @swap_zset",
"write no-script fast gtid-non-determinism @sortedset @blocking @swap_zset",
0,NULL,getKeyRequestsZpopMin,SWAP_IN,SWAP_IN_DEL,1,-2,1,0,0,0},

{"bzpopmax",bzpopmaxCommand,-3,
"write no-script fast @sortedset @blocking @swap_zset",
"write no-script fast gtid-non-determinism @sortedset @blocking @swap_zset",
0,NULL,getKeyRequestsZpopMax,SWAP_IN,SWAP_IN_DEL,1,-2,1,0,0,0},

{"zrandmember",zrandmemberCommand,-2,
Expand Down Expand Up @@ -419,11 +419,11 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,getKeyRequestsHmget,SWAP_IN,0,1,1,1,0,0,0},

{"hincrby",hincrbyCommand,4,
"write use-memory fast @hash @swap_hash",
"write use-memory fast gtid-non-determinism @hash @swap_hash",
0,NULL,getKeyRequestsHincrby,SWAP_IN,0,1,1,1,0,0,0},

{"hincrbyfloat",hincrbyfloatCommand,4,
"write use-memory fast @hash @swap_hash",
"write use-memory fast gtid-non-determinism @hash @swap_hash",
0,NULL,getKeyRequestsHincrbyfloat,SWAP_IN,0,1,1,1,0,0,0},

{"hdel",hdelCommand,-3,
Expand Down Expand Up @@ -471,11 +471,11 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"incrbyfloat",incrbyfloatCommand,3,
"write use-memory fast @string @swap_string",
"write use-memory fast gtid-non-determinism @string @swap_string",
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"getset",getsetCommand,3,
"write use-memory fast @string @swap_string",
"write use-memory fast gtid-non-determinism @string @swap_string",
0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0},

{"mset",msetCommand,-3,
Expand Down Expand Up @@ -517,15 +517,15 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,2,1,0,0,0},

{"expire",expireCommand,3,
"write fast @keyspace @swap_keyspace",
"write fast gtid-non-determinism @keyspace @swap_keyspace",
0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0},

{"expireat",expireatCommand,3,
"write fast @keyspace @swap_keyspace",
"write fast gtid-non-determinism @keyspace @swap_keyspace",
0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0},

{"pexpire",pexpireCommand,3,
"write fast @keyspace @swap_keyspace",
"write fast gtid-non-determinism @keyspace @swap_keyspace",
0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0},

{"pexpireat",pexpireatCommand,3,
Expand Down Expand Up @@ -802,7 +802,7 @@ struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = {
0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0},

{"geoadd",geoaddCommand,-5,
"write use-memory @geo @swap_zset",
"write use-memory gtid-non-determinism @geo @swap_zset",
0,NULL,getKeyRequestsGeoAdd,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0},

/* GEORADIUS has store options that may write. */
Expand Down
1 change: 1 addition & 0 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ int64_t commandFlagsFromString(char *s) {
else if (!strcasecmp(t,"may-replicate")) flags |= CMD_MAY_REPLICATE;
else if (!strcasecmp(t,"getkeys-api")) flags |= CMD_MODULE_GETKEYS;
else if (!strcasecmp(t,"no-cluster")) flags |= CMD_MODULE_NO_CLUSTER;
else if (!strcasecmp(t,"gtid-non-determinism")) flags |= CMD_GTID_NON_DETERMINISM;
else break;
}
sdsfreesplitres(tokens,count);
Expand Down
49 changes: 26 additions & 23 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,1,1,0,0,0},

{"getex",getexCommand,-2,
"write fast @string",
"write fast gtid-non-determinism @string",
0,NULL,1,1,1,0,0,0},

{"getdel",getdelCommand,2,
"write fast @string",
"write fast gtid-non-determinism @string",
0,NULL,1,1,1,0,0,0},

/* Note that we can't flag set as fast, since it may perform an
Expand All @@ -220,15 +220,15 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,1,1,0,0,0},

{"setex",setexCommand,4,
"write use-memory @string",
"write use-memory gtid-non-determinism @string",
0,NULL,1,1,1,0,0,0},

{"psetex",psetexCommand,4,
"write use-memory @string",
"write use-memory gtid-non-determinism @string",
0,NULL,1,1,1,0,0,0},

{"append",appendCommand,3,
"write use-memory fast @string",
"write use-memory gtid-non-determinism fast @string",
0,NULL,1,1,1,0,0,0},

{"strlen",strlenCommand,2,
Expand Down Expand Up @@ -264,7 +264,7 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,1,1,0,0,0},

{"setrange",setrangeCommand,4,
"write use-memory @string",
"write use-memory gtid-non-determinism @string",
0,NULL,1,1,1,0,0,0},

{"getrange",getrangeCommand,4,
Expand All @@ -276,11 +276,11 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,1,1,0,0,0},

{"incr",incrCommand,2,
"write use-memory fast @string",
"write use-memory fast gtid-non-determinism @string",
0,NULL,1,1,1,0,0,0},

{"decr",decrCommand,2,
"write use-memory fast @string",
"write use-memory fast gtid-non-determinism @string",
0,NULL,1,1,1,0,0,0},

{"mget",mgetCommand,-2,
Expand Down Expand Up @@ -316,19 +316,19 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,1,1,0,0,0},

{"brpop",brpopCommand,-3,
"write no-script @list @blocking",
"write no-script gtid-non-determinism @list @blocking",
0,NULL,1,-2,1,0,0,0},

{"brpoplpush",brpoplpushCommand,4,
"write use-memory no-script @list @blocking",
"write use-memory no-script gtid-non-determinism @list @blocking",
0,NULL,1,2,1,0,0,0},

{"blmove",blmoveCommand,6,
"write use-memory no-script @list @blocking",
"write use-memory no-script gtid-non-determinism @list @blocking",
0,NULL,1,2,1,0,0,0},

{"blpop",blpopCommand,-3,
"write no-script @list @blocking",
"write no-script gtid-non-determinism @list @blocking",
0,NULL,1,-2,1,0,0,0},

{"llen",llenCommand,2,
Expand Down Expand Up @@ -392,7 +392,7 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,1,1,0,0,0},

{"spop",spopCommand,-2,
"write random fast @set",
"write random fast gtid-non-determinism @set",
0,NULL,1,1,1,0,0,0},

{"srandmember",srandmemberCommand,-2,
Expand Down Expand Up @@ -548,11 +548,11 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,1,1,0,0,0},

{"bzpopmin",bzpopminCommand,-3,
"write no-script fast @sortedset @blocking",
"write no-script fast gtid-non-determinism @sortedset @blocking",
0,NULL,1,-2,1,0,0,0},

{"bzpopmax",bzpopmaxCommand,-3,
"write no-script fast @sortedset @blocking",
"write no-script fast gtid-non-determinism @sortedset @blocking",
0,NULL,1,-2,1,0,0,0},

{"zrandmember",zrandmemberCommand,-2,
Expand Down Expand Up @@ -580,11 +580,11 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,1,1,0,0,0},

{"hincrby",hincrbyCommand,4,
"write use-memory fast @hash",
"write use-memory fast gtid-non-determinism @hash",
0,NULL,1,1,1,0,0,0},

{"hincrbyfloat",hincrbyfloatCommand,4,
"write use-memory fast @hash",
"write use-memory fast gtid-non-determinism @hash",
0,NULL,1,1,1,0,0,0},

{"hdel",hdelCommand,-3,
Expand Down Expand Up @@ -632,11 +632,11 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,1,1,0,0,0},

{"incrbyfloat",incrbyfloatCommand,3,
"write use-memory fast @string",
"write use-memory fast gtid-non-determinism @string",
0,NULL,1,1,1,0,0,0},

{"getset",getsetCommand,3,
"write use-memory fast @string",
"write use-memory fast gtid-non-determinism @string",
0,NULL,1,1,1,0,0,0},

{"mset",msetCommand,-3,
Expand Down Expand Up @@ -678,15 +678,15 @@ struct redisCommand redisCommandTable[] = {
0,NULL,1,2,1,0,0,0},

{"expire",expireCommand,3,
"write fast @keyspace",
"write fast gtid-non-determinism @keyspace",
0,NULL,1,1,1,0,0,0},

{"expireat",expireatCommand,3,
"write fast @keyspace",
"write fast gtid-non-determinism @keyspace",
0,NULL,1,1,1,0,0,0},

{"pexpire",pexpireCommand,3,
"write fast @keyspace",
"write fast gtid-non-determinism @keyspace",
0,NULL,1,1,1,0,0,0},

{"pexpireat",pexpireatCommand,3,
Expand Down Expand Up @@ -951,7 +951,7 @@ struct redisCommand redisCommandTable[] = {
0,NULL,0,0,0,0,0,0},

{"geoadd",geoaddCommand,-5,
"write use-memory @geo",
"write use-memory gtid-non-determinism @geo",
0,NULL,1,1,1,0,0,0},

/* GEORADIUS has store options that may write. */
Expand Down Expand Up @@ -3782,6 +3782,8 @@ int populateCommandTableParseFlags(struct redisCommand *c, char *strflags) {
c->flags |= CMD_NO_AUTH;
} else if (!strcasecmp(flag,"may-replicate")) {
c->flags |= CMD_MAY_REPLICATE;
} else if (!strcasecmp(flag, "gtid-non-determinism")) {
c->flags |= CMD_GTID_NON_DETERMINISM;
} else {
/* Parse ACL categories here if the flag name starts with @. */
uint64_t catflag;
Expand Down Expand Up @@ -4933,6 +4935,7 @@ void addReplyCommand(client *c, struct redisCommand *cmd) {
flagcount += addReplyCommandFlag(c,cmd,CMD_FAST, "fast");
flagcount += addReplyCommandFlag(c,cmd,CMD_NO_AUTH, "no_auth");
flagcount += addReplyCommandFlag(c,cmd,CMD_MAY_REPLICATE, "may_replicate");
flagcount += addReplyCommandFlag(c,cmd,CMD_GTID_NON_DETERMINISM, "rewrite_command");
if (cmdHasMovableKeys(cmd)) {
addReplyStatus(c, "movablekeys");
flagcount += 1;
Expand Down
1 change: 1 addition & 0 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT];
#define CMD_CATEGORY_CONNECTION (1ULL<<37)
#define CMD_CATEGORY_TRANSACTION (1ULL<<38)
#define CMD_CATEGORY_SCRIPTING (1ULL<<39)
#define CMD_GTID_NON_DETERMINISM (1ULL<<40)

/* AOF states */
#define AOF_OFF 0 /* AOF is off */
Expand Down
Loading