diff --git a/deps/xredis-gtid b/deps/xredis-gtid index c000e050d63..9b562529d9c 160000 --- a/deps/xredis-gtid +++ b/deps/xredis-gtid @@ -1 +1 @@ -Subproject commit c000e050d635f0a261a90c1420ba5ece71b47115 +Subproject commit 9b562529d9cdda5c10b17cda7e7335ac430af09e diff --git a/src/Makefile b/src/Makefile index 873ef45d44d..4fcde9c58a0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -259,7 +259,7 @@ FINAL_LIBS += -lsnappy -lz -lstdc++ endif # Include paths to dependencies -FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram -I../deps/fpconv -I../deps/fast_float -I../deps/xredis-gtid/include +FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -I../deps/hdr_histogram -I../deps/fpconv -I../deps/fast_float -I../deps/xredis-gtid/include -I../deps/xredis-gtid/xredis ifdef SWAP FINAL_CFLAGS+= -I../deps/tdigest -I../deps/rocksdb/include endif @@ -395,7 +395,7 @@ endif REDIS_SERVER_NAME=redis-server$(PROG_SUFFIX) REDIS_SENTINEL_NAME=redis-sentinel$(PROG_SUFFIX) -REDIS_SERVER_OBJ=threads_mngr.o memory_prefetch.o adlist.o quicklist.o ae.o anet.o dict.o ebuckets.o eventnotifier.o iothread.o mstr.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o cluster_slot_stats.o crc16.o endianconv.o slowlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crccombine.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o lolwut8.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script_lua.o script.o functions.o function_lua.o commands.o strl.o connection.o unix.o logreqres.o xredis_gtid.o xredis_gtid_aof.o xredis_gtid_repl.o xredis_gtid_rs.o xredis_gtid_rdb.o ctrip_heartbeat.o ctrip.o +REDIS_SERVER_OBJ=threads_mngr.o memory_prefetch.o adlist.o quicklist.o ae.o anet.o dict.o ebuckets.o eventnotifier.o iothread.o mstr.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o cluster_slot_stats.o crc16.o endianconv.o slowlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crccombine.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o lolwut8.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script_lua.o script.o functions.o function_lua.o commands.o strl.o connection.o unix.o logreqres.o xredis_gtid.o xredis_gtid_repl.o xredis_gtid_rs.o xredis_gtid_rdb.o ctrip_heartbeat.o ctrip.o xredis_gtid_gap_log.o xredis_gtid_adaptation_version.o xredis_gtid_cmdparse.o REDIS_CLI_NAME=redis-cli$(PROG_SUFFIX) ifdef SWAP SWAP_LIBS= ../deps/rocksdb/librocksdb.a ../deps/tdigest/tdigest.o diff --git a/src/commands/gtidx.json b/src/commands/gtidx.json index 25828234d11..7d1501d3b9f 100644 --- a/src/commands/gtidx.json +++ b/src/commands/gtidx.json @@ -4,7 +4,7 @@ "complexity": "O(N)", "group": "server", "since": "2.0.0", - "arity": -3, + "arity": -2, "function": "gtidxCommand", "history": [ [ diff --git a/src/config.c b/src/config.c index c8f9e8f0de0..0e67e92c9f3 100644 --- a/src/config.c +++ b/src/config.c @@ -2672,7 +2672,7 @@ static int updateSwapAbsentCacheEnabled(const char **err) { static int updateReplBacklogSize(const char **err) { UNUSED(err); - ctrip_resizeReplicationBacklog(); + ctrip_resizeReplicationBacklog(-1); return 1; } @@ -3568,7 +3568,7 @@ standardConfig static_configs[] = { createBoolConfig("hide-user-data-from-log", NULL, MODIFIABLE_CONFIG, server.hide_user_data_from_log, 0, NULL, NULL), createBoolConfig("lazyexpire-nested-arbitrary-keys", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, server.lazyexpire_nested_arbitrary_keys, 1, NULL, NULL), createBoolConfig("cluster-slot-stats-enabled", NULL, MODIFIABLE_CONFIG, server.cluster_slot_stats_enabled, 0, NULL, NULL), - createBoolConfig("slave-repl-all", NULL, MODIFIABLE_CONFIG, server.repl_slave_repl_all, 0, NULL, NULL), + createBoolConfig("slave-repl-all", NULL, MODIFIABLE_CONFIG, server.repl_slave_repl_all, 0, NULL, NULL), #ifdef ENABLE_SWAP createBoolConfig("swap-debug-trace-latency", NULL, MODIFIABLE_CONFIG, server.swap_debug_trace_latency, 0, NULL, NULL), createBoolConfig("swap-rordb-load-incremental-fsync", NULL, MODIFIABLE_CONFIG, server.swap_rordb_load_incremental_fsync, 1, NULL, NULL), @@ -3846,6 +3846,7 @@ standardConfig static_configs[] = { /* ctrip configs */ createBoolConfig("gtid-enabled", NULL, MODIFIABLE_CONFIG, server.gtid_enabled, 0, NULL, updateGtidEnabled), + createBoolConfig("gtid-gaplog-enabled", NULL, MODIFIABLE_CONFIG, server.gtid_gaplog_enabled, 1, NULL, NULL), createIntConfig("tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.tls_port, 0, INTEGER_CONFIG, NULL, applyTLSPort), /* TCP port. */ createIntConfig("tls-session-cache-size", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.tls_ctx_config.session_cache_size, 20*1024, INTEGER_CONFIG, NULL, applyTlsCfg), diff --git a/src/ctrip_swap.c b/src/ctrip_swap.c index 0615f187020..0d5cfb746e2 100644 --- a/src/ctrip_swap.c +++ b/src/ctrip_swap.c @@ -186,7 +186,7 @@ swapCtx *swapCtxCreate(client *c, keyRequest *key_request, snprintf(identity,MAX_MSG,"[%s(%u):%s:%.*s]", swapIntentionName(key_request->cmd_intention), key_request->cmd_intention_flags, - c->cmd->name,MAX_MSG/2,key); + c->cmd->fullname,MAX_MSG/2,key); swapDebugMsgsInit(&ctx->msgs, identity); #endif ctx->pd = pd; diff --git a/src/ctrip_swap_cmd.c b/src/ctrip_swap_cmd.c index d270ec459b7..5acab30823a 100644 --- a/src/ctrip_swap_cmd.c +++ b/src/ctrip_swap_cmd.c @@ -30,988 +30,7 @@ #include #include "slowlog.h" -// struct redisCommand redisCommandTable[SWAP_CMD_COUNT] = { -// {"module",moduleCommand,-2, -// "admin no-script", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"get",getCommand,2, -// "read-only fast @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"getex",getexCommand,-2, -// "write fast @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"getdel",getdelCommand,2, -// "write fast @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 -// * implicit DEL of a large key. */ -// {"set",setCommand,-3, -// "write use-memory @string @swap_string @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_OVERWRITE,1,1,1,0,0,0}, -// {"setnx",setnxCommand,3, -// "write use-memory fast @string @swap_string @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"setex",setexCommand,4, -// "write use-memory @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", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_OVERWRITE,1,1,1,0,0,0}, - -// {"append",appendCommand,3, -// "write use-memory fast @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"strlen",strlenCommand,2, -// "read-only fast @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"del",delCommand,-2, -// "write @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_DEL_MOCK_VALUE,1,-1,1,0,0,0}, - -// {"unlink",unlinkCommand,-2, -// "write fast @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_DEL_MOCK_VALUE,1,-1,1,0,0,0}, - -// {"exists",existsCommand,-2, -// "read-only fast @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,-1,1,0,0,0}, - -// {"setbit",setbitCommand,4, -// "write use-memory @bitmap @swap_bitmap", -// 0,NULL,getKeyRequestsSetbit,SWAP_IN,0,1,1,1,0,0,0}, - -// {"getbit",getbitCommand,3, -// "read-only fast @bitmap @swap_bitmap", -// 0,NULL,getKeyRequestsGetbit,SWAP_IN,0,1,1,1,0,0,0}, - -// {"bitfield",bitfieldCommand,-2, -// "write use-memory @bitmap @swap_bitmap", -// 0,NULL,getKeyRequestsBitField,SWAP_IN,0,1,1,1,0,0,0}, - -// {"bitfield_ro",bitfieldroCommand,-2, -// "read-only fast @bitmap @swap_bitmap", -// 0,NULL,getKeyRequestsBitField,SWAP_IN,0,1,1,1,0,0,0}, - -// {"setrange",setrangeCommand,4, -// "write use-memory @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"getrange",getrangeCommand,4, -// "read-only @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"substr",getrangeCommand,4, -// "read-only @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"incr",incrCommand,2, -// "write use-memory fast @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", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"mget",mgetCommand,-2, -// "read-only fast @string @swap_string @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,0,1,-1,1,0,0,0}, - -// {"rpush",rpushCommand,-3, -// "write use-memory fast @list @swap_list", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"lpush",lpushCommand,-3, -// "write use-memory fast @list @swap_list", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"rpushx",rpushxCommand,-3, -// "write use-memory fast @list @swap_list", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"lpushx",lpushxCommand,-3, -// "write use-memory fast @list @swap_list", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"linsert",linsertCommand,5, -// "write use-memory @list @swap_list", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"rpop",rpopCommand,-2, -// "write fast @list @swap_list", -// 0,NULL,getKeyRequestsRpop,SWAP_IN,0,1,1,1,0,0,0}, - -// {"lpop",lpopCommand,-2, -// "write fast @list @swap_list", -// 0,NULL,getKeyRequestsLpop,SWAP_IN,0,1,1,1,0,0,0}, - -// {"brpop",brpopCommand,-3, -// "write no-script @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 ", -// 0,NULL,getKeyRequestsRpoplpush,SWAP_IN,0,1,2,1,0,0,0}, - -// {"blmove",blmoveCommand,6, -// "write use-memory no-script @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", -// 0,NULL,getKeyRequestsBlpop,SWAP_IN,0,1,-2,1,0,0,0}, - -// {"llen",llenCommand,2, -// "read-only fast @list @swap_list", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"lindex",lindexCommand,3, -// "read-only @list @swap_list", -// 0,NULL,getKeyRequestsLindex,SWAP_IN,0,1,1,1,0,0,0}, - -// {"lset",lsetCommand,4, -// "write use-memory @list @swap_list", -// 0,NULL,getKeyRequestsLset,SWAP_IN,0,1,1,1,0,0,0}, - -// {"lrange",lrangeCommand,4, -// "read-only @list @swap_list", -// 0,NULL,getKeyRequestsLrange,SWAP_IN,0,1,1,1,0,0,0}, - -// {"ltrim",ltrimCommand,4, -// "write @list @swap_list", -// 0,NULL,getKeyRequestsLtrim,SWAP_IN,0,1,1,1,0,0,0}, - -// {"lpos",lposCommand,-3, -// "read-only @list @swap_list", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"lrem",lremCommand,4, -// "write @list @swap_list", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"rpoplpush",rpoplpushCommand,3, -// "write use-memory @list @swap_list", -// 0,NULL,getKeyRequestsRpoplpush,SWAP_IN,0,1,2,1,0,0,0}, - -// {"lmove",lmoveCommand,5, -// "write use-memory @list @swap_list", -// 0,NULL,getKeyRequestsLmove,SWAP_IN,0,1,2,1,0,0,0}, - -// {"sadd",saddCommand,-3, -// "write use-memory fast @set @swap_set", -// 0,NULL,getKeyRequestsSadd,SWAP_IN,0,1,1,1,0,0,0}, - -// {"srem",sremCommand,-3, -// "write fast @set @swap_set", -// 0,NULL,getKeyRequestsSrem,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// /* smove cmd intention flags set by getKeyRequestSmove */ -// {"smove",smoveCommand,4, -// "write fast @set @swap_set", -// 0,NULL,getKeyRequestSmove,SWAP_IN,0,1,2,1,0,0,0}, - -// {"sismember",sismemberCommand,3, -// "read-only fast @set @swap_set", -// 0,NULL,getKeyRequestSmembers,SWAP_IN,0,1,1,1,0,0,0}, - -// {"smismember",smismemberCommand,-3, -// "read-only fast @set @swap_set", -// 0,NULL,getKeyRequestSmembers,SWAP_IN,0,1,1,1,0,0,0}, - -// {"scard",swap_scardCommand,2, -// "read-only fast @set @swap_set", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"spop",spopCommand,-2, -// "write random fast @set @swap_set", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"srandmember",srandmemberCommand,-2, -// "read-only random @set @swap_set", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"sinter",sinterCommand,-2, -// "read-only to-sort @set @swap_set", -// 0,NULL,NULL,SWAP_IN,0,1,-1,1,0,0,0}, - -// {"sinterstore",sinterstoreCommand,-3, -// "write use-memory @set @swap_set", -// 0,NULL,getKeyRequestsSinterstore,SWAP_IN,0,1,-1,1,0,0,0}, - -// {"sunion",sunionCommand,-2, -// "read-only to-sort @set @swap_set", -// 0,NULL,NULL,SWAP_IN,0,1,-1,1,0,0,0}, - -// {"sunionstore",sunionstoreCommand,-3, -// "write use-memory @set @swap_set", -// 0,NULL,getKeyRequestsSunionstore,SWAP_IN,0,1,-1,1,0,0,0}, - -// {"sdiff",sdiffCommand,-2, -// "read-only to-sort @set @swap_set", -// 0,NULL,NULL,SWAP_IN,0,1,-1,1,0,0,0}, - -// {"sdiffstore",sdiffstoreCommand,-3, -// "write use-memory @set @swap_set", -// 0,NULL,getKeyRequestsSdiffstore,SWAP_IN,0,1,-1,1,0,0,0}, - -// {"smembers",sinterCommand,2, -// "read-only to-sort @set @swap_set", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"sscan",sscanCommand,-3, -// "read-only random @set @swap_set", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, -// /* (zset type) write command flag should be SWAP_IN_DEL, Because the index (score_cf data) needs to be deleted */ -// {"zadd",zaddCommand,-4, -// "write use-memory fast @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZAdd,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zincrby",zincrbyCommand,4, -// "write use-memory fast @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZincrby,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zrem",zremCommand,-3, -// "write fast @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZrem,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zremrangebyscore",zremrangebyscoreCommand,4, -// "write @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZremRangeByScore,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zremrangebyrank",zremrangebyrankCommand,4, -// "write @sortedset @swap_zset", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zremrangebylex",zremrangebylexCommand,4, -// "write @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZremRangeByLex,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zunionstore",zunionstoreCommand,-4, -// "write use-memory @sortedset @swap_zset @swap_set", -// 0,zunionInterDiffStoreGetKeys,getKeyRequestsZunionstore,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zinterstore",zinterstoreCommand,-4, -// "write use-memory @sortedset @swap_zset @swap_set", -// 0,zunionInterDiffStoreGetKeys,getKeyRequestsZinterstore,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zdiffstore",zdiffstoreCommand,-4, -// "write use-memory @sortedset @swap_zset @swap_set", -// 0,zunionInterDiffStoreGetKeys,getKeyRequestsZdiffstore,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zunion",zunionCommand,-3, -// "read-only @sortedset @swap_zset @swap_set", -// 0,zunionInterDiffGetKeys,NULL,SWAP_IN,0,0,0,0,0,0,0}, - -// {"zinter",zinterCommand,-3, -// "read-only @sortedset @swap_zset @swap_set", -// 0,zunionInterDiffGetKeys,NULL,SWAP_IN,0,0,0,0,0,0,0}, - -// {"zdiff",zdiffCommand,-3, -// "read-only @sortedset @swap_zset @swap_set", -// 0,zunionInterDiffGetKeys,NULL,SWAP_IN,0,0,0,0,0,0,0}, - -// {"zrange",zrangeCommand,-4, -// "read-only @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZrange,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zrangestore",zrangestoreCommand,-5, -// "write use-memory @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZrangestore,SWAP_IN,SWAP_IN_DEL,1,2,1,0,0,0}, - -// {"zrangebyscore",zrangebyscoreCommand,-4, -// "read-only @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZrangeByScore,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zrevrangebyscore",zrevrangebyscoreCommand,-4, -// "read-only @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZrevrangeByScore,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zrangebylex",zrangebylexCommand,-4, -// "read-only @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZrangeByLex,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zrevrangebylex",zrevrangebylexCommand,-4, -// "read-only @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZrevrangeByLex,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zcount",zcountCommand,4, -// "read-only fast @sortedset @swap_zset", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zlexcount",zlexcountCommand,4, -// "read-only fast @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZlexCount,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zrevrange",zrevrangeCommand,-4, -// "read-only @sortedset @swap_zset", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zcard",zcardCommand,2, -// "read-only fast @sortedset @swap_zset", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"zscore",zscoreCommand,3, -// "read-only fast @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZScore,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zmscore",zmscoreCommand,-3, -// "read-only fast @sortedset @swap_zset", -// 0,NULL,getKeyRequestsZMScore,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zrank",zrankCommand,3, -// "read-only fast @sortedset @swap_zset", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zrevrank",zrevrankCommand,3, -// "read-only fast @sortedset @swap_zset", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zscan",zscanCommand,-3, -// "read-only random @sortedset @swap_zset", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"zpopmin",zpopminCommand,-2, -// "write fast @sortedset @swap_zset", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"zpopmax",zpopmaxCommand,-2, -// "write fast @sortedset @swap_zset", -// 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", -// 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", -// 0,NULL,getKeyRequestsZpopMax,SWAP_IN,SWAP_IN_DEL,1,-2,1,0,0,0}, - -// {"zrandmember",zrandmemberCommand,-2, -// "read-only random @sortedset @swap_zset", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hset",hsetCommand,-4, -// "write use-memory fast @hash @swap_hash", -// 0,NULL,getKeyRequestsHset,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hsetnx",hsetnxCommand,4, -// "write use-memory fast @hash @swap_hash", -// 0,NULL,getKeyRequestsHsetnx,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hget",hgetCommand,3, -// "read-only fast @hash @swap_hash", -// 0,NULL,getKeyRequestsHget,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hmset",hsetCommand,-4, -// "write use-memory fast @hash @swap_hash", -// 0,NULL,getKeyRequestsHset,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hmget",hmgetCommand,-3, -// "read-only fast @hash @swap_hash", -// 0,NULL,getKeyRequestsHmget,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hincrby",hincrbyCommand,4, -// "write use-memory fast @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", -// 0,NULL,getKeyRequestsHincrbyfloat,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hdel",hdelCommand,-3, -// "write fast @hash @swap_hash", -// 0,NULL,getKeyRequestsHdel,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"hlen",hlenCommand,2, -// "read-only fast @hash @swap_hash", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"hstrlen",hstrlenCommand,3, -// "read-only fast @hash @swap_hash", -// 0,NULL,getKeyRequestsHstrlen,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hkeys",hkeysCommand,2, -// "read-only to-sort @hash @swap_hash", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hvals",hvalsCommand,2, -// "read-only to-sort @hash @swap_hash", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hgetall",hgetallCommand,2, -// "read-only random @hash @swap_hash", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hexists",hexistsCommand,3, -// "read-only fast @hash @swap_hash", -// 0,NULL,getKeyRequestsHexists,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hrandfield",hrandfieldCommand,-2, -// "read-only random @hash @swap_hash", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"hscan",hscanCommand,-3, -// "read-only random @hash @swap_hash", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"incrby",incrbyCommand,3, -// "write use-memory fast @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"decrby",decrbyCommand,3, -// "write use-memory fast @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"incrbyfloat",incrbyfloatCommand,3, -// "write use-memory fast @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", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"mset",msetCommand,-3, -// "write use-memory @string @swap_string @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_OVERWRITE,1,-1,2,0,0,0}, - -// {"msetnx",msetnxCommand,-3, -// "write use-memory @string @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,-1,2,0,0,0}, - -// {"randomkey",randomkeyCommand,1, -// "read-only random @keyspace @swap_keyspace", -// 0,NULL,getKeyRequestsMetaScan,SWAP_IN,SWAP_METASCAN_RANDOMKEY,0,0,0,0,0,0}, - -// {"select",selectCommand,2, -// "ok-loading fast ok-stale @keyspace", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"swapdb",swapdbCommand,3, -// "write fast @keyspace @dangerous @swap_keyspace", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"move",moveCommand,3, -// "write fast @keyspace", -// 0,NULL,NULL,SWAP_NOP,0,1,1,1,0,0,0}, - -// {"copy",copyCommand,-3, -// "write use-memory @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,0,1,2,1,0,0,0}, - -// /* Like for SET, we can't mark rename as a fast command because -// * overwriting the target key may result in an implicit slow DEL. */ -// {"rename",renameCommand,3, -// "write @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,2,1,0,0,0}, - -// {"renamenx",renamenxCommand,3, -// "write fast @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,2,1,0,0,0}, - -// {"expire",expireCommand,3, -// "write fast @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", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"pexpire",pexpireCommand,3, -// "write fast @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"pexpireat",pexpireatCommand,3, -// "write fast @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"keys",keysCommand,2, -// "read-only to-sort @keyspace @dangerous @swap_keyspace", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"scan",scanCommand,-2, -// "read-only random @keyspace @swap_keyspace", -// 0,NULL,getKeyRequestsMetaScan,SWAP_IN,SWAP_METASCAN_SCAN,0,0,0,0,0,0}, - -// {"dbsize",dbsizeCommand,1, -// "read-only fast @keyspace", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"auth",authCommand,-2, -// "no-auth no-script ok-loading ok-stale fast @connection", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// /* We don't allow PING during loading since in Redis PING is used as -// * failure detection, and a loading server is considered to be -// * not available. */ -// {"ping",pingCommand,-1, -// "ok-stale fast @connection", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"echo",echoCommand,2, -// "fast @connection", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"save",saveCommand,1, -// "admin no-script", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"bgsave",bgsaveCommand,-1, -// "admin no-script", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"refullsync",refullsyncCommand,1, -// "admin read-only", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"bgrewriteaof",bgrewriteaofCommand,1, -// "admin no-script", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"shutdown",shutdownCommand,-1, -// "admin no-script ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"lastsave",lastsaveCommand,1, -// "random fast ok-loading ok-stale @admin @dangerous", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"type",typeCommand,2, -// "read-only fast @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"multi",multiCommand,1, -// "no-script fast ok-loading ok-stale @transaction", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"exec",execCommand,1, -// "no-script no-slowlog ok-loading ok-stale @transaction", -// 0,NULL,NULL,SWAP_IN,0,0,0,0,0,0,0}, - -// {"discard",discardCommand,1, -// "no-script fast ok-loading ok-stale @transaction", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"sync",syncCommand,1, -// "admin no-script", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"psync",syncCommand,-3, -// "admin no-script", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"xsync",syncCommand,-3, -// "admin no-script", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"replconf",replconfCommand,-1, -// "admin no-script ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"flushdb",flushdbCommand,-1, -// "write @keyspace @dangerous", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"flushall",flushallCommand,-1, -// "write @keyspace @dangerous", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"sort",sortCommand,-2, -// "write use-memory @list @set @sortedset @dangerous @swap_list @swap_set @swap_zset", -// 0,sortGetKeys,getKeyRequestsSort,SWAP_IN,0,1,1,1,0,0,0}, - -// {"info",infoCommand,-1, -// "ok-loading ok-stale random @dangerous", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"monitor",monitorCommand,1, -// "admin no-script ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"ttl",ttlCommand,2, -// "read-only fast random @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"touch",touchCommand,-2, -// "read-only fast @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,-1,1,0,0,0}, - -// {"pttl",pttlCommand,2, -// "read-only fast random @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"persist",persistCommand,2, -// "write fast @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_META,1,1,1,0,0,0}, - -// {"slaveof",replicaofCommand,3, -// "admin no-script ok-stale", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"xslaveof",xslaveofCommand,3, -// "admin no-script ok-stale", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"replicaof",replicaofCommand,3, -// "admin no-script ok-stale", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"role",roleCommand,1, -// "ok-loading ok-stale no-script fast @dangerous", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"debug",debugCommand,-2, -// "admin no-script ok-loading ok-stale @swap_keyspace", -// 0,debugGetKeys,getKeyRequestsDebug,SWAP_IN,0,0,0,0,0,0,0}, - -// {"config",configCommand,-2, -// "admin ok-loading ok-stale no-script", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"subscribe",subscribeCommand,-2, -// "pub-sub no-script ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"unsubscribe",unsubscribeCommand,-1, -// "pub-sub no-script ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"psubscribe",psubscribeCommand,-2, -// "pub-sub no-script ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"punsubscribe",punsubscribeCommand,-1, -// "pub-sub no-script ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"publish",publishCommand,3, -// "pub-sub ok-loading ok-stale fast may-replicate", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"pubsub",pubsubCommand,-2, -// "pub-sub ok-loading ok-stale random", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"watch",watchCommand,-2, -// "no-script fast ok-loading ok-stale @transaction @swap_keyspace", -// 0,NULL,NULL,SWAP_NOP,0,1,-1,1,0,0,0}, - -// {"unwatch",unwatchCommand,1, -// "no-script fast ok-loading ok-stale @transaction", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"cluster",clusterCommand,-2, -// "admin ok-stale random", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"restore",restoreCommand,-4, -// "write use-memory @keyspace @dangerous @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"restore-asking",restoreCommand,-4, -// "write use-memory cluster-asking @keyspace @dangerous @swap_keyspace", -// 0,NULL,NULL,SWAP_NOP,0,1,1,1,0,0,0}, - -// {"migrate",migrateCommand,-6, -// "write random @keyspace @dangerous @swap_keyspace", -// 0,migrateGetKeys,NULL,SWAP_IN,SWAP_IN_DEL,3,3,1,0,0,0}, - -// {"asking",askingCommand,1, -// "fast @keyspace", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"readonly",readonlyCommand,1, -// "fast @keyspace", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"readwrite",readwriteCommand,1, -// "fast @keyspace", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"dump",dumpCommand,2, -// "read-only random @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"object",objectCommand,-2, -// "read-only random @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_IN,0,2,2,1,0,0,0}, - -// {"memory",memoryCommand,-2, -// "random read-only @swap_keyspace", -// 0,memoryGetKeys,getKeyRequestsMemory,SWAP_IN,0,0,0,0,0,0,0}, - -// {"client",clientCommand,-2, -// "admin no-script random ok-loading ok-stale @connection", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"hello",helloCommand,-1, -// "no-auth no-script fast ok-loading ok-stale @connection", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// /* EVAL can modify the dataset, however it is not flagged as a write -// * command since we do the check while running commands from Lua. -// * -// * EVAL and EVALSHA also feed monitors before the commands are executed, -// * as opposed to after. -// */ -// {"eval",evalCommand,-3, -// "no-script no-monitor may-replicate @scripting @swap_keyspace", -// 0,evalGetKeys,NULL,SWAP_IN,SWAP_IN_DEL,0,0,0,0,0,0}, - -// {"evalsha",evalShaCommand,-3, -// "no-script no-monitor may-replicate @scripting @swap_keyspace", -// 0,evalGetKeys,NULL,SWAP_IN,SWAP_IN_DEL,0,0,0,0,0,0}, - -// {"slowlog",slowlogCommand,-2, -// "admin random ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"script",scriptCommand,-2, -// "no-script may-replicate @scripting", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"time",timeCommand,1, -// "random fast ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"bitop",bitopCommand,-4, -// "write use-memory @bitmap @swap_bitmap", -// 0,NULL,getKeyRequestsBitop,SWAP_IN,0,2,-1,1,0,0,0}, - -// {"bitcount",bitcountCommand,-2, -// "read-only @bitmap @swap_bitmap", -// 0,NULL,getKeyRequestsBitcount,SWAP_IN,0,1,1,1,0,0,0}, - -// {"bitpos",bitposCommand,-3, -// "read-only @bitmap @swap_bitmap", -// 0,NULL,getKeyRequestsBitpos,SWAP_IN,0,1,1,1,0,0,0}, - -// {"wait",waitCommand,3, -// "no-script @keyspace", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"command",commandCommand,-1, -// "ok-loading ok-stale random @connection", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"geoadd",geoaddCommand,-5, -// "write use-memory @geo @swap_zset", -// 0,NULL,getKeyRequestsGeoAdd,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// /* GEORADIUS has store options that may write. */ -// {"georadius",georadiusCommand,-6, -// "write use-memory @geo @swap_zset", -// 0,georadiusGetKeys,getKeyRequestsGeoRadius,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"georadius_ro",georadiusroCommand,-6, -// "read-only @geo @swap_zset", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"georadiusbymember",georadiusbymemberCommand,-5, -// "write use-memory @geo @swap_zset", -// 0,georadiusGetKeys,getKeyRequestsGeoRadiusByMember,SWAP_IN,SWAP_IN_DEL,1,1,1,0,0,0}, - -// {"georadiusbymember_ro",georadiusbymemberroCommand,-5, -// "read-only @geo @swap_zset", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"geohash",geohashCommand,-2, -// "read-only @geo @swap_zset", -// 0,NULL,getKeyRequestsGeoHash,SWAP_IN,0,1,1,1,0,0,0}, - -// {"geopos",geoposCommand,-2, -// "read-only @geo @swap_zset", -// 0,NULL,getKeyRequestsGeoPos,SWAP_IN,0,1,1,1,0,0,0}, - -// {"geodist",geodistCommand,-4, -// "read-only @geo @swap_zset", -// 0,NULL,getKeyRequestsGeoDist,SWAP_IN,0,1,1,1,0,0,0}, - -// {"geosearch",geosearchCommand,-7, -// "read-only @geo @swap_zset", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"geosearchstore",geosearchstoreCommand,-8, -// "write use-memory @geo @swap_zset", -// 0,NULL,getKeyRequestsGeoSearchStore,SWAP_IN,SWAP_IN_DEL,1,2,1,0,0,0}, - -// {"pfselftest",pfselftestCommand,1, -// "admin @hyperloglog @swap_string", -// 0,NULL,NULL,SWAP_IN,0,0,0,0,0,0,0}, - -// {"pfadd",pfaddCommand,-2, -// "write use-memory fast @hyperloglog @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// /* Technically speaking PFCOUNT may change the key since it changes the -// * final bytes in the HyperLogLog representation. However in this case -// * we claim that the representation, even if accessible, is an internal -// * affair, and the command is semantically read only. */ -// {"pfcount",pfcountCommand,-2, -// "read-only may-replicate @hyperloglog @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,-1,1,0,0,0}, - -// {"pfmerge",pfmergeCommand,-2, -// "write use-memory @hyperloglog @swap_string", -// 0,NULL,NULL,SWAP_IN,0,1,-1,1,0,0,0}, - -// /* Unlike PFCOUNT that is considered as a read-only command (although -// * it changes a bit), PFDEBUG may change the entire key when converting -// * from sparse to dense representation */ -// {"pfdebug",pfdebugCommand,-3, -// "admin write use-memory @hyperloglog @swap_string", -// 0,NULL,NULL,SWAP_IN,0,2,2,1,0,0,0}, - -// {"xadd",xaddCommand,-5, -// "write use-memory fast random @stream", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"xrange",xrangeCommand,-4, -// "read-only @stream", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"xrevrange",xrevrangeCommand,-4, -// "read-only @stream", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"xlen",xlenCommand,2, -// "read-only fast @stream", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"xread",xreadCommand,-4, -// "read-only @stream @blocking", -// 0,xreadGetKeys,NULL,SWAP_IN,0,0,0,0,0,0,0}, - -// {"xreadgroup",xreadCommand,-7, -// "write @stream @blocking", -// 0,xreadGetKeys,NULL,SWAP_IN,0,0,0,0,0,0,0}, - -// {"xgroup",xgroupCommand,-2, -// "write use-memory @stream", -// 0,NULL,NULL,SWAP_NOP,0,2,2,1,0,0,0}, - -// {"xsetid",xsetidCommand,3, -// "write use-memory fast @stream", -// 0,NULL,NULL,SWAP_NOP,0,1,1,1,0,0,0}, - -// {"xack",xackCommand,-4, -// "write fast random @stream", -// 0,NULL,NULL,SWAP_NOP,0,1,1,1,0,0,0}, - -// {"xpending",xpendingCommand,-3, -// "read-only random @stream", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"xclaim",xclaimCommand,-6, -// "write random fast @stream", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"xautoclaim",xautoclaimCommand,-6, -// "write random fast @stream", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"xinfo",xinfoCommand,-2, -// "read-only random @stream", -// 0,NULL,NULL,SWAP_IN,0,2,2,1,0,0,0}, - -// {"xdel",xdelCommand,-3, -// "write fast @stream", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"xtrim",xtrimCommand,-4, -// "write random @stream", -// 0,NULL,NULL,SWAP_IN,0,1,1,1,0,0,0}, - -// {"post",securityWarningCommand,-1, -// "ok-loading ok-stale read-only", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"host:",securityWarningCommand,-1, -// "ok-loading ok-stale read-only", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"latency",latencyCommand,-2, -// "admin no-script ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"lolwut",lolwutCommand,-1, -// "read-only fast", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"acl",aclCommand,-2, -// "admin no-script ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// // {"stralgo",stralgoCommand,-2, -// // "read-only @string @swap_string", -// // 0,lcsGetKeys,NULL,SWAP_IN,0,0,0,0,0,0,0}, - -// {"reset",resetCommand,1, -// "no-script ok-stale ok-loading fast @connection", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"failover",failoverCommand,-1, -// "admin no-script ok-stale", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// /* evict command used by shared fake to identify swap does -// * not need any swap before command proc, but triggers swap in proc. */ -// {"swap.evict",swapEvictCommand,-2, -// "read-only fast @keyspace @swap_keyspace", -// 0,NULL,getKeyRequestsNone,SWAP_OUT,0,1,-1,1,0,0,0}, - -// {"swap.load",swapLoadCommand,-2, -// "read-only fast @swap_keyspace", -// 0,NULL,getKeyRequestsNone,SWAP_IN,SWAP_IN_FORCE_HOT,1,-1,1,0,0,0}, - -// {"swap.expired",swapExpiredCommand,1, -// "write fast @keyspace @swap_keyspace", -// 0,NULL,getKeyRequestsNone,SWAP_NOP,0,1,-1,1,0,0,0}, - -// {"swap.scanexpire",swapScanexpireCommand,1, -// "read-only no-script @keyspace @swap_keyspace", -// 0,NULL,NULL,SWAP_NOP,0,1,-1,1,0,0,0}, - -// {"swap",swapCommand,-2, -// "read-only fast", -// 0,NULL,NULL,SWAP_IN,0,0,0,0,0,0,0}, - -// {"swap.mutexop",swapMutexopCommand,1, -// "admin no-script", -// 0,NULL,getKeyRequestsNone,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"swap.debug",swapDebugCommand,-2, -// "admin no-script ok-stale @swap_keyspace", -// 0,NULL,getKeyRequestsGlobal,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"gtid",gtidCommand, -3, -// "write use-memory no-script", -// 0,NULL,getKeyRequestsGtid,SWAP_NOP/*not used*/,0,0,0,0,0,0,0}, - -// {"gtidx",gtidxCommand, -2, -// "admin no-script random ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"swap.slowlog",swapSlowlogCommand, -2, -// "admin random ok-loading ok-stale", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"swap.info",swapInfoCommand, -2, -// "admin no-script ok-loading fast may-replicate", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// {"import",importCommand,-2, -// "admin use-memory ok-loading fast @dangerous", -// 0,NULL,NULL,SWAP_NOP,0,0,0,0,0,0,0}, - -// }; struct SwapDataTypeItem { const char *name; @@ -2884,4 +1903,3 @@ int swapCmdTest(int argc, char *argv[], int accurate) { } #endif - diff --git a/src/ctrip_swap_repl.c b/src/ctrip_swap_repl.c index 681bd6a959c..f1537a30df3 100644 --- a/src/ctrip_swap_repl.c +++ b/src/ctrip_swap_repl.c @@ -233,7 +233,7 @@ static void processFinishedReplCommands() { } if(!server.repl_slave_repl_all){ - ctrip_replicationFeedSlavesFromMasterStream( + ctrip_replicationFeedSlavesFromMasterStream(NULL, c->querybuf+c->repl_applied, applied, uuid,uuid_len,gno,server.master_repl_offset+1); } c->repl_applied += applied; diff --git a/src/networking.c b/src/networking.c index debacda1206..7c4c62abe97 100644 --- a/src/networking.c +++ b/src/networking.c @@ -1917,7 +1917,7 @@ void freeClient(client *c) { //TODO what if master link reset but no master mode enabled? serverReplStreamSwitchIfNeeded( server.gtid_enabled ? REPL_MODE_XSYNC:REPL_MODE_PSYNC, - RS_UPDATE_NOP,"master mode enabled(defer)"); + RS_UPDATE_DOWN,"master mode enabled(defer)"); if (!(c->flags & (CLIENT_PROTOCOL_ERROR|CLIENT_BLOCKED|CLIENT_SWAP_DISCARD_CACHED_MASTER)) && server.repl_mode->mode != REPL_MODE_XSYNC) { @@ -2980,7 +2980,7 @@ void commandProcessed(client *c) { sds repr = gtid_repr->ptr; uuid = uuidGnoDecode(repr,sdslen(repr),&gno,&uuid_len); } - ctrip_replicationFeedSlavesFromMasterStream(c->querybuf+c->repl_applied,applied, uuid,uuid_len,gno,server.master_repl_offset+1); + ctrip_replicationFeedSlavesFromMasterStream(NULL, c->querybuf+c->repl_applied,applied, uuid,uuid_len,gno,server.master_repl_offset+1); c->repl_applied += applied; } } diff --git a/src/redis_gtid.h b/src/redis_gtid.h new file mode 120000 index 00000000000..963f6205203 --- /dev/null +++ b/src/redis_gtid.h @@ -0,0 +1 @@ +../deps/xredis-gtid/xredis/redis_gtid_8x.h \ No newline at end of file diff --git a/src/replication.c b/src/replication.c index 88ebe455687..833ad2d8e8f 100644 --- a/src/replication.c +++ b/src/replication.c @@ -3472,6 +3472,11 @@ void replicationUnsetMaster(void) { if (server.master) freeClient(server.master); replicationDiscardCachedMaster(); cancelReplicationHandshake(0); + /* Disconnecting all the slaves is required: we need to inform slaves + * of the replication ID change (see shiftReplicationId() call). However + * the slaves will be able to partially resync with us, so it will be + * a very fast reconnection. */ + disconnectSlaves(); /* When a slave is turned into a master, the current replication ID * (that was inherited from the master at synchronization time) is * used as secondary ID up to the current offset, and a new replication @@ -3491,11 +3496,6 @@ void replicationUnsetMaster(void) { server.gtid_enabled ? REPL_MODE_XSYNC:REPL_MODE_PSYNC, RS_UPDATE_NOP,"master mode enabled"); } - /* Disconnecting all the slaves is required: we need to inform slaves - * of the replication ID change (see shiftReplicationId() call). However - * the slaves will be able to partially resync with us, so it will be - * a very fast reconnection. */ - disconnectSlaves(); server.repl_state = REPL_STATE_NONE; /* Reset the attempts number. */ server.repl_current_sync_attempts = 0; diff --git a/src/server.c b/src/server.c index 53c4a103b6e..61bf1fa5afc 100644 --- a/src/server.c +++ b/src/server.c @@ -3014,6 +3014,7 @@ void initServer(void) { server.gtid_lost = gtidSetNew(); xsyncUuidInterestedInit(); gtidInitialInfoInit(server.gtid_initial); + server.gtid_gap_log = gtidGaplogNew(); server.gtid_xsync_fullresync_indicator = 0; server.gtid_executed_cmd_count = 0; server.gtid_ignored_cmd_count = 0; @@ -3697,10 +3698,10 @@ static void propagateNow(int dbid, robj **argv, int argc, int target) { serverAssert(!(isPausedActions(PAUSE_ACTION_REPLICA) && (!server.client_pause_in_transaction))); propagateArgs pargs; - propagateArgsInit(&pargs,dbid,argv,argc); + propagateArgsInit(&pargs,NULL,dbid,argv,argc); propagateArgsPrepareToFeed(&pargs); if (server.aof_state != AOF_OFF && target & PROPAGATE_AOF) - ctrip_feedAppendOnlyFile(pargs.orig_dbid,pargs.argv,pargs.argc); + ctrip_feedAppendOnlyFile(pargs.orig_cmd,pargs.orig_dbid,pargs.argv,pargs.argc); if (target & PROPAGATE_REPL) ctrip_replicationFeedSlaves(server.slaves, pargs.orig_dbid,pargs.argv, pargs.argc,pargs.uuid,pargs.uuid_len,pargs.gno,pargs.offset); @@ -7743,31 +7744,14 @@ void loadDataFromDisk(void) { server.repl_backlog->offset = server.master_repl_offset - server.repl_backlog->histlen + 1; rebaseReplicationBuffer(rsi.repl_offset); - // if (server.gtid_enabled || (rsi.gtid != NULL && rsi.gtid->repl_mode == REPL_MODE_XSYNC) ) { - // server.repl_mode->mode = REPL_MODE_XSYNC; - // server.repl_mode->from = rsi.repl_offset + 1; - // server.prev_repl_mode->mode = REPL_MODE_PSYNC; - // memcpy(server.prev_repl_mode->psync.replid,rsi.repl_id,sizeof(rsi.repl_id)); - // server.prev_repl_mode->from = 1; - // gtidSeqRebaseOffset(server.gtid_seq, server.uuid, server.uuid_len, rsi.repl_offset); - // if (rsi.gtid != NULL) { - // serverGtidSetResetExecuted(gtidSetDup(rsi.gtid->gtid_executed)); - // serverGtidSetResetLost(gtidSetDup(rsi.gtid->gtid_lost)); - // } - // } else { - // serverAssert(server.repl_mode->mode == REPL_MODE_PSYNC); - // serverAssert(server.repl_mode->from == 1); - // } if (server.gtid_enabled) { server.repl_mode->mode = REPL_MODE_XSYNC; server.repl_mode->from = rsi.repl_offset + 1; server.prev_repl_mode->mode = REPL_MODE_PSYNC; memcpy(server.prev_repl_mode->psync.replid,rsi.repl_id,sizeof(rsi.repl_id)); server.prev_repl_mode->from = 1; - gtidSeqRebaseOffset(server.gtid_seq, server.uuid, server.uuid_len, rsi.repl_offset); + gtidSeqRebaseOffset(server.gtid_seq, rsi.repl_offset); if (rsi.gtid != NULL) { - // serverGtidSetResetExecuted(gtidSetDup(rsi.gtid->gtid_executed)); - // serverGtidSetResetLost(gtidSetDup(rsi.gtid->gtid_lost)); gtidSetMerge(server.gtid_executed, rsi.gtid->gtid_executed); gtidSetMerge(server.gtid_lost, rsi.gtid->gtid_lost); } diff --git a/src/server.h b/src/server.h index c9051fca084..d19f133c6b7 100644 --- a/src/server.h +++ b/src/server.h @@ -2418,6 +2418,8 @@ struct redisServer { long long gtid_ignored_cmd_count; long long gtid_executed_cmd_count; long long gtid_sync_stat[GTID_SYNC_TYPES]; + int gtid_gaplog_enabled; + gtidGaplog* gtid_gap_log; /* importing mode */ mstime_t importing_end_time; /* in milliseconds */ int importing_expire_enabled; diff --git a/src/xredis_gtid_adaptation_version.c b/src/xredis_gtid_adaptation_version.c new file mode 120000 index 00000000000..b1426ed922a --- /dev/null +++ b/src/xredis_gtid_adaptation_version.c @@ -0,0 +1 @@ +../deps/xredis-gtid/xredis/xredis_gtid_adaptation_version_8x.c \ No newline at end of file diff --git a/src/xredis_gtid_adaptation_version.h b/src/xredis_gtid_adaptation_version.h new file mode 120000 index 00000000000..c4fb1a67cfd --- /dev/null +++ b/src/xredis_gtid_adaptation_version.h @@ -0,0 +1 @@ +../deps/xredis-gtid/xredis/xredis_gtid_adaptation_version.h \ No newline at end of file diff --git a/src/xredis_gtid_aof.c b/src/xredis_gtid_aof.c deleted file mode 120000 index bf1bc4d2348..00000000000 --- a/src/xredis_gtid_aof.c +++ /dev/null @@ -1 +0,0 @@ -../deps/xredis-gtid/xredis/xredis_gtid_aof.c \ No newline at end of file diff --git a/src/xredis_gtid_cmdparse.c b/src/xredis_gtid_cmdparse.c new file mode 120000 index 00000000000..4f35e5bf4d2 --- /dev/null +++ b/src/xredis_gtid_cmdparse.c @@ -0,0 +1 @@ +../deps/xredis-gtid/xredis/xredis_gtid_cmdparse.c \ No newline at end of file diff --git a/src/xredis_gtid_cmdparse.h b/src/xredis_gtid_cmdparse.h new file mode 120000 index 00000000000..89911fec0cd --- /dev/null +++ b/src/xredis_gtid_cmdparse.h @@ -0,0 +1 @@ +../deps/xredis-gtid/xredis/xredis_gtid_cmdparse.h \ No newline at end of file diff --git a/src/xredis_gtid_gap_log.c b/src/xredis_gtid_gap_log.c new file mode 120000 index 00000000000..d9bf28f3f7b --- /dev/null +++ b/src/xredis_gtid_gap_log.c @@ -0,0 +1 @@ +../deps/xredis-gtid/xredis/xredis_gtid_gap_log.c \ No newline at end of file diff --git a/tests/gtid/gaplog.tcl b/tests/gtid/gaplog.tcl new file mode 120000 index 00000000000..21d9e5954b3 --- /dev/null +++ b/tests/gtid/gaplog.tcl @@ -0,0 +1 @@ +../../deps/xredis-gtid/xredis/tests/gtid/gaplog.tcl \ No newline at end of file diff --git a/tests/gtid/gaplog/gaplog.tcl b/tests/gtid/gaplog/gaplog.tcl new file mode 120000 index 00000000000..c3d7dd2105e --- /dev/null +++ b/tests/gtid/gaplog/gaplog.tcl @@ -0,0 +1 @@ +../../../deps/xredis-gtid/xredis/tests/gtid/gaplog.tcl \ No newline at end of file diff --git a/tests/gtid/gaplog/gaplog_commands.tcl b/tests/gtid/gaplog/gaplog_commands.tcl new file mode 120000 index 00000000000..86f11cc7c99 --- /dev/null +++ b/tests/gtid/gaplog/gaplog_commands.tcl @@ -0,0 +1 @@ +../../../deps/xredis-gtid/xredis/tests/gtid/gaplog_commands.tcl \ No newline at end of file diff --git a/tests/gtid/gaplog/gaplog_write_commands.tcl b/tests/gtid/gaplog/gaplog_write_commands.tcl new file mode 120000 index 00000000000..ed8002f59a2 --- /dev/null +++ b/tests/gtid/gaplog/gaplog_write_commands.tcl @@ -0,0 +1 @@ +../../../deps/xredis-gtid/xredis/tests/gtid/gaplog_write_commands.tcl \ No newline at end of file diff --git a/tests/gtid/gaplog_commands.tcl b/tests/gtid/gaplog_commands.tcl new file mode 120000 index 00000000000..7a96975b7e2 --- /dev/null +++ b/tests/gtid/gaplog_commands.tcl @@ -0,0 +1 @@ +../../deps/xredis-gtid/xredis/tests/gtid/gaplog_commands.tcl \ No newline at end of file diff --git a/tests/gtid/gaplog_write_commands.tcl b/tests/gtid/gaplog_write_commands.tcl new file mode 120000 index 00000000000..36b9c4e2001 --- /dev/null +++ b/tests/gtid/gaplog_write_commands.tcl @@ -0,0 +1 @@ +../../deps/xredis-gtid/xredis/tests/gtid/gaplog_write_commands.tcl \ No newline at end of file