From 83938f45fdb56899c230dddf32f12eee7e866264 Mon Sep 17 00:00:00 2001 From: harrylin98 Date: Wed, 20 May 2026 13:53:59 -0700 Subject: [PATCH 1/2] Optimize Clang format configs Signed-off-by: harrylin98 --- src/.clang-format | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/src/.clang-format b/src/.clang-format index 7255b18ac0d..b55a39aabf3 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -1,33 +1,23 @@ BasedOnStyle: LLVM IndentWidth: 4 TabWidth: 4 -UseTab: Never -ColumnLimit: 0 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 100 -PenaltyExcessCharacter: 100 MaxEmptyLinesToKeep: 2 -BreakBeforeBraces: Attach AllowShortCaseLabelsOnASingleLine: true AllowShortIfStatementsOnASingleLine: WithoutElse AllowShortLoopsOnASingleLine: true AllowShortFunctionsOnASingleLine: false -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AlignTrailingComments: true -PointerAlignment: Right KeepEmptyLinesAtTheStartOfBlocks: false -SpaceBeforeParens: ControlStatements -SpacesInParentheses: false -SpacesInAngles: false -SpacesInCStyleCastParentheses: false -SpaceAfterCStyleCast: false -SpacesInSquareBrackets: false -ReflowComments: true CommentPragmas: '^\\s*\\*' SortIncludes: false AllowAllParametersOfDeclarationOnNextLine: false BinPackParameters: false -AlignAfterOpenBracket: Align +BinPackArguments: false InsertNewlineAtEOF: true +ColumnLimit: 120 +PenaltyReturnTypeOnItsOwnLine: 1000000 +PenaltyBreakAssignment: 1000 +PenaltyBreakOpenParenthesis: 1000 +ReflowComments: false +SkipMacroDefinitionBody: true +AllowShortEnumsOnASingleLine: false +AllowAllArgumentsOnNextLine: false From aed50c02be48cfb2371d68990dcf1ed25908935d Mon Sep 17 00:00:00 2001 From: harrylin98 Date: Wed, 20 May 2026 14:42:30 -0700 Subject: [PATCH 2/2] Reformat code using new clang configs Signed-off-by: harrylin98 --- src/.clang-format | 3 +- src/.clang-format-ignore | 4 +- src/acl.c | 125 +- src/ae.h | 8 +- src/ae_epoll.c | 4 +- src/allocator_defrag.c | 43 +- src/allocator_defrag.h | 9 +- src/anet.c | 12 +- src/aof.c | 244 ++-- src/asciilogo.h | 39 +- src/bio.c | 3 +- src/bitops.c | 16 +- src/blocked.c | 37 +- src/call_reply.c | 12 +- src/childinfo.c | 34 +- src/cli_commands.c | 25 +- src/cli_common.c | 22 +- src/cli_common.h | 7 +- src/cluster.c | 61 +- src/cluster.h | 9 +- src/cluster_legacy.c | 1028 +++++++++----- src/cluster_legacy.h | 38 +- src/cluster_migrateslots.c | 428 +++--- src/cluster_slot_stats.c | 27 +- src/commandlog.c | 38 +- src/commands.c | 25 +- src/config.c | 2373 +++++++++++++++++++++++++++----- src/config.h | 44 +- src/connection.h | 20 +- src/crc16_slottable.c | 1844 ++++++++++++++----------- src/db.c | 51 +- src/debug.c | 575 +++++--- src/defrag.c | 121 +- src/endianconv.h | 20 +- src/entry.c | 89 +- src/eval.c | 30 +- src/evict.c | 12 +- src/expire.c | 39 +- src/functions.c | 81 +- src/fuzzer_client.c | 110 +- src/fuzzer_command_generator.c | 448 +++--- src/geo.c | 88 +- src/geohash.c | 19 +- src/geohash_helper.c | 15 +- src/geohash_helper.h | 7 +- src/hashtable.c | 99 +- src/hashtable.h | 7 +- src/hyperloglog.c | 121 +- src/io_threads.c | 41 +- src/kvstore.c | 19 +- src/kvstore.h | 6 +- src/latency.c | 136 +- src/latency.h | 4 +- src/lazyfree.c | 3 +- src/listpack.c | 32 +- src/listpack.h | 15 +- src/logreqres.c | 11 +- src/lolwut5.c | 4 +- src/lolwut6.c | 5 +- src/lolwut9.c | 7 +- src/memtest.c | 4 +- src/module.c | 362 +++-- src/module.h | 9 +- src/modules/helloacl.c | 12 +- src/modules/hellocluster.c | 28 +- src/modules/hellohook.c | 9 +- src/modules/hellotimer.c | 4 +- src/modules/hellotype.c | 28 +- src/modules/helloworld.c | 78 +- src/modules/lua/debug_lua.c | 125 +- src/modules/lua/engine_lua.c | 69 +- src/modules/lua/function_lua.c | 23 +- src/modules/lua/script_lua.c | 98 +- src/monotonic.c | 4 +- src/networking.c | 629 +++++---- src/notify.c | 2 + src/object.c | 82 +- src/pubsub.c | 15 +- src/queues.c | 4 +- src/quicklist.c | 35 +- src/rax.c | 14 +- src/rax.h | 12 +- src/rdb.c | 145 +- src/rdb.h | 2 +- src/rdma.c | 44 +- src/replication.c | 548 +++++--- src/resp_parser.c | 4 +- src/rio.c | 15 +- src/rio.h | 8 +- src/script.c | 42 +- src/scripting_engine.c | 194 +-- src/scripting_engine.h | 24 +- src/sds.c | 15 +- src/sentinel.c | 596 +++++--- src/server.c | 692 ++++++---- src/socket.c | 8 +- src/sort.c | 28 +- src/syscheck.c | 23 +- src/t_hash.c | 153 +- src/t_list.c | 52 +- src/t_set.c | 18 +- src/t_stream.c | 176 ++- src/t_string.c | 94 +- src/t_zset.c | 105 +- src/tls.c | 117 +- src/tracking.c | 26 +- src/util.c | 31 +- src/valkey-benchmark-dataset.c | 50 +- src/valkey-benchmark-dataset.h | 16 +- src/valkey-benchmark.c | 450 +++--- src/valkey-check-aof.c | 28 +- src/valkey-check-rdb.c | 87 +- src/valkey-cli.c | 458 ++++-- src/valkey_strtod.c | 4 +- src/vset.c | 397 +++--- src/vset.h | 14 +- src/ziplist.c | 62 +- src/ziplist.h | 7 +- src/zipmap.c | 13 +- src/zipmap.h | 7 +- src/zmalloc.c | 13 +- src/zmalloc.h | 5 +- 122 files changed, 9601 insertions(+), 5613 deletions(-) diff --git a/src/.clang-format b/src/.clang-format index b55a39aabf3..f55d2cd4135 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -15,9 +15,10 @@ BinPackArguments: false InsertNewlineAtEOF: true ColumnLimit: 120 PenaltyReturnTypeOnItsOwnLine: 1000000 -PenaltyBreakAssignment: 1000 +PenaltyBreakAssignment: 100 PenaltyBreakOpenParenthesis: 1000 ReflowComments: false SkipMacroDefinitionBody: true AllowShortEnumsOnASingleLine: false AllowAllArgumentsOnNextLine: false +BreakBeforeBinaryOperators: NonAssignment diff --git a/src/.clang-format-ignore b/src/.clang-format-ignore index bc649ac70cb..d44acb592c7 100644 --- a/src/.clang-format-ignore +++ b/src/.clang-format-ignore @@ -14,4 +14,6 @@ sha1.* sha256.* siphash.c strl.c -trace/trace_* \ No newline at end of file +trace/trace_* +server.h +valkeymodule.h diff --git a/src/acl.c b/src/acl.c index 26b1cfd41a1..2cf4165d579 100644 --- a/src/acl.c +++ b/src/acl.c @@ -665,7 +665,10 @@ static void ACLChangeSelectorPerm(aclSelector *selector, struct serverCommand *c * value. Since the category passed by the user may be non existing, the * function returns C_ERR if the category was not found, or C_OK if it was * found and the operation was performed. */ -static void ACLSetSelectorCommandBitsForCategory(hashtable *commands, aclSelector *selector, uint64_t cflag, int value) { +static void ACLSetSelectorCommandBitsForCategory(hashtable *commands, + aclSelector *selector, + uint64_t cflag, + int value) { hashtableIterator iter; hashtableInitIterator(&iter, commands, 0); void *next; @@ -1629,15 +1632,16 @@ static int checkPasswordBasedAuth(client *c, robj *username, robj *password) { moduleNotifyUserChanged(c); result = AUTH_OK; } else { - addACLLogEntry(c, ACL_DENIED_AUTH, (c->flag.multi) ? ACL_LOG_CTX_MULTI : ACL_LOG_CTX_TOPLEVEL, 0, objectGetVal(username), + addACLLogEntry(c, + ACL_DENIED_AUTH, + (c->flag.multi) ? ACL_LOG_CTX_MULTI : ACL_LOG_CTX_TOPLEVEL, + 0, + objectGetVal(username), NULL); result = AUTH_ERR; } - moduleFireAuthenticationEvent(c->id, - objectGetVal(username), - NULL, - result == AUTH_OK); + moduleFireAuthenticationEvent(c->id, objectGetVal(username), NULL, result == AUTH_OK); return result; } @@ -1800,8 +1804,8 @@ static int ACLCheckChannelAgainstList(list *reference, const char *channel, int size_t plen = sdslen(pattern); /* Channel patterns are matched literally against the channels in * the list. Regular channels perform pattern matching. */ - if ((is_pattern && !strcmp(pattern, channel)) || - (!is_pattern && stringmatchlen(pattern, plen, channel, channellen, 0))) { + if ((is_pattern && !strcmp(pattern, channel)) + || (!is_pattern && stringmatchlen(pattern, plen, channel, channellen, 0))) { return ACL_OK; } } @@ -1810,11 +1814,9 @@ static int ACLCheckChannelAgainstList(list *reference, const char *channel, int /* Check if selector allows access to the specified database */ static inline int ACLSelectorCanAccessDb(aclSelector *selector, long long dbid) { - if (selector->flags & SELECTOR_FLAG_ALLDBS) - return 1; + if (selector->flags & SELECTOR_FLAG_ALLDBS) return 1; - if (dbid < 0 || dbid >= server.dbnum || !selector->dbs) - return 0; + if (dbid < 0 || dbid >= server.dbnum || !selector->dbs) return 0; return intsetFind(selector->dbs, dbid); } @@ -1836,10 +1838,8 @@ static void cleanupACLKeyResultCache(aclKeyResultCache *cache) { /* Inline func to check if command should be restricted */ static inline int shouldRestrictCmd(struct serverCommand *cmd) { - return (cmd->acl_categories & ACL_CATEGORY_KEYSPACE) || - (cmd->acl_categories & ACL_CATEGORY_READ) || - (cmd->acl_categories & ACL_CATEGORY_WRITE) || - doesCommandHaveKeys(cmd); + return (cmd->acl_categories & ACL_CATEGORY_KEYSPACE) || (cmd->acl_categories & ACL_CATEGORY_READ) + || (cmd->acl_categories & ACL_CATEGORY_WRITE) || doesCommandHaveKeys(cmd); } /* Check if the command is ready to be executed according to the @@ -1929,7 +1929,11 @@ static int ACLSelectorCheckCmd(aclSelector *selector, keyReference *resultidx = result->keys; for (int j = 0; j < result->numkeys; j++) { int idx = resultidx[j].pos; - ret = ACLSelectorCheckKey(selector, objectGetVal(argv[idx]), sdslen(objectGetVal(argv[idx])), resultidx[j].flags, false); + ret = ACLSelectorCheckKey(selector, + objectGetVal(argv[idx]), + sdslen(objectGetVal(argv[idx])), + resultidx[j].flags, + false); if (ret != ACL_OK) { if (keyidxptr) *keyidxptr = resultidx[j].pos; return ret; @@ -1949,8 +1953,10 @@ static int ACLSelectorCheckCmd(aclSelector *selector, int idx = channelref[j].pos; if (!(channelref[j].flags & channel_flags)) continue; int is_pattern = channelref[j].flags & CMD_CHANNEL_PATTERN; - int ret = - ACLCheckChannelAgainstList(selector->channels, objectGetVal(argv[idx]), sdslen(objectGetVal(argv[idx])), is_pattern); + int ret = ACLCheckChannelAgainstList(selector->channels, + objectGetVal(argv[idx]), + sdslen(objectGetVal(argv[idx])), + is_pattern); if (ret != ACL_OK) { if (keyidxptr) *keyidxptr = channelref[j].pos; getKeysFreeResult(&channels); @@ -2009,7 +2015,12 @@ int ACLUserCheckKeyPerm(user *u, const char *key, int keylen, int flags, bool is * granted in addition to the access required by the command. Returns 1 * if the user has access or 0 otherwise. */ -int ACLUserCheckCmdWithUnrestrictedKeyAccess(user *u, struct serverCommand *cmd, robj **argv, int argc, int dbid, int flags) { +int ACLUserCheckCmdWithUnrestrictedKeyAccess(user *u, + struct serverCommand *cmd, + robj **argv, + int argc, + int dbid, + int flags) { listIter li; listNode *ln; int local_idxptr; @@ -2462,7 +2473,9 @@ static int ACLLoadConfiguredUsers(void) { serverLog(LL_WARNING, "Error loading ACL rule '%s' for " "the user named '%s': %s", - aclrules[j], aclrules[0], errmsg); + aclrules[j], + aclrules[0], + errmsg); return C_ERR; } } @@ -2559,15 +2572,19 @@ static sds ACLLoadFromFile(const char *filename) { errors = sdscatprintf(errors, "%s:%d should start with user keyword followed " "by the username. ", - server.acl_filename, linenum); + server.acl_filename, + linenum); sdsfreesplitres(argv, argc); continue; } /* Spaces are not allowed in usernames. */ if (ACLStringHasSpaces(argv[1], sdslen(argv[1]))) { - errors = sdscatprintf(errors, "'%s:%d: username '%s' contains invalid characters. ", server.acl_filename, - linenum, argv[1]); + errors = sdscatprintf(errors, + "'%s:%d: username '%s' contains invalid characters. ", + server.acl_filename, + linenum, + argv[1]); sdsfreesplitres(argv, argc); continue; } @@ -2588,7 +2605,9 @@ static sds ACLLoadFromFile(const char *filename) { int merged_argc; sds *acl_args = ACLMergeSelectorArguments(argv + 2, argc - 2, &merged_argc, NULL); if (!acl_args) { - errors = sdscatprintf(errors, "%s:%d: Unmatched parenthesis in selector definition.", server.acl_filename, + errors = sdscatprintf(errors, + "%s:%d: Unmatched parenthesis in selector definition.", + server.acl_filename, linenum); } @@ -2600,8 +2619,12 @@ static sds ACLLoadFromFile(const char *filename) { if (errno == ENOENT) { /* For missing commands, we print out more information since * it shouldn't contain any sensitive information. */ - errors = sdscatprintf(errors, "%s:%d: Error in applying operation '%s': %s. ", server.acl_filename, - linenum, acl_args[j], errmsg); + errors = sdscatprintf(errors, + "%s:%d: Error in applying operation '%s': %s. ", + server.acl_filename, + linenum, + acl_args[j], + errmsg); } else if (syntax_error == 0) { /* For all other errors, only print out the first error encountered * since it might affect future operations. */ @@ -2661,7 +2684,9 @@ static sds ACLLoadFromFile(const char *filename) { list *channels = NULL; user *new_user = ACLGetUserByName(c->user->name, sdslen(c->user->name)); if (new_user && user_channels) { - if (!raxFind(user_channels, (unsigned char *)(new_user->name), sdslen(new_user->name), + if (!raxFind(user_channels, + (unsigned char *)(new_user->name), + sdslen(new_user->name), (void **)&channels)) { channels = getUpcomingChannelList(new_user, original); raxInsert(user_channels, (unsigned char *)(new_user->name), sdslen(new_user->name), channels, NULL); @@ -2683,8 +2708,8 @@ static sds ACLLoadFromFile(const char *filename) { } else { raxFreeWithCallback(Users, ACLFreeUserVoid); Users = old_users; - errors = - sdscat(errors, "WARNING: ACL errors detected, no change to the previously active ACL rules was performed"); + errors = sdscat(errors, + "WARNING: ACL errors detected, no change to the previously active ACL rules was performed"); return errors; } } @@ -2908,7 +2933,9 @@ void addACLLogEntry(client *c, int reason, int context, int argpos, sds username case ACL_DENIED_CMD: le->object = sdsdup(c->cmd->fullname); break; case ACL_DENIED_KEY: le->object = sdsdup(objectGetVal(c->argv[argpos])); break; case ACL_DENIED_CHANNEL: le->object = sdsdup(objectGetVal(c->argv[argpos])); break; - case ACL_DENIED_DB: le->object = argpos ? sdsdup(objectGetVal(c->argv[argpos])) : sdsdup(c->cmd->fullname); break; + case ACL_DENIED_DB: + le->object = argpos ? sdsdup(objectGetVal(c->argv[argpos])) : sdsdup(c->cmd->fullname); + break; case ACL_DENIED_AUTH: le->object = sdsdup(objectGetVal(c->argv[0])); break; default: le->object = sdsempty(); } @@ -2919,8 +2946,7 @@ void addACLLogEntry(client *c, int reason, int context, int argpos, sds username le->cinfo = catClientInfoString(sdsempty(), realclient, 0); - if (context == ACL_LOG_CTX_SCRIPT && - strcmp(scriptGetRunningEngineName(), "LUA") == 0) { + if (context == ACL_LOG_CTX_SCRIPT && strcmp(scriptGetRunningEngineName(), "LUA") == 0) { /* For backward compatibility, we track that it's Lua using a special * lua ACL log context. Any other scripting language is just "script" in * the ACL log. */ @@ -2974,13 +3000,15 @@ sds getAclErrorMessage(int acl_res, user *user, struct serverCommand *cmd, sds e return sdscatfmt(sdsempty(), "User %S has no permissions to run " "the '%S' command", - user->name, cmd->fullname); + user->name, + cmd->fullname); case ACL_DENIED_KEY: if (verbose) { return sdscatfmt(sdsempty(), "User %S has no permissions to access " "the '%S' key", - user->name, errored_val); + user->name, + errored_val); } else { return sdsnew("No permissions to access a key"); } @@ -2989,7 +3017,8 @@ sds getAclErrorMessage(int acl_res, user *user, struct serverCommand *cmd, sds e return sdscatfmt(sdsempty(), "User %S has no permissions to access " "the '%S' channel", - user->name, errored_val); + user->name, + errored_val); } else { return sdsnew("No permissions to access a channel"); } @@ -2998,7 +3027,8 @@ sds getAclErrorMessage(int acl_res, user *user, struct serverCommand *cmd, sds e return sdscatfmt(sdsempty(), "User %s has no permissions to access " "database %s", - user->name, errored_val); + user->name, + errored_val); } else { return sdsnew("No permissions to access database"); } @@ -3241,9 +3271,10 @@ void aclCommand(client *c) { addReplyNull(c); } } else if (server.acl_filename[0] == '\0' && (!strcasecmp(sub, "load") || !strcasecmp(sub, "save"))) { - addReplyError(c, "This instance is not configured to use an ACL file. You may want to specify users via the " - "ACL SETUSER command and then issue a CONFIG REWRITE (assuming you have a configuration file " - "set) in order to store users in the configuration."); + addReplyError(c, + "This instance is not configured to use an ACL file. You may want to specify users via the " + "ACL SETUSER command and then issue a CONFIG REWRITE (assuming you have a configuration file " + "set) in order to store users in the configuration."); return; } else if (!strcasecmp(sub, "load") && c->argc == 2) { sds errors = ACLLoadFromFile(server.acl_filename); @@ -3257,9 +3288,10 @@ void aclCommand(client *c) { if (ACLSaveToFile(server.acl_filename) == C_OK) { addReply(c, shared.ok); } else { - addReplyError(c, "There was an error trying to save the ACLs. " - "Please check the server logs for more " - "information"); + addReplyError(c, + "There was an error trying to save the ACLs. " + "Please check the server logs for more " + "information"); } } else if (!strcasecmp(sub, "cat") && c->argc == 2) { void *dl = addReplyDeferredLen(c); @@ -3466,9 +3498,10 @@ void authCommand(client *c) { /* Mimic the old behavior of giving an error for the two argument * form if no password is configured. */ if (DefaultUser->flags & USER_FLAG_NOPASS) { - addReplyError(c, "AUTH called without any password " - "configured for the default user. Are you sure " - "your configuration is correct?"); + addReplyError(c, + "AUTH called without any password " + "configured for the default user. Are you sure " + "your configuration is correct?"); return; } diff --git a/src/ae.h b/src/ae.h index 985429cd567..a726e7478df 100644 --- a/src/ae.h +++ b/src/ae.h @@ -42,10 +42,10 @@ #define AE_NONE 0 /* No events registered. */ #define AE_READABLE 1 /* Fire when descriptor is readable. */ #define AE_WRITABLE 2 /* Fire when descriptor is writable. */ -#define AE_BARRIER 4 /* With WRITABLE, never fire the event if the \ - READABLE event already fired in the same event \ - loop iteration. Useful when you want to persist \ - things to disk before sending replies, and want \ +#define AE_BARRIER 4 /* With WRITABLE, never fire the event if the \ + READABLE event already fired in the same event \ + loop iteration. Useful when you want to persist \ + things to disk before sending replies, and want \ to do that in a group fashion. */ #define AE_FILE_EVENTS (1 << 0) diff --git a/src/ae_epoll.c b/src/ae_epoll.c index b2410ca29a9..b2a2138a63e 100644 --- a/src/ae_epoll.c +++ b/src/ae_epoll.c @@ -111,7 +111,9 @@ static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) { aeApiState *state = eventLoop->apidata; int retval, numevents = 0; - retval = epoll_wait(state->epfd, state->events, eventLoop->setsize, + retval = epoll_wait(state->epfd, + state->events, + eventLoop->setsize, tvp ? (tvp->tv_sec * 1000 + (tvp->tv_usec + 999) / 1000) : -1); if (retval > 0) { int j; diff --git a/src/allocator_defrag.c b/src/allocator_defrag.c index 3ccac3ea515..f6d2570b67f 100644 --- a/src/allocator_defrag.c +++ b/src/allocator_defrag.c @@ -182,13 +182,11 @@ static inline unsigned jeSize2BinIndexLgQ3(size_t sz) { unsigned exp = 64 - leading_zeros; // Effective log2(sz) /* Calculate the size's position within its group */ - unsigned within_group_offset = size_class_group_size - - (((1ULL << exp) - sz) >> (exp - lg_quantum_3_first_pow2)); + unsigned within_group_offset = size_class_group_size - (((1ULL << exp) - sz) >> (exp - lg_quantum_3_first_pow2)); /* Calculate the final bin index */ - return within_group_offset + - ((exp - (lg_quantum_3_first_pow2 + 3)) - 1) * size_class_group_size + - lg_quantum_3_offset; + return within_group_offset + ((exp - (lg_quantum_3_first_pow2 + 3)) - 1) * size_class_group_size + + lg_quantum_3_offset; } /* ----------------------------------------------------------------------------- * Interface functions to get fragmentation info from jemalloc @@ -222,13 +220,22 @@ static inline int binQueryHelperInitialization(jeBinInfoKeys *helper, unsigned b char mallctl_name[128]; /* Mib of fetch number of used regions in the bin */ - snprintf(mallctl_name, sizeof(mallctl_name), "stats.arenas." STRINGIFY(ARENA_TO_QUERY) ".bins.%d.curregs", bin_index); + snprintf(mallctl_name, + sizeof(mallctl_name), + "stats.arenas." STRINGIFY(ARENA_TO_QUERY) ".bins.%d.curregs", + bin_index); if (jeQueryKeyInit(mallctl_name, &helper->curr_regs) != 0) return -1; /* Mib of fetch number of current slabs in the bin */ - snprintf(mallctl_name, sizeof(mallctl_name), "stats.arenas." STRINGIFY(ARENA_TO_QUERY) ".bins.%d.curslabs", bin_index); + snprintf(mallctl_name, + sizeof(mallctl_name), + "stats.arenas." STRINGIFY(ARENA_TO_QUERY) ".bins.%d.curslabs", + bin_index); if (jeQueryKeyInit(mallctl_name, &helper->curr_slabs) != 0) return -1; /* Mib of fetch nonfull slabs */ - snprintf(mallctl_name, sizeof(mallctl_name), "stats.arenas." STRINGIFY(ARENA_TO_QUERY) ".bins.%d.nonfull_slabs", bin_index); + snprintf(mallctl_name, + sizeof(mallctl_name), + "stats.arenas." STRINGIFY(ARENA_TO_QUERY) ".bins.%d.nonfull_slabs", + bin_index); if (jeQueryKeyInit(mallctl_name, &helper->nonfull_slabs) != 0) return -1; return 0; @@ -366,7 +373,9 @@ static inline int makeDefragDecision(jeBinInfo *bin_info, jemallocBinUsageData * if (1000 * nalloced < bin_info->nregs * UTILIZATION_THRESHOLD_FACTOR_MILLI) return 1; /* Don't defrag if the slab usage is greater than the average usage (+ 12.5%) */ - if (1000 * nalloced * bin_usage->curr_nonfull_slabs > (1000 + UTILIZATION_THRESHOLD_FACTOR_MILLI) * allocated_nonfull) return 0; + if (1000 * nalloced * bin_usage->curr_nonfull_slabs + > (1000 + UTILIZATION_THRESHOLD_FACTOR_MILLI) * allocated_nonfull) + return 0; /* Otherwise, defrag! */ return 1; @@ -387,10 +396,7 @@ int allocatorShouldDefrag(void *ptr) { for (unsigned j = 0; j < BATCH_QUERY_ARGS_OUT; j++) { out[j] = -1; } - je_mallctlbymib(je_cb.util_batch_query.key, - je_cb.util_batch_query.keylen, - out, &out_sz, - &ptr, in_sz); + je_mallctlbymib(je_cb.util_batch_query.key, je_cb.util_batch_query.keylen, out, &out_sz, &ptr, in_sz); /* handle results with appropriate quantum value */ assert(SLAB_NUM_REGS(out, 0) > 0); assert(SLAB_LEN(out, 0) > 0); @@ -428,8 +434,15 @@ float getAllocatorFragmentation(size_t *out_frag_bytes) { float rss_pct = ((float)resident / allocated) * 100 - 100; size_t rss_bytes = resident - allocated; if (out_frag_bytes) *out_frag_bytes = frag_smallbins_bytes; - serverLog(LL_DEBUG, "allocated=%zu, active=%zu, resident=%zu, frag=%.2f%% (%.2f%% rss), frag_bytes=%zu (%zu rss)", - allocated, active, resident, frag_pct, rss_pct, frag_smallbins_bytes, rss_bytes); + serverLog(LL_DEBUG, + "allocated=%zu, active=%zu, resident=%zu, frag=%.2f%% (%.2f%% rss), frag_bytes=%zu (%zu rss)", + allocated, + active, + resident, + frag_pct, + rss_pct, + frag_smallbins_bytes, + rss_bytes); return frag_pct; } diff --git a/src/allocator_defrag.h b/src/allocator_defrag.h index 43d89e3c427..0503f943dfc 100644 --- a/src/allocator_defrag.h +++ b/src/allocator_defrag.h @@ -5,11 +5,10 @@ #include /* We can enable the server defrag capabilities only if we are using Jemalloc * and the version that has the experimental.utilization namespace in mallctl . */ -#if (defined(VALKEY_VENDORED_JEMALLOC) && defined(JEMALLOC_VERSION_MAJOR) && \ - (JEMALLOC_VERSION_MAJOR > 5 || \ - (JEMALLOC_VERSION_MAJOR == 5 && JEMALLOC_VERSION_MINOR > 2) || \ - (JEMALLOC_VERSION_MAJOR == 5 && JEMALLOC_VERSION_MINOR == 2 && JEMALLOC_VERSION_BUGFIX >= 1))) || \ - defined(DEBUG_FORCE_DEFRAG) +#if (defined(VALKEY_VENDORED_JEMALLOC) && defined(JEMALLOC_VERSION_MAJOR) \ + && (JEMALLOC_VERSION_MAJOR > 5 || (JEMALLOC_VERSION_MAJOR == 5 && JEMALLOC_VERSION_MINOR > 2) \ + || (JEMALLOC_VERSION_MAJOR == 5 && JEMALLOC_VERSION_MINOR == 2 && JEMALLOC_VERSION_BUGFIX >= 1))) \ + || defined(DEBUG_FORCE_DEFRAG) #define HAVE_DEFRAG #endif #endif diff --git a/src/anet.c b/src/anet.c index 5524e9cf4c1..759332be082 100644 --- a/src/anet.c +++ b/src/anet.c @@ -165,8 +165,8 @@ int anetKeepAlive(char *err, int fd, int interval) { * we want the compiler to emit warnings of unused variables if the preprocessor directives * somehow fail, and other than those platforms, just omit these warnings if they happen. */ -#if !(defined(_AIX) || defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__illumos__) || \ - defined(__linux__) || defined(__NetBSD__) || defined(__sun)) +#if !(defined(_AIX) || defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__illumos__) \ + || defined(__linux__) || defined(__NetBSD__) || defined(__sun)) UNUSED(interval); UNUSED(idle); UNUSED(intvl); @@ -666,8 +666,7 @@ int anetRetryAcceptOnError(int err) { * the server receives and queues it in the pending connections queue (the SYN queue), * but before accept() is called, the connection is aborted. * in such cases we can continue accepting other connections. ß*/ - if (err == ECONNABORTED) - return 1; + if (err == ECONNABORTED) return 1; #if defined(__linux__) /* https://www.man7.org/linux/man-pages/man2/accept4.2 suggests that: @@ -679,9 +678,8 @@ int anetRetryAcceptOnError(int err) { EAGAIN by retrying. In the case of TCP/IP, these are ENETDOWN, EPROTO, ENOPROTOOPT, EHOSTDOWN, ENONET, EHOSTUNREACH, EOPNOTSUPP, and ENETUNREACH. */ - if (err == ENETDOWN || err == EPROTO || err == ENOPROTOOPT || - err == EHOSTDOWN || err == ENONET || err == EHOSTUNREACH || - err == EOPNOTSUPP || err == ENETUNREACH) { + if (err == ENETDOWN || err == EPROTO || err == ENOPROTOOPT || err == EHOSTDOWN || err == ENONET + || err == EHOSTUNREACH || err == EOPNOTSUPP || err == ENETUNREACH) { return 1; } #endif diff --git a/src/aof.c b/src/aof.c index 276dcbeee2e..4339eb468fc 100644 --- a/src/aof.c +++ b/src/aof.c @@ -125,9 +125,14 @@ sds aofInfoFormat(sds buf, aofInfo *ai) { if (sdsneedsrepr(ai->file_name)) filename_repr = sdscatrepr(sdsempty(), ai->file_name, sdslen(ai->file_name)); - sds ret = sdscatprintf(buf, "%s %s %s %lld %s %c\n", AOF_MANIFEST_KEY_FILE_NAME, - filename_repr ? filename_repr : ai->file_name, AOF_MANIFEST_KEY_FILE_SEQ, ai->file_seq, - AOF_MANIFEST_KEY_FILE_TYPE, ai->file_type); + sds ret = sdscatprintf(buf, + "%s %s %s %lld %s %c\n", + AOF_MANIFEST_KEY_FILE_NAME, + filename_repr ? filename_repr : ai->file_name, + AOF_MANIFEST_KEY_FILE_SEQ, + ai->file_seq, + AOF_MANIFEST_KEY_FILE_TYPE, + ai->file_type); sdsfree(filename_repr); return ret; @@ -261,7 +266,8 @@ aofManifest *aofLoadManifestFromFile(sds am_filepath) { serverLog(LL_WARNING, "Fatal error: can't open the AOF manifest " "file %s for reading: %s", - am_filepath, strerror(errno)); + am_filepath, + strerror(errno)); exit(1); } @@ -435,8 +441,12 @@ sds getNewBaseFileNameAndMarkPreAsHistory(aofManifest *am, int aof_use_rdb_pream char *format_suffix = aof_use_rdb_preamble ? RDB_FORMAT_SUFFIX : AOF_FORMAT_SUFFIX; aofInfo *ai = aofInfoCreate(); - ai->file_name = sdscatprintf(sdsempty(), "%s.%lld%s%s", server.aof_filename, ++am->curr_base_file_seq, - BASE_FILE_SUFFIX, format_suffix); + ai->file_name = sdscatprintf(sdsempty(), + "%s.%lld%s%s", + server.aof_filename, + ++am->curr_base_file_seq, + BASE_FILE_SUFFIX, + format_suffix); ai->file_seq = am->curr_base_file_seq; ai->file_type = AOF_FILE_TYPE_BASE; am->base_aof_info = ai; @@ -454,8 +464,12 @@ sds getNewBaseFileNameAndMarkPreAsHistory(aofManifest *am, int aof_use_rdb_pream sds getNewIncrAofName(aofManifest *am) { aofInfo *ai = aofInfoCreate(); ai->file_type = AOF_FILE_TYPE_INCR; - ai->file_name = sdscatprintf(sdsempty(), "%s.%lld%s%s", server.aof_filename, ++am->curr_incr_file_seq, - INCR_FILE_SUFFIX, AOF_FORMAT_SUFFIX); + ai->file_name = sdscatprintf(sdsempty(), + "%s.%lld%s%s", + server.aof_filename, + ++am->curr_incr_file_seq, + INCR_FILE_SUFFIX, + AOF_FORMAT_SUFFIX); ai->file_seq = am->curr_incr_file_seq; listAddNodeTail(am->incr_aof_list, ai); am->dirty = 1; @@ -545,7 +559,9 @@ int writeAofManifestFile(sds buf) { if (nwritten < 0) { if (errno == EINTR) continue; - serverLog(LL_WARNING, "Error trying to write the temporary AOF manifest file %s: %s", tmp_am_name, + serverLog(LL_WARNING, + "Error trying to write the temporary AOF manifest file %s: %s", + tmp_am_name, strerror(errno)); ret = C_ERR; @@ -564,8 +580,11 @@ int writeAofManifestFile(sds buf) { } if (rename(tmp_am_filepath, am_filepath) != 0) { - serverLog(LL_WARNING, "Error trying to rename the temporary AOF manifest file %s into %s: %s", tmp_am_name, - am_name, strerror(errno)); + serverLog(LL_WARNING, + "Error trying to rename the temporary AOF manifest file %s into %s: %s", + tmp_am_name, + am_name, + strerror(errno)); ret = C_ERR; goto cleanup; @@ -638,15 +657,20 @@ void aofUpgradePrepare(aofManifest *am) { /* Move the old AOF file to AOF directory. */ sds aof_filepath = makePath(server.aof_dirname, server.aof_filename); if (rename(server.aof_filename, aof_filepath) == -1) { - serverLog(LL_WARNING, "Error trying to move the old AOF file %s into dir %s: %s", server.aof_filename, - server.aof_dirname, strerror(errno)); + serverLog(LL_WARNING, + "Error trying to move the old AOF file %s into dir %s: %s", + server.aof_filename, + server.aof_dirname, + strerror(errno)); sdsfree(aof_filepath); exit(1); } sdsfree(aof_filepath); - serverLog(LL_NOTICE, "Successfully migrated an old-style AOF file (%s) into the AOF directory (%s).", - server.aof_filename, server.aof_dirname); + serverLog(LL_NOTICE, + "Successfully migrated an old-style AOF file (%s) into the AOF directory (%s).", + server.aof_filename, + server.aof_dirname); } /* When AOFRW success, the previous BASE and INCR AOFs will @@ -656,8 +680,8 @@ void aofUpgradePrepare(aofManifest *am) { * the delete task to the bio thread. */ int aofDelHistoryFiles(void) { - if (server.aof_manifest == NULL || server.aof_disable_auto_gc == 1 || - !listLength(server.aof_manifest->history_aof_list)) { + if (server.aof_manifest == NULL || server.aof_disable_auto_gc == 1 + || !listLength(server.aof_manifest->history_aof_list)) { return C_OK; } @@ -966,8 +990,9 @@ int startAppendOnly(void) { server.aof_state = AOF_WAIT_REWRITE; if (hasActiveChildProcess() && server.child_type != CHILD_TYPE_AOF) { server.aof_rewrite_scheduled = 1; - serverLog(LL_NOTICE, "AOF was enabled but there is already another background operation. An AOF background was " - "scheduled to start when possible."); + serverLog(LL_NOTICE, + "AOF was enabled but there is already another background operation. An AOF background was " + "scheduled to start when possible."); } else if (server.in_exec) { server.aof_rewrite_scheduled = 1; serverLog(LL_NOTICE, @@ -977,15 +1002,17 @@ int startAppendOnly(void) { * start a new one: the old one cannot be reused because it is not * accumulating the AOF buffer. */ if (server.child_type == CHILD_TYPE_AOF) { - serverLog(LL_NOTICE, "AOF was enabled but there is already an AOF rewriting in background. Stopping " - "background AOF and starting a rewrite now."); + serverLog(LL_NOTICE, + "AOF was enabled but there is already an AOF rewriting in background. Stopping " + "background AOF and starting a rewrite now."); killAppendOnlyChild(); } if (rewriteAppendOnlyFileBackground() == C_ERR) { server.aof_state = AOF_OFF; - serverLog(LL_WARNING, "The server needs to enable the AOF but can't trigger a background AOF rewrite " - "operation. Check the above logs for more info about the error."); + serverLog(LL_WARNING, + "The server needs to enable the AOF but can't trigger a background AOF rewrite " + "operation. Check the above logs for more info about the error."); return C_ERR; } } @@ -1033,8 +1060,11 @@ int restartAOFWithSyncRdb(void) { new_base_filepath = makePath(server.aof_dirname, new_base_filename); if (rename(server.rdb_filename, new_base_filepath) == -1) { - serverLog(LL_WARNING, "Error trying to rename the RDB file %s into %s: %s", server.rdb_filename, - new_base_filepath, strerror(errno)); + serverLog(LL_WARNING, + "Error trying to rename the RDB file %s into %s: %s", + server.rdb_filename, + new_base_filepath, + strerror(errno)); goto cleanup; } rdbfile_renamed = 1; @@ -1069,8 +1099,7 @@ int restartAOFWithSyncRdb(void) { * fsynced offset to avoid races on fsynced_reploff_pending. */ bioDrainWorker(BIO_AOF_FSYNC); atomic_store_explicit(&server.fsynced_reploff_pending, server.primary_repl_offset, memory_order_relaxed); - server.fsynced_reploff = - atomic_load_explicit(&server.fsynced_reploff_pending, memory_order_relaxed); + server.fsynced_reploff = atomic_load_explicit(&server.fsynced_reploff_pending, memory_order_relaxed); int aof_bio_fsync_status = atomic_load_explicit(&server.aof_bio_fsync_status, memory_order_relaxed); if (aof_bio_fsync_status == C_ERR) { @@ -1105,15 +1134,18 @@ int restartAOFWithSyncRdb(void) { serverLog(LL_WARNING, "Failed to rename AOF base back to RDB file %s: %s. " "Orphan file may remain at %s", - server.rdb_filename, strerror(errno), new_base_filepath); + server.rdb_filename, + strerror(errno), + new_base_filepath); } else { rdbfile_renamed = 0; } } if (server.rdb_del_sync_files && allPersistenceDisabled()) { - serverLog(LL_NOTICE, "Removing the RDB file obtained from " - "the primary. This replica has persistence " - "disabled"); + serverLog(LL_NOTICE, + "Removing the RDB file obtained from " + "the primary. This replica has persistence " + "disabled"); if (rdbfile_renamed) { bg_unlink(new_base_filepath); } else { @@ -1186,16 +1218,16 @@ void flushAppendOnlyFile(int force) { * called only when aof buffer is not empty, so if users * stop write commands before fsync called in one second, * the data in page cache cannot be flushed in time. */ - if (server.aof_fsync == AOF_FSYNC_EVERYSEC && server.aof_last_incr_fsync_offset != server.aof_last_incr_size && - server.mstime - server.aof_last_fsync >= 1000 && !(sync_in_progress = aofFsyncInProgress())) { + if (server.aof_fsync == AOF_FSYNC_EVERYSEC && server.aof_last_incr_fsync_offset != server.aof_last_incr_size + && server.mstime - server.aof_last_fsync >= 1000 && !(sync_in_progress = aofFsyncInProgress())) { goto try_fsync; /* Check if we need to do fsync even the aof buffer is empty, * the reason is described in the previous AOF_FSYNC_EVERYSEC block, * and AOF_FSYNC_ALWAYS is also checked here to handle a case where * aof_fsync is changed from everysec to always. */ - } else if (server.aof_fsync == AOF_FSYNC_ALWAYS && - server.aof_last_incr_fsync_offset != server.aof_last_incr_size) { + } else if (server.aof_fsync == AOF_FSYNC_ALWAYS + && server.aof_last_incr_fsync_offset != server.aof_last_incr_size) { goto try_fsync; } else { /* All data is fsync'd already: Update fsynced_reploff_pending just in case. @@ -1204,7 +1236,8 @@ void flushAppendOnlyFile(int force) { * (because there's no reason, from the AOF POV, to call fsync) and then WAITAOF may wait on * the higher offset (which contains data that was only propagated to replicas, and not to AOF) */ if (!sync_in_progress && server.aof_fsync != AOF_FSYNC_NO) - atomic_store_explicit(&server.fsynced_reploff_pending, server.primary_repl_offset, + atomic_store_explicit(&server.fsynced_reploff_pending, + server.primary_repl_offset, memory_order_relaxed); return; } @@ -1230,8 +1263,9 @@ void flushAppendOnlyFile(int force) { /* Otherwise fall through, and go write since we can't wait * over two seconds. */ server.aof_delayed_fsync++; - serverLog(LL_NOTICE, "Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer " - "without waiting for fsync to complete, this may slow down the server."); + serverLog(LL_NOTICE, + "Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer " + "without waiting for fsync to complete, this may slow down the server."); } } /* We want to perform a single write. This should be guaranteed atomic @@ -1290,7 +1324,8 @@ void flushAppendOnlyFile(int force) { "Short write while writing to " "the AOF file: (nwritten=%lld, " "expected=%lld)", - (long long)nwritten, (long long)sdslen(server.aof_buf)); + (long long)nwritten, + (long long)sdslen(server.aof_buf)); } if (ftruncate(server.aof_fd, server.aof_last_incr_size) == -1) { @@ -1534,7 +1569,9 @@ int loadSingleAppendOnlyFile(char *filename) { if (fp == NULL) { int en = errno; if (valkey_stat(aof_filepath, &sb) == 0 || errno != ENOENT) { - serverLog(LL_WARNING, "Fatal error: can't open the append log file %s for reading: %s", filename, + serverLog(LL_WARNING, + "Fatal error: can't open the append log file %s for reading: %s", + filename, strerror(en)); sdsfree(aof_filepath); return AOF_OPEN_ERR; @@ -1580,7 +1617,8 @@ int loadSingleAppendOnlyFile(char *filename) { rioInitWithFile(&rdb, fp); if (rdbLoadRio(&rdb, RDBFLAGS_AOF_PREAMBLE, NULL) != RDB_OK) { if (old_style) - serverLog(LL_WARNING, "Error reading the RDB preamble of the AOF file %s, AOF loading aborted", + serverLog(LL_WARNING, + "Error reading the RDB preamble of the AOF file %s, AOF loading aborted", filename); else serverLog(LL_WARNING, "Error reading the RDB base file %s, AOF loading aborted", filename); @@ -1724,7 +1762,9 @@ int loadSingleAppendOnlyFile(char *filename) { uxeof: /* Unexpected AOF end of file. */ if (server.aof_load_truncated) { serverLog(LL_WARNING, "!!! Warning: short read while loading the AOF file %s!!!", filename); - serverLog(LL_WARNING, "!!! Truncating the AOF %s at offset %llu !!!", filename, + serverLog(LL_WARNING, + "!!! Truncating the AOF %s at offset %llu !!!", + filename, (unsigned long long)valid_up_to); if (valid_up_to == -1 || truncate(aof_filepath, valid_up_to) == -1) { if (valid_up_to == -1) { @@ -1744,12 +1784,12 @@ int loadSingleAppendOnlyFile(char *filename) { } } } - serverLog( - LL_WARNING, - "Unexpected end of file reading the append only file %s. You can: " - "1) Make a backup of your AOF file, then use ./valkey-check-aof --fix . " - "2) Alternatively you can set the 'aof-load-truncated' configuration option to yes and restart the server.", - filename); + serverLog(LL_WARNING, + "Unexpected end of file reading the append only file %s. You can: " + "1) Make a backup of your AOF file, then use ./valkey-check-aof --fix . " + "2) Alternatively you can set the 'aof-load-truncated' configuration option to yes and restart the " + "server.", + filename); ret = AOF_FAILED; goto cleanup; @@ -1789,9 +1829,9 @@ int loadAppendOnlyFiles(aofManifest *am) { * and the 'server.aof_filename' file not exist in 'server.aof_dirname' directory * */ if (fileExist(server.aof_filename)) { - if (!dirExists(server.aof_dirname) || (am->base_aof_info == NULL && listLength(am->incr_aof_list) == 0) || - (am->base_aof_info != NULL && listLength(am->incr_aof_list) == 0 && - !strcmp(am->base_aof_info->file_name, server.aof_filename) && !aofFileExist(server.aof_filename))) { + if (!dirExists(server.aof_dirname) || (am->base_aof_info == NULL && listLength(am->incr_aof_list) == 0) + || (am->base_aof_info != NULL && listLength(am->incr_aof_list) == 0 + && !strcmp(am->base_aof_info->file_name, server.aof_filename) && !aofFileExist(server.aof_filename))) { aofUpgradePrepare(am); } } @@ -1827,7 +1867,9 @@ int loadAppendOnlyFiles(aofManifest *am) { start = ustime(); ret = loadSingleAppendOnlyFile(aof_name); if (ret == AOF_OK || (ret == AOF_TRUNCATED && last_file)) { - serverLog(LL_NOTICE, "DB loaded from base file %s: %.3f seconds", aof_name, + serverLog(LL_NOTICE, + "DB loaded from base file %s: %.3f seconds", + aof_name, (float)(ustime() - start) / 1000000); } @@ -1857,7 +1899,9 @@ int loadAppendOnlyFiles(aofManifest *am) { start = ustime(); ret = loadSingleAppendOnlyFile(aof_name); if (ret == AOF_OK || (ret == AOF_TRUNCATED && last_file)) { - serverLog(LL_NOTICE, "DB loaded from incr file %s: %.3f seconds", aof_name, + serverLog(LL_NOTICE, + "DB loaded from incr file %s: %.3f seconds", + aof_name, (float)(ustime() - start) / 1000000); } @@ -1922,8 +1966,8 @@ int rewriteListObject(rio *r, robj *key, robj *o) { while (listTypeNext(li, &entry)) { if (count == 0) { int cmd_items = (items > AOF_REWRITE_ITEMS_PER_CMD) ? AOF_REWRITE_ITEMS_PER_CMD : items; - if (!rioWriteBulkCount(r, '*', 2 + cmd_items) || !rioWriteBulkString(r, "RPUSH", 5) || - !rioWriteBulkObject(r, key)) { + if (!rioWriteBulkCount(r, '*', 2 + cmd_items) || !rioWriteBulkString(r, "RPUSH", 5) + || !rioWriteBulkObject(r, key)) { listTypeReleaseIterator(li); return 0; } @@ -1962,8 +2006,8 @@ int rewriteSetObject(rio *r, robj *key, robj *o) { while (setTypeNext(si, &str, &len, &llval) != -1) { if (count == 0) { int cmd_items = (items > AOF_REWRITE_ITEMS_PER_CMD) ? AOF_REWRITE_ITEMS_PER_CMD : items; - if (!rioWriteBulkCount(r, '*', 2 + cmd_items) || !rioWriteBulkString(r, "SADD", 4) || - !rioWriteBulkObject(r, key)) { + if (!rioWriteBulkCount(r, '*', 2 + cmd_items) || !rioWriteBulkString(r, "SADD", 4) + || !rioWriteBulkObject(r, key)) { setTypeReleaseIterator(si); return 0; } @@ -2005,8 +2049,8 @@ int rewriteSortedSetObject(rio *r, robj *key, robj *o) { if (count == 0) { int cmd_items = (items > AOF_REWRITE_ITEMS_PER_CMD) ? AOF_REWRITE_ITEMS_PER_CMD : items; - if (!rioWriteBulkCount(r, '*', 2 + cmd_items * 2) || !rioWriteBulkString(r, "ZADD", 4) || - !rioWriteBulkObject(r, key)) { + if (!rioWriteBulkCount(r, '*', 2 + cmd_items * 2) || !rioWriteBulkString(r, "ZADD", 4) + || !rioWriteBulkObject(r, key)) { return 0; } } @@ -2030,8 +2074,8 @@ int rewriteSortedSetObject(rio *r, robj *key, robj *o) { if (count == 0) { int cmd_items = (items > AOF_REWRITE_ITEMS_PER_CMD) ? AOF_REWRITE_ITEMS_PER_CMD : items; - if (!rioWriteBulkCount(r, '*', 2 + cmd_items * 2) || !rioWriteBulkString(r, "ZADD", 4) || - !rioWriteBulkObject(r, key)) { + if (!rioWriteBulkCount(r, '*', 2 + cmd_items * 2) || !rioWriteBulkString(r, "ZADD", 4) + || !rioWriteBulkObject(r, key)) { hashtableCleanupIterator(&iter); return 0; } @@ -2107,20 +2151,21 @@ int rewriteHashObject(rio *r, robj *key, robj *o) { non_volatile_items = hashTypeLength(o) - volatile_items; hashTypeInitIterator(o, &hi); while (hashTypeNext(&hi) != C_ERR) { - if (volatile_items > 0 && entryHasExpiry(hi.next)) - continue; + if (volatile_items > 0 && entryHasExpiry(hi.next)) continue; if (count == 0) { - int cmd_items = (non_volatile_items > AOF_REWRITE_ITEMS_PER_CMD) ? AOF_REWRITE_ITEMS_PER_CMD : non_volatile_items; + int cmd_items = (non_volatile_items > AOF_REWRITE_ITEMS_PER_CMD) ? AOF_REWRITE_ITEMS_PER_CMD + : non_volatile_items; - if (!rioWriteBulkCount(r, '*', 2 + cmd_items * 2) || !rioWriteBulkString(r, "HMSET", 5) || - !rioWriteBulkObject(r, key)) { + if (!rioWriteBulkCount(r, '*', 2 + cmd_items * 2) || !rioWriteBulkString(r, "HMSET", 5) + || !rioWriteBulkObject(r, key)) { hashTypeResetIterator(&hi); return 0; } } - if (!rioWriteHashIteratorCursor(r, &hi, OBJ_HASH_FIELD) || !rioWriteHashIteratorCursor(r, &hi, OBJ_HASH_VALUE)) { + if (!rioWriteHashIteratorCursor(r, &hi, OBJ_HASH_FIELD) + || !rioWriteHashIteratorCursor(r, &hi, OBJ_HASH_VALUE)) { hashTypeResetIterator(&hi); return 0; } @@ -2208,8 +2253,8 @@ int rewriteStreamObject(rio *r, robj *key, robj *o) { * the ID, the second is an array of field-value pairs. */ /* Emit the XADD ...fields... command. */ - if (!rioWriteBulkCount(r, '*', 3 + numfields * 2) || !rioWriteBulkString(r, "XADD", 4) || - !rioWriteBulkObject(r, key) || !rioWriteBulkStreamID(r, &id)) { + if (!rioWriteBulkCount(r, '*', 3 + numfields * 2) || !rioWriteBulkString(r, "XADD", 4) + || !rioWriteBulkObject(r, key) || !rioWriteBulkStreamID(r, &id)) { streamIteratorStop(&si); return 0; } @@ -2217,8 +2262,8 @@ int rewriteStreamObject(rio *r, robj *key, robj *o) { unsigned char *field, *value; int64_t field_len, value_len; streamIteratorGetField(&si, &field, &value, &field_len, &value_len); - if (!rioWriteBulkString(r, (char *)field, field_len) || - !rioWriteBulkString(r, (char *)value, value_len)) { + if (!rioWriteBulkString(r, (char *)field, field_len) + || !rioWriteBulkString(r, (char *)value, value_len)) { streamIteratorStop(&si); return 0; } @@ -2230,9 +2275,9 @@ int rewriteStreamObject(rio *r, robj *key, robj *o) { * for the Stream type. */ id.ms = 0; id.seq = 1; - if (!rioWriteBulkCount(r, '*', 7) || !rioWriteBulkString(r, "XADD", 4) || !rioWriteBulkObject(r, key) || - !rioWriteBulkString(r, "MAXLEN", 6) || !rioWriteBulkString(r, "0", 1) || !rioWriteBulkStreamID(r, &id) || - !rioWriteBulkString(r, "x", 1) || !rioWriteBulkString(r, "y", 1)) { + if (!rioWriteBulkCount(r, '*', 7) || !rioWriteBulkString(r, "XADD", 4) || !rioWriteBulkObject(r, key) + || !rioWriteBulkString(r, "MAXLEN", 6) || !rioWriteBulkString(r, "0", 1) || !rioWriteBulkStreamID(r, &id) + || !rioWriteBulkString(r, "x", 1) || !rioWriteBulkString(r, "y", 1)) { streamIteratorStop(&si); return 0; } @@ -2240,10 +2285,10 @@ int rewriteStreamObject(rio *r, robj *key, robj *o) { /* Append XSETID after XADD, make sure lastid is correct, * in case of XDEL lastid. */ - if (!rioWriteBulkCount(r, '*', 7) || !rioWriteBulkString(r, "XSETID", 6) || !rioWriteBulkObject(r, key) || - !rioWriteBulkStreamID(r, &s->last_id) || !rioWriteBulkString(r, "ENTRIESADDED", 12) || - !rioWriteBulkLongLong(r, s->entries_added) || !rioWriteBulkString(r, "MAXDELETEDID", 12) || - !rioWriteBulkStreamID(r, &s->max_deleted_entry_id)) { + if (!rioWriteBulkCount(r, '*', 7) || !rioWriteBulkString(r, "XSETID", 6) || !rioWriteBulkObject(r, key) + || !rioWriteBulkStreamID(r, &s->last_id) || !rioWriteBulkString(r, "ENTRIESADDED", 12) + || !rioWriteBulkLongLong(r, s->entries_added) || !rioWriteBulkString(r, "MAXDELETEDID", 12) + || !rioWriteBulkStreamID(r, &s->max_deleted_entry_id)) { streamIteratorStop(&si); return 0; } @@ -2257,10 +2302,10 @@ int rewriteStreamObject(rio *r, robj *key, robj *o) { while (raxNext(&ri)) { streamCG *group = ri.data; /* Emit the XGROUP CREATE in order to create the group. */ - if (!rioWriteBulkCount(r, '*', 7) || !rioWriteBulkString(r, "XGROUP", 6) || - !rioWriteBulkString(r, "CREATE", 6) || !rioWriteBulkObject(r, key) || - !rioWriteBulkString(r, (char *)ri.key, ri.key_len) || !rioWriteBulkStreamID(r, &group->last_id) || - !rioWriteBulkString(r, "ENTRIESREAD", 11) || !rioWriteBulkLongLong(r, group->entries_read)) { + if (!rioWriteBulkCount(r, '*', 7) || !rioWriteBulkString(r, "XGROUP", 6) + || !rioWriteBulkString(r, "CREATE", 6) || !rioWriteBulkObject(r, key) + || !rioWriteBulkString(r, (char *)ri.key, ri.key_len) || !rioWriteBulkStreamID(r, &group->last_id) + || !rioWriteBulkString(r, "ENTRIESREAD", 11) || !rioWriteBulkLongLong(r, group->entries_read)) { raxStop(&ri); streamIteratorStop(&si); return 0; @@ -2291,8 +2336,8 @@ int rewriteStreamObject(rio *r, robj *key, robj *o) { raxSeek(&ri_pel, "^", NULL, 0); while (raxNext(&ri_pel)) { streamNACK *nack = ri_pel.data; - if (rioWriteStreamPendingEntry(r, key, (char *)ri.key, ri.key_len, consumer, ri_pel.key, nack) == - 0) { + if (rioWriteStreamPendingEntry(r, key, (char *)ri.key, ri.key_len, consumer, ri_pel.key, nack) + == 0) { raxStop(&ri_pel); raxStop(&ri_cons); raxStop(&ri); @@ -2421,7 +2466,9 @@ int rewriteSlotToAppendOnlyFileRio(rio *aof, int db_num, int hashslot, size_t *k /* SELECT the DB */ if (rewriteSelectDbRio(aof, db_num) == C_ERR) return C_ERR; - kvstoreHashtableIterator *iter = kvstoreGetHashtableIterator(db->keys, hashslot, HASHTABLE_ITER_SAFE | HASHTABLE_ITER_PREFETCH_VALUES); + kvstoreHashtableIterator *iter = kvstoreGetHashtableIterator(db->keys, + hashslot, + HASHTABLE_ITER_SAFE | HASHTABLE_ITER_PREFETCH_VALUES); void *next; while (kvstoreHashtableIteratorNext(iter, &next)) { robj *o = next; @@ -2670,8 +2717,9 @@ void bgrewriteaofCommand(client *c) { } else if (rewriteAppendOnlyFileBackground() == C_OK) { addReplyStatus(c, "Background append only file rewriting started"); } else { - addReplyError(c, "Can't execute an AOF background rewriting. " - "Please check the server logs for more information."); + addReplyError(c, + "Can't execute an AOF background rewriting. " + "Please check the server logs for more information."); } } @@ -2795,8 +2843,11 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) { /* Rename the temporary aof file to 'new_base_filename'. */ latencyStartMonitor(latency); if (rename(tmpfile, new_base_filepath) == -1) { - serverLog(LL_WARNING, "Error trying to rename the temporary AOF base file %s into %s: %s", tmpfile, - new_base_filepath, strerror(errno)); + serverLog(LL_WARNING, + "Error trying to rename the temporary AOF base file %s into %s: %s", + tmpfile, + new_base_filepath, + strerror(errno)); aofManifestFree(temp_am); sdsfree(new_base_filepath); server.aof_lastbgrewrite_status = C_ERR; @@ -2818,8 +2869,11 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) { new_incr_filepath = makePath(server.aof_dirname, new_incr_filename); latencyStartMonitor(latency); if (rename(temp_incr_filepath, new_incr_filepath) == -1) { - serverLog(LL_WARNING, "Error trying to rename the temporary AOF incr file %s into %s: %s", - temp_incr_filepath, new_incr_filepath, strerror(errno)); + serverLog(LL_WARNING, + "Error trying to rename the temporary AOF incr file %s into %s: %s", + temp_incr_filepath, + new_incr_filepath, + strerror(errno)); bg_unlink(new_base_filepath); sdsfree(new_base_filepath); aofManifestFree(temp_am); @@ -2833,7 +2887,9 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) { latencyEndMonitor(latency); latencyAddSampleIfNeeded("aof-rename", latency); latencyTraceIfNeeded(aof, aof_rename, latency); - serverLog(LL_NOTICE, "Successfully renamed the temporary AOF incr file %s into %s", temp_incr_aof_name, + serverLog(LL_NOTICE, + "Successfully renamed the temporary AOF incr file %s into %s", + temp_incr_aof_name, new_incr_filename); sdsfree(temp_incr_filepath); sdsfree(temp_incr_aof_name); @@ -2883,8 +2939,8 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) { /* Update the fsynced replication offset that just now become valid. * This could either be the one we took in startAppendOnly, or a * newer one set by the bio thread. */ - long long fsynced_reploff_pending = - atomic_load_explicit(&server.fsynced_reploff_pending, memory_order_relaxed); + long long fsynced_reploff_pending = atomic_load_explicit(&server.fsynced_reploff_pending, + memory_order_relaxed); server.fsynced_reploff = fsynced_reploff_pending; } diff --git a/src/asciilogo.h b/src/asciilogo.h index 65df3a16f62..5f20a5dfc0d 100644 --- a/src/asciilogo.h +++ b/src/asciilogo.h @@ -31,23 +31,22 @@ * All rights reserved. * SPDX-License-Identifier: BSD-3-Clause */ -const char *ascii_logo = - " .+^+. \n" - " .+#########+. \n" - " .+########+########+. Valkey %s (%s/%d) %s bit\n" - " .+########+' '+########+. \n" - " .########+' .+. '+########. Running in %s mode\n" - " |####+' .+#######+. '+####| Port: %d\n" - " |###| .+###############+. |###| PID: %ld \n" - " |###| |#####*'' ''*#####| |###| \n" - " |###| |####' .-. '####| |###| \n" - " |###| |###( (@@@) )###| |###| https://valkey.io \n" - " |###| |####. '-' .####| |###| \n" - " |###| |#####*. .*#####| |###| \n" - " |###| '+#####| |#####+' |###| \n" - " |####+. +##| |#+' .+####| \n" - " '#######+ |##| .+########' \n" - " '+###| |##| .+########+' \n" - " '| |####+########+' \n" - " +#########+' \n" - " '+v+' \n\n"; +const char *ascii_logo = " .+^+. \n" + " .+#########+. \n" + " .+########+########+. Valkey %s (%s/%d) %s bit\n" + " .+########+' '+########+. \n" + " .########+' .+. '+########. Running in %s mode\n" + " |####+' .+#######+. '+####| Port: %d\n" + " |###| .+###############+. |###| PID: %ld \n" + " |###| |#####*'' ''*#####| |###| \n" + " |###| |####' .-. '####| |###| \n" + " |###| |###( (@@@) )###| |###| https://valkey.io \n" + " |###| |####. '-' .####| |###| \n" + " |###| |#####*. .*#####| |###| \n" + " |###| '+#####| |#####+' |###| \n" + " |####+. +##| |#+' .+####| \n" + " '#######+ |##| .+########' \n" + " '+###| |##| .+########+' \n" + " '| |####+########+' \n" + " +#########+' \n" + " '+v+' \n\n"; diff --git a/src/bio.c b/src/bio.c index 560e3534a19..e6ed5613a0d 100644 --- a/src/bio.c +++ b/src/bio.c @@ -260,8 +260,7 @@ void *bioProcessBackgroundJobs(void *arg) { sigemptyset(&sigset); sigaddset(&sigset, SIGALRM); int err = pthread_sigmask(SIG_BLOCK, &sigset, NULL); - if (err) - serverLog(LL_WARNING, "Warning: can't mask SIGALRM in bio.c thread: %s", strerror(err)); + if (err) serverLog(LL_WARNING, "Warning: can't mask SIGALRM in bio.c thread: %s", strerror(err)); bio_worker_num = bioWorkerNum(bwd); diff --git a/src/bitops.c b/src/bitops.c index e9daf1ce602..2576f46c1ff 100644 --- a/src/bitops.c +++ b/src/bitops.c @@ -177,12 +177,12 @@ long long popcountScalar(void *s, long count) { aux6 = (aux6 & 0x33333333) + ((aux6 >> 2) & 0x33333333); aux7 = aux7 - ((aux7 >> 1) & 0x55555555); aux7 = (aux7 & 0x33333333) + ((aux7 >> 2) & 0x33333333); - bits += ((((aux1 + (aux1 >> 4)) & 0x0F0F0F0F) + ((aux2 + (aux2 >> 4)) & 0x0F0F0F0F) + - ((aux3 + (aux3 >> 4)) & 0x0F0F0F0F) + ((aux4 + (aux4 >> 4)) & 0x0F0F0F0F) + - ((aux5 + (aux5 >> 4)) & 0x0F0F0F0F) + ((aux6 + (aux6 >> 4)) & 0x0F0F0F0F) + - ((aux7 + (aux7 >> 4)) & 0x0F0F0F0F)) * - 0x01010101) >> - 24; + bits += ((((aux1 + (aux1 >> 4)) & 0x0F0F0F0F) + ((aux2 + (aux2 >> 4)) & 0x0F0F0F0F) + + ((aux3 + (aux3 >> 4)) & 0x0F0F0F0F) + ((aux4 + (aux4 >> 4)) & 0x0F0F0F0F) + + ((aux5 + (aux5 >> 4)) & 0x0F0F0F0F) + ((aux6 + (aux6 >> 4)) & 0x0F0F0F0F) + + ((aux7 + (aux7 >> 4)) & 0x0F0F0F0F)) + * 0x01010101) + >> 24; } /* Count the remaining bytes. */ p = (unsigned char *)p4; @@ -621,8 +621,8 @@ int getBitfieldTypeFromArgument(client *c, robj *o, int *sign, int *bits) { return C_ERR; } - if ((string2ll(p + 1, plen - 1, &llbits)) == 0 || llbits < 1 || (*sign == 1 && llbits > 64) || - (*sign == 0 && llbits > 63)) { + if ((string2ll(p + 1, plen - 1, &llbits)) == 0 || llbits < 1 || (*sign == 1 && llbits > 64) + || (*sign == 0 && llbits > 63)) { addReplyError(c, err); return C_ERR; } diff --git a/src/blocked.c b/src/blocked.c index 9d081b643ce..506cd99d94c 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -262,10 +262,8 @@ int blockedClientMayTimeout(client *c) { return moduleBlockedClientMayTimeout(c); } - if (c->bstate->btype == BLOCKED_LIST || - c->bstate->btype == BLOCKED_ZSET || - c->bstate->btype == BLOCKED_STREAM || - c->bstate->btype == BLOCKED_WAIT) { + if (c->bstate->btype == BLOCKED_LIST || c->bstate->btype == BLOCKED_ZSET || c->bstate->btype == BLOCKED_STREAM + || c->bstate->btype == BLOCKED_WAIT) { return 1; } return 0; @@ -339,20 +337,25 @@ void disconnectOrRedirectAllBlockedClients(void) { if (c->bstate->btype == BLOCKED_POSTPONE) continue; if (server.cluster_enabled) { - if (clusterRedirectBlockedClientIfNeeded(c)) - unblockClientOnError(c, NULL); + if (clusterRedirectBlockedClientIfNeeded(c)) unblockClientOnError(c, NULL); } else { /* if the client is read-only and blocked by a read command, we do not unblock it */ if (c->flag.readonly && !(c->lastcmd->flags & CMD_WRITE)) continue; - if (clientSupportStandAloneRedirect(c) && (c->bstate->btype == BLOCKED_LIST || c->bstate->btype == BLOCKED_ZSET || - c->bstate->btype == BLOCKED_STREAM || c->bstate->btype == BLOCKED_MODULE)) { + if (clientSupportStandAloneRedirect(c) + && (c->bstate->btype == BLOCKED_LIST || c->bstate->btype == BLOCKED_ZSET + || c->bstate->btype == BLOCKED_STREAM || c->bstate->btype == BLOCKED_MODULE)) { if (c->bstate->btype == BLOCKED_MODULE && !moduleClientIsBlockedOnKeys(c)) continue; /* Client has redirect capability and blocked on keys */ - addReplyErrorSds(c, sdscatprintf(sdsempty(), "-REDIRECT %s:%d", server.primary_host, server.primary_port)); + addReplyErrorSds(c, + sdscatprintf(sdsempty(), + "-REDIRECT %s:%d", + server.primary_host, + server.primary_port)); unblockClientOnError(c, NULL); } else { - unblockClientOnError(c, "-UNBLOCKED force unblock from blocking operation, " - "instance state changed (master -> replica?)"); + unblockClientOnError(c, + "-UNBLOCKED force unblock from blocking operation, " + "instance state changed (master -> replica?)"); c->flag.close_after_reply = 1; } } @@ -645,8 +648,8 @@ static void handleClientsBlockedOnKey(readyList *rl) { * module is trying to accomplish right now. * 3. In case of XREADGROUP call we will want to unblock on any change in object type * or in case the key was deleted, since the group is no longer valid. */ - if ((o != NULL && (receiver->bstate->btype == getBlockedTypeByType(o->type))) || - (o != NULL && (receiver->bstate->btype == BLOCKED_MODULE)) || (receiver->bstate->unblock_on_nokey)) { + if ((o != NULL && (receiver->bstate->btype == getBlockedTypeByType(o->type))) + || (o != NULL && (receiver->bstate->btype == BLOCKED_MODULE)) || (receiver->bstate->unblock_on_nokey)) { if (receiver->bstate->btype != BLOCKED_MODULE) unblockClientOnKey(receiver, rl->key); else @@ -705,8 +708,8 @@ static void unblockClientOnKey(client *c, robj *key) { /* Only in case of blocking API calls, we might be blocked on several keys. however we should force unblock the entire blocking keys */ - serverAssert(c->bstate->btype == BLOCKED_STREAM || c->bstate->btype == BLOCKED_LIST || - c->bstate->btype == BLOCKED_ZSET); + serverAssert(c->bstate->btype == BLOCKED_STREAM || c->bstate->btype == BLOCKED_LIST + || c->bstate->btype == BLOCKED_ZSET); /* We need to unblock the client before calling processCommandAndResetClient * because it checks the CLIENT_BLOCKED flag */ @@ -758,7 +761,9 @@ static void moduleUnblockClientOnKey(client *c, robj *key) { elapsedStart(&replyTimer); if (moduleTryServeClientBlockedOnKey(c, key)) { - updateStatsOnUnblock(c, 0, elapsedUs(replyTimer), + updateStatsOnUnblock(c, + 0, + elapsedUs(replyTimer), ((server.stat_total_error_replies != prev_error_replies) ? ERROR_COMMAND_FAILED : 0)); moduleUnblockClient(c); } diff --git a/src/call_reply.c b/src/call_reply.c index 71b89b21ba2..c44797ec8b8 100644 --- a/src/call_reply.c +++ b/src/call_reply.c @@ -122,8 +122,7 @@ static void callReplyNullBulkString(void *ctx, const char *proto, size_t proto_l static void callReplyNullArray(void *ctx, const char *proto, size_t proto_len) { CallReply *rep = ctx; - int type = rep->flags & REPLY_FLAG_EXACT_TYPE ? VALKEYMODULE_REPLY_ARRAY_NULL - : VALKEYMODULE_REPLY_NULL; + int type = rep->flags & REPLY_FLAG_EXACT_TYPE ? VALKEYMODULE_REPLY_ARRAY_NULL : VALKEYMODULE_REPLY_NULL; callReplySetSharedData(rep, type, proto, proto_len, 0); } @@ -143,8 +142,7 @@ static void callReplyError(void *ctx, const char *str, size_t len, const char *p static void callReplySimpleStr(void *ctx, const char *str, size_t len, const char *proto, size_t proto_len) { CallReply *rep = ctx; - int type = rep->flags & REPLY_FLAG_EXACT_TYPE ? VALKEYMODULE_REPLY_SIMPLE_STRING - : VALKEYMODULE_REPLY_STRING; + int type = rep->flags & REPLY_FLAG_EXACT_TYPE ? VALKEYMODULE_REPLY_SIMPLE_STRING : VALKEYMODULE_REPLY_STRING; callReplySetSharedData(rep, type, proto, proto_len, 0); rep->len = len; rep->val.str = str; @@ -366,9 +364,9 @@ int callReplyType(CallReply *rep) { */ const char *callReplyGetString(CallReply *rep, size_t *len) { callReplyParse(rep); - if (rep->type != VALKEYMODULE_REPLY_STRING && - rep->type != VALKEYMODULE_REPLY_SIMPLE_STRING && - rep->type != VALKEYMODULE_REPLY_ERROR) return NULL; + if (rep->type != VALKEYMODULE_REPLY_STRING && rep->type != VALKEYMODULE_REPLY_SIMPLE_STRING + && rep->type != VALKEYMODULE_REPLY_ERROR) + return NULL; if (len) *len = rep->len; return rep->val.str; } diff --git a/src/childinfo.c b/src/childinfo.c index 6eb558f4fa3..45b43c6bc65 100644 --- a/src/childinfo.c +++ b/src/childinfo.c @@ -65,7 +65,11 @@ void closeChildInfoPipe(void) { } /* Send save data to parent. */ -void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t repl_output_bytes, double progress, char *pname) { +void sendChildInfoGeneric(childInfoType info_type, + size_t keys, + size_t repl_output_bytes, + double progress, + char *pname) { if (server.child_info_pipe[1] == -1) return; static monotime cow_updated = 0; @@ -83,8 +87,8 @@ void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t repl_outp * passes. */ monotime now = getMonotonicUs(); - if (info_type != CHILD_INFO_TYPE_CURRENT_INFO || !cow_updated || - now - cow_updated > cow_update_cost * CHILD_COW_DUTY_CYCLE) { + if (info_type != CHILD_INFO_TYPE_CURRENT_INFO || !cow_updated + || now - cow_updated > cow_update_cost * CHILD_COW_DUTY_CYCLE) { cow = zmalloc_get_private_dirty(-1); cow_updated = getMonotonicUs(); cow_update_cost = cow_updated - now; @@ -95,7 +99,10 @@ void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t repl_outp int cow_info = (info_type != CHILD_INFO_TYPE_CURRENT_INFO); if (cow || cow_info) { serverLog(cow_info ? LL_NOTICE : LL_VERBOSE, - "Fork CoW for %s: current %zu MB, peak %zu MB, average %llu MB", pname, cow >> 20, peak_cow >> 20, + "Fork CoW for %s: current %zu MB, peak %zu MB, average %llu MB", + pname, + cow >> 20, + peak_cow >> 20, (sum_cow / update_count) >> 20); } } @@ -117,7 +124,12 @@ void sendChildInfoGeneric(childInfoType info_type, size_t keys, size_t repl_outp } /* Update Child info. */ -void updateChildInfo(childInfoType information_type, size_t cow, monotime cow_updated, size_t keys, size_t repl_output_bytes, double progress) { +void updateChildInfo(childInfoType information_type, + size_t cow, + monotime cow_updated, + size_t keys, + size_t repl_output_bytes, + double progress) { if (cow > server.stat_current_cow_peak) server.stat_current_cow_peak = cow; if (information_type == CHILD_INFO_TYPE_CURRENT_INFO) { @@ -142,7 +154,12 @@ void updateChildInfo(childInfoType information_type, size_t cow, monotime cow_up * if complete data read into the buffer, * data is stored into *buffer, and returns 1. * otherwise, the partial data is left in the buffer, waiting for the next read, and returns 0. */ -int readChildInfo(childInfoType *information_type, size_t *cow, monotime *cow_updated, size_t *keys, size_t *repl_output_bytes, double *progress) { +int readChildInfo(childInfoType *information_type, + size_t *cow, + monotime *cow_updated, + size_t *keys, + size_t *repl_output_bytes, + double *progress) { /* We are using here a static buffer in combination with the server.child_info_nread to handle short reads */ static child_info_data buffer; ssize_t wlen = sizeof(buffer); @@ -150,8 +167,9 @@ int readChildInfo(childInfoType *information_type, size_t *cow, monotime *cow_up /* Do not overlap */ if (server.child_info_nread == wlen) server.child_info_nread = 0; - int nread = - read(server.child_info_pipe[0], (char *)&buffer + server.child_info_nread, wlen - server.child_info_nread); + int nread = read(server.child_info_pipe[0], + (char *)&buffer + server.child_info_nread, + wlen - server.child_info_nread); if (nread > 0) { server.child_info_nread += nread; } diff --git a/src/cli_commands.c b/src/cli_commands.c index 989428ec1b0..92ab483ac41 100644 --- a/src/cli_commands.c +++ b/src/cli_commands.c @@ -2,9 +2,28 @@ #include "cli_commands.h" /* Definitions to configure commands.c to generate the above structs. */ -#define MAKE_CMD(name, summary, complexity, since, doc_flags, replaced, deprecated, group, group_enum, history, \ - num_history, tips, num_tips, function, arity, flags, acl, get_dbid_args, key_specs, \ - key_specs_num, get_keys, numargs) \ +#define MAKE_CMD(name, \ + summary, \ + complexity, \ + since, \ + doc_flags, \ + replaced, \ + deprecated, \ + group, \ + group_enum, \ + history, \ + num_history, \ + tips, \ + num_tips, \ + function, \ + arity, \ + flags, \ + acl, \ + get_dbid_args, \ + key_specs, \ + key_specs_num, \ + get_keys, \ + numargs) \ name, summary, group, since, numargs #define MAKE_ARG(name, type, key_spec_index, token, summary, since, flags, numsubargs, deprecated_since) \ name, type, token, since, flags, numsubargs diff --git a/src/cli_common.c b/src/cli_common.c index a43acd971e6..3e3c74de003 100644 --- a/src/cli_common.c +++ b/src/cli_common.c @@ -327,8 +327,8 @@ void parseUri(const char *uri, const char *tool_name, cliConnInfo *connInfo, int const char *userinfo, *username, *port, *host, *path; /* URI must start with a valid scheme. */ - if (!strncasecmp(tlsscheme, curr, strlen(tlsscheme)) || - !strncasecmp(redisTlsscheme, curr, strlen(redisTlsscheme))) { + if (!strncasecmp(tlsscheme, curr, strlen(tlsscheme)) + || !strncasecmp(redisTlsscheme, curr, strlen(redisTlsscheme))) { #ifdef USE_OPENSSL *tls_flag = 1; const char *del = strstr(curr, "://"); @@ -408,17 +408,18 @@ sds cliVersion(void) { } /* This is a wrapper to call valkeyConnect or valkeyConnectWithTimeout. */ -valkeyContext *valkeyConnectWrapper(enum valkeyConnectionType ct, const char *ip_or_path, int port, const struct timeval tv, int nonblock, int multipath) { +valkeyContext *valkeyConnectWrapper(enum valkeyConnectionType ct, + const char *ip_or_path, + int port, + const struct timeval tv, + int nonblock, + int multipath) { valkeyOptions options = {0}; switch (ct) { - case VALKEY_CONN_TCP: - VALKEY_OPTIONS_SET_TCP(&options, ip_or_path, port); - break; + case VALKEY_CONN_TCP: VALKEY_OPTIONS_SET_TCP(&options, ip_or_path, port); break; - case VALKEY_CONN_UNIX: - VALKEY_OPTIONS_SET_UNIX(&options, ip_or_path); - break; + case VALKEY_CONN_UNIX: VALKEY_OPTIONS_SET_UNIX(&options, ip_or_path); break; case VALKEY_CONN_RDMA: #ifdef USE_RDMA @@ -428,8 +429,7 @@ valkeyContext *valkeyConnectWrapper(enum valkeyConnectionType ct, const char *ip assert(0); /* requesting RDMA connection without RDMA support??? */ #endif - default: - assert(0); /* this should not happen */ + default: assert(0); /* this should not happen */ } if (tv.tv_sec || tv.tv_usec) { diff --git a/src/cli_common.h b/src/cli_common.h index 19628651b00..7539ff2d10d 100644 --- a/src/cli_common.h +++ b/src/cli_common.h @@ -51,6 +51,11 @@ void freeCliConnInfo(cliConnInfo connInfo); sds cliVersion(void); -valkeyContext *valkeyConnectWrapper(enum valkeyConnectionType ct, const char *ip_or_path, int port, const struct timeval tv, int nonblock, int multipath); +valkeyContext *valkeyConnectWrapper(enum valkeyConnectionType ct, + const char *ip_or_path, + int port, + const struct timeval tv, + int nonblock, + int multipath); #endif /* __CLICOMMON_H */ diff --git a/src/cluster.c b/src/cluster.c index ed2e51a92c0..2ecac36864e 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -473,8 +473,9 @@ void migrateCommand(client *c) { redactClientCommandArgument(c, j); } else if (!strcasecmp(objectGetVal(c->argv[j]), "keys")) { if (sdslen(objectGetVal(c->argv[3])) != 0) { - addReplyError(c, "When using MIGRATE KEYS option, the key argument" - " must be set to the empty string"); + addReplyError(c, + "When using MIGRATE KEYS option, the key argument" + " must be set to the empty string"); return; } first_key = j + 1; @@ -487,8 +488,8 @@ void migrateCommand(client *c) { } /* Sanity check */ - if (getLongFromObjectOrReply(c, c->argv[5], &timeout, NULL) != C_OK || - getLongFromObjectOrReply(c, c->argv[4], &dbid, NULL) != C_OK) { + if (getLongFromObjectOrReply(c, c->argv[5], &timeout, NULL) != C_OK + || getLongFromObjectOrReply(c, c->argv[4], &dbid, NULL) != C_OK) { return; } if (timeout <= 0) timeout = 1000; @@ -756,8 +757,10 @@ void migrateCommand(client *c) { /* Cleanup we want to do if no retry is attempted. */ zfree(ov); zfree(kv); - addReplyErrorSds(c, sdscatprintf(sdsempty(), "-IOERR error or timeout %s to target instance", - write_error ? "writing" : "reading")); + addReplyErrorSds(c, + sdscatprintf(sdsempty(), + "-IOERR error or timeout %s to target instance", + write_error ? "writing" : "reading")); return; } @@ -945,7 +948,8 @@ void clusterCommand(client *c) { addReplyBulkCBuffer(c, sdskey, sdslen(sdskey)); } kvstoreReleaseHashtableIterator(kvs_di); - } else if ((!strcasecmp(objectGetVal(c->argv[1]), "slaves") || !strcasecmp(objectGetVal(c->argv[1]), "replicas")) && c->argc == 3) { + } else if ((!strcasecmp(objectGetVal(c->argv[1]), "slaves") || !strcasecmp(objectGetVal(c->argv[1]), "replicas")) + && c->argc == 3) { /* CLUSTER REPLICAS */ clusterNode *n = clusterLookupNode(objectGetVal(c->argv[2]), sdslen(objectGetVal(c->argv[2]))); int j; @@ -1116,8 +1120,8 @@ clusterNode *getNodeByQuery(client *c, int *error_code) { uint64_t cmd_flags = getCommandFlags(c); /* Only valid for sharded pubsub as regular pubsub can operate on any node and bypasses this layer. */ - int pubsubshard_included = - (cmd_flags & CMD_PUBSUB) || (c->cmd->proc == execCommand && (c->mstate->cmd_flags & CMD_PUBSUB)); + int pubsubshard_included = (cmd_flags & CMD_PUBSUB) + || (c->cmd->proc == execCommand && (c->mstate->cmd_flags & CMD_PUBSUB)); /* If we're importing or migrating the slot, we need to do some more checks: * @@ -1201,8 +1205,7 @@ clusterNode *getNodeByQuery(client *c, int *error_code) { /* Block the COPY command if it's cross-DB to keep the code simple. * Allowing cross-DB COPY is possible, but it would require looking up the second key in the target DB. * The command should only be allowed if the key exists. We may revisit this decision in the future. */ - if (mcmd->proc == copyCommand && - margc >= 4 && !strcasecmp(objectGetVal(margv[3]), "db")) { + if (mcmd->proc == copyCommand && margc >= 4 && !strcasecmp(objectGetVal(margv[3]), "db")) { long long value; if (getLongLongFromObject(margv[4], &value) != C_OK || value != currentDb->id) { if (error_code) *error_code = CLUSTER_REDIR_UNSTABLE; @@ -1218,8 +1221,7 @@ clusterNode *getNodeByQuery(client *c, int *error_code) { * node until the migration completes with CLUSTER SETSLOT * NODE . */ int flags = LOOKUP_NOTOUCH | LOOKUP_NOSTATS | LOOKUP_NONOTIFY | LOOKUP_NOEXPIRE; - if (!pubsubshard_included && - (!c->flag.multi || (c->flag.multi && c->cmd->proc == execCommand))) { + if (!pubsubshard_included && (!c->flag.multi || (c->flag.multi && c->cmd->proc == execCommand))) { /* Multi/Exec validation happens on exec */ if (lookupKeyReadWithFlags(currentDb, thiskey, flags) == NULL) missing_keys++; @@ -1292,10 +1294,10 @@ clusterNode *getNodeByQuery(client *c, int *error_code) { /* Handle the read-only client case reading from a replica: if this * node is a replica and the request is about a hash slot our primary * is serving, we can reply without redirection. */ - int is_write_command = - (cmd_flags & CMD_WRITE) || (c->cmd->proc == execCommand && (c->mstate->cmd_flags & CMD_WRITE)); - if ((c->flag.readonly || pubsubshard_included) && !is_write_command && clusterNodeIsReplica(myself) && - clusterNodeGetPrimary(myself) == n) { + int is_write_command = (cmd_flags & CMD_WRITE) + || (c->cmd->proc == execCommand && (c->mstate->cmd_flags & CMD_WRITE)); + if ((c->flag.readonly || pubsubshard_included) && !is_write_command && clusterNodeIsReplica(myself) + && clusterNodeGetPrimary(myself) == n) { return myself; } @@ -1330,8 +1332,12 @@ void clusterRedirectClient(client *c, clusterNode *n, int hashslot, int error_co /* Report TLS ports to TLS client, and report non-TLS port to non-TLS client. */ int port = clusterNodeClientPort(n, shouldReturnTlsInfo(), c); addReplyErrorSds(c, - sdscatprintf(sdsempty(), "-%s %d %s:%d", (error_code == CLUSTER_REDIR_ASK) ? "ASK" : "MOVED", - hashslot, clusterNodePreferredEndpoint(n, c), port)); + sdscatprintf(sdsempty(), + "-%s %d %s:%d", + (error_code == CLUSTER_REDIR_ASK) ? "ASK" : "MOVED", + hashslot, + clusterNodePreferredEndpoint(n, c), + port)); } else { serverPanic("getNodeByQuery() unknown error."); } @@ -1350,8 +1356,9 @@ void clusterRedirectClient(client *c, clusterNode *n, int hashslot, int error_co * returns 1. Otherwise 0 is returned and no operation is performed. */ int clusterRedirectBlockedClientIfNeeded(client *c) { clusterNode *myself = getMyClusterNode(); - if (c->flag.blocked && (c->bstate->btype == BLOCKED_LIST || c->bstate->btype == BLOCKED_ZSET || - c->bstate->btype == BLOCKED_STREAM || c->bstate->btype == BLOCKED_MODULE)) { + if (c->flag.blocked + && (c->bstate->btype == BLOCKED_LIST || c->bstate->btype == BLOCKED_ZSET || c->bstate->btype == BLOCKED_STREAM + || c->bstate->btype == BLOCKED_MODULE)) { dictEntry *de; dictIterator *di; @@ -1378,8 +1385,8 @@ int clusterRedirectBlockedClientIfNeeded(client *c) { /* if the client is read-only and attempting to access key that our * replica can handle, allow it. */ - if (c->flag.readonly && !(c->lastcmd->flags & CMD_WRITE) && clusterNodeIsReplica(myself) && - clusterNodeGetPrimary(myself) == node) { + if (c->flag.readonly && !(c->lastcmd->flags & CMD_WRITE) && clusterNodeIsReplica(myself) + && clusterNodeGetPrimary(myself) == node) { node = myself; } @@ -1430,8 +1437,8 @@ void addNodeToNodeReply(client *c, clusterNode *node) { if (server.cluster_preferred_endpoint_type != CLUSTER_ENDPOINT_TYPE_IP) { length++; } - if (server.cluster_preferred_endpoint_type != CLUSTER_ENDPOINT_TYPE_HOSTNAME && hostname != NULL && - hostname[0] != '\0') { + if (server.cluster_preferred_endpoint_type != CLUSTER_ENDPOINT_TYPE_HOSTNAME && hostname != NULL + && hostname[0] != '\0') { length++; } @@ -1446,8 +1453,8 @@ void addNodeToNodeReply(client *c, clusterNode *node) { addReplyBulkCString(c, clusterNodeIp(node, c)); length--; } - if (server.cluster_preferred_endpoint_type != CLUSTER_ENDPOINT_TYPE_HOSTNAME && hostname != NULL && - hostname[0] != '\0') { + if (server.cluster_preferred_endpoint_type != CLUSTER_ENDPOINT_TYPE_HOSTNAME && hostname != NULL + && hostname[0] != '\0') { addReplyBulkCString(c, "hostname"); addReplyBulkCString(c, hostname); length--; diff --git a/src/cluster.h b/src/cluster.h index 92a254cbb8f..2b6939beec8 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -6,11 +6,12 @@ * Cluster exported API. *----------------------------------------------------------------------------*/ -#define CLUSTER_SLOT_MASK_BITS 14 /* Number of bits used for slot id. */ +#define CLUSTER_SLOT_MASK_BITS 14 /* Number of bits used for slot id. */ +#define CLUSTER_OK 0 /* Everything looks ok */ +#define CLUSTER_FAIL 1 /* The cluster can't work */ +#define CLUSTER_NAMELEN 40 /* sha1 hex length */ + #define CLUSTER_SLOTS (1 << CLUSTER_SLOT_MASK_BITS) /* Total number of slots in cluster mode, which is 16384. */ -#define CLUSTER_OK 0 /* Everything looks ok */ -#define CLUSTER_FAIL 1 /* The cluster can't work */ -#define CLUSTER_NAMELEN 40 /* sha1 hex length */ /* Reason why the cluster state changes to fail. When adding new reasons, * make sure to update clusterLogFailReason. */ diff --git a/src/cluster_legacy.c b/src/cluster_legacy.c index cd88cdf895d..c0924b8b1c4 100644 --- a/src/cluster_legacy.c +++ b/src/cluster_legacy.c @@ -73,7 +73,11 @@ int clusterNodeAddReplica(clusterNode *primary, clusterNode *replica); int clusterAddSlot(clusterNode *n, int slot); int clusterDelSlot(int slot); int clusterDelNodeSlots(clusterNode *node); -void clusterMoveNodeSlots(clusterNode *from_node, clusterNode *to_node, int *slots, int *importing_slots, int *migrating_slots); +void clusterMoveNodeSlots(clusterNode *from_node, + clusterNode *to_node, + int *slots, + int *importing_slots, + int *migrating_slots); void clusterNodeSetSlotBit(clusterNode *n, int slot); static void clusterSetPrimary(clusterNode *n, int closeSlots, int full_sync_required); void clusterHandleReplicaFailover(void); @@ -161,11 +165,9 @@ int clusterNodeIsVotingPrimary(clusterNode *n) { /* Returns if myself is the best ranked replica in an automatic failover process. * To avoid newly added empty replica from affecting the ranking, we will skip it. */ static inline int myselfIsBestRankedReplica(void) { - return (server.cluster->mf_end == 0 && - getNodeReplicationOffset(myself) != 0 && - server.cluster->failover_auth_rank == 0 && - server.cluster->failover_failed_primary_rank == 0 && - clusterAllReplicasThinkPrimaryIsFail()); + return (server.cluster->mf_end == 0 && getNodeReplicationOffset(myself) != 0 + && server.cluster->failover_auth_rank == 0 && server.cluster->failover_failed_primary_rank == 0 + && clusterAllReplicasThinkPrimaryIsFail()); } int getNodeDefaultClientPort(clusterNode *n) { @@ -213,7 +215,9 @@ char *humanNodename(clusterNode *node) { /* Avoid allocating heap memory so that users can call the function with ease. * Use a small ring of thread-local buffers here so that multiple function calls * in the same logging statement are safe. */ - enum { BUF_COUNT = 8 }; + enum { + BUF_COUNT = 8 + }; static _Thread_local char buffers[BUF_COUNT][CONN_ADDR_STR_LEN]; static _Thread_local int idx; @@ -441,8 +445,14 @@ auxFieldHandler auxFieldHandlers[] = { {"tls-port", auxTlsPortSetter, auxTlsPortGetter, auxTlsPortPresent}, {"client-ipv4", auxAnnounceClientIpV4Setter, auxAnnounceClientIpV4Getter, auxAnnounceClientIpV4Present}, {"client-ipv6", auxAnnounceClientIpV6Setter, auxAnnounceClientIpV6Getter, auxAnnounceClientIpV6Present}, - {"client-tcp-port", auxAnnounceClientTcpPortSetter, auxAnnounceClientTcpPortGetter, auxAnnounceClientTcpPortPresent}, - {"client-tls-port", auxAnnounceClientTlsPortSetter, auxAnnounceClientTlsPortGetter, auxAnnounceClientTlsPortPresent}, + {"client-tcp-port", + auxAnnounceClientTcpPortSetter, + auxAnnounceClientTcpPortGetter, + auxAnnounceClientTcpPortPresent}, + {"client-tls-port", + auxAnnounceClientTlsPortSetter, + auxAnnounceClientTlsPortGetter, + auxAnnounceClientTlsPortPresent}, {"availability-zone", auxAvailabilityZoneSetter, auxAvailabilityZoneGetter, auxAvailabilityZonePresent}, }; @@ -458,7 +468,10 @@ int auxShardIdSetter(clusterNode *n, void *value, size_t length) { serverLog(LL_NOTICE, "Node %.40s has a different shard id (%.40s) than its primary's shard id %.40s (%.40s). " "Updating replica's shard id to match primary's shard id.", - n->replicas[i]->name, n->replicas[i]->shard_id, n->name, n->shard_id); + n->replicas[i]->name, + n->replicas[i]->shard_id, + n->name, + n->shard_id); clusterRemoveNodeFromShard(n->replicas[i]); memcpy(n->replicas[i]->shard_id, n->shard_id, CLUSTER_NAMELEN); clusterAddNodeToShard(n->shard_id, n->replicas[i]); @@ -813,8 +826,8 @@ int clusterLoadConfig(char *filename) { * future so a linear search is completely fine. */ int field_found = 0; for (unsigned j = 0; j < numElements(auxFieldHandlers); j++) { - if (sdslen(field_argv[0]) != strlen(auxFieldHandlers[j].field) || - memcmp(field_argv[0], auxFieldHandlers[j].field, sdslen(field_argv[0])) != 0) { + if (sdslen(field_argv[0]) != strlen(auxFieldHandlers[j].field) + || memcmp(field_argv[0], auxFieldHandlers[j].field, sdslen(field_argv[0])) != 0) { continue; } field_found = 1; @@ -927,15 +940,18 @@ int clusterLoadConfig(char *filename) { if (auxFieldHandlers[af_shard_id].isPresent(n) == 0) { memcpy(n->shard_id, primary->shard_id, CLUSTER_NAMELEN); clusterAddNodeToShard(primary->shard_id, n); - } else if (clusterGetNodesInMyShard(primary) != NULL && - memcmp(primary->shard_id, n->shard_id, CLUSTER_NAMELEN) != 0) { + } else if (clusterGetNodesInMyShard(primary) != NULL + && memcmp(primary->shard_id, n->shard_id, CLUSTER_NAMELEN) != 0) { /* If the primary has been added to a shard and this replica has * a different shard id stored in nodes.conf, update it to match * the primary instead of aborting the startup. */ serverLog(LL_NOTICE, "Node %.40s has a different shard id (%.40s) than its primary %.40s (%.40s). " "Updating replica's shard id to match primary's shard id.", - n->name, n->shard_id, primary->name, primary->shard_id); + n->name, + n->shard_id, + primary->name, + primary->shard_id); clusterRemoveNodeFromShard(n); memcpy(n->shard_id, primary->shard_id, CLUSTER_NAMELEN); clusterAddNodeToShard(primary->shard_id, n); @@ -1060,7 +1076,8 @@ int clusterSaveConfig(int do_fsync) { /* Get the nodes description and concatenate our "vars" directive to * save currentEpoch and lastVoteEpoch. */ ci = clusterGenNodesDescription(NULL, CLUSTER_NODE_HANDSHAKE, 0); - ci = sdscatfmt(ci, "vars currentEpoch %U lastVoteEpoch %U\n", + ci = sdscatfmt(ci, + "vars currentEpoch %U lastVoteEpoch %U\n", (unsigned long long)server.cluster->currentEpoch, (unsigned long long)server.cluster->lastVoteEpoch); content_size = sdslen(ci); @@ -1080,7 +1097,9 @@ int clusterSaveConfig(int do_fsync) { written_bytes = write(fd, ci + offset, content_size - offset); if (written_bytes <= 0) { if (errno == EINTR) continue; - serverLog(LL_WARNING, "Failed after writing (%zd) bytes to tmp cluster config file: %s", offset, + serverLog(LL_WARNING, + "Failed after writing (%zd) bytes to tmp cluster config file: %s", + offset, strerror(errno)); goto cleanup; } @@ -1156,8 +1175,9 @@ void clusterSaveConfigOrLog(int do_fsync) { static time_t last_save_error_log = 0; /* Limit logging rate to 1 line per CONFIG_SAVE_LOG_ERROR_RATE seconds. */ if ((server.unixtime - last_save_error_log) > CONFIG_SAVE_LOG_ERROR_RATE) { - serverLog(LL_WARNING, "Cluster config updated even though writing " - "the cluster config file to disk failed."); + serverLog(LL_WARNING, + "Cluster config updated even though writing " + "the cluster config file to disk failed."); last_save_error_log = server.unixtime; } } @@ -1250,10 +1270,8 @@ void clusterUpdateMyselfFlags(void) { int nofailover = server.cluster_replica_no_failover ? CLUSTER_NODE_NOFAILOVER : 0; myself->flags &= ~CLUSTER_NODE_NOFAILOVER; myself->flags |= nofailover; - myself->flags |= CLUSTER_NODE_EXTENSIONS_SUPPORTED | - CLUSTER_NODE_LIGHT_HDR_PUBLISH_SUPPORTED | - CLUSTER_NODE_LIGHT_HDR_MODULE_SUPPORTED | - CLUSTER_NODE_MULTI_MEET_SUPPORTED; + myself->flags |= CLUSTER_NODE_EXTENSIONS_SUPPORTED | CLUSTER_NODE_LIGHT_HDR_PUBLISH_SUPPORTED + | CLUSTER_NODE_LIGHT_HDR_MODULE_SUPPORTED | CLUSTER_NODE_MULTI_MEET_SUPPORTED; if (myself->flags != oldflags) { clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE); } @@ -1265,8 +1283,11 @@ void clusterUpdateMyselfFlags(void) { * The option can be set at runtime via CONFIG SET. */ void clusterUpdateMyselfAnnouncedPorts(void) { if (!myself) return; - deriveAnnouncedPorts(&myself->tcp_port, &myself->tls_port, &myself->cport, - &myself->announce_client_tcp_port, &myself->announce_client_tls_port); + deriveAnnouncedPorts(&myself->tcp_port, + &myself->tls_port, + &myself->cport, + &myself->announce_client_tcp_port, + &myself->announce_client_tls_port); clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG); } @@ -1369,12 +1390,14 @@ static void updateShardId(clusterNode *node, const char *shard_id) { * persisted in the primary's nodes.conf file. While this divergence will * eventually resolve, if the primary crashes beforehand, it will enter a * crash-restart loop due to the mismatch in its nodes.conf. */ - if (shard_id && nodeIsReplica(node) && - memcmp(clusterNodeGetPrimary(node)->shard_id, shard_id, CLUSTER_NAMELEN) != 0) { - serverLog( - LL_NOTICE, - "Shard id %.40s update request for node id %.40s diverges from existing primary shard id %.40s, rejecting!", - shard_id, node->name, clusterNodeGetPrimary(node)->shard_id); + if (shard_id && nodeIsReplica(node) + && memcmp(clusterNodeGetPrimary(node)->shard_id, shard_id, CLUSTER_NAMELEN) != 0) { + serverLog(LL_NOTICE, + "Shard id %.40s update request for node id %.40s diverges from existing primary shard id %.40s, " + "rejecting!", + shard_id, + node->name, + clusterNodeGetPrimary(node)->shard_id); return; } @@ -1495,7 +1518,9 @@ void clusterInit(void) { "Cluster communication port is 10,000 port " "numbers higher than your %s port. " "Your %s port number must be 55535 or less.", - SERVER_TITLE, SERVER_TITLE, SERVER_TITLE); + SERVER_TITLE, + SERVER_TITLE, + SERVER_TITLE); exit(1); } if (!server.bindaddr_count) { @@ -1504,16 +1529,21 @@ void clusterInit(void) { } /* Register our own rdb aux fields */ - serverAssert(rdbRegisterAuxField("cluster-slot-states", clusterEncodeOpenSlotsAuxField, - clusterDecodeOpenSlotsAuxField) == C_OK); + serverAssert(rdbRegisterAuxField("cluster-slot-states", + clusterEncodeOpenSlotsAuxField, + clusterDecodeOpenSlotsAuxField) + == C_OK); /* Initialize list for slot migration jobs. */ initClusterSlotMigrationJobList(); /* Set myself->port/cport/pport to my listening ports, we'll just need to * discover the IP address via MEET messages. */ - deriveAnnouncedPorts(&myself->tcp_port, &myself->tls_port, &myself->cport, - &myself->announce_client_tcp_port, &myself->announce_client_tls_port); + deriveAnnouncedPorts(&myself->tcp_port, + &myself->tls_port, + &myself->cport, + &myself->announce_client_tcp_port, + &myself->announce_client_tls_port); server.cluster->mf_end = 0; server.cluster->mf_replica = NULL; @@ -1533,7 +1563,8 @@ void clusterInit(void) { void clusterInitLast(void) { if (!connectionByType(connTypeOfCluster()->get_type())) { - serverLog(LL_WARNING, "Missing connection type %s, but it is required for the Cluster bus.", + serverLog(LL_WARNING, + "Missing connection type %s, but it is required for the Cluster bus.", getConnectionTypeName(connTypeOfCluster()->get_type())); exit(1); } @@ -1574,9 +1605,9 @@ void clusterAutoFailoverOnShutdown(void) { best_replica = NULL; break; } - if (replica->repl_data->repl_state == REPLICA_STATE_ONLINE && - replica->repl_data->repl_ack_off == server.primary_repl_offset && - replica->repl_data->replica_nodeid && sdslen(replica->repl_data->replica_nodeid) == CLUSTER_NAMELEN) { + if (replica->repl_data->repl_state == REPLICA_STATE_ONLINE + && replica->repl_data->repl_ack_off == server.primary_repl_offset && replica->repl_data->replica_nodeid + && sdslen(replica->repl_data->replica_nodeid) == CLUSTER_NAMELEN) { best_replica = replica; } } @@ -1596,7 +1627,8 @@ void clusterAutoFailoverOnShutdown(void) { * node-id will execute it. The caller will call flushReplicasOutputBuffers, * so in here it is a best effort. */ char buf[128]; - size_t buflen = snprintf(buf, sizeof(buf), + size_t buflen = snprintf(buf, + sizeof(buf), "*5\r\n$7\r\nCLUSTER\r\n" "$8\r\nFAILOVER\r\n" "$5\r\nFORCE\r\n" @@ -1778,7 +1810,8 @@ clusterLink *createClusterLink(clusterNode *node) { * with this link will have the 'link' field set to NULL. */ void freeClusterLink(clusterLink *link) { serverAssert(link != NULL); - serverLog(LL_DEBUG, "Freeing cluster link for node: %.40s:%s (%s)", + serverLog(LL_DEBUG, + "Freeing cluster link for node: %.40s:%s (%s)", clusterLinkGetNodeName(link), link->inbound ? "inbound" : "outbound", clusterLinkGetHumanNodeName(link)); @@ -1815,8 +1848,11 @@ void setClusterNodeToInboundClusterLink(clusterNode *node, clusterLink *link) { * a one to one relationship between nodes and inbound links, so we need to kill * one of the links. The existing link is more likely the outdated one, but it's * possible the other node may need to open another link. */ - serverLog(LL_DEBUG, "Replacing inbound link fd %d from node %.40s with fd %d", node->inbound_link->conn->fd, - node->name, link->conn->fd); + serverLog(LL_DEBUG, + "Replacing inbound link fd %d from node %.40s with fd %d", + node->inbound_link->conn->fd, + node->name, + link->conn->fd); freeClusterLink(node->inbound_link); } serverAssert(!node->inbound_link); @@ -1826,11 +1862,17 @@ void setClusterNodeToInboundClusterLink(clusterNode *node, clusterLink *link) { char ip[NET_IP_STR_LEN]; int port; if (connAddrPeerName(link->conn, ip, sizeof(ip), &port) != -1) { - serverLog(LL_VERBOSE, "Bound cluster node %.40s (%s) to connection of client %s:%d", - node->name, humanNodename(node), ip, port); + serverLog(LL_VERBOSE, + "Bound cluster node %.40s (%s) to connection of client %s:%d", + node->name, + humanNodename(node), + ip, + port); } else { - serverLog(LL_VERBOSE, "Error resolving the inbound connection address of node %.40s (%s)", - node->name, humanNodename(node)); + serverLog(LL_VERBOSE, + "Error resolving the inbound connection address of node %.40s (%s)", + node->name, + humanNodename(node)); } } } @@ -1882,7 +1924,8 @@ void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) { /* Make sure connection is not in an error state */ if (connGetState(conn) != CONN_STATE_ACCEPTING) { - serverLog(LL_VERBOSE, "Error creating an accepting connection for cluster node: %s", + serverLog(LL_VERBOSE, + "Error creating an accepting connection for cluster node: %s", connGetLastError(conn)); connClose(conn); return; @@ -2037,8 +2080,7 @@ int clusterNodeAddFailureReport(clusterNode *failing, clusterNode *sender) { return 0; } - raxRemove(failing->fail_reports, - ri.key, ri.key_len, NULL); + raxRemove(failing->fail_reports, ri.key, ri.key_len, NULL); is_new = 0; break; } @@ -2047,8 +2089,7 @@ int clusterNodeAddFailureReport(clusterNode *failing, clusterNode *sender) { /* Encode new key (now + sender) and store the fresh timestamp */ encodeFailureReportKey(sender, now, buf); - raxInsert(failing->fail_reports, - buf, sizeof(buf), NULL, NULL); + raxInsert(failing->fail_reports, buf, sizeof(buf), NULL, NULL); return is_new; } @@ -2110,8 +2151,7 @@ int clusterNodeDelFailureReport(clusterNode *node, clusterNode *sender) { clusterNode *reported_node; decodeFailureReportKey(ri.key, &reported_time, &reported_node); if (reported_node == sender) { - raxRemove(node->fail_reports, - ri.key, ri.key_len, NULL); + raxRemove(node->fail_reports, ri.key, ri.key_len, NULL); raxStop(&ri); return 1; } @@ -2139,7 +2179,8 @@ int clusterNodeRemoveReplica(clusterNode *primary, clusterNode *replica) { if (primary->replicas[j] == replica) { if ((j + 1) < primary->num_replicas) { int remaining_replicas = (primary->num_replicas - j) - 1; - memmove(primary->replicas + j, primary->replicas + (j + 1), + memmove(primary->replicas + j, + primary->replicas + (j + 1), (sizeof(*primary->replicas) * remaining_replicas)); } primary->num_replicas--; @@ -2448,8 +2489,11 @@ void clusterHandleConfigEpochCollision(clusterNode *sender) { server.cluster->currentEpoch++; myself->configEpoch = server.cluster->currentEpoch; clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_FSYNC_CONFIG | CLUSTER_TODO_BROADCAST_ALL); - serverLog(LL_NOTICE, "configEpoch collision with node %.40s (%s). configEpoch set to %llu", sender->name, - humanNodename(sender), (unsigned long long)myself->configEpoch); + serverLog(LL_NOTICE, + "configEpoch collision with node %.40s (%s). configEpoch set to %llu", + sender->name, + humanNodename(sender), + (unsigned long long)myself->configEpoch); } /* ----------------------------------------------------------------------------- @@ -2607,8 +2651,11 @@ void clearNodeFailureIfNeeded(clusterNode *node) { /* For replicas or primaries without slots, that is, nodes without voting * right, we always clear the FAIL flag if we can contact the node again. */ if (!clusterNodeIsVotingPrimary(node)) { - serverLog(LL_NOTICE, "Clear FAIL state for node %.40s (%s): %s is reachable again.", node->name, - humanNodename(node), nodeIsReplica(node) ? "replica" : "primary without slots"); + serverLog(LL_NOTICE, + "Clear FAIL state for node %.40s (%s): %s is reachable again.", + node->name, + humanNodename(node), + nodeIsReplica(node) ? "replica" : "primary without slots"); node->flags &= ~CLUSTER_NODE_FAIL; if (nodeIsReplica(myself) && myself->replicaof == node) node->flags &= ~CLUSTER_NODE_MY_PRIMARY_FAIL; clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_SAVE_CONFIG); @@ -2618,12 +2665,13 @@ void clearNodeFailureIfNeeded(clusterNode *node) { * 1) The FAIL state is old enough. * 2) It is yet serving slots from our point of view (not failed over). * Apparently no one is going to fix these slots, clear the FAIL flag. */ - if (clusterNodeIsVotingPrimary(node) && - (now - node->fail_time) > (server.cluster_node_timeout * CLUSTER_FAIL_UNDO_TIME_MULT)) { - serverLog( - LL_NOTICE, - "Clear FAIL state for node %.40s (%s): is reachable again and nobody is serving its slots after some time.", - node->name, humanNodename(node)); + if (clusterNodeIsVotingPrimary(node) + && (now - node->fail_time) > (server.cluster_node_timeout * CLUSTER_FAIL_UNDO_TIME_MULT)) { + serverLog(LL_NOTICE, + "Clear FAIL state for node %.40s (%s): is reachable again and nobody is serving its slots after some " + "time.", + node->name, + humanNodename(node)); node->flags &= ~CLUSTER_NODE_FAIL; if (nodeIsReplica(myself) && myself->replicaof == node) node->flags &= ~CLUSTER_NODE_MY_PRIMARY_FAIL; clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_SAVE_CONFIG); @@ -2746,7 +2794,8 @@ int verifyGossipSectionNodeIds(clusterMsgDataGossip *g, uint16_t count) { serverLog(LL_WARNING, "Received gossip about a node with invalid ID %.40s. For debugging purposes, " "the 48 bytes including the invalid ID and 8 trailing bytes are: %s", - nodename, raw_node_id); + nodename, + raw_node_id); zfree(raw_node_id); } } @@ -2767,8 +2816,11 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) { int invalid_ids = verifyGossipSectionNodeIds(g, count); if (invalid_ids) { if (sender) { - serverLog(LL_WARNING, "Node %.40s (%s) gossiped %d nodes with invalid IDs.", sender->name, - humanNodename(sender), invalid_ids); + serverLog(LL_WARNING, + "Node %.40s (%s) gossiped %d nodes with invalid IDs.", + sender->name, + humanNodename(sender), + invalid_ids); } else { serverLog(LL_WARNING, "Unknown node gossiped %d nodes with invalid IDs.", invalid_ids); } @@ -2800,14 +2852,22 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) { if (sender) { if (flags & (CLUSTER_NODE_FAIL | CLUSTER_NODE_PFAIL)) { if (clusterNodeIsVotingPrimary(sender) && clusterNodeAddFailureReport(node, sender)) { - serverLog(LL_VERBOSE, "Node %.40s (%s) reported node %.40s (%s) as not reachable.", sender->name, - humanNodename(sender), node->name, humanNodename(node)); + serverLog(LL_VERBOSE, + "Node %.40s (%s) reported node %.40s (%s) as not reachable.", + sender->name, + humanNodename(sender), + node->name, + humanNodename(node)); } markNodeAsFailingIfNeeded(node); } else { if (clusterNodeDelFailureReport(node, sender)) { - serverLog(LL_VERBOSE, "Node %.40s (%s) reported node %.40s (%s) is back online.", sender->name, - humanNodename(sender), node->name, humanNodename(node)); + serverLog(LL_VERBOSE, + "Node %.40s (%s) reported node %.40s (%s) is back online.", + sender->name, + humanNodename(sender), + node->name, + humanNodename(node)); } } } @@ -2816,10 +2876,8 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) { * we have no pending ping for the node, nor we have failure * reports for this node, update the last pong time with the * one we see from the other nodes. */ - if (!(flags & (CLUSTER_NODE_FAIL | CLUSTER_NODE_PFAIL)) && - nodeInNormalState(node) && - node->ping_sent == 0 && - clusterNodeFailureReportsCount(node) == 0) { + if (!(flags & (CLUSTER_NODE_FAIL | CLUSTER_NODE_PFAIL)) && nodeInNormalState(node) && node->ping_sent == 0 + && clusterNodeFailureReportsCount(node) == 0) { mstime_t pongtime = ntohl(g->pong_received); pongtime *= 1000; /* Convert back to milliseconds. */ @@ -2837,10 +2895,10 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) { * can talk with this other node, update the address, disconnect * the old link if any, so that we'll attempt to connect with the * new address. */ - if (node->flags & (CLUSTER_NODE_FAIL | CLUSTER_NODE_PFAIL) && !(flags & CLUSTER_NODE_NOADDR) && - !(flags & (CLUSTER_NODE_FAIL | CLUSTER_NODE_PFAIL)) && - (strcasecmp(node->ip, g->ip) || node->tls_port != msg_tls_port || - node->tcp_port != msg_tcp_port || node->cport != ntohs(g->cport))) { + if (node->flags & (CLUSTER_NODE_FAIL | CLUSTER_NODE_PFAIL) && !(flags & CLUSTER_NODE_NOADDR) + && !(flags & (CLUSTER_NODE_FAIL | CLUSTER_NODE_PFAIL)) + && (strcasecmp(node->ip, g->ip) || node->tls_port != msg_tls_port || node->tcp_port != msg_tcp_port + || node->cport != ntohs(g->cport))) { if (node->link) freeClusterLink(node->link); memcpy(node->ip, g->ip, NET_IP_STR_LEN); node->tcp_port = msg_tcp_port; @@ -2848,8 +2906,12 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) { node->cport = ntohs(g->cport); node->flags &= ~CLUSTER_NODE_NOADDR; - serverLog(LL_NOTICE, "Address updated for node %.40s (%s), now %s:%d", node->name, humanNodename(node), - node->ip, getNodeDefaultClientPort(node)); + serverLog(LL_NOTICE, + "Address updated for node %.40s (%s), now %s:%d", + node->name, + humanNodename(node), + node->ip, + getNodeDefaultClientPort(node)); /* Check if this is our primary and we have to change the * replication target as well. @@ -2902,7 +2964,8 @@ int nodeIp2String(char *buf, clusterLink *link, char *announced_ip) { return C_OK; } else { if (connAddrPeerName(link->conn, buf, NET_IP_STR_LEN, NULL) == -1) { - serverLog(LL_NOTICE, "Error converting peer IP to string: %s", + serverLog(LL_NOTICE, + "Error converting peer IP to string: %s", link->conn ? connGetLastError(link->conn) : "no link"); return C_ERR; } @@ -2951,7 +3014,11 @@ int nodeUpdateAddressIfNeeded(clusterNode *node, clusterLink *link, clusterMsg * node->cport = cport; if (node->link) freeClusterLink(node->link); node->flags &= ~CLUSTER_NODE_NOADDR; - serverLog(LL_NOTICE, "Address updated for node %.40s (%s), now %s:%d", node->name, humanNodename(node), node->ip, + serverLog(LL_NOTICE, + "Address updated for node %.40s (%s), now %s:%d", + node->name, + humanNodename(node), + node->ip, getNodeDefaultClientPort(node)); /* Check if this is our primary and we have to change the @@ -2967,7 +3034,11 @@ int nodeUpdateAddressIfNeeded(clusterNode *node, clusterLink *link, clusterMsg * void clusterSetNodeAsPrimary(clusterNode *n) { if (clusterNodeIsPrimary(n)) return; - serverLog(LL_NOTICE, "Reconfiguring node %.40s (%s) as primary for shard %.40s", n->name, humanNodename(n), n->shard_id); + serverLog(LL_NOTICE, + "Reconfiguring node %.40s (%s) as primary for shard %.40s", + n->name, + humanNodename(n), + n->shard_id); if (n->replicaof) { clusterNodeRemoveReplica(n->replicaof, n); @@ -2992,9 +3063,14 @@ static void clusterLogSlotRangeMigration(int first_slot, serverLog(LL_NOTICE, "Slot range [%d, %d] is migrated from node %.40s (%s) in shard %.40s" " to node %.40s (%s) in shard %.40s.", - first_slot, last_slot, - source_node->name, humanNodename(source_node), source_node->shard_id, - target_node->name, humanNodename(target_node), target_node->shard_id); + first_slot, + last_slot, + source_node->name, + humanNodename(source_node), + source_node->shard_id, + target_node->name, + humanNodename(target_node), + target_node->shard_id); } /* This function is called when we receive a primary configuration via a @@ -3067,9 +3143,8 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc * from being accepted. To counter this, if our node is aware of the * migration, we will accept the topology update regardless of the * epoch. */ - if (isSlotUnclaimed(j) || - server.cluster->slots[j]->configEpoch < senderConfigEpoch || - clusterSlotFailoverGranted(j)) { + if (isSlotUnclaimed(j) || server.cluster->slots[j]->configEpoch < senderConfigEpoch + || clusterSlotFailoverGranted(j)) { if (!isSlotUnclaimed(j) && !areInSameShard(server.cluster->slots[j], sender)) { if (first_migrated_slot == -1) { /* Delay-initialize the range of migrated slots. */ @@ -3082,8 +3157,10 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc } else { /* We have a gap in the range of migrated slots. * Log the previous range and start a new one. */ - clusterLogSlotRangeMigration(first_migrated_slot, last_migrated_slot, - migration_source_node, sender); + clusterLogSlotRangeMigration(first_migrated_slot, + last_migrated_slot, + migration_source_node, + sender); /* Reset the range for the next slot. */ first_migrated_slot = j; last_migrated_slot = j; @@ -3116,30 +3193,40 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc clusterNode *mn = getMigratingSlotDest(j); if (mn != NULL) { if (!are_in_same_shard) { - serverLog(LL_NOTICE, "Slot %d is no longer being migrated to node %.40s (%s) in shard %.40s.", - j, mn->name, humanNodename(mn), mn->shard_id); + serverLog(LL_NOTICE, + "Slot %d is no longer being migrated to node %.40s (%s) in shard %.40s.", + j, + mn->name, + humanNodename(mn), + mn->shard_id); setMigratingSlotDest(j, NULL); } } /* Handle the case where we are importing this slot and the ownership changes */ clusterNode *in = getImportingSlotSource(j); - if (in != NULL && - in != sender) { + if (in != NULL && in != sender) { /* Update importing_slots_from to point to the sender, if it is in the * same shard as the previous slot owner */ if (areInSameShard(sender, in)) { serverLog(LL_VERBOSE, "Failover occurred in migration source. Update importing " "source for slot %d to node %.40s (%s) in shard %.40s.", - j, sender->name, humanNodename(sender), sender->shard_id); + j, + sender->name, + humanNodename(sender), + sender->shard_id); setImportingSlotSource(j, sender); } else { /* If the sender is from a different shard, it must be a result * of deliberate operator actions. We should clear the importing * state to conform to the operator's will. */ - serverLog(LL_NOTICE, "Slot %d is no longer being imported from node %.40s (%s) in shard %.40s.", - j, in->name, humanNodename(in), in->shard_id); + serverLog(LL_NOTICE, + "Slot %d is no longer being imported from node %.40s (%s) in shard %.40s.", + j, + in->name, + humanNodename(in), + in->shard_id); setImportingSlotSource(j, NULL); } } @@ -3166,14 +3253,15 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc * the shard. Update the migrating_slots_to state to point to the * sender if it has just taken over the primary role. */ clusterNode *mn = getMigratingSlotDest(j); - if (mn != NULL && mn != sender && - (mn->configEpoch < senderConfigEpoch || - nodeIsReplica(mn)) && - areInSameShard(mn, sender)) { + if (mn != NULL && mn != sender && (mn->configEpoch < senderConfigEpoch || nodeIsReplica(mn)) + && areInSameShard(mn, sender)) { serverLog(LL_VERBOSE, "Failover occurred in migration target." " Slot %d is now being migrated to node %.40s (%s) in shard %.40s.", - j, sender->name, humanNodename(sender), sender->shard_id); + j, + sender->name, + humanNodename(sender), + sender->shard_id); setMigratingSlotDest(j, sender); clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_FSYNC_CONFIG); } @@ -3198,7 +3286,10 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc serverLog(LL_NOTICE, "Slot %d is no longer being imported from node %.40s (%s) in shard %.40s;" " Clear my importing source for the slot.", - j, sender->name, humanNodename(sender), sender->shard_id); + j, + sender->name, + humanNodename(sender), + sender->shard_id); setImportingSlotSource(j, NULL); /* Take over the slot ownership if I am not the owner yet*/ if (server.cluster->slots[j] != myself) { @@ -3217,16 +3308,15 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc clusterDelSlot(j); clusterAddSlot(myself, j); clusterBumpConfigEpochWithoutConsensus(); - clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE | - CLUSTER_TODO_FSYNC_CONFIG); + clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE + | CLUSTER_TODO_FSYNC_CONFIG); } } } } if (first_migrated_slot != -1) { - clusterLogSlotRangeMigration(first_migrated_slot, last_migrated_slot, - migration_source_node, sender); + clusterLogSlotRangeMigration(first_migrated_slot, last_migrated_slot, migration_source_node, sender); } /* After updating the slots configuration, don't do any actual change @@ -3238,8 +3328,8 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc * and myself own no slots and in the same shard. Set the sender as * the new primary if my current config epoch is lower than the * sender's. */ - if (!new_primary && myself->replicaof != sender && sender_slots == 0 && myself->numslots == 0 && - nodeEpoch(myself) < senderConfigEpoch && are_in_same_shard) { + if (!new_primary && myself->replicaof != sender && sender_slots == 0 && myself->numslots == 0 + && nodeEpoch(myself) < senderConfigEpoch && are_in_same_shard) { new_primary = sender; } @@ -3267,14 +3357,16 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc serverLog(LL_NOTICE, "Configuration change detected. Reconfiguring myself " "as a replica of node %.40s (%s) in shard %.40s", - sender->name, humanNodename(sender), sender->shard_id); + sender->name, + humanNodename(sender), + sender->shard_id); /* Don't clear the migrating/importing states if this is a replica that * just gets promoted to the new primary in the shard. * * If the sender and myself are in the same shard, try psync. */ clusterSetPrimary(sender, !are_in_same_shard, !are_in_same_shard); - clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_FSYNC_CONFIG | - CLUSTER_TODO_BROADCAST_ALL); + clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_FSYNC_CONFIG + | CLUSTER_TODO_BROADCAST_ALL); } else if (nodeIsPrimary(myself) && (sender_slots >= migrated_our_slots) && !are_in_same_shard) { /* When all our slots are lost to the sender and the sender belongs to * a different shard, this is likely due to a client triggered slot @@ -3282,7 +3374,9 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc * in this case. */ serverLog(LL_NOTICE, "My last slot was migrated to node %.40s (%s) in shard %.40s. I am now an empty primary.", - sender->name, humanNodename(sender), sender->shard_id); + sender->name, + humanNodename(sender), + sender->shard_id); /* We may still have dirty slots when we became a empty primary due to * a bad migration. * @@ -3312,8 +3406,12 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc if (delete_dirty_slots) { for (int j = 0; j < dirty_slots_count; j++) { - serverLog(LL_NOTICE, "Deleting keys in dirty slot %d on node %.40s (%s) in shard %.40s", dirty_slots[j], - myself->name, humanNodename(myself), myself->shard_id); + serverLog(LL_NOTICE, + "Deleting keys in dirty slot %d on node %.40s (%s) in shard %.40s", + dirty_slots[j], + myself->name, + humanNodename(myself), + myself->shard_id); delKeysInSlot(dirty_slots[j], server.lazyfree_lazy_server_del, true, false); } } @@ -3374,8 +3472,10 @@ static void *preparePingExt(clusterMsgPingExt *ext, uint16_t type, uint32_t leng * If given value is empty, function does no computation. * Returns 1 (added a new extension) or 0 (no extension added). */ -static uint32_t -writeSdsPingExtIfNonempty(uint32_t *totlen_ptr, clusterMsgPingExt **cursor_ptr, clusterMsgPingtypes type, sds value) { +static uint32_t writeSdsPingExtIfNonempty(uint32_t *totlen_ptr, + clusterMsgPingExt **cursor_ptr, + clusterMsgPingtypes type, + sds value) { size_t len = sdslen(value); if (len == 0) return 0; size_t size = getAlignedPingExtSize(len + 1); @@ -3388,8 +3488,10 @@ writeSdsPingExtIfNonempty(uint32_t *totlen_ptr, clusterMsgPingExt **cursor_ptr, return 1; } -static uint32_t -writePortPingExtIfNonzero(uint32_t *totlen_ptr, clusterMsgPingExt **cursor_ptr, clusterMsgPingtypes type, uint16_t value) { +static uint32_t writePortPingExtIfNonzero(uint32_t *totlen_ptr, + clusterMsgPingExt **cursor_ptr, + clusterMsgPingtypes type, + uint16_t value) { if (value == 0) return 0; size_t size = getAlignedPingExtSize(sizeof(clusterMsgPingExtClientPort)); if (*cursor_ptr != NULL) { @@ -3427,8 +3529,10 @@ static uint32_t writePingExtensions(clusterMsg *hdr, int gossipcount) { writeSdsPingExtIfNonempty(&totlen, &cursor, CLUSTERMSG_EXT_TYPE_CLIENT_IPV6, myself->announce_client_ipv6); extensions += writePortPingExtIfNonzero(&totlen, &cursor, CLUSTERMSG_EXT_TYPE_CLIENT_PORT, myself->announce_client_tcp_port); - extensions += - writePortPingExtIfNonzero(&totlen, &cursor, CLUSTERMSG_EXT_TYPE_CLIENT_TLS_PORT, myself->announce_client_tls_port); + extensions += writePortPingExtIfNonzero(&totlen, + &cursor, + CLUSTERMSG_EXT_TYPE_CLIENT_TLS_PORT, + myself->announce_client_tls_port); extensions += writeSdsPingExtIfNonempty(&totlen, &cursor, CLUSTERMSG_EXT_TYPE_AVAILABILITY_ZONE, myself->availability_zone); @@ -3442,8 +3546,9 @@ static uint32_t writePingExtensions(clusterMsg *hdr, int gossipcount) { uint64_t expire = dictGetUnsignedIntegerVal(de); if ((time_t)expire < server.unixtime) continue; /* already expired */ uint64_t ttl = expire - server.unixtime; - clusterMsgPingExtForgottenNode *ext = - preparePingExt(cursor, CLUSTERMSG_EXT_TYPE_FORGOTTEN_NODE, getForgottenNodeExtSize()); + clusterMsgPingExtForgottenNode *ext = preparePingExt(cursor, + CLUSTERMSG_EXT_TYPE_FORGOTTEN_NODE, + getForgottenNodeExtSize()); memcpy(ext->name, dictGetKey(de), CLUSTER_NAMELEN); ext->ttl = htonu64(ttl); @@ -3596,8 +3701,8 @@ static void clusterProcessPublishPacket(clusterMsgDataPublish *publish_data, uin /* Don't bother creating useless objects if there are no * Pub/Sub subscribers. */ - if ((type == CLUSTERMSG_TYPE_PUBLISH && serverPubsubSubscriptionCount() > 0) || - (type == CLUSTERMSG_TYPE_PUBLISHSHARD && serverPubsubShardSubscriptionCount() > 0)) { + if ((type == CLUSTERMSG_TYPE_PUBLISH && serverPubsubSubscriptionCount() > 0) + || (type == CLUSTERMSG_TYPE_PUBLISHSHARD && serverPubsubShardSubscriptionCount() > 0)) { channel_len = ntohl(publish_data->channel_len); message_len = ntohl(publish_data->message_len); channel = createStringObject((char *)publish_data->bulk_data, channel_len); @@ -3644,8 +3749,7 @@ static inline int messageTypeSupportsLightHdr(uint16_t type) { } static void clusterBusAddNetworkBytesByType(uint16_t type, uint64_t bytes, bool sent) { - sent ? (server.cluster->stats_bus_bytes_sent += bytes) - : (server.cluster->stats_bus_bytes_received += bytes); + sent ? (server.cluster->stats_bus_bytes_sent += bytes) : (server.cluster->stats_bus_bytes_received += bytes); if (type == CLUSTERMSG_TYPE_PUBLISH || type == CLUSTERMSG_TYPE_PUBLISHSHARD) { sent ? (server.cluster->stats_bus_pubsub_bytes_sent += bytes) @@ -3670,11 +3774,14 @@ int clusterIsValidPacket(clusterLink *link) { if (is_light && !messageTypeSupportsLightHdr(type)) { serverLog(LL_NOTICE, "Packet of type '%s' (%u) does not support light cluster header. Marking packet as invalid.", - clusterGetMessageTypeString(type), type); + clusterGetMessageTypeString(type), + type); return 0; } - serverLog(LL_DEBUG, "--- Processing packet of type %s, %lu bytes", clusterGetMessageTypeString(type), + serverLog(LL_DEBUG, + "--- Processing packet of type %s, %lu bytes", + clusterGetMessageTypeString(type), (unsigned long)totlen); /* Perform sanity checks */ @@ -3687,7 +3794,8 @@ int clusterIsValidPacket(clusterLink *link) { } if (type == server.cluster_drop_packet_filter || server.cluster_drop_packet_filter == -2) { - serverLog(LL_WARNING, "Dropping packet of type %s that matches debug drop filter", + serverLog(LL_WARNING, + "Dropping packet of type %s that matches debug drop filter", clusterGetMessageTypeString(type)); return 0; } @@ -3708,7 +3816,9 @@ int clusterIsValidPacket(clusterLink *link) { serverLog(LL_WARNING, "Received invalid %s packet with gossip count %d that exceeds " "total packet length (%lld)", - clusterGetMessageTypeString(type), count, (unsigned long long)totlen); + clusterGetMessageTypeString(type), + count, + (unsigned long long)totlen); return 0; } @@ -3723,13 +3833,16 @@ int clusterIsValidPacket(clusterLink *link) { serverLog(LL_WARNING, "Received invalid %s packet with extension data that exceeds " "total packet length (%lld)", - clusterGetMessageTypeString(type), (unsigned long long)totlen); + clusterGetMessageTypeString(type), + (unsigned long long)totlen); return 0; } uint32_t extlen = getPingExtLength(ext); if (extlen % 8 != 0) { - serverLog(LL_WARNING, "Received a %s packet without proper padding (%d bytes)", - clusterGetMessageTypeString(type), (int)extlen); + serverLog(LL_WARNING, + "Received a %s packet without proper padding (%d bytes)", + clusterGetMessageTypeString(type), + (int)extlen); return 0; } /* Similar check to earlier, but we want to make sure the extension length is valid @@ -3738,7 +3851,8 @@ int clusterIsValidPacket(clusterLink *link) { serverLog(LL_WARNING, "Received invalid %s packet with extension data that exceeds " "total packet length (%lld)", - clusterGetMessageTypeString(type), (unsigned long long)totlen); + clusterGetMessageTypeString(type), + (unsigned long long)totlen); return 0; } explen += extlen; @@ -3760,10 +3874,10 @@ int clusterIsValidPacket(clusterLink *link) { explen = sizeof(clusterMsg); } explen -= sizeof(union clusterMsgData); - explen += - sizeof(clusterMsgDataPublish) - 8 + ntohl(publish_data->channel_len) + ntohl(publish_data->message_len); - } else if (type == CLUSTERMSG_TYPE_FAILOVER_AUTH_REQUEST || type == CLUSTERMSG_TYPE_FAILOVER_AUTH_ACK || - type == CLUSTERMSG_TYPE_MFSTART) { + explen += sizeof(clusterMsgDataPublish) - 8 + ntohl(publish_data->channel_len) + + ntohl(publish_data->message_len); + } else if (type == CLUSTERMSG_TYPE_FAILOVER_AUTH_REQUEST || type == CLUSTERMSG_TYPE_FAILOVER_AUTH_ACK + || type == CLUSTERMSG_TYPE_MFSTART) { explen = sizeof(clusterMsg) - sizeof(union clusterMsgData); } else if (type == CLUSTERMSG_TYPE_UPDATE) { explen = sizeof(clusterMsg) - sizeof(union clusterMsgData); @@ -3784,8 +3898,11 @@ int clusterIsValidPacket(clusterLink *link) { } if (totlen != explen) { - serverLog(LL_WARNING, "Received invalid %s packet of length %lld but expected length %lld", - clusterGetMessageTypeString(type), (unsigned long long)totlen, (unsigned long long)explen); + serverLog(LL_WARNING, + "Received invalid %s packet of length %lld but expected length %lld", + clusterGetMessageTypeString(type), + (unsigned long long)totlen, + (unsigned long long)explen); return 0; } @@ -3816,8 +3933,8 @@ int clusterProcessPacket(clusterLink *link) { if (!clusterIsValidPacket(link)) { clusterMsgHeader *hdr = (clusterMsgHeader *)link->rcvbuf; uint16_t type = ntohs(hdr->type); - if (server.debug_cluster_close_link_on_packet_drop && - (type == server.cluster_drop_packet_filter || server.cluster_drop_packet_filter == -2)) { + if (server.debug_cluster_close_link_on_packet_drop + && (type == server.cluster_drop_packet_filter || server.cluster_drop_packet_filter == -2)) { freeClusterLink(link); serverLog(LL_WARNING, "Closing link for matching packet type %s", clusterGetMessageTypeString(type)); return 0; @@ -3832,12 +3949,12 @@ int clusterProcessPacket(clusterLink *link) { if (is_light) { if (!link->node || nodeInHandshake(link->node)) { - serverLog( - LL_NOTICE, - "Closing link for node %.40s (%s) that sent a lightweight message of type %s as its first message on the link", - clusterLinkGetNodeName(link), - clusterLinkGetHumanNodeName(link), - clusterGetMessageTypeString(type)); + serverLog(LL_NOTICE, + "Closing link for node %.40s (%s) that sent a lightweight message of type %s as its first " + "message on the link", + clusterLinkGetNodeName(link), + clusterLinkGetHumanNodeName(link), + clusterGetMessageTypeString(type)); freeClusterLink(link); return 0; } @@ -3914,8 +4031,8 @@ int clusterProcessPacket(clusterLink *link) { sender->configEpoch = sender_claimed_config_epoch; clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_FSYNC_CONFIG); - if (server.cluster->failover_auth_time && server.cluster->failover_auth_sent && - sender->configEpoch >= server.cluster->failover_auth_epoch) { + if (server.cluster->failover_auth_time && server.cluster->failover_auth_sent + && sender->configEpoch >= server.cluster->failover_auth_epoch) { /* Another node has claimed an epoch greater than or equal to ours. * If we have an ongoing election, reset it because we cannot win * with an epoch smaller than or equal to the incoming claim. This @@ -3926,7 +4043,8 @@ int clusterProcessPacket(clusterLink *link) { "node %.40s (%s) with an equal or higher epoch %llu. Resetting the election " "since we cannot win an election in the past.", (unsigned long long)server.cluster->failover_auth_epoch, - sender->name, humanNodename(sender), + sender->name, + humanNodename(sender), (unsigned long long)sender->configEpoch); /* Maybe we could start a new election, set a flag here to make sure * we check as soon as possible, instead of waiting for a cron. */ @@ -3937,8 +4055,8 @@ int clusterProcessPacket(clusterLink *link) { sender->repl_offset = ntohu64(msg->offset); /* If we are a replica performing a manual failover and our primary * sent its offset while already paused, populate the MF state. */ - if (server.cluster->mf_end && nodeIsReplica(myself) && myself->replicaof == sender && - msg->mflags[0] & CLUSTERMSG_FLAG0_PAUSED && server.cluster->mf_primary_offset == -1) { + if (server.cluster->mf_end && nodeIsReplica(myself) && myself->replicaof == sender + && msg->mflags[0] & CLUSTERMSG_FLAG0_PAUSED && server.cluster->mf_primary_offset == -1) { server.cluster->mf_primary_offset = sender->repl_offset; clusterDoBeforeSleep(CLUSTER_TODO_HANDLE_MANUALFAILOVER); serverLog(LL_NOTICE, @@ -3979,8 +4097,9 @@ int clusterProcessPacket(clusterLink *link) { /* Unable to retrieve the node's IP address from the connection. Without a * valid IP, the node becomes unusable in the cluster. This failure might be * due to the connection being closed. */ - serverLog(LL_NOTICE, "Closing cluster link due to failure to retrieve IP from the connection, " - "possibly caused by a closed connection."); + serverLog(LL_NOTICE, + "Closing cluster link due to failure to retrieve IP from the connection, " + "possibly caused by a closed connection."); freeClusterLink(link); return 0; } @@ -4031,9 +4150,11 @@ int clusterProcessPacket(clusterLink *link) { /* We should always receive a MEET packet on an inbound link. */ serverAssert(link != sender->link); - serverLog(LL_NOTICE, "Freeing outbound link to node %.40s (%s) after receiving a MEET packet " - "from this known node", - sender->name, humanNodename(sender)); + serverLog(LL_NOTICE, + "Freeing outbound link to node %.40s (%s) after receiving a MEET packet " + "from this known node", + sender->name, + humanNodename(sender)); freeClusterLink(sender->link); } } @@ -4046,13 +4167,18 @@ int clusterProcessPacket(clusterLink *link) { char ip[NET_IP_STR_LEN]; int port; if (connAddrPeerName(link->conn, ip, sizeof(ip), &port) != -1) { - serverLog(LL_DEBUG, "%s packet received from: %.40s (%s) from client: %s:%d", + serverLog(LL_DEBUG, + "%s packet received from: %.40s (%s) from client: %s:%d", clusterGetMessageTypeString(type), - clusterLinkGetNodeName(link), clusterLinkGetHumanNodeName(link), - ip, port); + clusterLinkGetNodeName(link), + clusterLinkGetHumanNodeName(link), + ip, + port); } else { - serverLog(LL_DEBUG, "Error resolving the address of packet sender %.40s (%s)", - clusterLinkGetNodeName(link), clusterLinkGetHumanNodeName(link)); + serverLog(LL_DEBUG, + "Error resolving the address of packet sender %.40s (%s)", + clusterLinkGetNodeName(link), + clusterLinkGetHumanNodeName(link)); } } /* PING, PONG, MEET: process config information. */ @@ -4060,7 +4186,9 @@ int clusterProcessPacket(clusterLink *link) { if (sender && nodeInMeetState(sender)) { /* Once we get a response for MEET from the sender, we can stop sending more MEET. */ sender->flags &= ~CLUSTER_NODE_MEET; - serverLog(LL_NOTICE, "Successfully completed handshake with %.40s (%s)", sender->name, + serverLog(LL_NOTICE, + "Successfully completed handshake with %.40s (%s)", + sender->name, humanNodename(sender)); } if (!link->inbound) { @@ -4071,7 +4199,8 @@ int clusterProcessPacket(clusterLink *link) { serverLog(LL_VERBOSE, "Handshake: we already know node %.40s (%s), " "updating the address if needed.", - sender->name, humanNodename(sender)); + sender->name, + humanNodename(sender)); if (nodeUpdateAddressIfNeeded(sender, link, msg)) { clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE); } @@ -4084,7 +4213,10 @@ int clusterProcessPacket(clusterLink *link) { /* First thing to do is replacing the random name with the * right node name if this was a handshake stage. */ clusterRenameNode(link->node, msg->sender); - serverLog(LL_DEBUG, "Handshake with node %.40s (%s) completed.", link->node->name, humanNodename(link->node)); + serverLog(LL_DEBUG, + "Handshake with node %.40s (%s) completed.", + link->node->name, + humanNodename(link->node)); link->node->flags &= ~CLUSTER_NODE_HANDSHAKE; link->node->flags |= flags & (CLUSTER_NODE_PRIMARY | CLUSTER_NODE_REPLICA); clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG); @@ -4097,8 +4229,11 @@ int clusterProcessPacket(clusterLink *link) { serverLog(LL_NOTICE, "PONG contains mismatching sender ID. About node %.40s (%s) in shard %.40s added %d ms ago, " "having flags %d", - link->node->name, humanNodename(link->node), link->node->shard_id, - (int)(now - (link->node->ctime)), link->node->flags); + link->node->name, + humanNodename(link->node), + link->node->shard_id, + (int)(now - (link->node->ctime)), + link->node->flags); link->node->flags |= CLUSTER_NODE_NOADDR; link->node->ip[0] = '\0'; link->node->tcp_port = 0; @@ -4137,8 +4272,8 @@ int clusterProcessPacket(clusterLink *link) { } /* Update the node address if it changed. */ - if (sender && type == CLUSTERMSG_TYPE_PING && !nodeInHandshake(sender) && - nodeUpdateAddressIfNeeded(sender, link, msg)) { + if (sender && type == CLUSTERMSG_TYPE_PING && !nodeInHandshake(sender) + && nodeUpdateAddressIfNeeded(sender, link, msg)) { clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE); } @@ -4166,8 +4301,12 @@ int clusterProcessPacket(clusterLink *link) { if (sender_claims_to_be_primary) { /* Node is a primary. */ if (sender_last_reported_as_replica) { - serverLog(LL_DEBUG, "node %.40s (%s) announces that it is a %s in shard %.40s", sender->name, - humanNodename(sender), sender_claims_to_be_primary ? "primary" : "replica", sender->shard_id); + serverLog(LL_DEBUG, + "node %.40s (%s) announces that it is a %s in shard %.40s", + sender->name, + humanNodename(sender), + sender_claims_to_be_primary ? "primary" : "replica", + sender->shard_id); clusterSetNodeAsPrimary(sender); } } else { @@ -4175,18 +4314,24 @@ int clusterProcessPacket(clusterLink *link) { clusterNode *sender_claimed_primary = clusterLookupNode(msg->replicaof, CLUSTER_NAMELEN); if (sender_last_reported_as_primary) { - serverLog(LL_DEBUG, "node %.40s (%s) announces that it is a %s in shard %.40s", sender->name, - humanNodename(sender), sender_claims_to_be_primary ? "primary" : "replica", sender->shard_id); + serverLog(LL_DEBUG, + "node %.40s (%s) announces that it is a %s in shard %.40s", + sender->name, + humanNodename(sender), + sender_claims_to_be_primary ? "primary" : "replica", + sender->shard_id); /* Primary turned into a replica! Reconfigure the node. */ if (sender_claimed_primary && areInSameShard(sender_claimed_primary, sender)) { /* `sender` was a primary and was in the same shard as its new primary */ - if (nodeEpoch(sender) > sender_claimed_config_epoch || - nodeEpoch(sender_claimed_primary) > sender_claimed_config_epoch) { + if (nodeEpoch(sender) > sender_claimed_config_epoch + || nodeEpoch(sender_claimed_primary) > sender_claimed_config_epoch) { serverLog(LL_NOTICE, "Ignore stale message from %.40s (%s) in shard %.40s;" " gossip config epoch: %llu, current config epoch: %llu", - sender->name, humanNodename(sender), sender->shard_id, + sender->name, + humanNodename(sender), + sender->shard_id, (unsigned long long)sender_claimed_config_epoch, (unsigned long long)max(nodeEpoch(sender), nodeEpoch(sender_claimed_primary))); /* This packet is stale so we avoid processing it anymore. Otherwise @@ -4197,8 +4342,11 @@ int clusterProcessPacket(clusterLink *link) { * no longer a primary. Update slot assignment to `sender_claimed_config_epoch`, * which is the new primary in the shard. */ int slots = 0, importing_slots = 0, migrating_slots = 0; - clusterMoveNodeSlots(sender, sender_claimed_primary, - &slots, &importing_slots, &migrating_slots); + clusterMoveNodeSlots(sender, + sender_claimed_primary, + &slots, + &importing_slots, + &migrating_slots); /* `primary` is still a `replica` in this observer node's view; * update its role and configEpoch */ clusterSetNodeAsPrimary(sender_claimed_primary); @@ -4207,23 +4355,31 @@ int clusterProcessPacket(clusterLink *link) { serverLog(LL_NOTICE, "A failover occurred in shard %.40s; node %.40s (%s) lost %d slot(s) and" " failed over to node %.40s (%s) with a config epoch of %llu", - sender->shard_id, sender->name, humanNodename(sender), slots, - sender_claimed_primary->name, humanNodename(sender_claimed_primary), + sender->shard_id, + sender->name, + humanNodename(sender), + slots, + sender_claimed_primary->name, + humanNodename(sender_claimed_primary), (unsigned long long)sender_claimed_primary->configEpoch); } if (importing_slots) { serverLog(LL_NOTICE, "A failover occurred in migration source. Update importing " "source of %d slot(s) to node %.40s (%s) in shard %.40s.", - importing_slots, sender_claimed_primary->name, - humanNodename(sender_claimed_primary), sender_claimed_primary->shard_id); + importing_slots, + sender_claimed_primary->name, + humanNodename(sender_claimed_primary), + sender_claimed_primary->shard_id); } if (migrating_slots) { serverLog(LL_NOTICE, "A failover occurred in migration target. Update migrating " "target of %d slot(s) to node %.40s (%s) in shard %.40s.", - migrating_slots, sender_claimed_primary->name, - humanNodename(sender_claimed_primary), sender_claimed_primary->shard_id); + migrating_slots, + sender_claimed_primary->name, + humanNodename(sender_claimed_primary), + sender_claimed_primary->shard_id); } serverAssert(sender->numslots == 0); } @@ -4233,10 +4389,16 @@ int clusterProcessPacket(clusterLink *link) { serverLog(LL_NOTICE, "Node %.40s (%s) is no longer primary of shard %.40s;" " removed all %d slot(s) it used to own", - sender->name, humanNodename(sender), sender->shard_id, slots); + sender->name, + humanNodename(sender), + sender->shard_id, + slots); if (sender_claimed_primary != NULL) { - serverLog(LL_NOTICE, "Node %.40s (%s) is now part of shard %.40s", sender->name, - humanNodename(sender), sender_claimed_primary->shard_id); + serverLog(LL_NOTICE, + "Node %.40s (%s) is now part of shard %.40s", + sender->name, + humanNodename(sender), + sender_claimed_primary->shard_id); } serverAssert(sender->numslots == 0); } @@ -4245,15 +4407,20 @@ int clusterProcessPacket(clusterLink *link) { sender->flags |= CLUSTER_NODE_REPLICA; /* Update config and state. */ - clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_FSYNC_CONFIG); + clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE + | CLUSTER_TODO_FSYNC_CONFIG); } /* Primary node changed for this replica? */ if (sender_claimed_primary && sender->replicaof != sender_claimed_primary) { if (sender->replicaof) clusterNodeRemoveReplica(sender->replicaof, sender); - serverLog(LL_NOTICE, "Node %.40s (%s) is now a replica of node %.40s (%s) in shard %.40s", - sender->name, humanNodename(sender), sender_claimed_primary->name, - humanNodename(sender_claimed_primary), sender_claimed_primary->shard_id); + serverLog(LL_NOTICE, + "Node %.40s (%s) is now a replica of node %.40s (%s) in shard %.40s", + sender->name, + humanNodename(sender), + sender_claimed_primary->name, + humanNodename(sender_claimed_primary), + sender_claimed_primary->shard_id); clusterNodeAddReplica(sender_claimed_primary, sender); sender->replicaof = sender_claimed_primary; @@ -4282,12 +4449,15 @@ int clusterProcessPacket(clusterLink *link) { * Or a replica's primary can turn itself into a replica of its other * replica during a failover. In this case, they are in the same shard, * so we can try a psync. */ - serverLog(LL_NOTICE, "I'm a sub-replica! Reconfiguring myself as a replica of %.40s from %.40s", - myself->replicaof->replicaof->name, myself->replicaof->name); - clusterSetPrimary(myself->replicaof->replicaof, 1, + serverLog(LL_NOTICE, + "I'm a sub-replica! Reconfiguring myself as a replica of %.40s from %.40s", + myself->replicaof->replicaof->name, + myself->replicaof->name); + clusterSetPrimary(myself->replicaof->replicaof, + 1, !areInSameShard(myself->replicaof->replicaof, myself)); - clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE | - CLUSTER_TODO_FSYNC_CONFIG | CLUSTER_TODO_BROADCAST_ALL); + clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE + | CLUSTER_TODO_FSYNC_CONFIG | CLUSTER_TODO_BROADCAST_ALL); } /* Update the shard_id when a replica is connected to its @@ -4310,13 +4480,16 @@ int clusterProcessPacket(clusterLink *link) { * for it or if there was a failover in the sender's shard. Check * this ASAP to avoid other computational expensive checks later.*/ - if (sender && sender_claims_to_be_primary && - (sender_last_reported_as_replica || memcmp(sender->slots, msg->myslots, sizeof(msg->myslots)))) { + if (sender && sender_claims_to_be_primary + && (sender_last_reported_as_replica || memcmp(sender->slots, msg->myslots, sizeof(msg->myslots)))) { /* Make sure CLUSTER_NODE_PRIMARY has already been set by now on sender */ serverAssert(nodeIsPrimary(sender)); - serverLog(LL_NOTICE, "Mismatch in topology information for sender node %.40s (%s) in shard %.40s", sender->name, - humanNodename(sender), sender->shard_id); + serverLog(LL_NOTICE, + "Mismatch in topology information for sender node %.40s (%s) in shard %.40s", + sender->name, + humanNodename(sender), + sender->shard_id); /* 1) If the sender of the message is a primary, and we detected that * the set of slots it claims changed, scan the slots to see if we @@ -4355,8 +4528,10 @@ int clusterProcessPacket(clusterLink *link) { serverLog(LL_VERBOSE, "Node %.40s (%s) has old slots configuration, sending " "an UPDATE message about %.40s (%s)", - sender->name, humanNodename(sender), - slot_owner->name, humanNodename(slot_owner)); + sender->name, + humanNodename(sender), + slot_owner->name, + humanNodename(slot_owner)); clusterSendUpdate(sender->link, slot_owner); /* TODO: instead of exiting the loop send every other @@ -4371,8 +4546,8 @@ int clusterProcessPacket(clusterLink *link) { /* If our config epoch collides with the sender's try to fix * the problem. */ - if (sender && nodeIsPrimary(myself) && nodeIsPrimary(sender) && - sender_claimed_config_epoch == myself->configEpoch) { + if (sender && nodeIsPrimary(myself) && nodeIsPrimary(sender) + && sender_claimed_config_epoch == myself->configEpoch) { clusterHandleConfigEpochCollision(sender); } @@ -4387,12 +4562,18 @@ int clusterProcessPacket(clusterLink *link) { if (sender) { failing = clusterLookupNode(msg->data.fail.about.nodename, CLUSTER_NAMELEN); if (failing && !(failing->flags & (CLUSTER_NODE_FAIL | CLUSTER_NODE_MYSELF))) { - serverLog(LL_NOTICE, "FAIL message received from %.40s (%s) about %.40s (%s)", msg->sender, - humanNodename(sender), msg->data.fail.about.nodename, humanNodename(failing)); + serverLog(LL_NOTICE, + "FAIL message received from %.40s (%s) about %.40s (%s)", + msg->sender, + humanNodename(sender), + msg->data.fail.about.nodename, + humanNodename(failing)); markNodeAsFailing(failing); } } else { - serverLog(LL_NOTICE, "Ignoring FAIL message from unknown node %.40s about %.40s", msg->sender, + serverLog(LL_NOTICE, + "Ignoring FAIL message from unknown node %.40s about %.40s", + msg->sender, msg->data.fail.about.nodename); } } else if (type == CLUSTERMSG_TYPE_PUBLISH || type == CLUSTERMSG_TYPE_PUBLISHSHARD) { @@ -4421,7 +4602,8 @@ int clusterProcessPacket(clusterLink *link) { resetManualFailover(); server.cluster->mf_end = now + server.cluster_mf_timeout; server.cluster->mf_replica = sender; - pauseActions(PAUSE_DURING_FAILOVER, now + (server.cluster_mf_timeout * CLUSTER_MF_PAUSE_MULT), + pauseActions(PAUSE_DURING_FAILOVER, + now + (server.cluster_mf_timeout * CLUSTER_MF_PAUSE_MULT), PAUSE_ACTIONS_CLIENT_WRITE_SET); serverLog(LL_NOTICE, "Manual failover requested by replica %.40s (%s).", sender->name, humanNodename(sender)); /* We need to send a ping message to the replica, as it would carry @@ -4439,10 +4621,17 @@ int clusterProcessPacket(clusterLink *link) { if (!n) return 1; /* We don't know the reported node. */ if (n->configEpoch >= reportedConfigEpoch) return 1; /* Nothing new. */ - serverLog(LL_NOTICE, "Processing UPDATE message received from %.40s (%s) in shard %s about node %.40s (%s) in shard %s. old configEpoch %llu, new configEpoch %llu", - sender->name, humanNodename(sender), sender->shard_id, - n->name, humanNodename(n), n->shard_id, - (unsigned long long)n->configEpoch, (unsigned long long)reportedConfigEpoch); + serverLog(LL_NOTICE, + "Processing UPDATE message received from %.40s (%s) in shard %s about node %.40s (%s) in shard %s. " + "old configEpoch %llu, new configEpoch %llu", + sender->name, + humanNodename(sender), + sender->shard_id, + n->name, + humanNodename(n), + n->shard_id, + (unsigned long long)n->configEpoch, + (unsigned long long)reportedConfigEpoch); /* If in our current config the node is a replica, set it as a primary. */ if (nodeIsReplica(n)) clusterSetNodeAsPrimary(n); @@ -4488,7 +4677,8 @@ void clusterWriteHandler(connection *conn) { nwritten = connWrite(conn, (char *)msg + msg_offset, msg_len - msg_offset); if (nwritten <= 0) { if (nwritten == -1 && connGetState(conn) == CONN_STATE_CONNECTED) return; /* equivalent to EAGAIN */ - serverLog(LL_DEBUG, "I/O error writing to node link: %s", + serverLog(LL_DEBUG, + "I/O error writing to node link: %s", (nwritten == -1) ? connGetLastError(conn) : "short write"); handleLinkIOError(link); return; @@ -4524,7 +4714,11 @@ void clusterLinkConnectHandler(connection *conn) { /* Check if connection succeeded */ if (connGetState(conn) != CONN_STATE_CONNECTED) { - serverLog(LL_VERBOSE, "Connection with Node %.40s at %s:%d failed: %s", node->name, node->ip, node->cport, + serverLog(LL_VERBOSE, + "Connection with Node %.40s at %s:%d failed: %s", + node->name, + node->ip, + node->cport, connGetLastError(conn)); freeClusterLink(link); return; @@ -4598,13 +4792,15 @@ void clusterReadHandler(connection *conn) { char ip[NET_IP_STR_LEN]; int port; if (connAddrPeerName(conn, ip, sizeof(ip), &port) == -1) { - serverLog(LL_WARNING, "Bad message length or signature received " - "on the Cluster bus."); + serverLog(LL_WARNING, + "Bad message length or signature received " + "on the Cluster bus."); } else { serverLog(LL_WARNING, "Bad message length or signature received " "on the Cluster bus from %s:%d", - ip, port); + ip, + port); } handleLinkIOError(link); return; @@ -4619,7 +4815,8 @@ void clusterReadHandler(connection *conn) { if (nread <= 0) { /* I/O error... */ - serverLog(LL_DEBUG, "I/O error reading from node link (%.40s:%s) (%s): %s", + serverLog(LL_DEBUG, + "I/O error reading from node link (%.40s:%s) (%s): %s", clusterLinkGetNodeName(link), link->inbound ? "inbound" : "outbound", clusterLinkGetHumanNodeName(link), @@ -4746,7 +4943,11 @@ static void clusterBuildMessageHdr(clusterMsg *hdr, int type, size_t msglen) { /* Handle cluster-announce-[tls-|bus-]port. */ int announced_tcp_port, announced_tls_port, announced_cport, announced_client_tcp_port, announced_client_tls_port; - deriveAnnouncedPorts(&announced_tcp_port, &announced_tls_port, &announced_cport, &announced_client_tcp_port, &announced_client_tls_port); + deriveAnnouncedPorts(&announced_tcp_port, + &announced_tls_port, + &announced_cport, + &announced_client_tcp_port, + &announced_client_tls_port); memcpy(hdr->myslots, primary->slots, sizeof(hdr->myslots)); memset(hdr->replicaof, 0, CLUSTER_NAMELEN); @@ -4803,7 +5004,8 @@ void clusterSetGossipEntry(clusterMsg *hdr, int i, clusterNode *n) { /* Send a PING or PONG packet to the specified node, making sure to add enough * gossip information. */ void clusterSendPing(clusterLink *link, int type) { - serverLog(LL_DEBUG, "Sending %s packet to node %.40s (%s) on %s link", + serverLog(LL_DEBUG, + "Sending %s packet to node %.40s (%s) on %s link", clusterGetMessageTypeString(type), clusterLinkGetNodeName(link), clusterLinkGetHumanNodeName(link), @@ -4886,8 +5088,7 @@ void clusterSendPing(clusterLink *link, int type) { * many ping rounds all nodes get even coverage without needing an * explicit shuffle. */ int candidates_wanted = wanted + 2; /* +2 for myself and link->node */ - if (candidates_wanted > (int)dictSize(server.cluster->nodes)) - candidates_wanted = dictSize(server.cluster->nodes); + if (candidates_wanted > (int)dictSize(server.cluster->nodes)) candidates_wanted = dictSize(server.cluster->nodes); void **candidates = zmalloc(sizeof(void *) * candidates_wanted); unsigned int ncandidates = dictGetSomeKeys(server.cluster->nodes, candidates, candidates_wanted); @@ -4908,8 +5109,8 @@ void clusterSendPing(clusterLink *link, int type) { * 3) Nodes with the NOADDR flag set. * 4) Disconnected nodes if they don't have configured slots. */ - if (this->flags & (CLUSTER_NODE_HANDSHAKE | CLUSTER_NODE_NOADDR) || - (this->link == NULL && this->numslots == 0)) { + if (this->flags & (CLUSTER_NODE_HANDSHAKE | CLUSTER_NODE_NOADDR) + || (this->link == NULL && this->numslots == 0)) { continue; } @@ -4990,8 +5191,8 @@ void clusterBroadcastPong(int target) { if (!node->link) continue; if (node == myself || nodeInHandshake(node)) continue; if (target == CLUSTER_BROADCAST_LOCAL_REPLICAS) { - int local_replica = nodeIsReplica(node) && node->replicaof && - (node->replicaof == myself || node->replicaof == myself->replicaof); + int local_replica = nodeIsReplica(node) && node->replicaof + && (node->replicaof == myself || node->replicaof == myself->replicaof); if (!local_replica) continue; } clusterSendPing(node->link, CLUSTERMSG_TYPE_PONG); @@ -5037,7 +5238,9 @@ clusterMsgSendBlock *clusterCreatePublishMsgBlock(robj *channel, robj *message, hdr_data_msg->channel_len = htonl(channel_len); hdr_data_msg->message_len = htonl(message_len); memcpy(hdr_data_msg->bulk_data, objectGetVal(channel), sdslen(objectGetVal(channel))); - memcpy(hdr_data_msg->bulk_data + sdslen(objectGetVal(channel)), objectGetVal(message), sdslen(objectGetVal(message))); + memcpy(hdr_data_msg->bulk_data + sdslen(objectGetVal(channel)), + objectGetVal(message), + sdslen(objectGetVal(message))); decrRefCount(channel); decrRefCount(message); @@ -5076,8 +5279,8 @@ void clusterSendUpdate(clusterLink *link, clusterNode *node) { memcpy(hdr->data.update.nodecfg.slots, node->slots, sizeof(node->slots)); for (unsigned int i = 0; i < sizeof(node->slots); i++) { /* Don't advertise slots that the node stopped claiming */ - hdr->data.update.nodecfg.slots[i] = - hdr->data.update.nodecfg.slots[i] & (~server.cluster->owner_not_claiming_slot[i]); + hdr->data.update.nodecfg.slots[i] = hdr->data.update.nodecfg.slots[i] + & (~server.cluster->owner_not_claiming_slot[i]); } clusterSendMessage(link, msgblock); @@ -5088,18 +5291,20 @@ void clusterSendUpdate(clusterLink *link, clusterNode *node) { * and avoid using light weight messages until the bidirectional * link(s) have been established. */ static inline bool nodeSupportsLightMsgHdrForPubSub(clusterNode *n) { - return n->link && n->pong_received >= n->link->ctime && - (n->flags & CLUSTER_NODE_LIGHT_HDR_PUBLISH_SUPPORTED); + return n->link && n->pong_received >= n->link->ctime && (n->flags & CLUSTER_NODE_LIGHT_HDR_PUBLISH_SUPPORTED); } static inline bool nodeSupportsLightMsgHdrForModule(clusterNode *n) { - return n->link && n->pong_received >= n->link->ctime && - (n->flags & CLUSTER_NODE_LIGHT_HDR_MODULE_SUPPORTED); + return n->link && n->pong_received >= n->link->ctime && (n->flags & CLUSTER_NODE_LIGHT_HDR_MODULE_SUPPORTED); } /* Create a MODULE message block. * * If is_light is 1, then build a message block with `clusterMsgLight` struct else `clusterMsg`. */ -static clusterMsgSendBlock *createModuleMsgBlock(int64_t module_id, uint8_t type, const char *payload, uint32_t len, int is_light) { +static clusterMsgSendBlock *createModuleMsgBlock(int64_t module_id, + uint8_t type, + const char *payload, + uint32_t len, + int is_light) { uint32_t msglen; int msgtype; clusterMsgSendBlock *msgblock; @@ -5293,8 +5498,10 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) { if (!clusterNodeIsVotingPrimary(myself)) return; if (!server.cluster->safe_to_join) { - serverLog(LL_WARNING, "Failover auth denied to %.40s (%s): it is not safe to vote in this moment)", - node->name, humanNodename(node)); + serverLog(LL_WARNING, + "Failover auth denied to %.40s (%s): it is not safe to vote in this moment)", + node->name, + humanNodename(node)); return; } @@ -5303,16 +5510,22 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) { * our currentEpoch was updated as a side effect of receiving this * request, if the request epoch was greater. */ if (requestCurrentEpoch < server.cluster->currentEpoch) { - serverLog(LL_WARNING, "Failover auth denied to %.40s (%s): reqEpoch (%llu) < curEpoch(%llu)", node->name, - humanNodename(node), (unsigned long long)requestCurrentEpoch, + serverLog(LL_WARNING, + "Failover auth denied to %.40s (%s): reqEpoch (%llu) < curEpoch(%llu)", + node->name, + humanNodename(node), + (unsigned long long)requestCurrentEpoch, (unsigned long long)server.cluster->currentEpoch); return; } /* I already voted for this epoch? Return ASAP. */ if (server.cluster->lastVoteEpoch == server.cluster->currentEpoch) { - serverLog(LL_WARNING, "Failover auth denied to %.40s (%s): already voted for epoch %llu", node->name, - humanNodename(node), (unsigned long long)server.cluster->currentEpoch); + serverLog(LL_WARNING, + "Failover auth denied to %.40s (%s): already voted for epoch %llu", + node->name, + humanNodename(node), + (unsigned long long)server.cluster->currentEpoch); return; } @@ -5321,14 +5534,23 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) { * with CLUSTERMSG_FLAG0_FORCEACK (manual failover). */ if (clusterNodeIsPrimary(node) || primary == NULL || (!nodeFailed(primary) && !force_ack)) { if (clusterNodeIsPrimary(node)) { - serverLog(LL_WARNING, "Failover auth denied to %.40s (%s) for epoch %llu: it is a primary node", node->name, - humanNodename(node), (unsigned long long)requestCurrentEpoch); + serverLog(LL_WARNING, + "Failover auth denied to %.40s (%s) for epoch %llu: it is a primary node", + node->name, + humanNodename(node), + (unsigned long long)requestCurrentEpoch); } else if (primary == NULL) { - serverLog(LL_WARNING, "Failover auth denied to %.40s (%s) for epoch %llu: I don't know its primary", - node->name, humanNodename(node), (unsigned long long)requestCurrentEpoch); + serverLog(LL_WARNING, + "Failover auth denied to %.40s (%s) for epoch %llu: I don't know its primary", + node->name, + humanNodename(node), + (unsigned long long)requestCurrentEpoch); } else if (!nodeFailed(primary)) { - serverLog(LL_WARNING, "Failover auth denied to %.40s (%s) for epoch %llu: its primary is up", node->name, - humanNodename(node), (unsigned long long)requestCurrentEpoch); + serverLog(LL_WARNING, + "Failover auth denied to %.40s (%s) for epoch %llu: its primary is up", + node->name, + humanNodename(node), + (unsigned long long)requestCurrentEpoch); } return; } @@ -5353,7 +5575,10 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) { serverLog(LL_WARNING, "Failover auth denied to %.40s (%s): " "slot %d epoch (%llu) > reqConfigEpoch (%llu)", - node->name, humanNodename(node), slot, (unsigned long long)slot_owner->configEpoch, + node->name, + humanNodename(node), + slot, + (unsigned long long)slot_owner->configEpoch, (unsigned long long)requestConfigEpoch); /* Send an UPDATE message to the replica. After receiving the UPDATE message, @@ -5362,7 +5587,10 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) { serverLog(LL_VERBOSE, "Node %.40s (%s) has old slots configuration, sending " "an UPDATE message about %.40s (%s)", - node->name, humanNodename(node), slot_owner->name, humanNodename(slot_owner)); + node->name, + humanNodename(node), + slot_owner->name, + humanNodename(slot_owner)); clusterSendUpdate(node->link, slot_owner); return; } @@ -5372,7 +5600,10 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) { server.cluster->lastVoteEpoch = server.cluster->currentEpoch; clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_FSYNC_CONFIG); clusterSendFailoverAuth(node); - serverLog(LL_NOTICE, "Failover auth granted to %.40s (%s) for epoch %llu", node->name, humanNodename(node), + serverLog(LL_NOTICE, + "Failover auth granted to %.40s (%s) for epoch %llu", + node->name, + humanNodename(node), (unsigned long long)server.cluster->currentEpoch); } @@ -5408,8 +5639,8 @@ int clusterGetReplicaRank(void) { if (primary->replicas[j]->repl_offset > myoffset) { rank++; - } else if (primary->replicas[j]->repl_offset == myoffset && - memcmp(primary->replicas[j]->name, myself->name, CLUSTER_NAMELEN) < 0) { + } else if (primary->replicas[j]->repl_offset == myoffset + && memcmp(primary->replicas[j]->name, myself->name, CLUSTER_NAMELEN) < 0) { rank++; } } @@ -5508,8 +5739,8 @@ void clusterLogCantFailover(int reason) { } /* Special case: If the failure reason is due to data age, log 10 times less frequently. */ - if (reason == server.cluster->cant_failover_reason && reason == CLUSTER_CANT_FAILOVER_DATA_AGE && - now - lastlog_time < 10 * CLUSTER_CANT_FAILOVER_RELOG_PERIOD) { + if (reason == server.cluster->cant_failover_reason && reason == CLUSTER_CANT_FAILOVER_DATA_AGE + && now - lastlog_time < 10 * CLUSTER_CANT_FAILOVER_RELOG_PERIOD) { return; } @@ -5548,8 +5779,11 @@ void clusterFailoverReplaceYourPrimary(void) { if (clusterNodeIsPrimary(myself) || old_primary == NULL) return; - serverLog(LL_NOTICE, "Setting myself to primary in shard %.40s after failover; my old primary is %.40s (%s)", - myself->shard_id, old_primary->name, humanNodename(old_primary)); + serverLog(LL_NOTICE, + "Setting myself to primary in shard %.40s after failover; my old primary is %.40s (%s)", + myself->shard_id, + old_primary->name, + humanNodename(old_primary)); /* 1) Turn this node into a primary. */ clusterSetNodeAsPrimary(myself); @@ -5626,9 +5860,9 @@ void clusterHandleReplicaFailover(void) { * 2) Our primary is flagged as FAIL, or this is a manual failover. * 3) We don't have the no failover configuration set, and this is * not a manual failover. */ - if (clusterNodeIsPrimary(myself) || myself->replicaof == NULL || - (!nodeFailed(myself->replicaof) && !manual_failover) || - (server.cluster_replica_no_failover && !manual_failover)) { + if (clusterNodeIsPrimary(myself) || myself->replicaof == NULL + || (!nodeFailed(myself->replicaof) && !manual_failover) + || (server.cluster_replica_no_failover && !manual_failover)) { /* There are no reasons to failover, so we set the reason why we * are returning without failing over to NONE. */ server.cluster->cant_failover_reason = CLUSTER_CANT_FAILOVER_NONE; @@ -5652,9 +5886,9 @@ void clusterHandleReplicaFailover(void) { * factor configured by the user. * * Check bypassed for manual failovers. */ - if (server.cluster_replica_validity_factor && - data_age > (((mstime_t)server.repl_ping_replica_period * 1000) + - (server.cluster_node_timeout * server.cluster_replica_validity_factor))) { + if (server.cluster_replica_validity_factor + && data_age > (((mstime_t)server.repl_ping_replica_period * 1000) + + (server.cluster_node_timeout * server.cluster_replica_validity_factor))) { if (!manual_failover) { clusterLogCantFailover(CLUSTER_CANT_FAILOVER_DATA_AGE); return; @@ -5664,9 +5898,8 @@ void clusterHandleReplicaFailover(void) { /* If the previous failover attempt timeout and the retry time has * elapsed, we can setup a new one. */ if (auth_age > auth_retry_time) { - server.cluster->failover_auth_time = now + - delay + /* Fixed delay to let FAIL msg propagate. */ - random() % delay; /* Random delay between 0 and the fixed delay. */ + server.cluster->failover_auth_time = now + delay /* Fixed delay to let FAIL msg propagate. */ + + random() % delay; /* Random delay between 0 and the fixed delay. */ server.cluster->failover_auth_count = 0; server.cluster->failover_auth_sent = 0; server.cluster->failover_auth_rank = clusterGetReplicaRank(); @@ -5710,8 +5943,10 @@ void clusterHandleReplicaFailover(void) { serverLog(LL_NOTICE, "Start of election delayed for %lld milliseconds " "(rank #%d, primary rank #%d, offset %lld).", - server.cluster->failover_auth_time - now, server.cluster->failover_auth_rank, - server.cluster->failover_failed_primary_rank, replicationGetReplicaOffset()); + server.cluster->failover_auth_time - now, + server.cluster->failover_auth_rank, + server.cluster->failover_failed_primary_rank, + replicationGetReplicaOffset()); /* Now that we have a scheduled election, broadcast our offset * to all the other replicas so that they'll update their offsets * if our offset is better. */ @@ -5735,14 +5970,16 @@ void clusterHandleReplicaFailover(void) { * the election immediately. * * Not performed if this is a manual failover. */ - if (server.cluster->failover_auth_sent == 0 && server.cluster->mf_end == 0 && - server.cluster->failover_auth_time != now) { + if (server.cluster->failover_auth_sent == 0 && server.cluster->mf_end == 0 + && server.cluster->failover_auth_time != now) { int newrank = clusterGetReplicaRank(); if (newrank != server.cluster->failover_auth_rank) { long long added_delay = (newrank - server.cluster->failover_auth_rank) * (delay * 2); server.cluster->failover_auth_time += added_delay; server.cluster->failover_auth_rank = newrank; - serverLog(LL_NOTICE, "Replica rank updated to #%d, added %lld milliseconds of delay.", newrank, + serverLog(LL_NOTICE, + "Replica rank updated to #%d, added %lld milliseconds of delay.", + newrank, added_delay); } @@ -5751,8 +5988,10 @@ void clusterHandleReplicaFailover(void) { long long added_delay = (new_failed_primary_rank - server.cluster->failover_failed_primary_rank) * delay; server.cluster->failover_auth_time += added_delay; server.cluster->failover_failed_primary_rank = new_failed_primary_rank; - serverLog(LL_NOTICE, "Failed primary rank updated to #%d, added %lld milliseconds of delay.", - new_failed_primary_rank, added_delay); + serverLog(LL_NOTICE, + "Failed primary rank updated to #%d, added %lld milliseconds of delay.", + new_failed_primary_rank, + added_delay); } if (myselfIsBestRankedReplica()) { @@ -5779,8 +6018,10 @@ void clusterHandleReplicaFailover(void) { if (server.cluster->failover_auth_sent == 0) { server.cluster->currentEpoch++; server.cluster->failover_auth_epoch = server.cluster->currentEpoch; - serverLog(LL_NOTICE, "Starting a failover election for epoch %llu, node config epoch is %llu", - (unsigned long long)server.cluster->currentEpoch, (unsigned long long)nodeEpoch(myself)); + serverLog(LL_NOTICE, + "Starting a failover election for epoch %llu, node config epoch is %llu", + (unsigned long long)server.cluster->currentEpoch, + (unsigned long long)nodeEpoch(myself)); clusterRequestFailoverAuth(); server.cluster->failover_auth_sent = 1; clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_FSYNC_CONFIG); @@ -5797,7 +6038,8 @@ void clusterHandleReplicaFailover(void) { if (myself->configEpoch < server.cluster->failover_auth_epoch) { myself->configEpoch = server.cluster->failover_auth_epoch; clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_FSYNC_CONFIG | CLUSTER_TODO_BROADCAST_ALL); - serverLog(LL_NOTICE, "configEpoch set to %llu after successful failover", + serverLog(LL_NOTICE, + "configEpoch set to %llu after successful failover", (unsigned long long)myself->configEpoch); } @@ -5906,10 +6148,13 @@ void clusterHandleReplicaMigration(int max_replicas) { * couple of seconds, so that during failovers, we give some time to * the natural replicas of this instance to advertise their switch from * the old primary to the new one. */ - if (target && candidate == myself && (mstime() - target->orphaned_time) > CLUSTER_REPLICA_MIGRATION_DELAY && - !(server.cluster_module_flags & CLUSTER_MODULE_FLAG_NO_FAILOVER)) { - serverLog(LL_NOTICE, "Migrating to orphaned primary %.40s (%s) in shard %.40s", target->name, - humanNodename(target), target->shard_id); + if (target && candidate == myself && (mstime() - target->orphaned_time) > CLUSTER_REPLICA_MIGRATION_DELAY + && !(server.cluster_module_flags & CLUSTER_MODULE_FLAG_NO_FAILOVER)) { + serverLog(LL_NOTICE, + "Migrating to orphaned primary %.40s (%s) in shard %.40s", + target->name, + humanNodename(target), + target->shard_id); /* We are migrating to a different shard that has a completely different * replication history, so a full sync is required. */ clusterSetPrimary(target, 1, 1); @@ -6008,8 +6253,9 @@ void clusterHandleManualFailover(void) { /* Our replication offset matches the primary replication offset * announced after clients were paused. We can start the failover. */ manualFailoverCanStart(); - serverLog(LL_NOTICE, "All primary replication stream processed, " - "manual failover can start."); + serverLog(LL_NOTICE, + "All primary replication stream processed, " + "manual failover can start."); clusterDoBeforeSleep(CLUSTER_TODO_HANDLE_FAILOVER); return; } @@ -6051,18 +6297,19 @@ static int clusterNodeCronHandleReconnect(clusterNode *node, mstime_t now, long clusterDelNode(node); return 1; } - if (nodeInNormalState(node) && node->link != NULL && node->inbound_link == NULL && - now - node->inbound_link_freed_time > getHandshakeTimeout() && - now - node->meet_sent > getHandshakeTimeout() && - nodeSupportsMultiMeet(node)) { + if (nodeInNormalState(node) && node->link != NULL && node->inbound_link == NULL + && now - node->inbound_link_freed_time > getHandshakeTimeout() && now - node->meet_sent > getHandshakeTimeout() + && nodeSupportsMultiMeet(node)) { /* Node has an outbound link, but no inbound link for more than the handshake timeout. * This probably means this node does not know us yet, whereas we know it. * So we send it a MEET packet to do a handshake with it and correct the inconsistent cluster view. * We make sure to not re-send a MEET packet more than once every handshake timeout period, so as to * leave the other node time to complete the handshake. */ node->flags |= CLUSTER_NODE_MEET; - serverLog(LL_NOTICE, "Sending MEET packet to node %.40s (%s) because there is no inbound link for it", - node->name, humanNodename(node)); + serverLog(LL_NOTICE, + "Sending MEET packet to node %.40s (%s) because there is no inbound link for it", + node->name, + humanNodename(node)); clusterSendPing(node->link, CLUSTERMSG_TYPE_MEET); } @@ -6073,7 +6320,9 @@ static int clusterNodeCronHandleReconnect(clusterNode *node, mstime_t now, long * 2. The back‑off window since the last try is still active * 3. The node has already exceeded its retry budget for this cron cycle */ - if (!node->inbound_link && (now - node->outbound_link_attempt_time < reconnect_interval / NODE_CONNECTION_RETRIES_PER_TIMEOUT && *cluster_conn_attempts == 0)) { + if (!node->inbound_link + && (now - node->outbound_link_attempt_time < reconnect_interval / NODE_CONNECTION_RETRIES_PER_TIMEOUT + && *cluster_conn_attempts == 0)) { return 1; } node->outbound_link_attempt_time = now; @@ -6081,8 +6330,8 @@ static int clusterNodeCronHandleReconnect(clusterNode *node, mstime_t now, long clusterLink *link = createClusterLink(node); link->conn = connCreate(connTypeOfCluster()); connSetPrivateData(link->conn, link); - if (connConnect(link->conn, node->ip, node->cport, server.bind_source_addr, 0, clusterLinkConnectHandler) == - C_ERR) { + if (connConnect(link->conn, node->ip, node->cport, server.bind_source_addr, 0, clusterLinkConnectHandler) + == C_ERR) { /* We got a synchronous error from connect before * clusterSendPing() had a chance to be called. * If node->ping_sent is zero, failure detection can't work, @@ -6092,7 +6341,9 @@ static int clusterNodeCronHandleReconnect(clusterNode *node, mstime_t now, long serverLog(LL_DEBUG, "Unable to connect to " "Cluster Node [%s]:%d -> %s", - node->ip, node->cport, server.neterr); + node->ip, + node->cport, + server.neterr); freeClusterLink(link); return 0; @@ -6111,7 +6362,10 @@ static void freeClusterLinkOnBufferLimitReached(clusterLink *link) { serverLog(LL_WARNING, "Freeing cluster link(%s node %.40s (%s), used memory: %llu) due to " "exceeding send buffer memory limit.", - link->inbound ? "from" : "to", clusterLinkGetNodeName(link), clusterLinkGetHumanNodeName(link), mem_link); + link->inbound ? "from" : "to", + clusterLinkGetNodeName(link), + clusterLinkGetHumanNodeName(link), + mem_link); freeClusterLink(link); server.cluster->stat_cluster_links_buffer_limit_exceeded++; } @@ -6129,11 +6383,11 @@ static void clusterNodeCronFreeLinkOnBufferLimitReached(clusterNode *node) { * We want to guarantee that every node is contacted 10 times within node timeout. */ static long long maxConnectionAttemptsPerCron(void) { long long reconnect_interval = server.cluster_node_timeout / 2; - if (reconnect_interval <= 0) - return 0; + if (reconnect_interval <= 0) return 0; /* We run the cron loop every 100 ms. To reach 100 % of the nodes * within the timeout, we need: ceil(nodes * 100 / reconnect_interval) */ - const long long min_nodes_for_coverage = dictSize(server.cluster->nodes) * CLUSTER_CRON_PERIOD_MS / reconnect_interval; + const long long min_nodes_for_coverage = dictSize(server.cluster->nodes) * CLUSTER_CRON_PERIOD_MS + / reconnect_interval; /* Increase the coverage budget so each node can be probed 10 times * inside the timeout. */ return min_nodes_for_coverage * NODE_CONNECTION_RETRIES_PER_TIMEOUT; @@ -6170,7 +6424,9 @@ void clusterCron(void) { /* The protocol is that function(s) below return non-zero if the node was * terminated. */ - if (!server.debug_cluster_disable_reconnection && clusterNodeCronHandleReconnect(node, now, &cluster_node_conn_attempts)) continue; + if (!server.debug_cluster_disable_reconnection + && clusterNodeCronHandleReconnect(node, now, &cluster_node_conn_attempts)) + continue; } dictReleaseIterator(di); @@ -6250,8 +6506,8 @@ void clusterCron(void) { * received PONG is older than half the cluster timeout, send * a new ping now, to ensure all the nodes are pinged without * a too big delay. */ - mstime_t ping_interval = - server.cluster_ping_interval ? server.cluster_ping_interval : server.cluster_node_timeout / 2; + mstime_t ping_interval = server.cluster_ping_interval ? server.cluster_ping_interval + : server.cluster_node_timeout / 2; if (node->link && node->ping_sent == 0 && (now - node->pong_received) > ping_interval) { clusterSendPing(node->link, CLUSTERMSG_TYPE_PING); continue; @@ -6259,8 +6515,8 @@ void clusterCron(void) { /* If we are a primary and one of the replicas requested a manual * failover, ping it continuously. */ - if (server.cluster->mf_end && clusterNodeIsPrimary(myself) && server.cluster->mf_replica == node && - node->link) { + if (server.cluster->mf_end && clusterNodeIsPrimary(myself) && server.cluster->mf_replica == node + && node->link) { clusterSendPing(node->link, CLUSTERMSG_TYPE_PING); continue; } @@ -6312,8 +6568,8 @@ void clusterCron(void) { * the orphaned primaries. Note that it does not make sense to try * a migration if there is no primary with at least *two* working * replicas. */ - if (orphaned_primaries && max_replicas >= 2 && this_replicas == max_replicas && - server.cluster_allow_replica_migration) + if (orphaned_primaries && max_replicas >= 2 && this_replicas == max_replicas + && server.cluster_allow_replica_migration) clusterHandleReplicaMigration(max_replicas); } @@ -6349,8 +6605,7 @@ void clusterBeforeSleep(void) { * as it was handled only in clusterCron. This is needed when it * is likely that we can start the election or there is already * the quorum from primaries in order to react fast. */ - if (nodeIsReplica(myself) && - !(server.cluster_module_flags & CLUSTER_MODULE_FLAG_NO_FAILOVER)) { + if (nodeIsReplica(myself) && !(server.cluster_module_flags & CLUSTER_MODULE_FLAG_NO_FAILOVER)) { clusterHandleReplicaFailover(); } } @@ -6524,7 +6779,11 @@ int clusterDelNodeSlots(clusterNode *node) { * slots. This function currently only called after a failover occurs * within a shard, i.e. moving slots from the old primary to the new * primary. It is a special case of clusterUpdateSlotsConfigWith. */ -void clusterMoveNodeSlots(clusterNode *from_node, clusterNode *to_node, int *slots, int *importing_slots, int *migrating_slots) { +void clusterMoveNodeSlots(clusterNode *from_node, + clusterNode *to_node, + int *slots, + int *importing_slots, + int *migrating_slots) { serverAssert(areInSameShard(from_node, to_node)); int processed = 0, importing_processed = 0, migrating_processed = 0; @@ -6539,7 +6798,10 @@ void clusterMoveNodeSlots(clusterNode *from_node, clusterNode *to_node, int *slo serverLog(LL_VERBOSE, "Failover occurred in migration source. Update importing " "source for slot %d to node %.40s (%s) in shard %.40s.", - j, to_node->name, humanNodename(to_node), to_node->shard_id); + j, + to_node->name, + humanNodename(to_node), + to_node->shard_id); setImportingSlotSource(j, to_node); importing_processed++; } @@ -6548,7 +6810,10 @@ void clusterMoveNodeSlots(clusterNode *from_node, clusterNode *to_node, int *slo serverLog(LL_VERBOSE, "Failover occurred in migration target." " Slot %d is now being migrated to node %.40s (%s) in shard %.40s.", - j, to_node->name, humanNodename(to_node), to_node->shard_id); + j, + to_node->name, + humanNodename(to_node), + to_node->shard_id); setMigratingSlotDest(j, to_node); migrating_processed++; } @@ -6579,9 +6844,7 @@ void clusterLogFailReason(int reason) { msg = "At least one hash slot is not served by any available node. " "Please check the 'cluster-require-full-coverage' configuration."; break; - case CLUSTER_FAIL_MINORITY_PARTITION: - msg = "I am part of a minority partition."; - break; + case CLUSTER_FAIL_MINORITY_PARTITION: msg = "I am part of a minority partition."; break; default: serverPanic("Unknown fail reason code."); } serverLog(LL_WARNING, "Cluster is currently down: %s", msg); @@ -6610,8 +6873,8 @@ void clusterUpdateState(void) { * the first call to this function and not since the server start, in order * to not count the DB loading time. */ if (first_call_time == 0) first_call_time = mstime(); - if (clusterNodeIsPrimary(myself) && server.cluster->state == CLUSTER_FAIL && - mstime() - first_call_time < CLUSTER_WRITABLE_DELAY) { + if (clusterNodeIsPrimary(myself) && server.cluster->state == CLUSTER_FAIL + && mstime() - first_call_time < CLUSTER_WRITABLE_DELAY) { server.cluster->safe_to_join = 0; return; } else { @@ -6684,7 +6947,8 @@ void clusterUpdateState(void) { } /* Change the state and log the event. */ - serverLog(new_state == CLUSTER_OK ? LL_NOTICE : LL_WARNING, "Cluster state changed: %s", + serverLog(new_state == CLUSTER_OK ? LL_NOTICE : LL_WARNING, + "Cluster state changed: %s", new_state == CLUSTER_OK ? "ok" : "fail"); server.cluster->state = new_state; @@ -6769,8 +7033,13 @@ int verifyClusterConfigWithData(void) { serverLog(LL_NOTICE, "I am importing keys from node %.40s (%s) in shard %.40s to slot %d, " "but the slot is now owned by node %.40s (%s) in shard %.40s. Deleting keys in the slot", - in->name, humanNodename(in), in->shard_id, j, - slot_owner->name, humanNodename(slot_owner), slot_owner->shard_id); + in->name, + humanNodename(in), + in->shard_id, + j, + slot_owner->name, + humanNodename(slot_owner), + slot_owner->shard_id); } delKeysInSlot(j, server.lazyfree_lazy_server_del, true, false); } @@ -6835,15 +7104,14 @@ struct clusterNodeFlags { char *name; }; -static struct clusterNodeFlags clusterNodeFlagsTable[] = { - {CLUSTER_NODE_MYSELF, "myself,"}, - {CLUSTER_NODE_PRIMARY, "master,"}, - {CLUSTER_NODE_REPLICA, "slave,"}, - {CLUSTER_NODE_PFAIL, "fail?,"}, - {CLUSTER_NODE_FAIL, "fail,"}, - {CLUSTER_NODE_HANDSHAKE, "handshake,"}, - {CLUSTER_NODE_NOADDR, "noaddr,"}, - {CLUSTER_NODE_NOFAILOVER, "nofailover,"}}; +static struct clusterNodeFlags clusterNodeFlagsTable[] = {{CLUSTER_NODE_MYSELF, "myself,"}, + {CLUSTER_NODE_PRIMARY, "master,"}, + {CLUSTER_NODE_REPLICA, "slave,"}, + {CLUSTER_NODE_PFAIL, "fail?,"}, + {CLUSTER_NODE_FAIL, "fail,"}, + {CLUSTER_NODE_HANDSHAKE, "handshake,"}, + {CLUSTER_NODE_NOADDR, "noaddr,"}, + {CLUSTER_NODE_NOFAILOVER, "nofailover,"}}; /* Concatenate the comma separated list of node flags to the given SDS * string 'ci'. */ @@ -6924,7 +7192,11 @@ sds clusterGenNodeDescription(client *c, clusterNode *node, int tls_primary) { ci = sdscatlen(ci, "-", 1); /* Latency from the POV of this node, config epoch, link status */ - ci = sdscatfmt(ci, " %I %I %U %s", (long long)node->ping_sent, (long long)node->pong_received, nodeEpoch(node), + ci = sdscatfmt(ci, + " %I %I %U %s", + (long long)node->ping_sent, + (long long)node->pong_received, + nodeEpoch(node), (node->link || node->flags & CLUSTER_NODE_MYSELF) ? "connected" : "disconnected"); /* Slots served by this instance. If we already have slots info, @@ -7364,10 +7636,19 @@ sds genClusterInfoString(sds info) { "cluster_size:%i\r\n" "cluster_current_epoch:%U\r\n" "cluster_my_epoch:%U\r\n", - statestr[server.cluster->state], slots_assigned, slots_ok, slots_pfail, slots_fail, - nodes_pfail, nodes_fail, voting_nodes_pfail, voting_nodes_fail, - (unsigned long long)dictSize(server.cluster->nodes), server.cluster->size, - (unsigned long long)server.cluster->currentEpoch, (unsigned long long)my_epoch); + statestr[server.cluster->state], + slots_assigned, + slots_ok, + slots_pfail, + slots_fail, + nodes_pfail, + nodes_fail, + voting_nodes_pfail, + voting_nodes_fail, + (unsigned long long)dictSize(server.cluster->nodes), + server.cluster->size, + (unsigned long long)server.cluster->currentEpoch, + (unsigned long long)my_epoch); /* Show stats about messages sent and received. */ long long tot_msg_sent = 0; @@ -7376,7 +7657,9 @@ sds genClusterInfoString(sds info) { for (int i = 0; i < CLUSTERMSG_TYPE_COUNT; i++) { if (server.cluster->stats_bus_messages_sent[i] == 0) continue; tot_msg_sent += server.cluster->stats_bus_messages_sent[i]; - info = sdscatfmt(info, "cluster_stats_messages_%s_sent:%I\r\n", clusterGetMessageTypeString(i), + info = sdscatfmt(info, + "cluster_stats_messages_%s_sent:%I\r\n", + clusterGetMessageTypeString(i), (long long)server.cluster->stats_bus_messages_sent[i]); } info = sdscatfmt(info, "cluster_stats_messages_sent:%I\r\n", tot_msg_sent); @@ -7384,7 +7667,9 @@ sds genClusterInfoString(sds info) { for (int i = 0; i < CLUSTERMSG_TYPE_COUNT; i++) { if (server.cluster->stats_bus_messages_received[i] == 0) continue; tot_msg_received += server.cluster->stats_bus_messages_received[i]; - info = sdscatfmt(info, "cluster_stats_messages_%s_received:%I\r\n", clusterGetMessageTypeString(i), + info = sdscatfmt(info, + "cluster_stats_messages_%s_received:%I\r\n", + clusterGetMessageTypeString(i), (long long)server.cluster->stats_bus_messages_received[i]); } info = sdscatfmt(info, "cluster_stats_messages_received:%I\r\n", tot_msg_received); @@ -7402,7 +7687,8 @@ sds genClusterInfoString(sds info) { (unsigned long long)server.cluster->stats_bus_module_bytes_sent, (unsigned long long)server.cluster->stats_bus_module_bytes_received); - info = sdscatfmt(info, "total_cluster_links_buffer_limit_exceeded:%U\r\n", + info = sdscatfmt(info, + "total_cluster_links_buffer_limit_exceeded:%U\r\n", (unsigned long long)server.cluster->stat_cluster_links_buffer_limit_exceeded); return info; @@ -7520,7 +7806,8 @@ int clusterNodeIsPrimary(clusterNode *n) { } int handleDebugClusterCommand(client *c) { - if (c->argc != 5 || strcasecmp(objectGetVal(c->argv[1]), "CLUSTERLINK") || strcasecmp(objectGetVal(c->argv[2]), "KILL")) { + if (c->argc != 5 || strcasecmp(objectGetVal(c->argv[1]), "CLUSTERLINK") + || strcasecmp(objectGetVal(c->argv[2]), "KILL")) { return 0; } @@ -7833,7 +8120,11 @@ void clusterCommandSetSlot(client *c) { setMigratingSlotDest(slot, NULL); } else if (!strcasecmp(objectGetVal(c->argv[3]), "node")) { /* CLUSTER SETSLOT NODE */ - serverLog(LL_NOTICE, "Assigning slot %d to node %.40s (%s) in shard %.40s", slot, n->name, humanNodename(n), + serverLog(LL_NOTICE, + "Assigning slot %d to node %.40s (%s) in shard %.40s", + slot, + n->name, + humanNodename(n), n->shard_id); /* If this slot is in migrating status but we have no keys @@ -7857,7 +8148,9 @@ void clusterCommandSetSlot(client *c) { serverLog(LL_NOTICE, "Lost my last slot during slot migration. Reconfiguring myself " "as a replica of %.40s (%s) in shard %.40s", - n->name, humanNodename(n), n->shard_id); + n->name, + humanNodename(n), + n->shard_id); /* `c` is the primary client if `myself` is a replica, prevent it * from being freed by clusterSetPrimary. */ if (nodeIsReplica(myself)) protectClient(c); @@ -7865,8 +8158,8 @@ void clusterCommandSetSlot(client *c) { * replication history, so a full sync is required. */ clusterSetPrimary(n, 1, 1); if (nodeIsReplica(myself)) unprotectClient(c); - clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_FSYNC_CONFIG | - CLUSTER_TODO_BROADCAST_ALL); + clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG | CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_FSYNC_CONFIG + | CLUSTER_TODO_BROADCAST_ALL); } /* If replica migration is not allowed, check if the primary of this shard @@ -7876,7 +8169,9 @@ void clusterCommandSetSlot(client *c) { serverAssert(n != my_primary); serverLog(LL_NOTICE, "My last slot was migrated to node %.40s (%s) in shard %.40s. I am now an empty primary.", - n->name, humanNodename(n), n->shard_id); + n->name, + humanNodename(n), + n->shard_id); } /* If this node or this node's primary was importing this slot, @@ -7938,11 +8233,16 @@ int clusterCommandSpecial(client *c) { } if (clusterStartHandshake(objectGetVal(c->argv[2]), port, cport) == 0 && errno == EINVAL) { - addReplyErrorFormat(c, "Invalid node address specified: %s:%s", (char *)objectGetVal(c->argv[2]), + addReplyErrorFormat(c, + "Invalid node address specified: %s:%s", + (char *)objectGetVal(c->argv[2]), (char *)objectGetVal(c->argv[3])); } else { sds client = catClientInfoShortString(sdsempty(), c, server.hide_user_data_from_log); - serverLog(LL_NOTICE, "Cluster meet %s:%lld (user request from '%s').", (char *)objectGetVal(c->argv[2]), port, + serverLog(LL_NOTICE, + "Cluster meet %s:%lld (user request from '%s').", + (char *)objectGetVal(c->argv[2]), + port, client); sdsfree(client); addReply(c, shared.ok); @@ -7956,7 +8256,8 @@ int clusterCommandSpecial(client *c) { clusterDelNodeSlots(myself); clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_SAVE_CONFIG); addReply(c, shared.ok); - } else if ((!strcasecmp(objectGetVal(c->argv[1]), "addslots") || !strcasecmp(objectGetVal(c->argv[1]), "delslots")) && c->argc >= 3) { + } else if ((!strcasecmp(objectGetVal(c->argv[1]), "addslots") || !strcasecmp(objectGetVal(c->argv[1]), "delslots")) + && c->argc >= 3) { /* CLUSTER ADDSLOTS [slot] ... */ /* CLUSTER DELSLOTS [slot] ... */ int j, slot; @@ -7983,8 +8284,9 @@ int clusterCommandSpecial(client *c) { zfree(slots); clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE | CLUSTER_TODO_SAVE_CONFIG); addReply(c, shared.ok); - } else if ((!strcasecmp(objectGetVal(c->argv[1]), "addslotsrange") || !strcasecmp(objectGetVal(c->argv[1]), "delslotsrange")) && - c->argc >= 4) { + } else if ((!strcasecmp(objectGetVal(c->argv[1]), "addslotsrange") + || !strcasecmp(objectGetVal(c->argv[1]), "delslotsrange")) + && c->argc >= 4) { if (c->argc % 2 == 1) { addReplyErrorArity(c); return 1; @@ -8031,7 +8333,9 @@ int clusterCommandSpecial(client *c) { } else if (!strcasecmp(objectGetVal(c->argv[1]), "bumpepoch") && c->argc == 2) { /* CLUSTER BUMPEPOCH */ int retval = clusterBumpConfigEpochWithoutConsensus(); - sds reply = sdscatfmt(sdsempty(), "+%s %U\r\n", (retval == C_OK) ? "BUMPED" : "STILL", + sds reply = sdscatfmt(sdsempty(), + "+%s %U\r\n", + (retval == C_OK) ? "BUMPED" : "STILL", (unsigned long long)myself->configEpoch); addReplySds(c, reply); } else if (!strcasecmp(objectGetVal(c->argv[1]), "saveconfig") && c->argc == 2) { @@ -8121,8 +8425,9 @@ int clusterCommandSpecial(client *c) { * slots nor keys to accept to replicate some other node. * Replicas can switch to another primary without issues. */ if (clusterNodeIsPrimary(myself) && (myself->numslots != 0 || !dbsHaveNoKeys())) { - addReplyError(c, "To set a master the node must be empty and " - "without assigned slots."); + addReplyError(c, + "To set a master the node must be empty and " + "without assigned slots."); return 1; } @@ -8238,13 +8543,15 @@ int clusterCommandSpecial(client *c) { if (epoch < 0) { addReplyErrorFormat(c, "Invalid config epoch specified: %lld", epoch); } else if (dictSize(server.cluster->nodes) > 1) { - addReplyError(c, "The user can assign a config epoch only when the " - "node does not know any other node."); + addReplyError(c, + "The user can assign a config epoch only when the " + "node does not know any other node."); } else if (myself->configEpoch != 0) { addReplyError(c, "Node config epoch is already non-zero"); } else { myself->configEpoch = epoch; - serverLog(LL_NOTICE, "configEpoch set to %llu via CLUSTER SET-CONFIG-EPOCH", + serverLog(LL_NOTICE, + "configEpoch set to %llu via CLUSTER SET-CONFIG-EPOCH", (unsigned long long)myself->configEpoch); if (server.cluster->currentEpoch < (uint64_t)epoch) server.cluster->currentEpoch = epoch; @@ -8273,8 +8580,9 @@ int clusterCommandSpecial(client *c) { /* Replicas can be reset while containing data, but not primary nodes * that must be empty. */ if (clusterNodeIsPrimary(myself) && !dbsHaveNoKeys()) { - addReplyError(c, "CLUSTER RESET can't be called with " - "master nodes containing keys"); + addReplyError(c, + "CLUSTER RESET can't be called with " + "master nodes containing keys"); return 1; } sds client = catClientInfoShortString(sdsempty(), c, server.hide_user_data_from_log); @@ -8342,7 +8650,8 @@ const char **clusterCommandExtendedHelp(void) { "LINKS", " Return information about all network links between this node and its peers.", " Output format is an array where each array element is a map containing attributes of a link", - "MIGRATESLOTS SLOTSRANGE start-slot end-slot [start-slot end-slot ...] NODE node-id [SLOTSRANGE start-slot end-slot [start-slot end-slot ...] NODE node-id ...]", + "MIGRATESLOTS SLOTSRANGE start-slot end-slot [start-slot end-slot ...] NODE node-id [SLOTSRANGE start-slot " + "end-slot [start-slot end-slot ...] NODE node-id ...]", " Migrate the specified slot ranges from this node to the specified node.", "CANCELSLOTMIGRATIONS ALL", " Cancel all migrations.", @@ -8387,8 +8696,9 @@ int clusterAllowFailoverCmd(client *c) { if (!server.cluster_enabled) { return 1; } - addReplyError(c, "FAILOVER not allowed in cluster mode. " - "Use CLUSTER FAILOVER command instead."); + addReplyError(c, + "FAILOVER not allowed in cluster mode. " + "Use CLUSTER FAILOVER command instead."); return 0; } diff --git a/src/cluster_legacy.h b/src/cluster_legacy.h index 7703f071de0..9d0fb8f965b 100644 --- a/src/cluster_legacy.h +++ b/src/cluster_legacy.h @@ -49,26 +49,28 @@ typedef struct clusterLink { #define linkSupportsExtension(link) ((link)->flags & CLUSTER_LINK_EXTENSIONS_SUPPORTED) /* Cluster node flags and macros. */ -#define CLUSTER_NODE_PRIMARY (1 << 0) /* The node is a primary */ -#define CLUSTER_NODE_REPLICA (1 << 1) /* The node is a replica */ -#define CLUSTER_NODE_PFAIL (1 << 2) /* Failure? Need acknowledge */ -#define CLUSTER_NODE_FAIL (1 << 3) /* The node is believed to be malfunctioning */ -#define CLUSTER_NODE_MYSELF (1 << 4) /* This node is myself */ -#define CLUSTER_NODE_HANDSHAKE (1 << 5) /* We have still to exchange the first ping */ -#define CLUSTER_NODE_NOADDR (1 << 6) /* We don't know the address of this node */ -#define CLUSTER_NODE_MEET (1 << 7) /* Send a MEET message to this node */ -#define CLUSTER_NODE_MIGRATE_TO (1 << 8) /* Primary eligible for replica migration. */ -#define CLUSTER_NODE_NOFAILOVER (1 << 9) /* Replica will not try to failover. */ -#define CLUSTER_NODE_EXTENSIONS_SUPPORTED (1 << 10) /* This node supports extensions. */ -#define CLUSTER_NODE_LIGHT_HDR_PUBLISH_SUPPORTED (1 << 11) /* This node supports light message header for publish type. */ -#define CLUSTER_NODE_LIGHT_HDR_MODULE_SUPPORTED (1 << 12) /* This node supports light message header for module type. */ +#define CLUSTER_NODE_PRIMARY (1 << 0) /* The node is a primary */ +#define CLUSTER_NODE_REPLICA (1 << 1) /* The node is a replica */ +#define CLUSTER_NODE_PFAIL (1 << 2) /* Failure? Need acknowledge */ +#define CLUSTER_NODE_FAIL (1 << 3) /* The node is believed to be malfunctioning */ +#define CLUSTER_NODE_MYSELF (1 << 4) /* This node is myself */ +#define CLUSTER_NODE_HANDSHAKE (1 << 5) /* We have still to exchange the first ping */ +#define CLUSTER_NODE_NOADDR (1 << 6) /* We don't know the address of this node */ +#define CLUSTER_NODE_MEET (1 << 7) /* Send a MEET message to this node */ +#define CLUSTER_NODE_MIGRATE_TO (1 << 8) /* Primary eligible for replica migration. */ +#define CLUSTER_NODE_NOFAILOVER (1 << 9) /* Replica will not try to failover. */ +#define CLUSTER_NODE_EXTENSIONS_SUPPORTED (1 << 10) /* This node supports extensions. */ +#define CLUSTER_NODE_LIGHT_HDR_PUBLISH_SUPPORTED (1 << 11) /* This node supports light message header for publish type. */ +#define CLUSTER_NODE_LIGHT_HDR_MODULE_SUPPORTED (1 << 12) /* This node supports light message header for module type. */ + #define CLUSTER_NODE_MULTI_MEET_SUPPORTED CLUSTER_NODE_LIGHT_HDR_MODULE_SUPPORTED /* This node handles multi meet packet. \ Light hdr for module and multi meet were both introduced in 8.1, \ so we could reduce the same flag value. */ -#define CLUSTER_NODE_MY_PRIMARY_FAIL (1 << 13) /* myself is a replica and my primary is FAIL in my view. \ - * myself will gossip this flag to other replica in the \ - * shard so that the replicas can make a better ranking \ - * decisions to help with the failover. */ + +#define CLUSTER_NODE_MY_PRIMARY_FAIL (1 << 13) /* myself is a replica and my primary is FAIL in my view. \ + * myself will gossip this flag to other replica in the \ + * shard so that the replicas can make a better ranking \ + * decisions to help with the failover. */ #define CLUSTER_NODE_NULL_NAME \ "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" \ @@ -332,7 +334,7 @@ static_assert(offsetof(clusterMsg, data) == 2256, "unexpected field offset"); /* Message flags better specify the packet content or are used to * provide some information about the node state. */ #define CLUSTERMSG_FLAG0_PAUSED (1 << 0) /* Primary paused for manual failover. */ -#define CLUSTERMSG_FLAG0_FORCEACK (1 << 1) /* Give ACK to AUTH_REQUEST even if \ +#define CLUSTERMSG_FLAG0_FORCEACK (1 << 1) /* Give ACK to AUTH_REQUEST even if \ primary is up. */ #define CLUSTERMSG_FLAG0_EXT_DATA (1 << 2) /* Message contains extension data */ diff --git a/src/cluster_migrateslots.c b/src/cluster_migrateslots.c index f77f0b3d337..416fd54ea1f 100644 --- a/src/cluster_migrateslots.c +++ b/src/cluster_migrateslots.c @@ -92,23 +92,16 @@ typedef struct slotMigrationJob { static bool isSlotMigrationJobFinished(slotMigrationJob *job); static bool isSlotMigrationJobInProgress(slotMigrationJob *job); -static slotMigrationJob *createSlotImportJob(client *c, - clusterNode *source_node, - char *name, - list *slot_ranges); +static slotMigrationJob *createSlotImportJob(client *c, clusterNode *source_node, char *name, list *slot_ranges); static int connectSlotExportJob(slotMigrationJob *job); static const char *slotMigrationJobStateToString(slotMigrationJobState state); -static void updateSlotMigrationJobState(slotMigrationJob *job, - slotMigrationJobState state); +static void updateSlotMigrationJobState(slotMigrationJob *job, slotMigrationJobState state); static void sendSyncSlotsMessage(slotMigrationJob *job, const char *subcommand); static void proceedWithSlotMigration(slotMigrationJob *job); -static slotMigrationJob *createSlotExportJob(clusterNode *target_node, - list *slot_ranges); +static slotMigrationJob *createSlotExportJob(clusterNode *target_node, list *slot_ranges); static bool isSlotExportPauseTimedOut(slotMigrationJob *job); static void resetSlotMigrationJob(slotMigrationJob *job); -static void finishSlotMigrationJob(slotMigrationJob *job, - slotMigrationJobState state, - char *message); +static void finishSlotMigrationJob(slotMigrationJob *job, slotMigrationJobState state, char *message); static void freeSlotMigrationJob(void *o); static sds generateSlotMigrationJobDescription(slotMigrationJob *job, clusterNode *other_node); static void slotExportTryUnpause(void); @@ -184,8 +177,7 @@ bool isSlotInSlotRanges(int slot, list *slot_ranges) { /* Return whether or not the two slot ranges overlap or are distinct. */ bool doSlotRangesOverlap(slotRange *range1, slotRange *range2) { - return range1->end_slot >= range2->start_slot && - range1->start_slot <= range2->end_slot; + return range1->end_slot >= range2->start_slot && range1->start_slot <= range2->end_slot; } /* Return whether or not the two lists of slot ranges overlap or are @@ -225,9 +217,7 @@ void delKeysNotOwnedByMyself(list *slot_ranges) { } } -void setSlotImportingStateInDb(serverDb *db, - list *slot_ranges, - int is_importing) { +void setSlotImportingStateInDb(serverDb *db, list *slot_ranges, int is_importing) { if (db == NULL) return; listNode *ln; listIter li; @@ -237,8 +227,7 @@ void setSlotImportingStateInDb(serverDb *db, for (int slot = range->start_slot; slot <= range->end_slot; slot++) { kvstoreSetIsImporting(db->keys, slot, is_importing); kvstoreSetIsImporting(db->expires, slot, is_importing); - kvstoreSetIsImporting(db->keys_with_volatile_items, slot, - is_importing); + kvstoreSetIsImporting(db->keys_with_volatile_items, slot, is_importing); } } } @@ -258,10 +247,7 @@ void setSlotImportingStateInAllDbs(list *slot_ranges, int is_importing) { * Note that all slots in the slot range should belong to a sole node in the * cluster topology. node_out will be set to the node that owns all the * slots. */ -list *parseSlotRangesOrReply(client *c, - int start_index, - int *end_index_out, - clusterNode **node_out) { +list *parseSlotRangesOrReply(client *c, int start_index, int *end_index_out, clusterNode **node_out) { list *slot_ranges = createSlotRangeList(); *node_out = NULL; *end_index_out = c->argc; @@ -288,7 +274,8 @@ list *parseSlotRangesOrReply(client *c, addReplyErrorFormat(c, "Start slot number %d is greater than end slot " "number %d.", - startslot, endslot); + startslot, + endslot); goto cleanup; } /* Check if the current slot range is ready to do the migration. */ @@ -547,8 +534,7 @@ void clusterCommandSyncSlotsEstablish(client *c) { int i = 3; while (i < c->argc) { if (!strcasecmp(objectGetVal(c->argv[i]), "source")) { - if (source_node || i + 1 >= c->argc || - sdslen(objectGetVal(c->argv[i + 1])) != CLUSTER_NAMELEN) { + if (source_node || i + 1 >= c->argc || sdslen(objectGetVal(c->argv[i + 1])) != CLUSTER_NAMELEN) { addReplyErrorObject(c, shared.syntaxerr); goto cleanup; } @@ -575,8 +561,7 @@ void clusterCommandSyncSlotsEstablish(client *c) { continue; } if (!strcasecmp(objectGetVal(c->argv[i]), "name")) { - if (name || i + 1 >= c->argc || - sdslen(objectGetVal(c->argv[i + 1])) != CLUSTER_NAMELEN) { + if (name || i + 1 >= c->argc || sdslen(objectGetVal(c->argv[i + 1])) != CLUSTER_NAMELEN) { addReplyErrorObject(c, shared.syntaxerr); goto cleanup; } @@ -602,8 +587,9 @@ void clusterCommandSyncSlotsEstablish(client *c) { slotRange *range = ln->value; for (int i = range->start_slot; i <= range->end_slot; i++) { if (clusterIsSlotImporting(i)) { - addReplyError(c, "Slot is already being imported on " - "the target by a different migration"); + addReplyError(c, + "Slot is already being imported on " + "the target by a different migration"); goto cleanup; } } @@ -647,8 +633,9 @@ void clusterCommandSyncSlotsEstablish(client *c) { /* Sent by the source to the target after dumping the snapshot in AOF format. */ void clusterCommandSyncSlotsSnapshotEof(client *c) { if (!c->slot_migration_job) { - addReplyError(c, "CLUSTER SYNCSLOTS SNAPSHOT-EOF should only be used " - "by slot migration clients"); + addReplyError(c, + "CLUSTER SYNCSLOTS SNAPSHOT-EOF should only be used " + "by slot migration clients"); return; } serverAssert(isSlotMigrationJobInProgress(c->slot_migration_job)); @@ -658,8 +645,7 @@ void clusterCommandSyncSlotsSnapshotEof(client *c) { "%s, but not currently loading an AOF snapshot. Failing " "migration.", c->slot_migration_job->description); - finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, - "Unexpected state machine transition"); + finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, "Unexpected state machine transition"); return; } serverLog(LL_NOTICE, @@ -667,16 +653,16 @@ void clusterCommandSyncSlotsSnapshotEof(client *c) { "Beginning incremental stream...", c->slot_migration_job->description); sendSyncSlotsMessage(c->slot_migration_job, "REQUEST-PAUSE"); - updateSlotMigrationJobState(c->slot_migration_job, - SLOT_IMPORT_WAITING_FOR_PAUSED); + updateSlotMigrationJobState(c->slot_migration_job, SLOT_IMPORT_WAITING_FOR_PAUSED); } /* Sent by the source to the target as a marker of when the pause * began (therefore, target is caught up once read). */ void clusterCommandSyncSlotsPaused(client *c) { if (!c->slot_migration_job) { - addReplyError(c, "CLUSTER SYNCSLOTS PAUSED should only be used by slot " - "migration clients"); + addReplyError(c, + "CLUSTER SYNCSLOTS PAUSED should only be used by slot " + "migration clients"); return; } serverAssert(isSlotMigrationJobInProgress(c->slot_migration_job)); @@ -685,21 +671,20 @@ void clusterCommandSyncSlotsPaused(client *c) { "Received unexpected CLUSTER SYNCSLOTS PAUSED from slot " "migration %s, . Failing migration.", c->slot_migration_job->description); - finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, - "Unexpected state machine transition"); + finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, "Unexpected state machine transition"); return; } sendSyncSlotsMessage(c->slot_migration_job, "REQUEST-FAILOVER"); - updateSlotMigrationJobState(c->slot_migration_job, - SLOT_IMPORT_FAILOVER_REQUESTED); + updateSlotMigrationJobState(c->slot_migration_job, SLOT_IMPORT_FAILOVER_REQUESTED); } /* Sent by the source to the target to grant final authorization for * failover. */ void clusterCommandSyncSlotsFailoverGranted(client *c) { if (!c->slot_migration_job) { - addReplyError(c, "CLUSTER SYNCSLOTS FAILOVER-GRANTED should only be " - "used by slot migration clients"); + addReplyError(c, + "CLUSTER SYNCSLOTS FAILOVER-GRANTED should only be " + "used by slot migration clients"); return; } serverAssert(isSlotMigrationJobInProgress(c->slot_migration_job)); @@ -709,12 +694,10 @@ void clusterCommandSyncSlotsFailoverGranted(client *c) { "migration %s, but we never sent a failover request. Failing " "migration.", c->slot_migration_job->description); - finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, - "Unexpected state machine transition"); + finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, "Unexpected state machine transition"); return; } - updateSlotMigrationJobState(c->slot_migration_job, - SLOT_IMPORT_FAILOVER_GRANTED); + updateSlotMigrationJobState(c->slot_migration_job, SLOT_IMPORT_FAILOVER_GRANTED); clusterDoBeforeSleep(CLUSTER_TODO_HANDLE_SLOT_MIGRATION); } @@ -736,8 +719,7 @@ void clusterCommandSyncSlotsFinish(client *c) { continue; } if (!strcasecmp(objectGetVal(c->argv[i]), "name")) { - if (name || i + 1 >= c->argc || - sdslen(objectGetVal(c->argv[i + 1])) != CLUSTER_NAMELEN) { + if (name || i + 1 >= c->argc || sdslen(objectGetVal(c->argv[i + 1])) != CLUSTER_NAMELEN) { addReplyErrorObject(c, shared.syntaxerr); return; } @@ -785,10 +767,7 @@ void clusterCommandSyncSlotsFinish(client *c) { finishSlotMigrationJob(job, target_state, message); } -slotMigrationJob *createSlotImportJob(client *c, - clusterNode *source_node, - char *name, - list *slot_ranges) { +slotMigrationJob *createSlotImportJob(client *c, clusterNode *source_node, char *name, list *slot_ranges) { slotMigrationJob *job = zcalloc(sizeof(slotMigrationJob)); memcpy(job->name, name, CLUSTER_NAMELEN); job->ctime = server.unixtime; @@ -936,12 +915,12 @@ void clusterUpdateSlotImportsOnOwnershipChange(void) { clusterNode *n = getClusterNodeBySlotRanges(job->slot_ranges, NULL); if (n && !memcmp(n->name, job->source_node_name, CLUSTER_NAMELEN)) continue; if (n == server.cluster->myself) { - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, + finishSlotMigrationJob(job, + SLOT_MIGRATION_JOB_FAILED, "Slots were unexpectedly assigned to myself " "during import"); } - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, - "Slots are no longer owned by source node"); + finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, "Slots are no longer owned by source node"); } } @@ -1162,8 +1141,7 @@ void clusterCommandMigrateSlots(client *c) { curr_index++; clusterNode *source_node = NULL; - slot_ranges = parseSlotRangesOrReply(c, curr_index, &curr_index, - &source_node); + slot_ranges = parseSlotRangesOrReply(c, curr_index, &curr_index, &source_node); if (slot_ranges == NULL) { goto cleanup; } @@ -1179,8 +1157,7 @@ void clusterCommandMigrateSlots(client *c) { slotRange *range = (slotRange *)ln->value; for (int j = range->start_slot; j <= range->end_slot; j++) { if (clusterIsSlotExporting(j)) { - addReplyErrorFormat(c, - "I am already migrating slot %d.", j); + addReplyErrorFormat(c, "I am already migrating slot %d.", j); goto cleanup; } } @@ -1195,22 +1172,18 @@ void clusterCommandMigrateSlots(client *c) { } } - if (curr_index + 1 >= c->argc || - strcasecmp(objectGetVal(c->argv[curr_index]), "node")) { + if (curr_index + 1 >= c->argc || strcasecmp(objectGetVal(c->argv[curr_index]), "node")) { addReplyErrorObject(c, shared.syntaxerr); goto cleanup; } curr_index++; if (sdslen(objectGetVal(c->argv[curr_index])) != CLUSTER_NAMELEN) { - addReplyErrorFormat(c, "Invalid node name: %s", - (sds)objectGetVal(c->argv[curr_index])); + addReplyErrorFormat(c, "Invalid node name: %s", (sds)objectGetVal(c->argv[curr_index])); goto cleanup; } - clusterNode *target_node = clusterLookupNode(objectGetVal(c->argv[curr_index]), - CLUSTER_NAMELEN); + clusterNode *target_node = clusterLookupNode(objectGetVal(c->argv[curr_index]), CLUSTER_NAMELEN); if (!target_node) { - addReplyErrorFormat(c, "Unknown node name: %s", - (sds)objectGetVal(c->argv[curr_index])); + addReplyErrorFormat(c, "Unknown node name: %s", (sds)objectGetVal(c->argv[curr_index])); goto cleanup; } if (target_node == server.cluster->myself) { @@ -1228,15 +1201,15 @@ void clusterCommandMigrateSlots(client *c) { listIter li; listRewind(new_slot_migrations, &li); listNode *ln; - sds client_info = catClientInfoShortString(sdsempty(), c, - server.hide_user_data_from_log); + sds client_info = catClientInfoShortString(sdsempty(), c, server.hide_user_data_from_log); while ((ln = listNext(&li))) { slotMigrationJob *job = ln->value; listAddNodeHead(server.cluster->slot_migration_jobs, job); serverLog(LL_NOTICE, "Slot migration initiated through CLUSTER MIGRATESLOTS " "command: %s (user request from '%s')", - job->description, client_info); + job->description, + client_info); fireModuleSlotMigrationEvent(job, VALKEYMODULE_SUBEVENT_ATOMIC_SLOT_MIGRATION_EXPORT_STARTED); proceedWithSlotMigration(job); } @@ -1276,14 +1249,12 @@ void clusterCommandCancelSlotMigrations(client *c) { listRewind(server.cluster->slot_migration_jobs, &li); while ((ln = listNext(&li)) != NULL) { slotMigrationJob *job = ln->value; - if (!isSlotMigrationJobInProgress(job) || - job->type == SLOT_MIGRATION_IMPORT) { + if (!isSlotMigrationJobInProgress(job) || job->type == SLOT_MIGRATION_IMPORT) { continue; } finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_CANCELLED, NULL); } - sds client_info = catClientInfoShortString(sdsempty(), c, - server.hide_user_data_from_log); + sds client_info = catClientInfoShortString(sdsempty(), c, server.hide_user_data_from_log); serverLog(LL_NOTICE, "Canceled all in progress slot migrations (user request from " "'%s')", @@ -1307,18 +1278,15 @@ int connectSlotExportJob(slotMigrationJob *job) { serverLog(LL_WARNING, "Slot migration %s: target node %.40s not found in cluster, " "aborting connection attempt.", - job->description, job->target_node_name); + job->description, + job->target_node_name); return C_ERR; } int port = getNodeDefaultReplicationPort(n); - serverLog(LL_NOTICE, "Connecting slot migration %s (ip: %s, port %d)", - job->description, - n->ip, - port); + serverLog(LL_NOTICE, "Connecting slot migration %s (ip: %s, port %d)", job->description, n->ip, port); job->conn = connCreate(connTypeOfReplication()); - if (connConnect(job->conn, n->ip, port, server.bind_source_addr, - 0, slotExportConnectHandler) == C_ERR) { + if (connConnect(job->conn, n->ip, port, server.bind_source_addr, 0, slotExportConnectHandler) == C_ERR) { return C_ERR; } @@ -1336,12 +1304,9 @@ int proceedWithSlotExportJobConnecting(slotMigrationJob *job, bool *completed) { *completed = false; switch (connGetState(job->conn)) { - case CONN_STATE_CONNECTED: - *completed = true; - return C_OK; + case CONN_STATE_CONNECTED: *completed = true; return C_OK; case CONN_STATE_CONNECTING: return C_OK; - default: - return C_ERR; + default: return C_ERR; } } @@ -1417,9 +1382,12 @@ sds generateSyncSlotsEstablishCommand(slotMigrationJob *job) { listRewind(job->slot_ranges, &li); while ((ln = listNext(&li))) { slotRange *range = (slotRange *)ln->value; - result = sdscatfmt(result, "$%i\r\n%i\r\n$%i\r\n%i\r\n", - digits10(range->start_slot), range->start_slot, - digits10(range->end_slot), range->end_slot); + result = sdscatfmt(result, + "$%i\r\n%i\r\n$%i\r\n%i\r\n", + digits10(range->start_slot), + range->start_slot, + digits10(range->end_slot), + range->end_slot); } return result; } @@ -1438,9 +1406,7 @@ void slotExportBeginStreaming(slotMigrationJob *job) { * flush it. */ putClientInPendingWriteQueue(job->client); - serverLog(LL_NOTICE, - "Slot migration %s snapshot finished, starting streaming.", - job->description); + serverLog(LL_NOTICE, "Slot migration %s snapshot finished, starting streaming.", job->description); } /* Attempt to pause the provided slot export job. If we can pause, the state @@ -1449,17 +1415,17 @@ void slotExportBeginStreaming(slotMigrationJob *job) { int slotExportTryDoPause(slotMigrationJob *job) { serverAssert(job->type == SLOT_MIGRATION_EXPORT); - if (server.debug_slot_migration_prevent_pause || - (server.slot_migration_max_failover_repl_bytes >= 0 && - job->client->reply_bytes > (size_t)server.slot_migration_max_failover_repl_bytes)) { + if (server.debug_slot_migration_prevent_pause + || (server.slot_migration_max_failover_repl_bytes >= 0 + && job->client->reply_bytes > (size_t)server.slot_migration_max_failover_repl_bytes)) { return C_ERR; } serverLog(LL_NOTICE, "Pausing writes (remaining_repl_size is %lld) to allow slot migration %s to finalize failover.", - job->client->reply_bytes, job->description); + job->client->reply_bytes, + job->description); job->mf_end = mstime() + server.cluster_mf_timeout * CLUSTER_MF_PAUSE_MULT; - pauseActions(PAUSE_DURING_SLOT_MIGRATION, job->mf_end, - PAUSE_ACTIONS_CLIENT_WRITE_SET); + pauseActions(PAUSE_DURING_SLOT_MIGRATION, job->mf_end, PAUSE_ACTIONS_CLIENT_WRITE_SET); sendSyncSlotsMessage(job, "PAUSED"); return C_OK; } @@ -1468,21 +1434,21 @@ int slotExportTryDoPause(slotMigrationJob *job) { * failover. */ void clusterCommandSyncSlotsRequestPause(client *c) { if (!c->slot_migration_job) { - addReplyError(c, "CLUSTER SYNCSLOTS REQUEST-PAUSE should only be used " - "by slot migration clients"); + addReplyError(c, + "CLUSTER SYNCSLOTS REQUEST-PAUSE should only be used " + "by slot migration clients"); return; } serverAssert(isSlotMigrationJobInProgress(c->slot_migration_job)); /* Child process may not have closed yet, so SNAPSHOTTING is okay here */ - if (c->slot_migration_job->state != SLOT_EXPORT_STREAMING && - c->slot_migration_job->state != SLOT_EXPORT_SNAPSHOTTING) { + if (c->slot_migration_job->state != SLOT_EXPORT_STREAMING + && c->slot_migration_job->state != SLOT_EXPORT_SNAPSHOTTING) { serverLog(LL_WARNING, "Received CLUSTER SYNCSLOTS REQUEST-PAUSE for slot migration " "%s, but the client was not streaming incremental updates. " "Failing migration.", c->slot_migration_job->description); - finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, - "Unexpected state machine transition"); + finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, "Unexpected state machine transition"); return; } if (c->slot_migration_job->state != SLOT_EXPORT_STREAMING) { @@ -1490,12 +1456,10 @@ void clusterCommandSyncSlotsRequestPause(client *c) { } if (slotExportTryDoPause(c->slot_migration_job) == C_ERR) { - updateSlotMigrationJobState(c->slot_migration_job, - SLOT_EXPORT_WAITING_TO_PAUSE); + updateSlotMigrationJobState(c->slot_migration_job, SLOT_EXPORT_WAITING_TO_PAUSE); return; } - updateSlotMigrationJobState(c->slot_migration_job, - SLOT_EXPORT_FAILOVER_PAUSED); + updateSlotMigrationJobState(c->slot_migration_job, SLOT_EXPORT_FAILOVER_PAUSED); } /* Sent by the target to the source to request final authorization for @@ -1515,8 +1479,7 @@ void clusterCommandSyncSlotsRequestFailover(client *c) { "migration %s, but the client was not in the paused state. " "Failing migration.", c->slot_migration_job->description); - finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, - "Unexpected state machine transition"); + finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, "Unexpected state machine transition"); return; } @@ -1526,8 +1489,7 @@ void clusterCommandSyncSlotsRequestFailover(client *c) { "Received CLUSTER SYNCSLOTS REQUEST-FAILOVER on slot " "migration %s, but we are not paused. Denying failover.", c->slot_migration_job->description); - finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, - "Unpaused before failover completed"); + finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, "Unpaused before failover completed"); return; } @@ -1537,13 +1499,11 @@ void clusterCommandSyncSlotsRequestFailover(client *c) { mstime_t prop_deadline = mstime() + CLUSTER_OPERATION_TIMEOUT; if (c->slot_migration_job->mf_end < prop_deadline) { c->slot_migration_job->mf_end = prop_deadline; - pauseActions(PAUSE_DURING_SLOT_MIGRATION, prop_deadline, - PAUSE_ACTIONS_CLIENT_WRITE_SET); + pauseActions(PAUSE_DURING_SLOT_MIGRATION, prop_deadline, PAUSE_ACTIONS_CLIENT_WRITE_SET); } sendSyncSlotsMessage(c->slot_migration_job, "FAILOVER-GRANTED"); - updateSlotMigrationJobState(c->slot_migration_job, - SLOT_EXPORT_FAILOVER_GRANTED); + updateSlotMigrationJobState(c->slot_migration_job, SLOT_EXPORT_FAILOVER_GRANTED); } /* Predicate function supplied to rewriteAppendOnlyFileRio to filter to only @@ -1564,8 +1524,7 @@ int childSnapshotForSyncSlot(rio *aof, slotMigrationJob *job) { while ((ln = listNext(&li))) { slotRange *r = (slotRange *)ln->value; for (int slot = r->start_slot; slot <= r->end_slot; slot++) { - if (rewriteSlotToAppendOnlyFileRio( - aof, db_num, slot, &key_count) == C_ERR) return C_ERR; + if (rewriteSlotToAppendOnlyFileRio(aof, db_num, slot, &key_count) == C_ERR) return C_ERR; } } } @@ -1638,7 +1597,8 @@ int slotExportJobBeginSnapshotToTargetSocket(slotMigrationJob *job) { rioFreeFd(&aof); /* wake up the reader, tell it we're done. */ close(slot_migration_pipe_write); - close(server.slot_migration_child_exit_pipe); /* close write end so that we can detect the close on the parent. */ + /* close write end so that we can detect the close on the parent. */ + close(server.slot_migration_child_exit_pipe); ssize_t dummy = read(safe_to_exit_pipe, pipefds, 1); UNUSED(dummy); exitFromChild((retval == C_OK) ? 0 : 1); @@ -1655,7 +1615,12 @@ int slotExportJobBeginSnapshotToTargetSocket(slotMigrationJob *job) { serverLog(LL_NOTICE, "Started child process %ld for slot migration %s", (long)childpid, job->description); close(slot_migration_pipe_write); /* close write in parent so that it can detect the close on the child. */ - if (aeCreateFileEvent(server.el, server.slot_migration_pipe_read, AE_READABLE, slotMigrationPipeReadHandler, NULL) == AE_ERR) { + if (aeCreateFileEvent(server.el, + server.slot_migration_pipe_read, + AE_READABLE, + slotMigrationPipeReadHandler, + NULL) + == AE_ERR) { serverPanic("Unrecoverable error creating server.slot_migration_pipe_read file event."); } close(safe_to_exit_pipe); @@ -1699,11 +1664,8 @@ void backgroundSlotMigrationDoneHandler(int exitcode, int bysignal) { slotExportBeginStreaming(job); job->stat_cow_bytes = server.stat_slot_migration_cow_bytes; } else { - serverLog(LL_WARNING, - "Child process failed to snapshot slot migration %s", - job->description); - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, - "Failed to perform snapshot"); + serverLog(LL_WARNING, "Child process failed to snapshot slot migration %s", job->description); + finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, "Failed to perform snapshot"); } } } @@ -1740,8 +1702,7 @@ void clusterFeedSlotExportJobs(int dbid, robj **argv, int argc, int slot) { slotMigrationJob *job = (slotMigrationJob *)ln->value; if (job->type != SLOT_MIGRATION_EXPORT) continue; if (!job->client) continue; - if (!isSlotMigrationJobInProgress(job) || - job->state < SLOT_EXPORT_SNAPSHOTTING) continue; + if (!isSlotMigrationJobInProgress(job) || job->state < SLOT_EXPORT_SNAPSHOTTING) continue; if (!isSlotInSlotRanges(slot, job->slot_ranges)) continue; if (dbid != job->client->db->id) { @@ -1763,8 +1724,7 @@ void clusterFeedSlotExportJobs(int dbid, robj **argv, int argc, int slot) { } bool isSlotExportPauseTimedOut(slotMigrationJob *job) { - return job->mf_end < mstime() || - !getPausedActionsWithPurpose(PAUSE_DURING_SLOT_MIGRATION); + return job->mf_end < mstime() || !getPausedActionsWithPurpose(PAUSE_DURING_SLOT_MIGRATION); } /* Revalidate that the migration's slots are still owned by ourselves, or fail @@ -1781,9 +1741,7 @@ int checkSlotExportOwnership(slotMigrationJob *job, bool *migration_done) { return C_OK; } else if (!memcmp(n->name, job->target_node_name, CLUSTER_NAMELEN)) { *migration_done = true; - serverLog(LL_NOTICE, - "Slot migration %s slots are now owned by target node.", - job->description); + serverLog(LL_NOTICE, "Slot migration %s slots are now owned by target node.", job->description); return C_OK; } } @@ -1808,8 +1766,7 @@ void clusterUpdateSlotExportsOnOwnershipChange(void) { if (job->type != SLOT_MIGRATION_EXPORT) continue; bool migration_done; if (checkSlotExportOwnership(job, &migration_done) == C_ERR) { - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, - "Slots are no longer owned by myself"); + finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, "Slots are no longer owned by myself"); } else if (migration_done) { finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_SUCCESS, NULL); } @@ -1863,8 +1820,7 @@ size_t clusterGetTotalSlotExportBufferMemory(void) { } /* Create a slot export job with the given target and slot ranges. */ -slotMigrationJob *createSlotExportJob(clusterNode *target_node, - list *slot_ranges) { +slotMigrationJob *createSlotExportJob(clusterNode *target_node, list *slot_ranges) { slotMigrationJob *job = zcalloc(sizeof(slotMigrationJob)); job->ctime = server.unixtime; @@ -1892,14 +1848,11 @@ void slotMigrationJobReadEstablishResponse(connection *conn) { } if (!job->response_buf) { job->response_buf = sdsempty(); - job->response_buf = sdsMakeRoomForNonGreedy(job->response_buf, - PROTO_IOBUF_LEN); + job->response_buf = sdsMakeRoomForNonGreedy(job->response_buf, PROTO_IOBUF_LEN); } int result; - result = connRead(conn, - ((char *)job->response_buf) + sdslen(job->response_buf), - sdsavail(job->response_buf)); + result = connRead(conn, ((char *)job->response_buf) + sdslen(job->response_buf), sdsavail(job->response_buf)); if (result > 0) { sdsIncrLen(job->response_buf, result); } @@ -1907,13 +1860,13 @@ void slotMigrationJobReadEstablishResponse(connection *conn) { freeClientAsync(c); return; } - if (sdslen(job->response_buf) < 2 || - job->response_buf[sdslen(job->response_buf) - 2] != '\r' || - job->response_buf[sdslen(job->response_buf) - 1] != '\n') { + if (sdslen(job->response_buf) < 2 || job->response_buf[sdslen(job->response_buf) - 2] != '\r' + || job->response_buf[sdslen(job->response_buf) - 1] != '\n') { if (sdsavail(job->response_buf) == 0) { /* We filled up the buffer, and we still have no response. Only * choice is to stop the migration. */ - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, + finishSlotMigrationJob(job, + SLOT_MIGRATION_JOB_FAILED, "Response to establish job is larger than " "buffer limit"); return; @@ -1922,8 +1875,9 @@ void slotMigrationJobReadEstablishResponse(connection *conn) { return; } if (job->response_buf[0] == '-') { - sds err_msg = sdscatfmt(sdsempty(), "Received error during handshake " - "to target: %S", + sds err_msg = sdscatfmt(sdsempty(), + "Received error during handshake " + "to target: %S", job->response_buf); finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, err_msg); sdsfree(err_msg); @@ -1983,7 +1937,9 @@ void proceedWithSlotMigration(slotMigrationJob *job) { } return; case SLOT_IMPORT_FINISHED_CLEANING_UP: - serverLog(LL_NOTICE, "Cleaning up slot migration %s after %s", job->description, + serverLog(LL_NOTICE, + "Cleaning up slot migration %s after %s", + job->description, slotMigrationJobStateToString(job->post_cleanup_state)); delKeysNotOwnedByMyself(job->slot_ranges); finishSlotMigrationJob(job, job->post_cleanup_state, job->status_msg); @@ -2003,18 +1959,13 @@ void proceedWithSlotMigration(slotMigrationJob *job) { } if (status == C_ERR) { const char *conn_err = job->conn ? connGetLastError(job->conn) : "target node not found"; - sds status_msg = - sdscatfmt(sdsempty(), - "Unable to connect to target node: %s", - conn_err); - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, - status_msg); + sds status_msg = sdscatfmt(sdsempty(), "Unable to connect to target node: %s", conn_err); + finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, status_msg); sdsfree(status_msg); return; } if (!completed) return; - serverLog(LL_NOTICE, "Slot migration %s connection established.", - job->description); + serverLog(LL_NOTICE, "Slot migration %s connection established.", job->description); if (server.primary_auth) { updateSlotMigrationJobState(job, SLOT_EXPORT_SEND_AUTH); } else { @@ -2022,19 +1973,15 @@ void proceedWithSlotMigration(slotMigrationJob *job) { } continue; } - case SLOT_EXPORT_SEND_AUTH: - slotMigrationJobSendAuth(job); - continue; + case SLOT_EXPORT_SEND_AUTH: slotMigrationJobSendAuth(job); continue; case SLOT_EXPORT_READ_AUTH_RESPONSE: /* We are still reading back the response, nothing to do in cron */ return; case SLOT_EXPORT_SEND_ESTABLISH: initSlotExportJobClient(job); addReplySds(job->client, generateSyncSlotsEstablishCommand(job)); - connSetReadHandler(job->client->conn, - slotMigrationJobReadEstablishResponse); - updateSlotMigrationJobState(job, - SLOT_EXPORT_READ_ESTABLISH_RESPONSE); + connSetReadHandler(job->client->conn, slotMigrationJobReadEstablishResponse); + updateSlotMigrationJobState(job, SLOT_EXPORT_READ_ESTABLISH_RESPONSE); return; case SLOT_EXPORT_READ_ESTABLISH_RESPONSE: /* We are still reading back the response, nothing to do in cron */ @@ -2056,21 +2003,14 @@ void proceedWithSlotMigration(slotMigrationJob *job) { "Slot migration %s waiting before snapshotting " "due to %s.", job->description, - hasActiveChildProcess() - ? "active child process" - : "pending writes in output buffer"); + hasActiveChildProcess() ? "active child process" : "pending writes in output buffer"); } return; } - serverLog(LL_NOTICE, - "Beginning snapshot of slot migration %s.", - job->description); + serverLog(LL_NOTICE, "Beginning snapshot of slot migration %s.", job->description); if (slotExportJobBeginSnapshotToTargetSocket(job) == C_ERR) { - serverLog(LL_WARNING, - "Slot migration %s failed to start slot snapshot", - job->description); - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, - "Failed to start snapshot"); + serverLog(LL_WARNING, "Slot migration %s failed to start slot snapshot", job->description); + finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, "Failed to start snapshot"); return; } updateSlotMigrationJobState(job, SLOT_EXPORT_SNAPSHOTTING); @@ -2088,13 +2028,13 @@ void proceedWithSlotMigration(slotMigrationJob *job) { return; case SLOT_EXPORT_FAILOVER_PAUSED: if (isSlotExportPauseTimedOut(job)) { - serverLog(LL_WARNING, "Slot migration %s timed out during slot " - "failover.", + serverLog(LL_WARNING, + "Slot migration %s timed out during slot " + "failover.", job->description); job->mf_end = 0; updatePausedActions(); - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, - "Timed out before streaming completed"); + finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, "Timed out before streaming completed"); } return; case SLOT_EXPORT_FAILOVER_GRANTED: @@ -2114,14 +2054,16 @@ void proceedWithSlotMigration(slotMigrationJob *job) { * may still propagate to us after we unpause. In this case, we * would lose the slot (as our epoch is lower) and any writes we * have since accepted will be reverted. */ - serverLog(LL_WARNING, "Write loss risk! During slot migration " - "%s, new owner did not broadcast " - "ownership before we unpaused ourselves. " - "Any writes we have recorded since " - "unpausing may be lost!", + serverLog(LL_WARNING, + "Write loss risk! During slot migration " + "%s, new owner did not broadcast " + "ownership before we unpaused ourselves. " + "Any writes we have recorded since " + "unpausing may be lost!", job->description); - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, + finishSlotMigrationJob(job, + SLOT_MIGRATION_JOB_FAILED, "Unpaused before migration completed " "(migration may have succeeded with " "lost writes)"); @@ -2129,8 +2071,7 @@ void proceedWithSlotMigration(slotMigrationJob *job) { } bool migration_done; if (checkSlotExportOwnership(job, &migration_done) == C_ERR) { - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, - "Slots are no longer owned by myself"); + finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, "Slots are no longer owned by myself"); return; } if (migration_done) { @@ -2141,8 +2082,7 @@ void proceedWithSlotMigration(slotMigrationJob *job) { /* Terminal states */ case SLOT_MIGRATION_JOB_SUCCESS: case SLOT_MIGRATION_JOB_CANCELLED: - case SLOT_MIGRATION_JOB_FAILED: - return; + case SLOT_MIGRATION_JOB_FAILED: return; } } } @@ -2178,8 +2118,7 @@ void freeSlotMigrationJob(void *o) { void initClusterSlotMigrationJobList(void) { server.cluster->slot_migration_jobs = listCreate(); - listSetFreeMethod(server.cluster->slot_migration_jobs, - freeSlotMigrationJob); + listSetFreeMethod(server.cluster->slot_migration_jobs, freeSlotMigrationJob); } /* Convert a slotMigrationJobState enum to a user presentable string. */ @@ -2197,8 +2136,7 @@ const char *slotMigrationJobStateToString(slotMigrationJobState state) { case SLOT_EXPORT_SEND_AUTH: return "sending-auth-command"; case SLOT_EXPORT_READ_AUTH_RESPONSE: return "reading-auth-response"; case SLOT_EXPORT_SEND_ESTABLISH: return "sending-establish-command"; - case SLOT_EXPORT_READ_ESTABLISH_RESPONSE: - return "reading-establish-response"; + case SLOT_EXPORT_READ_ESTABLISH_RESPONSE: return "reading-establish-response"; case SLOT_EXPORT_WAITING_TO_SNAPSHOT: return "waiting-to-snapshot"; case SLOT_EXPORT_SNAPSHOTTING: return "snapshotting"; case SLOT_EXPORT_STREAMING: return "replicating"; @@ -2231,21 +2169,24 @@ sds generateSlotMigrationJobDescription(slotMigrationJob *job, clusterNode *othe "{name: %.40s, operation: %s, %s_id: %.40s, %s_human_name: %s, slots: %s}", job->name, job_type_str, - other_node_desc, other_node_name, other_node_desc, - other_node_human_name, job->slot_ranges_str); + other_node_desc, + other_node_name, + other_node_desc, + other_node_human_name, + job->slot_ranges_str); } else { return sdscatprintf(sdsempty(), "{name: %.40s, operation: %s, %s_id: %.40s, slots: %s}", job->name, job_type_str, - other_node_desc, other_node_name, + other_node_desc, + other_node_name, job->slot_ranges_str); } } /* Update the provided job to the given state. */ -void updateSlotMigrationJobState(slotMigrationJob *job, - slotMigrationJobState state) { +void updateSlotMigrationJobState(slotMigrationJob *job, slotMigrationJobState state) { serverLog(LL_NOTICE, "Slot migration %s state transition: %s -> %s", job->description, @@ -2259,7 +2200,8 @@ void clusterHandleSlotMigrationErrorResponse(slotMigrationJob *job) { if (!job || !isSlotMigrationJobInProgress(job)) { return; } - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, + finishSlotMigrationJob(job, + SLOT_MIGRATION_JOB_FAILED, "Failed to process command during slot migration. " "Check logs for more information"); } @@ -2279,12 +2221,14 @@ void clusterHandleSlotMigrationClientClose(slotMigrationJob *job) { * Otherwise, we can mark it failed. */ if (job->state != SLOT_EXPORT_FAILOVER_GRANTED) { if (job->type == SLOT_MIGRATION_EXPORT) { - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, + finishSlotMigrationJob(job, + SLOT_MIGRATION_JOB_FAILED, "Connection lost to target. Check CLUSTER " "GETSLOTMIGRATIONS on the target node for " "more information."); } else { - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, + finishSlotMigrationJob(job, + SLOT_MIGRATION_JOB_FAILED, "Connection lost to source. Check CLUSTER " "GETSLOTMIGRATIONS on the source node for " "more information."); @@ -2300,18 +2244,14 @@ void clusterHandleSlotMigrationClientOOM(slotMigrationJob *job) { if (!isSlotMigrationJobInProgress(job)) { return; } - serverLog(LL_WARNING, - "Slot migration %s failed due to OOM", job->description); - finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, - "Ran out of memory (OOM) during slot import"); + serverLog(LL_WARNING, "Slot migration %s failed due to OOM", job->description); + finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, "Ran out of memory (OOM) during slot import"); } /* Move the given job to the provided terminal state. Any associated connections * or clients will be closed, and this function will trigger cleanup if this is * an import operation. */ -void finishSlotMigrationJob(slotMigrationJob *job, - slotMigrationJobState state, - char *message) { +void finishSlotMigrationJob(slotMigrationJob *job, slotMigrationJobState state, char *message) { updateSlotMigrationJobStatusMessage(job, message); if (job->type == SLOT_MIGRATION_EXPORT) { /* If we finish the export, we should not remain paused */ @@ -2323,11 +2263,9 @@ void finishSlotMigrationJob(slotMigrationJob *job, * they haven't already). The only exception is if we finish a migration * during our loading job (e.g. during AOF load). SYNCSLOTS FINISH in the * AOF always means the keys have been cleaned up. */ - bool cleanup_needed = job->type == SLOT_MIGRATION_IMPORT && - nodeIsPrimary(server.cluster->myself) && - job->state != SLOT_IMPORT_FINISHED_CLEANING_UP && - !server.loading && - state != SLOT_MIGRATION_JOB_SUCCESS; + bool cleanup_needed = job->type == SLOT_MIGRATION_IMPORT && nodeIsPrimary(server.cluster->myself) + && job->state != SLOT_IMPORT_FINISHED_CLEANING_UP && !server.loading + && state != SLOT_MIGRATION_JOB_SUCCESS; if (cleanup_needed) { /* Defer cleanup until beforeSleep. */ job->post_cleanup_state = state; @@ -2368,17 +2306,15 @@ void finishSlotMigrationJob(slotMigrationJob *job, /* Finished means we are completely done with all work and this entry is just * a log for tracking purposes. */ bool isSlotMigrationJobFinished(slotMigrationJob *job) { - return job->state == SLOT_MIGRATION_JOB_SUCCESS || - job->state == SLOT_MIGRATION_JOB_CANCELLED || - job->state == SLOT_MIGRATION_JOB_FAILED; + return job->state == SLOT_MIGRATION_JOB_SUCCESS || job->state == SLOT_MIGRATION_JOB_CANCELLED + || job->state == SLOT_MIGRATION_JOB_FAILED; } /* In progress means we are still trying to perform the migration. It is * possible that we are not trying to perform the migration, but we are not * finished yet, e.g. if we are still pending cleanup. */ bool isSlotMigrationJobInProgress(slotMigrationJob *job) { - return job->state != SLOT_IMPORT_FINISHED_CLEANING_UP && - !isSlotMigrationJobFinished(job); + return job->state != SLOT_IMPORT_FINISHED_CLEANING_UP && !isSlotMigrationJobFinished(job); } /* Since slotMigrationJob is stored as void* in the client object, this allows @@ -2401,9 +2337,7 @@ void clusterCommandGetSlotMigrations(client *c) { addReplyBulkCString(c, "name"); addReplyBulkCBuffer(c, job->name, CLUSTER_NAMELEN); addReplyBulkCString(c, "operation"); - addReplyBulkCString(c, job->type == SLOT_MIGRATION_IMPORT - ? "IMPORT" - : "EXPORT"); + addReplyBulkCString(c, job->type == SLOT_MIGRATION_IMPORT ? "IMPORT" : "EXPORT"); addReplyBulkCString(c, "slot_ranges"); addReplyBulkCString(c, job->slot_ranges_str); if (!job->is_tracking_only) { @@ -2456,8 +2390,7 @@ void clusterCleanupSlotMigrationLog(size_t max_len) { listNode *ln; listIter li; listRewindTail(server.cluster->slot_migration_jobs, &li); - while (server.cluster->slot_migration_jobs->len > max_len && - (ln = listNext(&li)) != NULL) { + while (server.cluster->slot_migration_jobs->len > max_len && (ln = listNext(&li)) != NULL) { slotMigrationJob *job = ln->value; if (isSlotMigrationJobFinished(job)) { listDelNode(server.cluster->slot_migration_jobs, ln); @@ -2474,14 +2407,10 @@ bool canSlotMigrationJobSendAck(slotMigrationJob *job) { * parsing of the response to CLUSTER SYNCSLOTS ESTABLISH. * 3. We can't send ACK if we are still connecting or sending establish * job. */ - return job->state != SLOT_EXPORT_SNAPSHOTTING && - job->state != SLOT_IMPORT_WAIT_ACK && - job->state != SLOT_EXPORT_CONNECTING && - job->state != SLOT_EXPORT_SEND_AUTH && - job->state != SLOT_EXPORT_READ_AUTH_RESPONSE && - job->state != SLOT_EXPORT_SEND_ESTABLISH && - job->state != SLOT_EXPORT_READ_ESTABLISH_RESPONSE && - job->state != SLOT_IMPORT_OCCURRING_ON_PRIMARY; + return job->state != SLOT_EXPORT_SNAPSHOTTING && job->state != SLOT_IMPORT_WAIT_ACK + && job->state != SLOT_EXPORT_CONNECTING && job->state != SLOT_EXPORT_SEND_AUTH + && job->state != SLOT_EXPORT_READ_AUTH_RESPONSE && job->state != SLOT_EXPORT_SEND_ESTABLISH + && job->state != SLOT_EXPORT_READ_ESTABLISH_RESPONSE && job->state != SLOT_IMPORT_OCCURRING_ON_PRIMARY; } /* Cron related tasks run in clusterCron to drive slot migrations. */ @@ -2495,37 +2424,31 @@ void clusterSlotMigrationCron(void) { /* Note that after granting failover, we no longer care about the * connection timeout, since we will use pause timeout. */ - if (isSlotMigrationJobInProgress(job) && - job->state != SLOT_EXPORT_FAILOVER_GRANTED && - job->state != SLOT_IMPORT_OCCURRING_ON_PRIMARY) { + if (isSlotMigrationJobInProgress(job) && job->state != SLOT_EXPORT_FAILOVER_GRANTED + && job->state != SLOT_IMPORT_OCCURRING_ON_PRIMARY) { serverAssert(job->type == SLOT_MIGRATION_EXPORT || job->client); /* For imports, last interaction will be set to the last * incoming command, as replicated clients don't set * last_interaction when a reply is sent. However, for exports, * we have to use the last ack time to avoid counting sending * data/ACKs as an interaction here. */ - time_t last_interaction = job->type == SLOT_MIGRATION_EXPORT - ? job->last_ack - : job->client->last_interaction; + time_t last_interaction = job->type == SLOT_MIGRATION_EXPORT ? job->last_ack + : job->client->last_interaction; - if (last_interaction && - (server.unixtime - last_interaction > server.repl_timeout)) { + if (last_interaction && (server.unixtime - last_interaction > server.repl_timeout)) { serverLog(LL_WARNING, "Timing out slot migration %s " "after not receiving ack for too long", job->description); - finishSlotMigrationJob( - job, SLOT_MIGRATION_JOB_FAILED, - "Timed out after too long with no interaction"); + finishSlotMigrationJob(job, SLOT_MIGRATION_JOB_FAILED, "Timed out after too long with no interaction"); continue; } } proceedWithSlotMigration(job); - if (isSlotMigrationJobInProgress(job) && - job->state != SLOT_EXPORT_FAILOVER_GRANTED && - canSlotMigrationJobSendAck(job)) { + if (isSlotMigrationJobInProgress(job) && job->state != SLOT_EXPORT_FAILOVER_GRANTED + && canSlotMigrationJobSendAck(job)) { /* For slot exports, the timer is refreshed on any interaction, so we * don't need to send an ACK if we wrote this cron loop already. */ bool timer_already_refreshed = (job->type != SLOT_MIGRATION_IMPORT && job->client->flag.pending_write); @@ -2563,8 +2486,7 @@ void clusterCommandSyncSlotsAck(client *c) { } c->slot_migration_job->last_ack = server.unixtime; if (c->slot_migration_job->state == SLOT_IMPORT_WAIT_ACK) { - updateSlotMigrationJobState(c->slot_migration_job, - SLOT_IMPORT_RECEIVE_SNAPSHOT); + updateSlotMigrationJobState(c->slot_migration_job, SLOT_IMPORT_RECEIVE_SNAPSHOT); } } @@ -2627,14 +2549,12 @@ void clusterCommandSyncSlots(client *c) { clusterCommandSyncSlotsCapa(c); return; } - if (c->slot_migration_job && - isSlotMigrationJobInProgress(c->slot_migration_job)) { - serverLog(LL_WARNING, "Received unknown SYNCSLOTS subcommand from " - "slot migration %s. Failing the migration.", + if (c->slot_migration_job && isSlotMigrationJobInProgress(c->slot_migration_job)) { + serverLog(LL_WARNING, + "Received unknown SYNCSLOTS subcommand from " + "slot migration %s. Failing the migration.", c->slot_migration_job->description); - finishSlotMigrationJob(c->slot_migration_job, - SLOT_MIGRATION_JOB_FAILED, - "Unknown SYNCSLOTS subcommand used"); + finishSlotMigrationJob(c->slot_migration_job, SLOT_MIGRATION_JOB_FAILED, "Unknown SYNCSLOTS subcommand used"); return; } addReplyErrorObject(c, shared.syntaxerr); diff --git a/src/cluster_slot_stats.c b/src/cluster_slot_stats.c index c87aaa920a4..4b12ca46d9a 100644 --- a/src/cluster_slot_stats.c +++ b/src/cluster_slot_stats.c @@ -94,8 +94,9 @@ static void addReplySlotStat(client *c, int slot) { addReplyArrayLen(c, 2); /* Array of size 2, where 0th index represents (int) slot, * and 1st index represents (map) usage statistics. */ addReplyLongLong(c, slot); - addReplyMapLen(c, (server.cluster_slot_stats_enabled) ? SLOT_STAT_COUNT - : 1); /* Nested map representing slot usage statistics. */ + addReplyMapLen(c, + (server.cluster_slot_stats_enabled) ? SLOT_STAT_COUNT + : 1); /* Nested map representing slot usage statistics. */ addReplyBulkCString(c, "key-count"); addReplyLongLong(c, countKeysInSlot(slot)); @@ -213,10 +214,10 @@ void clusterSlotStatResetAll(void) { * would equate to repeating the same calculation twice. */ static int canAddCpuDuration(client *c) { - return clusterSlotStatsEnabled(c->slot) && - (!server.execution_nesting || /* Either; */ - (server.execution_nesting && /* 1) Command should not be nested, or */ - c->realcmd->flags & CMD_BLOCKING)); /* 2) If command is nested, it must be due to unblocking. */ + return clusterSlotStatsEnabled(c->slot) + && (!server.execution_nesting || /* Either; */ + (server.execution_nesting && /* 1) Command should not be nested, or */ + c->realcmd->flags & CMD_BLOCKING)); /* 2) If command is nested, it must be due to unblocking. */ } void clusterSlotStatsAddCpuDuration(client *c, ustime_t duration) { @@ -262,8 +263,7 @@ void clusterSlotStatsCommand(client *c) { if (c->argc == 5 && !strcasecmp(objectGetVal(c->argv[2]), "slotsrange")) { /* CLUSTER SLOT-STATS SLOTSRANGE start-slot end-slot */ int startslot, endslot; - if ((startslot = getSlotOrReply(c, c->argv[3])) == -1 || - (endslot = getSlotOrReply(c, c->argv[4])) == -1) { + if ((startslot = getSlotOrReply(c, c->argv[3])) == -1 || (endslot = getSlotOrReply(c, c->argv[4])) == -1) { return; } if (startslot > endslot) { @@ -297,9 +297,14 @@ void clusterSlotStatsCommand(client *c) { while (i < c->argc) { int moreargs = c->argc > i + 1; if (!strcasecmp(objectGetVal(c->argv[i]), "limit") && moreargs) { - if (getRangeLongFromObjectOrReply( - c, c->argv[i + 1], 1, CLUSTER_SLOTS, &limit, - "Limit has to lie in between 1 and 16384 (maximum number of slots).") != C_OK) { + if (getRangeLongFromObjectOrReply(c, + c->argv[i + 1], + 1, + CLUSTER_SLOTS, + &limit, + "Limit has to lie in between 1 and 16384 (maximum number of " + "slots).") + != C_OK) { return; } i++; diff --git a/src/commandlog.c b/src/commandlog.c index a4ed1b33c9e..4a5696ed4a8 100644 --- a/src/commandlog.c +++ b/src/commandlog.c @@ -40,17 +40,18 @@ static commandlogEntry *commandlogCreateEntry(client *c, robj **argv, int argc, * at COMMANDLOG_ENTRY_MAX_ARGC, but use the last argument to specify * how many remaining arguments there were in the original command. */ if (ceargc != argc && j == ceargc - 1) { - ce->argv[j] = - createObject(OBJ_STRING, sdscatprintf(sdsempty(), "... (%d more arguments)", argc - ceargc + 1)); + ce->argv[j] = createObject(OBJ_STRING, + sdscatprintf(sdsempty(), "... (%d more arguments)", argc - ceargc + 1)); } else { if (clientCommandArgShouldBeRedacted(c, j)) { ce->argv[j] = shared.redacted; /* Trim too long strings as well... */ - } else if (argv[j]->type == OBJ_STRING && sdsEncodedObject(argv[j]) && - sdslen(objectGetVal(argv[j])) > COMMANDLOG_ENTRY_MAX_STRING) { + } else if (argv[j]->type == OBJ_STRING && sdsEncodedObject(argv[j]) + && sdslen(objectGetVal(argv[j])) > COMMANDLOG_ENTRY_MAX_STRING) { sds s = sdsnewlen(objectGetVal(argv[j]), COMMANDLOG_ENTRY_MAX_STRING); - s = sdscatprintf(s, "... (%lu more bytes)", + s = sdscatprintf(s, + "... (%lu more bytes)", (unsigned long)sdslen(objectGetVal(argv[j])) - COMMANDLOG_ENTRY_MAX_STRING); ce->argv[j] = createObject(OBJ_STRING, s); } else if (argv[j]->refcount == OBJ_SHARED_REFCOUNT) { @@ -103,17 +104,20 @@ void commandlogInit(void) { * This function will make sure to trim the command log accordingly to the * configured max length. */ static void commandlogPushEntryIfNeeded(client *c, robj **argv, int argc, long long value, int type) { - if (server.commandlog[type].threshold < 0 || server.commandlog[type].max_len == 0) return; /* The corresponding commandlog disabled */ + if (server.commandlog[type].threshold < 0 || server.commandlog[type].max_len == 0) + return; /* The corresponding commandlog disabled */ if (value >= server.commandlog[type].threshold) listAddNodeHead(server.commandlog[type].entries, commandlogCreateEntry(c, argv, argc, value, type)); /* Remove old entries if needed. */ - while (listLength(server.commandlog[type].entries) > server.commandlog[type].max_len) listDelNode(server.commandlog[type].entries, listLast(server.commandlog[type].entries)); + while (listLength(server.commandlog[type].entries) > server.commandlog[type].max_len) + listDelNode(server.commandlog[type].entries, listLast(server.commandlog[type].entries)); } /* Remove all the entries from the current command log of the specified type. */ static void commandlogReset(int type) { - while (listLength(server.commandlog[type].entries) > 0) listDelNode(server.commandlog[type].entries, listLast(server.commandlog[type].entries)); + while (listLength(server.commandlog[type].entries) > 0) + listDelNode(server.commandlog[type].entries, listLast(server.commandlog[type].entries)); } /* Reply command logs to client. */ @@ -198,8 +202,13 @@ void slowlogCommand(client *c) { if (c->argc == 3) { /* Consume count arg. */ - if (getRangeLongFromObjectOrReply(c, c->argv[2], -1, LONG_MAX, &count, - "count should be greater than or equal to -1") != C_OK) + if (getRangeLongFromObjectOrReply(c, + c->argv[2], + -1, + LONG_MAX, + &count, + "count should be greater than or equal to -1") + != C_OK) return; if (count == -1) { @@ -256,8 +265,13 @@ void commandlogCommand(client *c) { long count; /* Consume count arg. */ - if (getRangeLongFromObjectOrReply(c, c->argv[2], -1, LONG_MAX, &count, - "count should be greater than or equal to -1") != C_OK) + if (getRangeLongFromObjectOrReply(c, + c->argv[2], + -1, + LONG_MAX, + &count, + "count should be greater than or equal to -1") + != C_OK) return; if ((type = commandlogGetTypeOrReply(c, c->argv[3])) == -1) return; diff --git a/src/commands.c b/src/commands.c index 7744f15e756..ddeaf728504 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1,9 +1,28 @@ #include "commands.h" #include "server.h" -#define MAKE_CMD(name, summary, complexity, since, doc_flags, replaced, deprecated, group, group_enum, history, \ - num_history, tips, num_tips, function, arity, flags, acl, get_dbid_args, key_specs, \ - key_specs_num, get_keys, numargs) \ +#define MAKE_CMD(name, \ + summary, \ + complexity, \ + since, \ + doc_flags, \ + replaced, \ + deprecated, \ + group, \ + group_enum, \ + history, \ + num_history, \ + tips, \ + num_tips, \ + function, \ + arity, \ + flags, \ + acl, \ + get_dbid_args, \ + key_specs, \ + key_specs_num, \ + get_keys, \ + numargs) \ name, summary, complexity, since, doc_flags, replaced, deprecated, group_enum, history, num_history, tips, \ num_tips, function, arity, flags, acl, get_dbid_args, key_specs, key_specs_num, get_keys, numargs #define MAKE_ARG(name, type, key_spec_index, token, summary, since, flags, numsubargs, deprecated_since) \ diff --git a/src/config.c b/src/config.c index 8cd049e69ed..a1566f4d9e6 100644 --- a/src/config.c +++ b/src/config.c @@ -57,121 +57,106 @@ typedef struct deprecatedConfig { const int argc_max; } deprecatedConfig; -configEnum maxmemory_policy_enum[] = { - {"volatile-lru", MAXMEMORY_VOLATILE_LRU}, - {"volatile-lfu", MAXMEMORY_VOLATILE_LFU}, - {"volatile-random", MAXMEMORY_VOLATILE_RANDOM}, - {"volatile-ttl", MAXMEMORY_VOLATILE_TTL}, - {"allkeys-lru", MAXMEMORY_ALLKEYS_LRU}, - {"allkeys-lfu", MAXMEMORY_ALLKEYS_LFU}, - {"allkeys-random", MAXMEMORY_ALLKEYS_RANDOM}, - {"noeviction", MAXMEMORY_NO_EVICTION}, - {NULL, 0}}; - -configEnum syslog_facility_enum[] = { - {"user", LOG_USER}, - {"local0", LOG_LOCAL0}, - {"local1", LOG_LOCAL1}, - {"local2", LOG_LOCAL2}, - {"local3", LOG_LOCAL3}, - {"local4", LOG_LOCAL4}, - {"local5", LOG_LOCAL5}, - {"local6", LOG_LOCAL6}, - {"local7", LOG_LOCAL7}, - {NULL, 0}}; - -configEnum loglevel_enum[] = { - {"debug", LL_DEBUG}, - {"verbose", LL_VERBOSE}, - {"notice", LL_NOTICE}, - {"warning", LL_WARNING}, - {"nothing", LL_NOTHING}, - {NULL, 0}}; - -configEnum supervised_mode_enum[] = { - {"upstart", SUPERVISED_UPSTART}, - {"systemd", SUPERVISED_SYSTEMD}, - {"auto", SUPERVISED_AUTODETECT}, - {"no", SUPERVISED_NONE}, - {NULL, 0}}; - -configEnum aof_fsync_enum[] = { - {"everysec", AOF_FSYNC_EVERYSEC}, - {"always", AOF_FSYNC_ALWAYS}, - {"no", AOF_FSYNC_NO}, - {NULL, 0}}; - -configEnum shutdown_on_sig_enum[] = { - {"default", SHUTDOWN_NOFLAGS}, - {"save", SHUTDOWN_SAVE}, - {"nosave", SHUTDOWN_NOSAVE}, - {"now", SHUTDOWN_NOW}, - {"force", SHUTDOWN_FORCE}, - {"safe", SHUTDOWN_SAFE}, - {"failover", SHUTDOWN_FAILOVER}, - {NULL, 0}}; - -configEnum repl_diskless_load_enum[] = { - {"disabled", REPL_DISKLESS_LOAD_DISABLED}, - {"on-empty-db", REPL_DISKLESS_LOAD_WHEN_DB_EMPTY}, - {"swapdb", REPL_DISKLESS_LOAD_SWAPDB}, - {"flush-before-load", REPL_DISKLESS_LOAD_FLUSH_BEFORE_LOAD}, - {NULL, 0}}; - -configEnum tls_auth_clients_enum[] = { - {"no", TLS_CLIENT_AUTH_NO}, - {"yes", TLS_CLIENT_AUTH_YES}, - {"optional", TLS_CLIENT_AUTH_OPTIONAL}, - {NULL, 0}}; - -configEnum tls_client_auth_user_enum[] = { - {"CN", TLS_CLIENT_FIELD_CN}, - {"URI", TLS_CLIENT_FIELD_URI}, - {"off", TLS_CLIENT_FIELD_OFF}, - {NULL, 0}}; - -configEnum oom_score_adj_enum[] = { - {"no", OOM_SCORE_ADJ_NO}, - {"yes", OOM_SCORE_RELATIVE}, - {"relative", OOM_SCORE_RELATIVE}, - {"absolute", OOM_SCORE_ADJ_ABSOLUTE}, - {NULL, 0}}; - -configEnum acl_pubsub_default_enum[] = { - {"allchannels", SELECTOR_FLAG_ALLCHANNELS}, - {"resetchannels", 0}, - {NULL, 0}}; - -configEnum sanitize_dump_payload_enum[] = { - {"no", SANITIZE_DUMP_NO}, - {"yes", SANITIZE_DUMP_YES}, - {"clients", SANITIZE_DUMP_CLIENTS}, - {NULL, 0}}; - -configEnum protected_action_enum[] = { - {"no", PROTECTED_ACTION_ALLOWED_NO}, - {"yes", PROTECTED_ACTION_ALLOWED_YES}, - {"local", PROTECTED_ACTION_ALLOWED_LOCAL}, - {NULL, 0}}; - -configEnum cluster_preferred_endpoint_type_enum[] = { - {"ip", CLUSTER_ENDPOINT_TYPE_IP}, - {"hostname", CLUSTER_ENDPOINT_TYPE_HOSTNAME}, - {"unknown-endpoint", CLUSTER_ENDPOINT_TYPE_UNKNOWN_ENDPOINT}, - {NULL, 0}}; - -configEnum cluster_configfile_save_behavior_enum[] = { - {"sync", CLUSTER_CONFIGFILE_SAVE_BEHAVIOR_SYNC}, - {"best-effort", CLUSTER_CONFIGFILE_SAVE_BEHAVIOR_BEST_EFFORT}, - {NULL, 0}}; - -configEnum propagation_error_behavior_enum[] = { - {"ignore", PROPAGATION_ERR_BEHAVIOR_IGNORE}, - {"panic", PROPAGATION_ERR_BEHAVIOR_PANIC}, - {"panic-on-replicas", PROPAGATION_ERR_BEHAVIOR_PANIC_ON_REPLICAS}, - {NULL, 0}}; - -configEnum log_format_enum[] = {{"legacy", LOG_FORMAT_LEGACY}, {"logfmt", LOG_FORMAT_LOGFMT}, {"json", LOG_FORMAT_JSON}, {NULL, 0}}; +configEnum maxmemory_policy_enum[] = {{"volatile-lru", MAXMEMORY_VOLATILE_LRU}, + {"volatile-lfu", MAXMEMORY_VOLATILE_LFU}, + {"volatile-random", MAXMEMORY_VOLATILE_RANDOM}, + {"volatile-ttl", MAXMEMORY_VOLATILE_TTL}, + {"allkeys-lru", MAXMEMORY_ALLKEYS_LRU}, + {"allkeys-lfu", MAXMEMORY_ALLKEYS_LFU}, + {"allkeys-random", MAXMEMORY_ALLKEYS_RANDOM}, + {"noeviction", MAXMEMORY_NO_EVICTION}, + {NULL, 0}}; + +configEnum syslog_facility_enum[] = {{"user", LOG_USER}, + {"local0", LOG_LOCAL0}, + {"local1", LOG_LOCAL1}, + {"local2", LOG_LOCAL2}, + {"local3", LOG_LOCAL3}, + {"local4", LOG_LOCAL4}, + {"local5", LOG_LOCAL5}, + {"local6", LOG_LOCAL6}, + {"local7", LOG_LOCAL7}, + {NULL, 0}}; + +configEnum loglevel_enum[] = {{"debug", LL_DEBUG}, + {"verbose", LL_VERBOSE}, + {"notice", LL_NOTICE}, + {"warning", LL_WARNING}, + {"nothing", LL_NOTHING}, + {NULL, 0}}; + +configEnum supervised_mode_enum[] = {{"upstart", SUPERVISED_UPSTART}, + {"systemd", SUPERVISED_SYSTEMD}, + {"auto", SUPERVISED_AUTODETECT}, + {"no", SUPERVISED_NONE}, + {NULL, 0}}; + +configEnum aof_fsync_enum[] = {{"everysec", AOF_FSYNC_EVERYSEC}, + {"always", AOF_FSYNC_ALWAYS}, + {"no", AOF_FSYNC_NO}, + {NULL, 0}}; + +configEnum shutdown_on_sig_enum[] = {{"default", SHUTDOWN_NOFLAGS}, + {"save", SHUTDOWN_SAVE}, + {"nosave", SHUTDOWN_NOSAVE}, + {"now", SHUTDOWN_NOW}, + {"force", SHUTDOWN_FORCE}, + {"safe", SHUTDOWN_SAFE}, + {"failover", SHUTDOWN_FAILOVER}, + {NULL, 0}}; + +configEnum repl_diskless_load_enum[] = {{"disabled", REPL_DISKLESS_LOAD_DISABLED}, + {"on-empty-db", REPL_DISKLESS_LOAD_WHEN_DB_EMPTY}, + {"swapdb", REPL_DISKLESS_LOAD_SWAPDB}, + {"flush-before-load", REPL_DISKLESS_LOAD_FLUSH_BEFORE_LOAD}, + {NULL, 0}}; + +configEnum tls_auth_clients_enum[] = {{"no", TLS_CLIENT_AUTH_NO}, + {"yes", TLS_CLIENT_AUTH_YES}, + {"optional", TLS_CLIENT_AUTH_OPTIONAL}, + {NULL, 0}}; + +configEnum tls_client_auth_user_enum[] = {{"CN", TLS_CLIENT_FIELD_CN}, + {"URI", TLS_CLIENT_FIELD_URI}, + {"off", TLS_CLIENT_FIELD_OFF}, + {NULL, 0}}; + +configEnum oom_score_adj_enum[] = {{"no", OOM_SCORE_ADJ_NO}, + {"yes", OOM_SCORE_RELATIVE}, + {"relative", OOM_SCORE_RELATIVE}, + {"absolute", OOM_SCORE_ADJ_ABSOLUTE}, + {NULL, 0}}; + +configEnum acl_pubsub_default_enum[] = {{"allchannels", SELECTOR_FLAG_ALLCHANNELS}, {"resetchannels", 0}, {NULL, 0}}; + +configEnum sanitize_dump_payload_enum[] = {{"no", SANITIZE_DUMP_NO}, + {"yes", SANITIZE_DUMP_YES}, + {"clients", SANITIZE_DUMP_CLIENTS}, + {NULL, 0}}; + +configEnum protected_action_enum[] = {{"no", PROTECTED_ACTION_ALLOWED_NO}, + {"yes", PROTECTED_ACTION_ALLOWED_YES}, + {"local", PROTECTED_ACTION_ALLOWED_LOCAL}, + {NULL, 0}}; + +configEnum cluster_preferred_endpoint_type_enum[] = {{"ip", CLUSTER_ENDPOINT_TYPE_IP}, + {"hostname", CLUSTER_ENDPOINT_TYPE_HOSTNAME}, + {"unknown-endpoint", CLUSTER_ENDPOINT_TYPE_UNKNOWN_ENDPOINT}, + {NULL, 0}}; + +configEnum cluster_configfile_save_behavior_enum[] = {{"sync", CLUSTER_CONFIGFILE_SAVE_BEHAVIOR_SYNC}, + {"best-effort", CLUSTER_CONFIGFILE_SAVE_BEHAVIOR_BEST_EFFORT}, + {NULL, 0}}; + +configEnum propagation_error_behavior_enum[] = {{"ignore", PROPAGATION_ERR_BEHAVIOR_IGNORE}, + {"panic", PROPAGATION_ERR_BEHAVIOR_PANIC}, + {"panic-on-replicas", PROPAGATION_ERR_BEHAVIOR_PANIC_ON_REPLICAS}, + {NULL, 0}}; + +configEnum log_format_enum[] = {{"legacy", LOG_FORMAT_LEGACY}, + {"logfmt", LOG_FORMAT_LOGFMT}, + {"json", LOG_FORMAT_JSON}, + {NULL, 0}}; configEnum log_timestamp_format_enum[] = {{"legacy", LOG_TIMESTAMP_LEGACY}, {"iso8601", LOG_TIMESTAMP_ISO8601}, @@ -681,7 +666,9 @@ void loadServerConfig(char *filename, char config_from_stdin, char *options) { if (glob(filename, 0, NULL, &globbuf) == 0) { for (size_t i = 0; i < globbuf.gl_pathc; i++) { if ((fp = fopen(globbuf.gl_pathv[i], "r")) == NULL) { - serverLog(LL_WARNING, "Fatal error, can't open config file '%s': %s", globbuf.gl_pathv[i], + serverLog(LL_WARNING, + "Fatal error, can't open config file '%s': %s", + globbuf.gl_pathv[i], strerror(errno)); exit(1); } @@ -774,8 +761,11 @@ static void restoreBackupConfig(standardConfig **set_configs, /* Set all backup values */ for (i = 0; i < count; i++) { if (!performInterfaceSet(set_configs[i], old_values[i], &errstr)) - serverLog(LL_WARNING, "Failed restoring failed CONFIG SET command. Error setting %s to '%s': %s", - set_configs[i]->name, old_values[i], errstr); + serverLog(LL_WARNING, + "Failed restoring failed CONFIG SET command. Error setting %s to '%s': %s", + set_configs[i]->name, + old_values[i], + errstr); } /* Apply backup */ if (apply_fns) { @@ -846,8 +836,8 @@ void configSetCommand(client *c) { /* We continue to make sure we redact all the configs */ if (invalid_args) continue; - if (config->flags & IMMUTABLE_CONFIG || - (config->flags & PROTECTED_CONFIG && !allowProtectedAction(server.enable_protected_configs, c))) { + if (config->flags & IMMUTABLE_CONFIG + || (config->flags & PROTECTED_CONFIG && !allowProtectedAction(server.enable_protected_configs, c))) { /* Note: we don't abort the loop since we still want to handle redacting sensitive configs (above) */ errstr = (config->flags & IMMUTABLE_CONFIG) ? "can't set immutable config" : "can't set protected config"; err_arg_name = objectGetVal(c->argv[2 + i * 2]); @@ -914,10 +904,10 @@ void configSetCommand(client *c) { /* Apply all configs after being set */ for (i = 0; i < config_count && apply_fns[i] != NULL; i++) { if (!apply_fns[i](&errstr)) { - serverLog( - LL_WARNING, - "Failed applying new configuration. Possibly related to new %s setting. Restoring previous settings.", - set_configs[config_map_fns[i]]->name); + serverLog(LL_WARNING, + "Failed applying new configuration. Possibly related to new %s setting. Restoring previous " + "settings.", + set_configs[config_map_fns[i]]->name); restoreBackupConfig(set_configs, old_values, config_count, apply_fns, NULL); err_arg_name = set_configs[config_map_fns[i]]->name; goto err; @@ -1178,12 +1168,13 @@ struct rewriteConfigState *rewriteConfigReadOldFile(char *path) { /* Not a comment, split into arguments. */ argv = sdssplitargs(line, &argc); - if (argv == NULL || - (!lookupConfig(argv[0]) && - /* The following is a list of config features that are only supported in - * config file parsing and are not recognized by lookupConfig */ - strcasecmp(argv[0], "include") && strcasecmp(argv[0], "rename-command") && strcasecmp(argv[0], "user") && - strcasecmp(argv[0], "loadmodule") && strcasecmp(argv[0], "sentinel"))) { + if (argv == NULL + || (!lookupConfig(argv[0]) + /* The following is a list of config features that are only supported in + * config file parsing and are not recognized by lookupConfig */ + && strcasecmp(argv[0], "include") && strcasecmp(argv[0], "rename-command") + && strcasecmp(argv[0], "user") && strcasecmp(argv[0], "loadmodule") + && strcasecmp(argv[0], "sentinel"))) { /* The line is either unparsable for some reason, for * instance it may have unbalanced quotes, may contain a * config that doesn't exist anymore, for instance a module that got @@ -1330,7 +1321,10 @@ void rewriteConfigYesNoOption(struct rewriteConfigState *state, const char *opti } /* Rewrite a string option. */ -void rewriteConfigStringOption(struct rewriteConfigState *state, const char *option, char *value, const char *defvalue) { +void rewriteConfigStringOption(struct rewriteConfigState *state, + const char *option, + char *value, + const char *defvalue) { int force = 1; sds line; @@ -1531,10 +1525,10 @@ void rewriteConfigClientOutputBufferLimitOption(standardConfig *config, UNUSED(config); int j; for (j = 0; j < CLIENT_TYPE_OBUF_COUNT; j++) { - int force = - (server.client_obuf_limits[j].hard_limit_bytes != clientBufferLimitsDefaults[j].hard_limit_bytes) || - (server.client_obuf_limits[j].soft_limit_bytes != clientBufferLimitsDefaults[j].soft_limit_bytes) || - (server.client_obuf_limits[j].soft_limit_seconds != clientBufferLimitsDefaults[j].soft_limit_seconds); + int force = (server.client_obuf_limits[j].hard_limit_bytes != clientBufferLimitsDefaults[j].hard_limit_bytes) + || (server.client_obuf_limits[j].soft_limit_bytes != clientBufferLimitsDefaults[j].soft_limit_bytes) + || (server.client_obuf_limits[j].soft_limit_seconds + != clientBufferLimitsDefaults[j].soft_limit_seconds); sds line; char hard[64], soft[64]; @@ -1543,7 +1537,12 @@ void rewriteConfigClientOutputBufferLimitOption(standardConfig *config, char *typename = getClientTypeName(j); if (!strcmp(typename, "slave")) typename = "replica"; - line = sdscatprintf(sdsempty(), "%s %s %s %s %ld", name, typename, hard, soft, + line = sdscatprintf(sdsempty(), + "%s %s %s %s %ld", + name, + typename, + hard, + soft, (long)server.client_obuf_limits[j].soft_limit_seconds); rewriteConfigRewriteLine(state, name, line, force); } @@ -1568,7 +1567,11 @@ void rewriteConfigOOMScoreAdjValuesOption(standardConfig *config, const char *na } /* Rewrite the bind option. */ -static void rewriteConfigBindOption(standardConfig *config, const char *name, struct rewriteConfigState *state, char **bindaddr, int bindaddr_count) { +static void rewriteConfigBindOption(standardConfig *config, + const char *name, + struct rewriteConfigState *state, + char **bindaddr, + int bindaddr_count) { UNUSED(config); int force = 1; sds line, addresses; @@ -2129,20 +2132,26 @@ static void numericConfigInit(standardConfig *config) { } static int numericBoundaryCheck(standardConfig *config, long long ll, const char **err) { - if (config->data.numeric.numeric_type == NUMERIC_TYPE_ULONG_LONG || - config->data.numeric.numeric_type == NUMERIC_TYPE_ULONG || - config->data.numeric.numeric_type == NUMERIC_TYPE_UINT || - config->data.numeric.numeric_type == NUMERIC_TYPE_SIZE_T) { + if (config->data.numeric.numeric_type == NUMERIC_TYPE_ULONG_LONG + || config->data.numeric.numeric_type == NUMERIC_TYPE_ULONG + || config->data.numeric.numeric_type == NUMERIC_TYPE_UINT + || config->data.numeric.numeric_type == NUMERIC_TYPE_SIZE_T) { /* Boundary check for unsigned types */ unsigned long long ull = ll; unsigned long long upper_bound = config->data.numeric.upper_bound; unsigned long long lower_bound = config->data.numeric.lower_bound; if (ull > upper_bound || ull < lower_bound) { if (config->data.numeric.flags & OCTAL_CONFIG) { - snprintf(loadbuf, LOADBUF_SIZE, "argument must be between %llo and %llo inclusive", lower_bound, + snprintf(loadbuf, + LOADBUF_SIZE, + "argument must be between %llo and %llo inclusive", + lower_bound, upper_bound); } else { - snprintf(loadbuf, LOADBUF_SIZE, "argument must be between %llu and %llu inclusive", lower_bound, + snprintf(loadbuf, + LOADBUF_SIZE, + "argument must be between %llu and %llu inclusive", + lower_bound, upper_bound); } *err = loadbuf; @@ -2152,7 +2161,9 @@ static int numericBoundaryCheck(standardConfig *config, long long ll, const char /* Boundary check for percentages */ if (config->data.numeric.flags & PERCENT_CONFIG && ll < 0) { if (ll < config->data.numeric.lower_bound) { - snprintf(loadbuf, LOADBUF_SIZE, "percentage argument must be less or equal to %lld", + snprintf(loadbuf, + LOADBUF_SIZE, + "percentage argument must be less or equal to %lld", -config->data.numeric.lower_bound); *err = loadbuf; return 0; @@ -2160,8 +2171,11 @@ static int numericBoundaryCheck(standardConfig *config, long long ll, const char } /* Boundary check for signed types */ else if (ll > config->data.numeric.upper_bound || ll < config->data.numeric.lower_bound) { - snprintf(loadbuf, LOADBUF_SIZE, "argument must be between %lld and %lld inclusive", - config->data.numeric.lower_bound, config->data.numeric.upper_bound); + snprintf(loadbuf, + LOADBUF_SIZE, + "argument must be between %lld and %lld inclusive", + config->data.numeric.lower_bound, + config->data.numeric.upper_bound); *err = loadbuf; return 0; } @@ -2185,8 +2199,8 @@ static int numericParseString(standardConfig *config, sds value, const char **er } /* Attempt to parse as percent */ - if (config->data.numeric.flags & PERCENT_CONFIG && sdslen(value) > 1 && value[sdslen(value) - 1] == '%' && - string2ll(value, sdslen(value) - 1, res) && *res >= 0) { + if (config->data.numeric.flags & PERCENT_CONFIG && sdslen(value) > 1 && value[sdslen(value) - 1] == '%' + && string2ll(value, sdslen(value) - 1, res) && *res >= 0) { /* We store percentage as negative value */ *res = -*res; return 1; @@ -2289,7 +2303,15 @@ static void numericConfigRewrite(standardConfig *config, const char *name, struc } } -#define embedCommonNumericalConfig(name, alias, _flags, lower, upper, config_addr, default, num_conf_flags, is_valid, \ +#define embedCommonNumericalConfig(name, \ + alias, \ + _flags, \ + lower, \ + upper, \ + config_addr, \ + default, \ + num_conf_flags, \ + is_valid, \ apply) \ { \ embedCommonConfig(name, alias, _flags) \ @@ -2591,7 +2613,8 @@ static int updateMaxmemory(const char **err) { "WARNING: the new maxmemory value set via CONFIG SET (%llu) is smaller than the current memory " "usage (%zu). This will result in key eviction and/or the inability to accept new write commands " "depending on the maxmemory-policy.", - server.maxmemory, used); + server.maxmemory, + used); } startEvictionTimeProc(); } @@ -2651,7 +2674,8 @@ static int updateMaxclients(const char **err) { adjustOpenFilesLimit(); if (server.maxclients != new_maxclients) { static char msg[128]; - snprintf(msg, sizeof(msg), + snprintf(msg, + sizeof(msg), "The operating system is not able to handle the specified number of clients, try with %d", server.maxclients); *err = msg; @@ -2796,8 +2820,8 @@ static int applyTlsCfg(const char **err) { UNUSED(err); /* If TLS is enabled, try to configure OpenSSL. */ - if ((server.tls_port || server.tls_replication || server.tls_cluster) && - connTypeConfigure(connectionTypeTls(), &server.tls_ctx_config, 1) == C_ERR) { + if ((server.tls_port || server.tls_replication || server.tls_cluster) + && connTypeConfigure(connectionTypeTls(), &server.tls_ctx_config, 1) == C_ERR) { *err = "Unable to update TLS configuration. Check server logs."; return 0; } @@ -2929,7 +2953,10 @@ static sds getConfigClientOutputBufferLimitOption(standardConfig *config) { sds buf = sdsempty(); int j; for (j = 0; j < CLIENT_TYPE_OBUF_COUNT; j++) { - buf = sdscatprintf(buf, "%s %llu %llu %ld", getClientTypeName(j), server.client_obuf_limits[j].hard_limit_bytes, + buf = sdscatprintf(buf, + "%s %llu %llu %ld", + getClientTypeName(j), + server.client_obuf_limits[j].hard_limit_bytes, server.client_obuf_limits[j].soft_limit_bytes, (long)server.client_obuf_limits[j].soft_limit_seconds); if (j != CLIENT_TYPE_OBUF_COUNT - 1) buf = sdscatlen(buf, " ", 1); @@ -2967,10 +2994,11 @@ static int setConfigOOMScoreAdjValuesOption(standardConfig *config, sds *argv, i * keep the configuration, which may still be valid for privileged processes. */ - if (values[CONFIG_OOM_REPLICA] < values[CONFIG_OOM_PRIMARY] || - values[CONFIG_OOM_BGCHILD] < values[CONFIG_OOM_REPLICA]) { - serverLog(LL_WARNING, "The oom-score-adj-values configuration may not work for non-privileged processes! " - "Please consult the documentation."); + if (values[CONFIG_OOM_REPLICA] < values[CONFIG_OOM_PRIMARY] + || values[CONFIG_OOM_BGCHILD] < values[CONFIG_OOM_REPLICA]) { + serverLog(LL_WARNING, + "The oom-score-adj-values configuration may not work for non-privileged processes! " + "Please consult the documentation."); } for (i = 0; i < CONFIG_OOM_COUNT; i++) { @@ -3016,7 +3044,12 @@ static sds getConfigNotifyKeyspaceEventsOption(standardConfig *config) { return keyspaceEventsFlagsToString(server.notify_keyspace_events); } -static int setConfigBindOption(standardConfig *config, sds *argv, int argc, const char **err, char **bindaddr, int *bindaddr_count) { +static int setConfigBindOption(standardConfig *config, + sds *argv, + int argc, + const char **err, + char **bindaddr, + int *bindaddr_count) { UNUSED(config); int orig_bindaddr_count = *bindaddr_count; int j; @@ -3044,7 +3077,12 @@ static int setConfigSocketBindOption(standardConfig *config, sds *argv, int argc static int setConfigRdmaBindOption(standardConfig *config, sds *argv, int argc, const char **err) { UNUSED(config); - return setConfigBindOption(config, argv, argc, err, server.rdma_ctx_config.bindaddr, &server.rdma_ctx_config.bindaddr_count); + return setConfigBindOption(config, + argv, + argc, + err, + server.rdma_ctx_config.bindaddr, + &server.rdma_ctx_config.bindaddr_count); } static sds getConfigRdmaBindOption(standardConfig *config) { @@ -3056,7 +3094,10 @@ static void rewriteConfigRdmaBindOption(standardConfig *config, const char *name UNUSED(config); if (server.rdma_ctx_config.bindaddr_count) { - rewriteConfigBindOption(config, name, state, server.rdma_ctx_config.bindaddr, + rewriteConfigBindOption(config, + name, + state, + server.rdma_ctx_config.bindaddr, server.rdma_ctx_config.bindaddr_count); } } @@ -3141,13 +3182,15 @@ static sds getConfigReplicaOfOption(standardConfig *config) { } int allowProtectedAction(int config, client *c) { - return (config == PROTECTED_ACTION_ALLOWED_YES) || - (config == PROTECTED_ACTION_ALLOWED_LOCAL && (connIsLocal(c->conn) == 1)); + return (config == PROTECTED_ACTION_ALLOWED_YES) + || (config == PROTECTED_ACTION_ALLOWED_LOCAL && (connIsLocal(c->conn) == 1)); } -static int -setConfigLatencyTrackingInfoPercentilesOutputOption(standardConfig *config, sds *argv, int argc, const char **err) { +static int setConfigLatencyTrackingInfoPercentilesOutputOption(standardConfig *config, + sds *argv, + int argc, + const char **err) { UNUSED(config); zfree(server.latency_tracking_info_percentiles); server.latency_tracking_info_percentiles = NULL; @@ -3262,256 +3305,1810 @@ standardConfig static_configs[] = { createBoolConfig("rdbcompression", NULL, MODIFIABLE_CONFIG, server.rdb_compression, 1, NULL, NULL), createBoolConfig("rdb-del-sync-files", NULL, MODIFIABLE_CONFIG, server.rdb_del_sync_files, 0, NULL, NULL), createBoolConfig("activerehashing", NULL, MODIFIABLE_CONFIG, server.activerehashing, 1, NULL, NULL), - createBoolConfig("stop-writes-on-bgsave-error", NULL, MODIFIABLE_CONFIG, server.stop_writes_on_bgsave_err, 1, NULL, NULL), - createBoolConfig("set-proc-title", NULL, IMMUTABLE_CONFIG, server.set_proc_title, 1, NULL, NULL), /* Should setproctitle be used? */ - createBoolConfig("lazyfree-lazy-eviction", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.lazyfree_lazy_eviction, 1, NULL, NULL), - createBoolConfig("lazyfree-lazy-expire", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.lazyfree_lazy_expire, 1, NULL, NULL), - createBoolConfig("lazyfree-lazy-server-del", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.lazyfree_lazy_server_del, 1, NULL, NULL), - createBoolConfig("lazyfree-lazy-user-del", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.lazyfree_lazy_user_del, 1, NULL, NULL), - createBoolConfig("lazyfree-lazy-user-flush", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.lazyfree_lazy_user_flush, 1, NULL, NULL), - createBoolConfig("repl-disable-tcp-nodelay", NULL, MODIFIABLE_CONFIG, server.repl_disable_tcp_nodelay, 0, NULL, NULL), + createBoolConfig("stop-writes-on-bgsave-error", + NULL, + MODIFIABLE_CONFIG, + server.stop_writes_on_bgsave_err, + 1, + NULL, + NULL), + createBoolConfig("set-proc-title", + NULL, + IMMUTABLE_CONFIG, + server.set_proc_title, + 1, + NULL, + NULL), /* Should setproctitle be used? */ + createBoolConfig("lazyfree-lazy-eviction", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + server.lazyfree_lazy_eviction, + 1, + NULL, + NULL), + createBoolConfig("lazyfree-lazy-expire", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + server.lazyfree_lazy_expire, + 1, + NULL, + NULL), + createBoolConfig("lazyfree-lazy-server-del", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + server.lazyfree_lazy_server_del, + 1, + NULL, + NULL), + createBoolConfig("lazyfree-lazy-user-del", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + server.lazyfree_lazy_user_del, + 1, + NULL, + NULL), + createBoolConfig("lazyfree-lazy-user-flush", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + server.lazyfree_lazy_user_flush, + 1, + NULL, + NULL), + createBoolConfig("repl-disable-tcp-nodelay", + NULL, + MODIFIABLE_CONFIG, + server.repl_disable_tcp_nodelay, + 0, + NULL, + NULL), createBoolConfig("repl-mptcp", NULL, IMMUTABLE_CONFIG, server.repl_mptcp, 0, isValidMptcp, NULL), - createBoolConfig("repl-diskless-sync", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.repl_diskless_sync, 1, NULL, NULL), - createBoolConfig("dual-channel-replication-enabled", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.dual_channel_replication, 0, NULL, NULL), - createBoolConfig("aof-rewrite-incremental-fsync", NULL, MODIFIABLE_CONFIG, server.aof_rewrite_incremental_fsync, 1, NULL, NULL), - createBoolConfig("no-appendfsync-on-rewrite", NULL, MODIFIABLE_CONFIG, server.aof_no_fsync_on_rewrite, 0, NULL, NULL), - createBoolConfig("cluster-require-full-coverage", NULL, MODIFIABLE_CONFIG, server.cluster_require_full_coverage, 1, NULL, NULL), - createBoolConfig("rdb-save-incremental-fsync", NULL, MODIFIABLE_CONFIG, server.rdb_save_incremental_fsync, 1, NULL, NULL), + createBoolConfig("repl-diskless-sync", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + server.repl_diskless_sync, + 1, + NULL, + NULL), + createBoolConfig("dual-channel-replication-enabled", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + server.dual_channel_replication, + 0, + NULL, + NULL), + createBoolConfig("aof-rewrite-incremental-fsync", + NULL, + MODIFIABLE_CONFIG, + server.aof_rewrite_incremental_fsync, + 1, + NULL, + NULL), + createBoolConfig("no-appendfsync-on-rewrite", + NULL, + MODIFIABLE_CONFIG, + server.aof_no_fsync_on_rewrite, + 0, + NULL, + NULL), + createBoolConfig("cluster-require-full-coverage", + NULL, + MODIFIABLE_CONFIG, + server.cluster_require_full_coverage, + 1, + NULL, + NULL), + createBoolConfig("rdb-save-incremental-fsync", + NULL, + MODIFIABLE_CONFIG, + server.rdb_save_incremental_fsync, + 1, + NULL, + NULL), createBoolConfig("aof-load-truncated", NULL, MODIFIABLE_CONFIG, server.aof_load_truncated, 1, NULL, NULL), createBoolConfig("aof-use-rdb-preamble", NULL, MODIFIABLE_CONFIG, server.aof_use_rdb_preamble, 1, NULL, NULL), createBoolConfig("aof-timestamp-enabled", NULL, MODIFIABLE_CONFIG, server.aof_timestamp_enabled, 0, NULL, NULL), - createBoolConfig("cluster-replica-no-failover", "cluster-slave-no-failover", MODIFIABLE_CONFIG, server.cluster_replica_no_failover, 0, NULL, updateClusterFlags), /* Failover by default. */ - createBoolConfig("replica-lazy-flush", "slave-lazy-flush", MODIFIABLE_CONFIG, server.repl_replica_lazy_flush, 1, NULL, NULL), - createBoolConfig("replica-serve-stale-data", "slave-serve-stale-data", MODIFIABLE_CONFIG, server.repl_serve_stale_data, 1, NULL, NULL), - createBoolConfig("replica-read-only", "slave-read-only", DEBUG_CONFIG | MODIFIABLE_CONFIG, server.repl_replica_ro, 1, NULL, NULL), - createBoolConfig("replica-ignore-maxmemory", "slave-ignore-maxmemory", MODIFIABLE_CONFIG, server.repl_replica_ignore_maxmemory, 1, NULL, NULL), - createBoolConfig("jemalloc-bg-thread", NULL, MODIFIABLE_CONFIG, server.jemalloc_bg_thread, 1, NULL, updateJemallocBgThread), - createBoolConfig("activedefrag", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.active_defrag_enabled, CONFIG_ACTIVE_DEFRAG_DEFAULT, isValidActiveDefrag, NULL), + createBoolConfig("cluster-replica-no-failover", + "cluster-slave-no-failover", + MODIFIABLE_CONFIG, + server.cluster_replica_no_failover, + 0, + NULL, + updateClusterFlags), /* Failover by default. */ + createBoolConfig("replica-lazy-flush", + "slave-lazy-flush", + MODIFIABLE_CONFIG, + server.repl_replica_lazy_flush, + 1, + NULL, + NULL), + createBoolConfig("replica-serve-stale-data", + "slave-serve-stale-data", + MODIFIABLE_CONFIG, + server.repl_serve_stale_data, + 1, + NULL, + NULL), + createBoolConfig("replica-read-only", + "slave-read-only", + DEBUG_CONFIG | MODIFIABLE_CONFIG, + server.repl_replica_ro, + 1, + NULL, + NULL), + createBoolConfig("replica-ignore-maxmemory", + "slave-ignore-maxmemory", + MODIFIABLE_CONFIG, + server.repl_replica_ignore_maxmemory, + 1, + NULL, + NULL), + createBoolConfig("jemalloc-bg-thread", + NULL, + MODIFIABLE_CONFIG, + server.jemalloc_bg_thread, + 1, + NULL, + updateJemallocBgThread), + createBoolConfig("activedefrag", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + server.active_defrag_enabled, + CONFIG_ACTIVE_DEFRAG_DEFAULT, + isValidActiveDefrag, + NULL), createBoolConfig("syslog-enabled", NULL, IMMUTABLE_CONFIG, server.syslog_enabled, 0, NULL, NULL), createBoolConfig("cluster-enabled", NULL, IMMUTABLE_CONFIG, server.cluster_enabled, 0, NULL, NULL), - createBoolConfig("appendonly", NULL, MODIFIABLE_CONFIG | DENY_LOADING_CONFIG, server.aof_enabled, 0, NULL, updateAppendOnly), - createBoolConfig("cluster-allow-reads-when-down", NULL, MODIFIABLE_CONFIG, server.cluster_allow_reads_when_down, 0, NULL, NULL), - createBoolConfig("cluster-allow-pubsubshard-when-down", NULL, MODIFIABLE_CONFIG, server.cluster_allow_pubsubshard_when_down, 1, NULL, NULL), - createBoolConfig("crash-log-enabled", NULL, MODIFIABLE_CONFIG, server.crashlog_enabled, 1, NULL, updateSighandlerEnabled), + createBoolConfig("appendonly", + NULL, + MODIFIABLE_CONFIG | DENY_LOADING_CONFIG, + server.aof_enabled, + 0, + NULL, + updateAppendOnly), + createBoolConfig("cluster-allow-reads-when-down", + NULL, + MODIFIABLE_CONFIG, + server.cluster_allow_reads_when_down, + 0, + NULL, + NULL), + createBoolConfig("cluster-allow-pubsubshard-when-down", + NULL, + MODIFIABLE_CONFIG, + server.cluster_allow_pubsubshard_when_down, + 1, + NULL, + NULL), + createBoolConfig("crash-log-enabled", + NULL, + MODIFIABLE_CONFIG, + server.crashlog_enabled, + 1, + NULL, + updateSighandlerEnabled), createBoolConfig("crash-memcheck-enabled", NULL, MODIFIABLE_CONFIG, server.memcheck_enabled, 1, NULL, NULL), - createBoolConfig("use-exit-on-panic", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, server.use_exit_on_panic, 0, NULL, NULL), + createBoolConfig("use-exit-on-panic", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + server.use_exit_on_panic, + 0, + NULL, + NULL), createBoolConfig("disable-thp", NULL, IMMUTABLE_CONFIG, server.disable_thp, 1, NULL, NULL), - createBoolConfig("cluster-allow-replica-migration", NULL, MODIFIABLE_CONFIG, server.cluster_allow_replica_migration, 1, NULL, NULL), + createBoolConfig("cluster-allow-replica-migration", + NULL, + MODIFIABLE_CONFIG, + server.cluster_allow_replica_migration, + 1, + NULL, + NULL), createBoolConfig("replica-announced", NULL, MODIFIABLE_CONFIG, server.replica_announced, 1, NULL, NULL), createBoolConfig("latency-tracking", NULL, MODIFIABLE_CONFIG, server.latency_tracking_enabled, 1, NULL, NULL), - createBoolConfig("aof-disable-auto-gc", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, server.aof_disable_auto_gc, 0, NULL, updateAofAutoGCEnabled), - createBoolConfig("replica-ignore-disk-write-errors", NULL, MODIFIABLE_CONFIG, server.repl_ignore_disk_write_error, 0, NULL, NULL), - createBoolConfig("extended-redis-compatibility", NULL, MODIFIABLE_CONFIG, server.extended_redis_compat, 0, NULL, updateExtendedRedisCompat), - createBoolConfig("enable-debug-assert", NULL, IMMUTABLE_CONFIG | HIDDEN_CONFIG, server.enable_debug_assert, 0, NULL, NULL), - createBoolConfig("cluster-slot-stats-enabled", NULL, MODIFIABLE_CONFIG, server.cluster_slot_stats_enabled, 0, NULL, NULL), + createBoolConfig("aof-disable-auto-gc", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + server.aof_disable_auto_gc, + 0, + NULL, + updateAofAutoGCEnabled), + createBoolConfig("replica-ignore-disk-write-errors", + NULL, + MODIFIABLE_CONFIG, + server.repl_ignore_disk_write_error, + 0, + NULL, + NULL), + createBoolConfig("extended-redis-compatibility", + NULL, + MODIFIABLE_CONFIG, + server.extended_redis_compat, + 0, + NULL, + updateExtendedRedisCompat), + createBoolConfig("enable-debug-assert", + NULL, + IMMUTABLE_CONFIG | HIDDEN_CONFIG, + server.enable_debug_assert, + 0, + NULL, + NULL), + createBoolConfig("cluster-slot-stats-enabled", + NULL, + MODIFIABLE_CONFIG, + server.cluster_slot_stats_enabled, + 0, + NULL, + NULL), createBoolConfig("hide-user-data-from-log", NULL, MODIFIABLE_CONFIG, server.hide_user_data_from_log, 1, NULL, NULL), - createBoolConfig("lua-enable-insecure-api", "lua-enable-deprecated-api", MODIFIABLE_CONFIG | HIDDEN_CONFIG | PROTECTED_CONFIG, server.lua_enable_insecure_api, 0, NULL, updateLuaEnableInsecureApi), + createBoolConfig("lua-enable-insecure-api", + "lua-enable-deprecated-api", + MODIFIABLE_CONFIG | HIDDEN_CONFIG | PROTECTED_CONFIG, + server.lua_enable_insecure_api, + 0, + NULL, + updateLuaEnableInsecureApi), createBoolConfig("import-mode", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.import_mode, 0, NULL, NULL), - createBoolConfig("io-threads-always-active", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, server.io_threads_always_active, 0, NULL, NULL), + createBoolConfig("io-threads-always-active", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + server.io_threads_always_active, + 0, + NULL, + NULL), /* String Configs */ createStringConfig("aclfile", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.acl_filename, "", NULL, NULL), createStringConfig("unixsocket", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.unixsocket, NULL, NULL, NULL), - createStringConfig("unixsocketgroup", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.unix_ctx_config.group, NULL, NULL, NULL), + createStringConfig("unixsocketgroup", + NULL, + IMMUTABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.unix_ctx_config.group, + NULL, + NULL, + NULL), createStringConfig("pidfile", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.pidfile, NULL, NULL, NULL), - createStringConfig("replica-announce-ip", "slave-announce-ip", MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.replica_announce_ip, NULL, NULL, NULL), - createStringConfig("primaryuser", "masteruser", MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.primary_user, NULL, NULL, NULL), - createStringConfig("cluster-announce-ip", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.cluster_announce_ip, NULL, NULL, updateClusterIp), - createStringConfig("cluster-announce-client-ipv4", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.cluster_announce_client_ipv4, NULL, isValidIpV4, updateClusterClientIpV4), - createStringConfig("cluster-announce-client-ipv6", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.cluster_announce_client_ipv6, NULL, isValidIpV6, updateClusterClientIpV6), - createStringConfig("cluster-config-file", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.cluster_configfile, "nodes.conf", isValidClusterConfigFile, NULL), - createStringConfig("cluster-announce-hostname", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.cluster_announce_hostname, NULL, isValidAnnouncedHostname, updateClusterHostname), - createStringConfig("cluster-announce-human-nodename", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.cluster_announce_human_nodename, NULL, isValidAnnouncedNodename, updateClusterHumanNodename), - createStringConfig("syslog-ident", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.syslog_ident, SERVER_NAME, NULL, NULL), - createStringConfig("dbfilename", NULL, MODIFIABLE_CONFIG | PROTECTED_CONFIG, ALLOW_EMPTY_STRING, server.rdb_filename, "dump.rdb", isValidDBfilename, NULL), - createStringConfig("appendfilename", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.aof_filename, "appendonly.aof", isValidAOFfilename, NULL), - createStringConfig("appenddirname", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.aof_dirname, "appendonlydir", isValidAOFdirname, NULL), - createStringConfig("server-cpulist", "server_cpulist", IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.server_cpulist, NULL, NULL, NULL), - createStringConfig("bio-cpulist", "bio_cpulist", IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.bio_cpulist, NULL, NULL, NULL), - createStringConfig("aof-rewrite-cpulist", "aof_rewrite_cpulist", IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.aof_rewrite_cpulist, NULL, NULL, NULL), - createStringConfig("bgsave-cpulist", "bgsave_cpulist", IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.bgsave_cpulist, NULL, NULL, NULL), - createStringConfig("ignore-warnings", NULL, MODIFIABLE_CONFIG, ALLOW_EMPTY_STRING, server.ignore_warnings, "", NULL, NULL), - createStringConfig("proc-title-template", NULL, MODIFIABLE_CONFIG, ALLOW_EMPTY_STRING, server.proc_title_template, CONFIG_DEFAULT_PROC_TITLE_TEMPLATE, isValidProcTitleTemplate, updateProcTitleTemplate), - createStringConfig("bind-source-addr", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.bind_source_addr, NULL, NULL, NULL), + createStringConfig("replica-announce-ip", + "slave-announce-ip", + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.replica_announce_ip, + NULL, + NULL, + NULL), + createStringConfig("primaryuser", + "masteruser", + MODIFIABLE_CONFIG | SENSITIVE_CONFIG, + EMPTY_STRING_IS_NULL, + server.primary_user, + NULL, + NULL, + NULL), + createStringConfig("cluster-announce-ip", + NULL, + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.cluster_announce_ip, + NULL, + NULL, + updateClusterIp), + createStringConfig("cluster-announce-client-ipv4", + NULL, + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.cluster_announce_client_ipv4, + NULL, + isValidIpV4, + updateClusterClientIpV4), + createStringConfig("cluster-announce-client-ipv6", + NULL, + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.cluster_announce_client_ipv6, + NULL, + isValidIpV6, + updateClusterClientIpV6), + createStringConfig("cluster-config-file", + NULL, + IMMUTABLE_CONFIG, + ALLOW_EMPTY_STRING, + server.cluster_configfile, + "nodes.conf", + isValidClusterConfigFile, + NULL), + createStringConfig("cluster-announce-hostname", + NULL, + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.cluster_announce_hostname, + NULL, + isValidAnnouncedHostname, + updateClusterHostname), + createStringConfig("cluster-announce-human-nodename", + NULL, + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.cluster_announce_human_nodename, + NULL, + isValidAnnouncedNodename, + updateClusterHumanNodename), + createStringConfig("syslog-ident", + NULL, + IMMUTABLE_CONFIG, + ALLOW_EMPTY_STRING, + server.syslog_ident, + SERVER_NAME, + NULL, + NULL), + createStringConfig("dbfilename", + NULL, + MODIFIABLE_CONFIG | PROTECTED_CONFIG, + ALLOW_EMPTY_STRING, + server.rdb_filename, + "dump.rdb", + isValidDBfilename, + NULL), + createStringConfig("appendfilename", + NULL, + IMMUTABLE_CONFIG, + ALLOW_EMPTY_STRING, + server.aof_filename, + "appendonly.aof", + isValidAOFfilename, + NULL), + createStringConfig("appenddirname", + NULL, + IMMUTABLE_CONFIG, + ALLOW_EMPTY_STRING, + server.aof_dirname, + "appendonlydir", + isValidAOFdirname, + NULL), + createStringConfig("server-cpulist", + "server_cpulist", + IMMUTABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.server_cpulist, + NULL, + NULL, + NULL), + createStringConfig("bio-cpulist", + "bio_cpulist", + IMMUTABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.bio_cpulist, + NULL, + NULL, + NULL), + createStringConfig("aof-rewrite-cpulist", + "aof_rewrite_cpulist", + IMMUTABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.aof_rewrite_cpulist, + NULL, + NULL, + NULL), + createStringConfig("bgsave-cpulist", + "bgsave_cpulist", + IMMUTABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.bgsave_cpulist, + NULL, + NULL, + NULL), + createStringConfig("ignore-warnings", + NULL, + MODIFIABLE_CONFIG, + ALLOW_EMPTY_STRING, + server.ignore_warnings, + "", + NULL, + NULL), + createStringConfig("proc-title-template", + NULL, + MODIFIABLE_CONFIG, + ALLOW_EMPTY_STRING, + server.proc_title_template, + CONFIG_DEFAULT_PROC_TITLE_TEMPLATE, + isValidProcTitleTemplate, + updateProcTitleTemplate), + createStringConfig("bind-source-addr", + NULL, + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.bind_source_addr, + NULL, + NULL, + NULL), createStringConfig("logfile", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.logfile, "", NULL, NULL), #ifdef LOG_REQ_RES - createStringConfig("req-res-logfile", NULL, IMMUTABLE_CONFIG | HIDDEN_CONFIG, EMPTY_STRING_IS_NULL, server.req_res_logfile, NULL, NULL, NULL), + createStringConfig("req-res-logfile", + NULL, + IMMUTABLE_CONFIG | HIDDEN_CONFIG, + EMPTY_STRING_IS_NULL, + server.req_res_logfile, + NULL, + NULL, + NULL), #endif - createStringConfig("locale-collate", NULL, MODIFIABLE_CONFIG, ALLOW_EMPTY_STRING, server.locale_collate, "", NULL, updateLocaleCollate), - createStringConfig("debug-context", NULL, MODIFIABLE_CONFIG | DEBUG_CONFIG | HIDDEN_CONFIG, ALLOW_EMPTY_STRING, server.debug_context, "", NULL, NULL), + createStringConfig("locale-collate", + NULL, + MODIFIABLE_CONFIG, + ALLOW_EMPTY_STRING, + server.locale_collate, + "", + NULL, + updateLocaleCollate), + createStringConfig("debug-context", + NULL, + MODIFIABLE_CONFIG | DEBUG_CONFIG | HIDDEN_CONFIG, + ALLOW_EMPTY_STRING, + server.debug_context, + "", + NULL, + NULL), /* SDS Configs */ - createSDSConfig("primaryauth", "masterauth", MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.primary_auth, NULL, NULL, NULL), - createSDSConfig("requirepass", NULL, MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.requirepass, NULL, NULL, updateRequirePass), - createSDSConfig("availability-zone", NULL, MODIFIABLE_CONFIG, ALLOW_EMPTY_STRING, server.availability_zone, "", NULL, updateClusterAvailabilityZone), - createSDSConfig("hash-seed", NULL, IMMUTABLE_CONFIG, EMPTY_STRING_IS_NULL, server.hash_seed, NULL, isValidDbHashSeed, NULL), + createSDSConfig("primaryauth", + "masterauth", + MODIFIABLE_CONFIG | SENSITIVE_CONFIG, + EMPTY_STRING_IS_NULL, + server.primary_auth, + NULL, + NULL, + NULL), + createSDSConfig("requirepass", + NULL, + MODIFIABLE_CONFIG | SENSITIVE_CONFIG, + EMPTY_STRING_IS_NULL, + server.requirepass, + NULL, + NULL, + updateRequirePass), + createSDSConfig("availability-zone", + NULL, + MODIFIABLE_CONFIG, + ALLOW_EMPTY_STRING, + server.availability_zone, + "", + NULL, + updateClusterAvailabilityZone), + createSDSConfig("hash-seed", + NULL, + IMMUTABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.hash_seed, + NULL, + isValidDbHashSeed, + NULL), /* Enum Configs */ - createEnumConfig("supervised", NULL, IMMUTABLE_CONFIG, supervised_mode_enum, server.supervised_mode, SUPERVISED_NONE, NULL, NULL), - createEnumConfig("syslog-facility", NULL, IMMUTABLE_CONFIG, syslog_facility_enum, server.syslog_facility, LOG_LOCAL0, NULL, NULL), - createEnumConfig("repl-diskless-load", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG | DENY_LOADING_CONFIG, repl_diskless_load_enum, server.repl_diskless_load, REPL_DISKLESS_LOAD_DISABLED, NULL, NULL), + createEnumConfig("supervised", + NULL, + IMMUTABLE_CONFIG, + supervised_mode_enum, + server.supervised_mode, + SUPERVISED_NONE, + NULL, + NULL), + createEnumConfig("syslog-facility", + NULL, + IMMUTABLE_CONFIG, + syslog_facility_enum, + server.syslog_facility, + LOG_LOCAL0, + NULL, + NULL), + createEnumConfig("repl-diskless-load", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG | DENY_LOADING_CONFIG, + repl_diskless_load_enum, + server.repl_diskless_load, + REPL_DISKLESS_LOAD_DISABLED, + NULL, + NULL), createEnumConfig("loglevel", NULL, MODIFIABLE_CONFIG, loglevel_enum, server.verbosity, LL_NOTICE, NULL, NULL), - createEnumConfig("maxmemory-policy", NULL, MODIFIABLE_CONFIG, maxmemory_policy_enum, server.maxmemory_policy, MAXMEMORY_NO_EVICTION, NULL, NULL), - createEnumConfig("appendfsync", NULL, MODIFIABLE_CONFIG, aof_fsync_enum, server.aof_fsync, AOF_FSYNC_EVERYSEC, NULL, updateAppendFsync), - createEnumConfig("oom-score-adj", NULL, MODIFIABLE_CONFIG, oom_score_adj_enum, server.oom_score_adj, OOM_SCORE_ADJ_NO, NULL, updateOOMScoreAdj), - createEnumConfig("acl-pubsub-default", NULL, MODIFIABLE_CONFIG, acl_pubsub_default_enum, server.acl_pubsub_default, 0, NULL, NULL), - createEnumConfig("sanitize-dump-payload", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, sanitize_dump_payload_enum, server.sanitize_dump_payload, SANITIZE_DUMP_NO, NULL, NULL), - createEnumConfig("enable-protected-configs", NULL, IMMUTABLE_CONFIG, protected_action_enum, server.enable_protected_configs, PROTECTED_ACTION_ALLOWED_NO, NULL, NULL), - createEnumConfig("enable-debug-command", NULL, IMMUTABLE_CONFIG, protected_action_enum, server.enable_debug_cmd, PROTECTED_ACTION_ALLOWED_NO, NULL, NULL), - createEnumConfig("enable-module-command", NULL, IMMUTABLE_CONFIG, protected_action_enum, server.enable_module_cmd, PROTECTED_ACTION_ALLOWED_NO, NULL, NULL), - createEnumConfig("cluster-preferred-endpoint-type", NULL, MODIFIABLE_CONFIG, cluster_preferred_endpoint_type_enum, server.cluster_preferred_endpoint_type, CLUSTER_ENDPOINT_TYPE_IP, NULL, invalidateClusterSlotsResp), - createEnumConfig("cluster-config-save-behavior", NULL, MODIFIABLE_CONFIG, cluster_configfile_save_behavior_enum, server.cluster_configfile_save_behavior, CLUSTER_CONFIGFILE_SAVE_BEHAVIOR_SYNC, NULL, NULL), - createEnumConfig("propagation-error-behavior", NULL, MODIFIABLE_CONFIG, propagation_error_behavior_enum, server.propagation_error_behavior, PROPAGATION_ERR_BEHAVIOR_IGNORE, NULL, NULL), - createEnumConfig("shutdown-on-sigint", NULL, MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, shutdown_on_sig_enum, server.shutdown_on_sigint, 0, isValidShutdownOnSigFlags, NULL), - createEnumConfig("shutdown-on-sigterm", NULL, MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, shutdown_on_sig_enum, server.shutdown_on_sigterm, 0, isValidShutdownOnSigFlags, NULL), - createEnumConfig("log-format", NULL, MODIFIABLE_CONFIG, log_format_enum, server.log_format, LOG_FORMAT_LEGACY, NULL, NULL), - createEnumConfig("log-timestamp-format", NULL, MODIFIABLE_CONFIG, log_timestamp_format_enum, server.log_timestamp_format, LOG_TIMESTAMP_LEGACY, NULL, NULL), - createEnumConfig("rdb-version-check", NULL, MODIFIABLE_CONFIG, rdb_version_check_enum, server.rdb_version_check, RDB_VERSION_CHECK_STRICT, NULL, NULL), + createEnumConfig("maxmemory-policy", + NULL, + MODIFIABLE_CONFIG, + maxmemory_policy_enum, + server.maxmemory_policy, + MAXMEMORY_NO_EVICTION, + NULL, + NULL), + createEnumConfig("appendfsync", + NULL, + MODIFIABLE_CONFIG, + aof_fsync_enum, + server.aof_fsync, + AOF_FSYNC_EVERYSEC, + NULL, + updateAppendFsync), + createEnumConfig("oom-score-adj", + NULL, + MODIFIABLE_CONFIG, + oom_score_adj_enum, + server.oom_score_adj, + OOM_SCORE_ADJ_NO, + NULL, + updateOOMScoreAdj), + createEnumConfig("acl-pubsub-default", + NULL, + MODIFIABLE_CONFIG, + acl_pubsub_default_enum, + server.acl_pubsub_default, + 0, + NULL, + NULL), + createEnumConfig("sanitize-dump-payload", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + sanitize_dump_payload_enum, + server.sanitize_dump_payload, + SANITIZE_DUMP_NO, + NULL, + NULL), + createEnumConfig("enable-protected-configs", + NULL, + IMMUTABLE_CONFIG, + protected_action_enum, + server.enable_protected_configs, + PROTECTED_ACTION_ALLOWED_NO, + NULL, + NULL), + createEnumConfig("enable-debug-command", + NULL, + IMMUTABLE_CONFIG, + protected_action_enum, + server.enable_debug_cmd, + PROTECTED_ACTION_ALLOWED_NO, + NULL, + NULL), + createEnumConfig("enable-module-command", + NULL, + IMMUTABLE_CONFIG, + protected_action_enum, + server.enable_module_cmd, + PROTECTED_ACTION_ALLOWED_NO, + NULL, + NULL), + createEnumConfig("cluster-preferred-endpoint-type", + NULL, + MODIFIABLE_CONFIG, + cluster_preferred_endpoint_type_enum, + server.cluster_preferred_endpoint_type, + CLUSTER_ENDPOINT_TYPE_IP, + NULL, + invalidateClusterSlotsResp), + createEnumConfig("cluster-config-save-behavior", + NULL, + MODIFIABLE_CONFIG, + cluster_configfile_save_behavior_enum, + server.cluster_configfile_save_behavior, + CLUSTER_CONFIGFILE_SAVE_BEHAVIOR_SYNC, + NULL, + NULL), + createEnumConfig("propagation-error-behavior", + NULL, + MODIFIABLE_CONFIG, + propagation_error_behavior_enum, + server.propagation_error_behavior, + PROPAGATION_ERR_BEHAVIOR_IGNORE, + NULL, + NULL), + createEnumConfig("shutdown-on-sigint", + NULL, + MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, + shutdown_on_sig_enum, + server.shutdown_on_sigint, + 0, + isValidShutdownOnSigFlags, + NULL), + createEnumConfig("shutdown-on-sigterm", + NULL, + MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, + shutdown_on_sig_enum, + server.shutdown_on_sigterm, + 0, + isValidShutdownOnSigFlags, + NULL), + createEnumConfig("log-format", + NULL, + MODIFIABLE_CONFIG, + log_format_enum, + server.log_format, + LOG_FORMAT_LEGACY, + NULL, + NULL), + createEnumConfig("log-timestamp-format", + NULL, + MODIFIABLE_CONFIG, + log_timestamp_format_enum, + server.log_timestamp_format, + LOG_TIMESTAMP_LEGACY, + NULL, + NULL), + createEnumConfig("rdb-version-check", + NULL, + MODIFIABLE_CONFIG, + rdb_version_check_enum, + server.rdb_version_check, + RDB_VERSION_CHECK_STRICT, + NULL, + NULL), /* Integer configs */ - createIntConfig("databases", NULL, IMMUTABLE_CONFIG, 1, INT_MAX, server.config_databases, 16, INTEGER_CONFIG, NULL, NULL), - createIntConfig("cluster-databases", NULL, IMMUTABLE_CONFIG, 1, INT_MAX, server.config_databases_cluster, 1, INTEGER_CONFIG, NULL, NULL), - createIntConfig("port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.port, 6379, INTEGER_CONFIG, NULL, updatePort), /* TCP port. */ - createIntConfig("io-threads", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, 1, IO_THREADS_MAX_NUM, server.io_threads_num, 1, INTEGER_CONFIG, NULL, updateIOThreads), /* Single threaded by default */ - createIntConfig("min-io-threads-avoid-copy-reply", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, 0, INT_MAX, server.min_io_threads_copy_avoid, 7, INTEGER_CONFIG, NULL, NULL), - createIntConfig("min-string-size-avoid-copy-reply", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, 0, INT_MAX, server.min_string_size_copy_avoid, 16384, INTEGER_CONFIG, NULL, NULL), - createIntConfig("min-string-size-avoid-copy-reply-threaded", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, 0, INT_MAX, server.min_string_size_copy_avoid_threaded, 65536, INTEGER_CONFIG, NULL, NULL), - createIntConfig("prefetch-batch-max-size", NULL, MODIFIABLE_CONFIG, 0, 128, server.prefetch_batch_max_size, 16, INTEGER_CONFIG, NULL, onMaxBatchSizeChange), - createIntConfig("auto-aof-rewrite-percentage", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.aof_rewrite_perc, 100, INTEGER_CONFIG, NULL, NULL), - createIntConfig("cluster-replica-validity-factor", "cluster-slave-validity-factor", MODIFIABLE_CONFIG, 0, INT_MAX, server.cluster_replica_validity_factor, 10, INTEGER_CONFIG, NULL, NULL), /* replica max data age factor. */ - createIntConfig("list-max-listpack-size", "list-max-ziplist-size", MODIFIABLE_CONFIG, INT_MIN, INT_MAX, server.list_max_listpack_size, -2, INTEGER_CONFIG, NULL, NULL), - createIntConfig("tcp-keepalive", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.tcpkeepalive, 300, INTEGER_CONFIG, NULL, NULL), - createIntConfig("cluster-migration-barrier", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.cluster_migration_barrier, 1, INTEGER_CONFIG, NULL, NULL), - createIntConfig("active-defrag-cycle-min", NULL, MODIFIABLE_CONFIG, 1, 99, server.active_defrag_cpu_min, 1, INTEGER_CONFIG, NULL, updateDefragConfiguration), /* Default: 1% CPU min (at lower threshold) */ - createIntConfig("active-defrag-cycle-max", NULL, MODIFIABLE_CONFIG, 1, 99, server.active_defrag_cpu_max, 25, INTEGER_CONFIG, NULL, updateDefragConfiguration), /* Default: 25% CPU max (at upper threshold) */ - createIntConfig("active-defrag-threshold-lower", NULL, MODIFIABLE_CONFIG, 0, 1000, server.active_defrag_threshold_lower, 10, INTEGER_CONFIG, NULL, NULL), /* Default: don't defrag when fragmentation is below 10% */ - createIntConfig("active-defrag-threshold-upper", NULL, MODIFIABLE_CONFIG, 0, 1000, server.active_defrag_threshold_upper, 100, INTEGER_CONFIG, NULL, updateDefragConfiguration), /* Default: maximum defrag force at 100% fragmentation */ - createIntConfig("active-defrag-cycle-us", NULL, MODIFIABLE_CONFIG, 0, 100000, server.active_defrag_cycle_us, 500, INTEGER_CONFIG, NULL, updateDefragConfiguration), - createIntConfig("lfu-log-factor", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, lfu_config_log_factor, 10, INTEGER_CONFIG, NULL, NULL), - createIntConfig("lfu-decay-time", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, lfu_config_decay_time, 1, INTEGER_CONFIG, NULL, NULL), - createIntConfig("replica-priority", "slave-priority", MODIFIABLE_CONFIG, 0, INT_MAX, server.replica_priority, 100, INTEGER_CONFIG, NULL, NULL), - createIntConfig("repl-diskless-sync-delay", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.repl_diskless_sync_delay, 5, INTEGER_CONFIG, NULL, NULL), - createIntConfig("maxmemory-samples", NULL, MODIFIABLE_CONFIG, 1, 64, server.maxmemory_samples, 5, INTEGER_CONFIG, NULL, NULL), - createIntConfig("maxmemory-eviction-tenacity", NULL, MODIFIABLE_CONFIG, 0, 100, server.maxmemory_eviction_tenacity, 10, INTEGER_CONFIG, NULL, NULL), - createIntConfig("timeout", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.maxidletime, 0, INTEGER_CONFIG, NULL, NULL), /* Default client timeout: infinite */ - createIntConfig("replica-announce-port", "slave-announce-port", MODIFIABLE_CONFIG, 0, 65535, server.replica_announce_port, 0, INTEGER_CONFIG, NULL, NULL), - createIntConfig("tcp-backlog", NULL, IMMUTABLE_CONFIG, 0, INT_MAX, server.tcp_backlog, 511, INTEGER_CONFIG, NULL, NULL), /* TCP listen backlog. */ - createBoolConfig("mptcp", NULL, IMMUTABLE_CONFIG, server.mptcp, 0, isValidMptcp, NULL), /* Multipath TCP. */ - createIntConfig("cluster-port", NULL, IMMUTABLE_CONFIG, 0, 65535, server.cluster_port, 0, INTEGER_CONFIG, NULL, NULL), - createIntConfig("cluster-announce-bus-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_bus_port, 0, INTEGER_CONFIG, NULL, updateClusterAnnouncedPort), /* Default: Use +10000 offset. */ - createIntConfig("cluster-announce-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_port, 0, INTEGER_CONFIG, NULL, updateClusterAnnouncedPort), /* Use server.port */ - createIntConfig("cluster-announce-tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_tls_port, 0, INTEGER_CONFIG, NULL, updateClusterAnnouncedPort), /* Use server.tls_port */ - createIntConfig("cluster-announce-client-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_client_port, 0, INTEGER_CONFIG, NULL, updateClusterAnnouncedPort), - createIntConfig("cluster-announce-client-tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.cluster_announce_client_tls_port, 0, INTEGER_CONFIG, NULL, updateClusterAnnouncedPort), - createIntConfig("repl-timeout", NULL, MODIFIABLE_CONFIG, 1, INT_MAX, server.repl_timeout, 60, INTEGER_CONFIG, NULL, NULL), - createIntConfig("repl-ping-replica-period", "repl-ping-slave-period", MODIFIABLE_CONFIG, 1, INT_MAX, server.repl_ping_replica_period, 10, INTEGER_CONFIG, NULL, NULL), - createIntConfig("list-compress-depth", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, 0, INT_MAX, server.list_compress_depth, 0, INTEGER_CONFIG, NULL, NULL), - createIntConfig("rdb-key-save-delay", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, INT_MIN, INT_MAX, server.rdb_key_save_delay, 0, INTEGER_CONFIG, NULL, NULL), - createIntConfig("key-load-delay", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, INT_MIN, INT_MAX, server.key_load_delay, 0, INTEGER_CONFIG, NULL, NULL), - createIntConfig("active-expire-effort", NULL, MODIFIABLE_CONFIG, 1, 10, server.active_expire_effort, 1, INTEGER_CONFIG, NULL, NULL), /* From 1 to 10. */ - createIntConfig("hz", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.hz, CONFIG_DEFAULT_HZ, INTEGER_CONFIG, NULL, updateHZ), - createIntConfig("min-replicas-to-write", "min-slaves-to-write", MODIFIABLE_CONFIG, 0, INT_MAX, server.repl_min_replicas_to_write, 0, INTEGER_CONFIG, NULL, updateGoodReplicas), - createIntConfig("min-replicas-max-lag", "min-slaves-max-lag", MODIFIABLE_CONFIG, 0, INT_MAX, server.repl_min_replicas_max_lag, 10, INTEGER_CONFIG, NULL, updateGoodReplicas), - createIntConfig("watchdog-period", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, 0, INT_MAX, server.watchdog_period, 0, INTEGER_CONFIG, NULL, updateWatchdogPeriod), - createIntConfig("shutdown-timeout", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.shutdown_timeout, 10, INTEGER_CONFIG, NULL, NULL), - createIntConfig("repl-diskless-sync-max-replicas", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.repl_diskless_sync_max_replicas, 0, INTEGER_CONFIG, NULL, NULL), - createIntConfig("rdma-port", NULL, MODIFIABLE_CONFIG, 0, 65535, server.rdma_ctx_config.port, 0, INTEGER_CONFIG, NULL, updateRdmaPort), - createIntConfig("rdma-rx-size", NULL, IMMUTABLE_CONFIG, 64 * 1024, 16 * 1024 * 1024, server.rdma_ctx_config.rx_size, 1024 * 1024, INTEGER_CONFIG, NULL, NULL), - createIntConfig("rdma-completion-vector", NULL, IMMUTABLE_CONFIG, -1, 1024, server.rdma_ctx_config.completion_vector, -1, INTEGER_CONFIG, NULL, NULL), - createIntConfig("cluster-message-gossip-perc", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, 1, 100, server.cluster_message_gossip_perc, 10, INTEGER_CONFIG, NULL, NULL), + createIntConfig("databases", + NULL, + IMMUTABLE_CONFIG, + 1, + INT_MAX, + server.config_databases, + 16, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("cluster-databases", + NULL, + IMMUTABLE_CONFIG, + 1, + INT_MAX, + server.config_databases_cluster, + 1, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("port", + NULL, + MODIFIABLE_CONFIG, + 0, + 65535, + server.port, + 6379, + INTEGER_CONFIG, + NULL, + updatePort), /* TCP port. */ + createIntConfig("io-threads", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + 1, + IO_THREADS_MAX_NUM, + server.io_threads_num, + 1, + INTEGER_CONFIG, + NULL, + updateIOThreads), /* Single threaded by default */ + createIntConfig("min-io-threads-avoid-copy-reply", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + 0, + INT_MAX, + server.min_io_threads_copy_avoid, + 7, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("min-string-size-avoid-copy-reply", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + 0, + INT_MAX, + server.min_string_size_copy_avoid, + 16384, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("min-string-size-avoid-copy-reply-threaded", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + 0, + INT_MAX, + server.min_string_size_copy_avoid_threaded, + 65536, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("prefetch-batch-max-size", + NULL, + MODIFIABLE_CONFIG, + 0, + 128, + server.prefetch_batch_max_size, + 16, + INTEGER_CONFIG, + NULL, + onMaxBatchSizeChange), + createIntConfig("auto-aof-rewrite-percentage", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.aof_rewrite_perc, + 100, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("cluster-replica-validity-factor", + "cluster-slave-validity-factor", + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.cluster_replica_validity_factor, + 10, + INTEGER_CONFIG, + NULL, + NULL), /* replica max data age factor. */ + createIntConfig("list-max-listpack-size", + "list-max-ziplist-size", + MODIFIABLE_CONFIG, + INT_MIN, + INT_MAX, + server.list_max_listpack_size, + -2, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("tcp-keepalive", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.tcpkeepalive, + 300, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("cluster-migration-barrier", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.cluster_migration_barrier, + 1, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("active-defrag-cycle-min", + NULL, + MODIFIABLE_CONFIG, + 1, + 99, + server.active_defrag_cpu_min, + 1, + INTEGER_CONFIG, + NULL, + updateDefragConfiguration), /* Default: 1% CPU min (at lower threshold) */ + createIntConfig("active-defrag-cycle-max", + NULL, + MODIFIABLE_CONFIG, + 1, + 99, + server.active_defrag_cpu_max, + 25, + INTEGER_CONFIG, + NULL, + updateDefragConfiguration), /* Default: 25% CPU max (at upper threshold) */ + createIntConfig("active-defrag-threshold-lower", + NULL, + MODIFIABLE_CONFIG, + 0, + 1000, + server.active_defrag_threshold_lower, + 10, + INTEGER_CONFIG, + NULL, + NULL), /* Default: don't defrag when fragmentation is below 10% */ + createIntConfig("active-defrag-threshold-upper", + NULL, + MODIFIABLE_CONFIG, + 0, + 1000, + server.active_defrag_threshold_upper, + 100, + INTEGER_CONFIG, + NULL, + updateDefragConfiguration), /* Default: maximum defrag force at 100% fragmentation */ + createIntConfig("active-defrag-cycle-us", + NULL, + MODIFIABLE_CONFIG, + 0, + 100000, + server.active_defrag_cycle_us, + 500, + INTEGER_CONFIG, + NULL, + updateDefragConfiguration), + createIntConfig("lfu-log-factor", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + lfu_config_log_factor, + 10, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("lfu-decay-time", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + lfu_config_decay_time, + 1, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("replica-priority", + "slave-priority", + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.replica_priority, + 100, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("repl-diskless-sync-delay", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.repl_diskless_sync_delay, + 5, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("maxmemory-samples", + NULL, + MODIFIABLE_CONFIG, + 1, + 64, + server.maxmemory_samples, + 5, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("maxmemory-eviction-tenacity", + NULL, + MODIFIABLE_CONFIG, + 0, + 100, + server.maxmemory_eviction_tenacity, + 10, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("timeout", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.maxidletime, + 0, + INTEGER_CONFIG, + NULL, + NULL), /* Default client timeout: infinite */ + createIntConfig("replica-announce-port", + "slave-announce-port", + MODIFIABLE_CONFIG, + 0, + 65535, + server.replica_announce_port, + 0, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("tcp-backlog", + NULL, + IMMUTABLE_CONFIG, + 0, + INT_MAX, + server.tcp_backlog, + 511, + INTEGER_CONFIG, + NULL, + NULL), /* TCP listen backlog. */ + createBoolConfig("mptcp", NULL, IMMUTABLE_CONFIG, server.mptcp, 0, isValidMptcp, NULL), /* Multipath TCP. */ + createIntConfig("cluster-port", + NULL, + IMMUTABLE_CONFIG, + 0, + 65535, + server.cluster_port, + 0, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("cluster-announce-bus-port", + NULL, + MODIFIABLE_CONFIG, + 0, + 65535, + server.cluster_announce_bus_port, + 0, + INTEGER_CONFIG, + NULL, + updateClusterAnnouncedPort), /* Default: Use +10000 offset. */ + createIntConfig("cluster-announce-port", + NULL, + MODIFIABLE_CONFIG, + 0, + 65535, + server.cluster_announce_port, + 0, + INTEGER_CONFIG, + NULL, + updateClusterAnnouncedPort), /* Use server.port */ + createIntConfig("cluster-announce-tls-port", + NULL, + MODIFIABLE_CONFIG, + 0, + 65535, + server.cluster_announce_tls_port, + 0, + INTEGER_CONFIG, + NULL, + updateClusterAnnouncedPort), /* Use server.tls_port */ + createIntConfig("cluster-announce-client-port", + NULL, + MODIFIABLE_CONFIG, + 0, + 65535, + server.cluster_announce_client_port, + 0, + INTEGER_CONFIG, + NULL, + updateClusterAnnouncedPort), + createIntConfig("cluster-announce-client-tls-port", + NULL, + MODIFIABLE_CONFIG, + 0, + 65535, + server.cluster_announce_client_tls_port, + 0, + INTEGER_CONFIG, + NULL, + updateClusterAnnouncedPort), + createIntConfig("repl-timeout", + NULL, + MODIFIABLE_CONFIG, + 1, + INT_MAX, + server.repl_timeout, + 60, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("repl-ping-replica-period", + "repl-ping-slave-period", + MODIFIABLE_CONFIG, + 1, + INT_MAX, + server.repl_ping_replica_period, + 10, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("list-compress-depth", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.list_compress_depth, + 0, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("rdb-key-save-delay", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + INT_MIN, + INT_MAX, + server.rdb_key_save_delay, + 0, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("key-load-delay", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + INT_MIN, + INT_MAX, + server.key_load_delay, + 0, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("active-expire-effort", + NULL, + MODIFIABLE_CONFIG, + 1, + 10, + server.active_expire_effort, + 1, + INTEGER_CONFIG, + NULL, + NULL), /* From 1 to 10. */ + createIntConfig("hz", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.hz, + CONFIG_DEFAULT_HZ, + INTEGER_CONFIG, + NULL, + updateHZ), + createIntConfig("min-replicas-to-write", + "min-slaves-to-write", + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.repl_min_replicas_to_write, + 0, + INTEGER_CONFIG, + NULL, + updateGoodReplicas), + createIntConfig("min-replicas-max-lag", + "min-slaves-max-lag", + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.repl_min_replicas_max_lag, + 10, + INTEGER_CONFIG, + NULL, + updateGoodReplicas), + createIntConfig("watchdog-period", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + 0, + INT_MAX, + server.watchdog_period, + 0, + INTEGER_CONFIG, + NULL, + updateWatchdogPeriod), + createIntConfig("shutdown-timeout", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.shutdown_timeout, + 10, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("repl-diskless-sync-max-replicas", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.repl_diskless_sync_max_replicas, + 0, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("rdma-port", + NULL, + MODIFIABLE_CONFIG, + 0, + 65535, + server.rdma_ctx_config.port, + 0, + INTEGER_CONFIG, + NULL, + updateRdmaPort), + createIntConfig("rdma-rx-size", + NULL, + IMMUTABLE_CONFIG, + 64 * 1024, + 16 * 1024 * 1024, + server.rdma_ctx_config.rx_size, + 1024 * 1024, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("rdma-completion-vector", + NULL, + IMMUTABLE_CONFIG, + -1, + 1024, + server.rdma_ctx_config.completion_vector, + -1, + INTEGER_CONFIG, + NULL, + NULL), + createIntConfig("cluster-message-gossip-perc", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + 1, + 100, + server.cluster_message_gossip_perc, + 10, + INTEGER_CONFIG, + NULL, + NULL), /* Unsigned int configs */ - createUIntConfig("maxclients", NULL, MODIFIABLE_CONFIG, 1, UINT_MAX, server.maxclients, 10000, INTEGER_CONFIG, NULL, updateMaxclients), - createUIntConfig("unixsocketperm", NULL, IMMUTABLE_CONFIG, 0, 0777, server.unix_ctx_config.perm, 0, OCTAL_CONFIG, NULL, NULL), - createUIntConfig("socket-mark-id", NULL, IMMUTABLE_CONFIG, 0, UINT_MAX, server.socket_mark_id, 0, INTEGER_CONFIG, NULL, NULL), - createUIntConfig("max-new-connections-per-cycle", NULL, MODIFIABLE_CONFIG, 1, 1000, server.max_new_conns_per_cycle, 10, INTEGER_CONFIG, NULL, NULL), - createUIntConfig("max-new-tls-connections-per-cycle", NULL, MODIFIABLE_CONFIG, 1, 1000, server.max_new_tls_conns_per_cycle, 1, INTEGER_CONFIG, NULL, NULL), + createUIntConfig("maxclients", + NULL, + MODIFIABLE_CONFIG, + 1, + UINT_MAX, + server.maxclients, + 10000, + INTEGER_CONFIG, + NULL, + updateMaxclients), + createUIntConfig("unixsocketperm", + NULL, + IMMUTABLE_CONFIG, + 0, + 0777, + server.unix_ctx_config.perm, + 0, + OCTAL_CONFIG, + NULL, + NULL), + createUIntConfig("socket-mark-id", + NULL, + IMMUTABLE_CONFIG, + 0, + UINT_MAX, + server.socket_mark_id, + 0, + INTEGER_CONFIG, + NULL, + NULL), + createUIntConfig("max-new-connections-per-cycle", + NULL, + MODIFIABLE_CONFIG, + 1, + 1000, + server.max_new_conns_per_cycle, + 10, + INTEGER_CONFIG, + NULL, + NULL), + createUIntConfig("max-new-tls-connections-per-cycle", + NULL, + MODIFIABLE_CONFIG, + 1, + 1000, + server.max_new_tls_conns_per_cycle, + 1, + INTEGER_CONFIG, + NULL, + NULL), #ifdef LOG_REQ_RES - createUIntConfig("client-default-resp", NULL, IMMUTABLE_CONFIG | HIDDEN_CONFIG, 2, 3, server.client_default_resp, 2, INTEGER_CONFIG, NULL, NULL), + createUIntConfig("client-default-resp", + NULL, + IMMUTABLE_CONFIG | HIDDEN_CONFIG, + 2, + 3, + server.client_default_resp, + 2, + INTEGER_CONFIG, + NULL, + NULL), #endif /* Unsigned Long configs */ - createULongConfig("active-defrag-max-scan-fields", NULL, MODIFIABLE_CONFIG, 1, LONG_MAX, server.active_defrag_max_scan_fields, 1000, INTEGER_CONFIG, NULL, NULL), /* Default: keys with more than 1000 fields will be processed separately */ - createULongConfig("commandlog-slow-execution-max-len", "slowlog-max-len", MODIFIABLE_CONFIG, 0, LONG_MAX, server.commandlog[COMMANDLOG_TYPE_SLOW].max_len, 128, INTEGER_CONFIG, NULL, NULL), - createULongConfig("commandlog-large-request-max-len", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.commandlog[COMMANDLOG_TYPE_LARGE_REQUEST].max_len, 128, INTEGER_CONFIG, NULL, NULL), - createULongConfig("commandlog-large-reply-max-len", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.commandlog[COMMANDLOG_TYPE_LARGE_REPLY].max_len, 128, INTEGER_CONFIG, NULL, NULL), - createULongConfig("acllog-max-len", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.acllog_max_len, 128, INTEGER_CONFIG, NULL, NULL), - createULongConfig("cluster-blacklist-ttl", NULL, MODIFIABLE_CONFIG, 0, ULONG_MAX, server.cluster_blacklist_ttl, 60, INTEGER_CONFIG, NULL, NULL), - createULongConfig("cluster-slot-migration-log-max-len", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.cluster_slot_migration_log_max_len, 1000, INTEGER_CONFIG, NULL, NULL), + createULongConfig("active-defrag-max-scan-fields", + NULL, + MODIFIABLE_CONFIG, + 1, + LONG_MAX, + server.active_defrag_max_scan_fields, + 1000, + INTEGER_CONFIG, + NULL, + NULL), /* Default: keys with more than 1000 fields will be processed separately */ + createULongConfig("commandlog-slow-execution-max-len", + "slowlog-max-len", + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.commandlog[COMMANDLOG_TYPE_SLOW].max_len, + 128, + INTEGER_CONFIG, + NULL, + NULL), + createULongConfig("commandlog-large-request-max-len", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.commandlog[COMMANDLOG_TYPE_LARGE_REQUEST].max_len, + 128, + INTEGER_CONFIG, + NULL, + NULL), + createULongConfig("commandlog-large-reply-max-len", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.commandlog[COMMANDLOG_TYPE_LARGE_REPLY].max_len, + 128, + INTEGER_CONFIG, + NULL, + NULL), + createULongConfig("acllog-max-len", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.acllog_max_len, + 128, + INTEGER_CONFIG, + NULL, + NULL), + createULongConfig("cluster-blacklist-ttl", + NULL, + MODIFIABLE_CONFIG, + 0, + ULONG_MAX, + server.cluster_blacklist_ttl, + 60, + INTEGER_CONFIG, + NULL, + NULL), + createULongConfig("cluster-slot-migration-log-max-len", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.cluster_slot_migration_log_max_len, + 1000, + INTEGER_CONFIG, + NULL, + NULL), /* Long Long configs */ - createLongLongConfig("busy-reply-threshold", "lua-time-limit", MODIFIABLE_CONFIG, 0, LONG_MAX, server.busy_reply_threshold, 5000, INTEGER_CONFIG, NULL, NULL), /* milliseconds */ - createLongLongConfig("cluster-node-timeout", NULL, MODIFIABLE_CONFIG, 0, LLONG_MAX, server.cluster_node_timeout, 15000, INTEGER_CONFIG, NULL, NULL), - createLongLongConfig("cluster-ping-interval", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, 0, LLONG_MAX, server.cluster_ping_interval, 0, INTEGER_CONFIG, NULL, NULL), - createLongLongConfig("commandlog-execution-slower-than", "slowlog-log-slower-than", MODIFIABLE_CONFIG, -1, LLONG_MAX, server.commandlog[COMMANDLOG_TYPE_SLOW].threshold, 10000, INTEGER_CONFIG, NULL, NULL), - createLongLongConfig("commandlog-request-larger-than", NULL, MODIFIABLE_CONFIG, -1, LLONG_MAX, server.commandlog[COMMANDLOG_TYPE_LARGE_REQUEST].threshold, 1024 * 1024, INTEGER_CONFIG, NULL, NULL), - createLongLongConfig("commandlog-reply-larger-than", NULL, MODIFIABLE_CONFIG, -1, LLONG_MAX, server.commandlog[COMMANDLOG_TYPE_LARGE_REPLY].threshold, 1024 * 1024, INTEGER_CONFIG, NULL, NULL), - createLongLongConfig("latency-monitor-threshold", NULL, MODIFIABLE_CONFIG, 0, LLONG_MAX, server.latency_monitor_threshold, 0, INTEGER_CONFIG, NULL, NULL), - createLongLongConfig("proto-max-bulk-len", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, 1024 * 1024, LONG_MAX, server.proto_max_bulk_len, 512ll * 1024 * 1024, MEMORY_CONFIG, NULL, NULL), /* Bulk request max size */ - createLongLongConfig("stream-node-max-entries", NULL, MODIFIABLE_CONFIG, 0, LLONG_MAX, server.stream_node_max_entries, 100, INTEGER_CONFIG, NULL, NULL), - createLongLongConfig("repl-backlog-size", NULL, MODIFIABLE_CONFIG, 1, LLONG_MAX, server.repl_backlog_size, 10 * 1024 * 1024, MEMORY_CONFIG, NULL, updateReplBacklogSize), /* Default: 10mb */ - createLongLongConfig("cluster-manual-failover-timeout", NULL, MODIFIABLE_CONFIG, 1, INT_MAX, server.cluster_mf_timeout, 5000, INTEGER_CONFIG, NULL, NULL), + createLongLongConfig("busy-reply-threshold", + "lua-time-limit", + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.busy_reply_threshold, + 5000, + INTEGER_CONFIG, + NULL, + NULL), /* milliseconds */ + createLongLongConfig("cluster-node-timeout", + NULL, + MODIFIABLE_CONFIG, + 0, + LLONG_MAX, + server.cluster_node_timeout, + 15000, + INTEGER_CONFIG, + NULL, + NULL), + createLongLongConfig("cluster-ping-interval", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + 0, + LLONG_MAX, + server.cluster_ping_interval, + 0, + INTEGER_CONFIG, + NULL, + NULL), + createLongLongConfig("commandlog-execution-slower-than", + "slowlog-log-slower-than", + MODIFIABLE_CONFIG, + -1, + LLONG_MAX, + server.commandlog[COMMANDLOG_TYPE_SLOW].threshold, + 10000, + INTEGER_CONFIG, + NULL, + NULL), + createLongLongConfig("commandlog-request-larger-than", + NULL, + MODIFIABLE_CONFIG, + -1, + LLONG_MAX, + server.commandlog[COMMANDLOG_TYPE_LARGE_REQUEST].threshold, + 1024 * 1024, + INTEGER_CONFIG, + NULL, + NULL), + createLongLongConfig("commandlog-reply-larger-than", + NULL, + MODIFIABLE_CONFIG, + -1, + LLONG_MAX, + server.commandlog[COMMANDLOG_TYPE_LARGE_REPLY].threshold, + 1024 * 1024, + INTEGER_CONFIG, + NULL, + NULL), + createLongLongConfig("latency-monitor-threshold", + NULL, + MODIFIABLE_CONFIG, + 0, + LLONG_MAX, + server.latency_monitor_threshold, + 0, + INTEGER_CONFIG, + NULL, + NULL), + createLongLongConfig("proto-max-bulk-len", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + 1024 * 1024, + LONG_MAX, + server.proto_max_bulk_len, + 512ll * 1024 * 1024, + MEMORY_CONFIG, + NULL, + NULL), /* Bulk request max size */ + createLongLongConfig("stream-node-max-entries", + NULL, + MODIFIABLE_CONFIG, + 0, + LLONG_MAX, + server.stream_node_max_entries, + 100, + INTEGER_CONFIG, + NULL, + NULL), + createLongLongConfig("repl-backlog-size", + NULL, + MODIFIABLE_CONFIG, + 1, + LLONG_MAX, + server.repl_backlog_size, + 10 * 1024 * 1024, + MEMORY_CONFIG, + NULL, + updateReplBacklogSize), /* Default: 10mb */ + createLongLongConfig("cluster-manual-failover-timeout", + NULL, + MODIFIABLE_CONFIG, + 1, + INT_MAX, + server.cluster_mf_timeout, + 5000, + INTEGER_CONFIG, + NULL, + NULL), /* Unsigned Long Long configs */ - createULongLongConfig("maxmemory", NULL, MODIFIABLE_CONFIG, 0, ULLONG_MAX, server.maxmemory, 0, MEMORY_CONFIG, NULL, updateMaxmemory), - createULongLongConfig("cluster-link-sendbuf-limit", NULL, MODIFIABLE_CONFIG, 0, ULLONG_MAX, server.cluster_link_msg_queue_limit_bytes, 0, MEMORY_CONFIG, NULL, NULL), + createULongLongConfig("maxmemory", + NULL, + MODIFIABLE_CONFIG, + 0, + ULLONG_MAX, + server.maxmemory, + 0, + MEMORY_CONFIG, + NULL, + updateMaxmemory), + createULongLongConfig("cluster-link-sendbuf-limit", + NULL, + MODIFIABLE_CONFIG, + 0, + ULLONG_MAX, + server.cluster_link_msg_queue_limit_bytes, + 0, + MEMORY_CONFIG, + NULL, + NULL), /* Size_t configs */ - createSizeTConfig("hash-max-listpack-entries", "hash-max-ziplist-entries", MODIFIABLE_CONFIG, 0, LONG_MAX, server.hash_max_listpack_entries, 512, INTEGER_CONFIG, NULL, NULL), - createSizeTConfig("set-max-intset-entries", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.set_max_intset_entries, 512, INTEGER_CONFIG, NULL, NULL), - createSizeTConfig("set-max-listpack-entries", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.set_max_listpack_entries, 128, INTEGER_CONFIG, NULL, NULL), - createSizeTConfig("set-max-listpack-value", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.set_max_listpack_value, 64, INTEGER_CONFIG, NULL, NULL), - createSizeTConfig("zset-max-listpack-entries", "zset-max-ziplist-entries", MODIFIABLE_CONFIG, 0, LONG_MAX, server.zset_max_listpack_entries, 128, INTEGER_CONFIG, NULL, NULL), - createSizeTConfig("active-defrag-ignore-bytes", NULL, MODIFIABLE_CONFIG, 1, LLONG_MAX, server.active_defrag_ignore_bytes, 100 << 20, MEMORY_CONFIG, NULL, NULL), /* Default: don't defrag if frag overhead is below 100mb */ - createSizeTConfig("hash-max-listpack-value", "hash-max-ziplist-value", MODIFIABLE_CONFIG, 0, LONG_MAX, server.hash_max_listpack_value, 64, MEMORY_CONFIG, NULL, NULL), - createSizeTConfig("stream-node-max-bytes", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.stream_node_max_bytes, 4096, MEMORY_CONFIG, NULL, NULL), - createSizeTConfig("zset-max-listpack-value", "zset-max-ziplist-value", MODIFIABLE_CONFIG, 0, LONG_MAX, server.zset_max_listpack_value, 64, MEMORY_CONFIG, NULL, NULL), - createSizeTConfig("hll-sparse-max-bytes", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.hll_sparse_max_bytes, 3000, MEMORY_CONFIG, NULL, NULL), - createSizeTConfig("tracking-table-max-keys", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.tracking_table_max_keys, 1000000, INTEGER_CONFIG, NULL, NULL), /* Default: 1 million keys max. */ - createSizeTConfig("client-query-buffer-limit", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, 1024 * 1024, LONG_MAX, server.client_max_querybuf_len, 1024 * 1024 * 1024, MEMORY_CONFIG, NULL, NULL), /* Default: 1GB max query buffer. */ - createSSizeTConfig("maxmemory-clients", NULL, MODIFIABLE_CONFIG, -100, SSIZE_MAX, server.maxmemory_clients, 0, MEMORY_CONFIG | PERCENT_CONFIG, NULL, applyClientMaxMemoryUsage), - createSSizeTConfig("slot-migration-max-failover-repl-bytes", NULL, MODIFIABLE_CONFIG, -1, SSIZE_MAX, server.slot_migration_max_failover_repl_bytes, 0, MEMORY_CONFIG | SIGNED_MEMORY_CONFIG, NULL, NULL), + createSizeTConfig("hash-max-listpack-entries", + "hash-max-ziplist-entries", + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.hash_max_listpack_entries, + 512, + INTEGER_CONFIG, + NULL, + NULL), + createSizeTConfig("set-max-intset-entries", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.set_max_intset_entries, + 512, + INTEGER_CONFIG, + NULL, + NULL), + createSizeTConfig("set-max-listpack-entries", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.set_max_listpack_entries, + 128, + INTEGER_CONFIG, + NULL, + NULL), + createSizeTConfig("set-max-listpack-value", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.set_max_listpack_value, + 64, + INTEGER_CONFIG, + NULL, + NULL), + createSizeTConfig("zset-max-listpack-entries", + "zset-max-ziplist-entries", + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.zset_max_listpack_entries, + 128, + INTEGER_CONFIG, + NULL, + NULL), + createSizeTConfig("active-defrag-ignore-bytes", + NULL, + MODIFIABLE_CONFIG, + 1, + LLONG_MAX, + server.active_defrag_ignore_bytes, + 100 << 20, + MEMORY_CONFIG, + NULL, + NULL), /* Default: don't defrag if frag overhead is below 100mb */ + createSizeTConfig("hash-max-listpack-value", + "hash-max-ziplist-value", + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.hash_max_listpack_value, + 64, + MEMORY_CONFIG, + NULL, + NULL), + createSizeTConfig("stream-node-max-bytes", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.stream_node_max_bytes, + 4096, + MEMORY_CONFIG, + NULL, + NULL), + createSizeTConfig("zset-max-listpack-value", + "zset-max-ziplist-value", + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.zset_max_listpack_value, + 64, + MEMORY_CONFIG, + NULL, + NULL), + createSizeTConfig("hll-sparse-max-bytes", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.hll_sparse_max_bytes, + 3000, + MEMORY_CONFIG, + NULL, + NULL), + createSizeTConfig("tracking-table-max-keys", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.tracking_table_max_keys, + 1000000, + INTEGER_CONFIG, + NULL, + NULL), /* Default: 1 million keys max. */ + createSizeTConfig("client-query-buffer-limit", + NULL, + DEBUG_CONFIG | MODIFIABLE_CONFIG, + 1024 * 1024, + LONG_MAX, + server.client_max_querybuf_len, + 1024 * 1024 * 1024, + MEMORY_CONFIG, + NULL, + NULL), /* Default: 1GB max query buffer. */ + createSSizeTConfig("maxmemory-clients", + NULL, + MODIFIABLE_CONFIG, + -100, + SSIZE_MAX, + server.maxmemory_clients, + 0, + MEMORY_CONFIG | PERCENT_CONFIG, + NULL, + applyClientMaxMemoryUsage), + createSSizeTConfig("slot-migration-max-failover-repl-bytes", + NULL, + MODIFIABLE_CONFIG, + -1, + SSIZE_MAX, + server.slot_migration_max_failover_repl_bytes, + 0, + MEMORY_CONFIG | SIGNED_MEMORY_CONFIG, + NULL, + NULL), /* Other configs */ - createTimeTConfig("repl-backlog-ttl", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.repl_backlog_time_limit, 60 * 60, INTEGER_CONFIG, NULL, NULL), /* Default: 1 hour */ - createOffTConfig("auto-aof-rewrite-min-size", NULL, MODIFIABLE_CONFIG, 0, LLONG_MAX, server.aof_rewrite_min_size, 64 * 1024 * 1024, MEMORY_CONFIG, NULL, NULL), - createOffTConfig("loading-process-events-interval-bytes", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, 1024, INT_MAX, server.loading_process_events_interval_bytes, 1024 * 1024 * 2, INTEGER_CONFIG, NULL, NULL), + createTimeTConfig("repl-backlog-ttl", + NULL, + MODIFIABLE_CONFIG, + 0, + LONG_MAX, + server.repl_backlog_time_limit, + 60 * 60, + INTEGER_CONFIG, + NULL, + NULL), /* Default: 1 hour */ + createOffTConfig("auto-aof-rewrite-min-size", + NULL, + MODIFIABLE_CONFIG, + 0, + LLONG_MAX, + server.aof_rewrite_min_size, + 64 * 1024 * 1024, + MEMORY_CONFIG, + NULL, + NULL), + createOffTConfig("loading-process-events-interval-bytes", + NULL, + MODIFIABLE_CONFIG | HIDDEN_CONFIG, + 1024, + INT_MAX, + server.loading_process_events_interval_bytes, + 1024 * 1024 * 2, + INTEGER_CONFIG, + NULL, + NULL), /* Tls configs */ - 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), - createIntConfig("tls-session-cache-timeout", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.tls_ctx_config.session_cache_timeout, 300, INTEGER_CONFIG, NULL, applyTlsCfg), - createIntConfig("tls-auto-reload-interval", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.tls_ctx_config.auto_reload_interval, 0, INTEGER_CONFIG, NULL, applyTlsCfg), + 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), + createIntConfig("tls-session-cache-timeout", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.tls_ctx_config.session_cache_timeout, + 300, + INTEGER_CONFIG, + NULL, + applyTlsCfg), + createIntConfig("tls-auto-reload-interval", + NULL, + MODIFIABLE_CONFIG, + 0, + INT_MAX, + server.tls_ctx_config.auto_reload_interval, + 0, + INTEGER_CONFIG, + NULL, + applyTlsCfg), createBoolConfig("tls-cluster", NULL, MODIFIABLE_CONFIG, server.tls_cluster, 0, NULL, applyTlsCfg), createBoolConfig("tls-replication", NULL, MODIFIABLE_CONFIG, server.tls_replication, 0, NULL, applyTlsCfg), - createEnumConfig("tls-auth-clients", NULL, MODIFIABLE_CONFIG, tls_auth_clients_enum, server.tls_auth_clients, TLS_CLIENT_AUTH_YES, NULL, NULL), - createEnumConfig("tls-auth-clients-user", NULL, MODIFIABLE_CONFIG, tls_client_auth_user_enum, server.tls_ctx_config.client_auth_user, TLS_CLIENT_FIELD_OFF, NULL, NULL), - createBoolConfig("tls-prefer-server-ciphers", NULL, MODIFIABLE_CONFIG, server.tls_ctx_config.prefer_server_ciphers, 0, NULL, applyTlsCfg), - createBoolConfig("tls-session-caching", NULL, MODIFIABLE_CONFIG, server.tls_ctx_config.session_caching, 1, NULL, applyTlsCfg), - createStringConfig("tls-cert-file", NULL, VOLATILE_CONFIG | MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.cert_file, NULL, NULL, applyTlsCfg), - createStringConfig("tls-key-file", NULL, VOLATILE_CONFIG | MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.key_file, NULL, NULL, applyTlsCfg), - createStringConfig("tls-key-file-pass", NULL, MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.key_file_pass, NULL, NULL, applyTlsCfg), - createStringConfig("tls-client-cert-file", NULL, VOLATILE_CONFIG | MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.client_cert_file, NULL, NULL, applyTlsCfg), - createStringConfig("tls-client-key-file", NULL, VOLATILE_CONFIG | MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.client_key_file, NULL, NULL, applyTlsCfg), - createStringConfig("tls-client-key-file-pass", NULL, MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.client_key_file_pass, NULL, NULL, applyTlsCfg), - createStringConfig("tls-dh-params-file", NULL, VOLATILE_CONFIG | MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.dh_params_file, NULL, NULL, applyTlsCfg), - createStringConfig("tls-ca-cert-file", NULL, VOLATILE_CONFIG | MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.ca_cert_file, NULL, NULL, applyTlsCfg), - createStringConfig("tls-ca-cert-dir", NULL, VOLATILE_CONFIG | MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.ca_cert_dir, NULL, NULL, applyTlsCfg), - createStringConfig("tls-protocols", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.protocols, NULL, NULL, applyTlsCfg), - createStringConfig("tls-ciphers", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.ciphers, NULL, NULL, applyTlsCfg), - createStringConfig("tls-ciphersuites", NULL, MODIFIABLE_CONFIG, EMPTY_STRING_IS_NULL, server.tls_ctx_config.ciphersuites, NULL, NULL, applyTlsCfg), + createEnumConfig("tls-auth-clients", + NULL, + MODIFIABLE_CONFIG, + tls_auth_clients_enum, + server.tls_auth_clients, + TLS_CLIENT_AUTH_YES, + NULL, + NULL), + createEnumConfig("tls-auth-clients-user", + NULL, + MODIFIABLE_CONFIG, + tls_client_auth_user_enum, + server.tls_ctx_config.client_auth_user, + TLS_CLIENT_FIELD_OFF, + NULL, + NULL), + createBoolConfig("tls-prefer-server-ciphers", + NULL, + MODIFIABLE_CONFIG, + server.tls_ctx_config.prefer_server_ciphers, + 0, + NULL, + applyTlsCfg), + createBoolConfig("tls-session-caching", + NULL, + MODIFIABLE_CONFIG, + server.tls_ctx_config.session_caching, + 1, + NULL, + applyTlsCfg), + createStringConfig("tls-cert-file", + NULL, + VOLATILE_CONFIG | MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.cert_file, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-key-file", + NULL, + VOLATILE_CONFIG | MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.key_file, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-key-file-pass", + NULL, + MODIFIABLE_CONFIG | SENSITIVE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.key_file_pass, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-client-cert-file", + NULL, + VOLATILE_CONFIG | MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.client_cert_file, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-client-key-file", + NULL, + VOLATILE_CONFIG | MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.client_key_file, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-client-key-file-pass", + NULL, + MODIFIABLE_CONFIG | SENSITIVE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.client_key_file_pass, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-dh-params-file", + NULL, + VOLATILE_CONFIG | MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.dh_params_file, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-ca-cert-file", + NULL, + VOLATILE_CONFIG | MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.ca_cert_file, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-ca-cert-dir", + NULL, + VOLATILE_CONFIG | MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.ca_cert_dir, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-protocols", + NULL, + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.protocols, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-ciphers", + NULL, + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.ciphers, + NULL, + NULL, + applyTlsCfg), + createStringConfig("tls-ciphersuites", + NULL, + MODIFIABLE_CONFIG, + EMPTY_STRING_IS_NULL, + server.tls_ctx_config.ciphersuites, + NULL, + NULL, + applyTlsCfg), /* Special configs */ - createSpecialConfig("dir", NULL, MODIFIABLE_CONFIG | PROTECTED_CONFIG | DENY_LOADING_CONFIG, setConfigDirOption, getConfigDirOption, rewriteConfigDirOption, NULL), - createSpecialConfig("save", NULL, MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, setConfigSaveOption, getConfigSaveOption, rewriteConfigSaveOption, NULL), - createSpecialConfig("client-output-buffer-limit", NULL, MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, setConfigClientOutputBufferLimitOption, getConfigClientOutputBufferLimitOption, rewriteConfigClientOutputBufferLimitOption, NULL), - createSpecialConfig("oom-score-adj-values", NULL, MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, setConfigOOMScoreAdjValuesOption, getConfigOOMScoreAdjValuesOption, rewriteConfigOOMScoreAdjValuesOption, updateOOMScoreAdj), - createSpecialConfig("notify-keyspace-events", NULL, MODIFIABLE_CONFIG, setConfigNotifyKeyspaceEventsOption, getConfigNotifyKeyspaceEventsOption, rewriteConfigNotifyKeyspaceEventsOption, NULL), - createSpecialConfig("bind", NULL, MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, setConfigSocketBindOption, getConfigBindOption, rewriteConfigSocketBindOption, applyBind), - createSpecialConfig("rdma-bind", NULL, MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, setConfigRdmaBindOption, getConfigRdmaBindOption, rewriteConfigRdmaBindOption, applyRdmaBind), - createSpecialConfig("replicaof", "slaveof", IMMUTABLE_CONFIG | MULTI_ARG_CONFIG, setConfigReplicaOfOption, getConfigReplicaOfOption, rewriteConfigReplicaOfOption, NULL), - createSpecialConfig("latency-tracking-info-percentiles", NULL, MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, setConfigLatencyTrackingInfoPercentilesOutputOption, getConfigLatencyTrackingInfoPercentilesOutputOption, rewriteConfigLatencyTrackingInfoPercentilesOutputOption, NULL), + createSpecialConfig("dir", + NULL, + MODIFIABLE_CONFIG | PROTECTED_CONFIG | DENY_LOADING_CONFIG, + setConfigDirOption, + getConfigDirOption, + rewriteConfigDirOption, + NULL), + createSpecialConfig("save", + NULL, + MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, + setConfigSaveOption, + getConfigSaveOption, + rewriteConfigSaveOption, + NULL), + createSpecialConfig("client-output-buffer-limit", + NULL, + MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, + setConfigClientOutputBufferLimitOption, + getConfigClientOutputBufferLimitOption, + rewriteConfigClientOutputBufferLimitOption, + NULL), + createSpecialConfig("oom-score-adj-values", + NULL, + MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, + setConfigOOMScoreAdjValuesOption, + getConfigOOMScoreAdjValuesOption, + rewriteConfigOOMScoreAdjValuesOption, + updateOOMScoreAdj), + createSpecialConfig("notify-keyspace-events", + NULL, + MODIFIABLE_CONFIG, + setConfigNotifyKeyspaceEventsOption, + getConfigNotifyKeyspaceEventsOption, + rewriteConfigNotifyKeyspaceEventsOption, + NULL), + createSpecialConfig("bind", + NULL, + MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, + setConfigSocketBindOption, + getConfigBindOption, + rewriteConfigSocketBindOption, + applyBind), + createSpecialConfig("rdma-bind", + NULL, + MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, + setConfigRdmaBindOption, + getConfigRdmaBindOption, + rewriteConfigRdmaBindOption, + applyRdmaBind), + createSpecialConfig("replicaof", + "slaveof", + IMMUTABLE_CONFIG | MULTI_ARG_CONFIG, + setConfigReplicaOfOption, + getConfigReplicaOfOption, + rewriteConfigReplicaOfOption, + NULL), + createSpecialConfig("latency-tracking-info-percentiles", + NULL, + MODIFIABLE_CONFIG | MULTI_ARG_CONFIG, + setConfigLatencyTrackingInfoPercentilesOutputOption, + getConfigLatencyTrackingInfoPercentilesOutputOption, + rewriteConfigLatencyTrackingInfoPercentilesOutputOption, + NULL), /* NULL Terminator, this is dropped when we convert to the runtime array. */ {NULL}, @@ -3541,13 +5138,13 @@ void initConfigValues(void) { if (config->type == NUMERIC_CONFIG) { /* SIGNED_MEMORY_CONFIG must be used together with MEMORY_CONFIG. */ - serverAssert(!(config->data.numeric.flags & SIGNED_MEMORY_CONFIG) || - (config->data.numeric.flags & MEMORY_CONFIG)); + serverAssert(!(config->data.numeric.flags & SIGNED_MEMORY_CONFIG) + || (config->data.numeric.flags & MEMORY_CONFIG)); /* PERCENT_CONFIG and SIGNED_MEMORY_CONFIG both use negative values * with different semantics, so they must not be combined. */ - serverAssert(!((config->data.numeric.flags & PERCENT_CONFIG) && - (config->data.numeric.flags & SIGNED_MEMORY_CONFIG))); + serverAssert(!((config->data.numeric.flags & PERCENT_CONFIG) + && (config->data.numeric.flags & SIGNED_MEMORY_CONFIG))); } /* Add the primary config to the dictionary. */ @@ -3616,8 +5213,14 @@ void addModuleEnumConfig(const char *module_name, configEnum *enum_vals) { sds config_name = sdscatfmt(sdsempty(), "%s.%s", module_name, name); int config_dummy_address; - standardConfig module_config = createEnumConfig(config_name, NULL, flags | MODULE_CONFIG, enum_vals, - config_dummy_address, default_val, NULL, NULL); + standardConfig module_config = createEnumConfig(config_name, + NULL, + flags | MODULE_CONFIG, + enum_vals, + config_dummy_address, + default_val, + NULL, + NULL); module_config.data.enumd.config = NULL; module_config.privdata = privdata; registerConfigValue(config_name, &module_config, 0); @@ -3633,8 +5236,16 @@ void addModuleNumericConfig(const char *module_name, long long upper) { sds config_name = sdscatfmt(sdsempty(), "%s.%s", module_name, name); long long config_dummy_address; - standardConfig module_config = createLongLongConfig(config_name, NULL, flags | MODULE_CONFIG, lower, upper, - config_dummy_address, default_val, conf_flags, NULL, NULL); + standardConfig module_config = createLongLongConfig(config_name, + NULL, + flags | MODULE_CONFIG, + lower, + upper, + config_dummy_address, + default_val, + conf_flags, + NULL, + NULL); module_config.data.numeric.config.ll = NULL; module_config.privdata = privdata; registerConfigValue(config_name, &module_config, 0); @@ -3650,8 +5261,16 @@ void addModuleUnsignedNumericConfig(const char *module_name, unsigned long long upper) { sds config_name = sdscatfmt(sdsempty(), "%s.%s", module_name, name); unsigned long long config_dummy_address; - standardConfig module_config = createULongLongConfig(config_name, NULL, flags | MODULE_CONFIG, lower, upper, - config_dummy_address, default_val, conf_flags, NULL, NULL); + standardConfig module_config = createULongLongConfig(config_name, + NULL, + flags | MODULE_CONFIG, + lower, + upper, + config_dummy_address, + default_val, + conf_flags, + NULL, + NULL); module_config.data.numeric.config.ull = NULL; module_config.privdata = privdata; registerConfigValue(config_name, &module_config, 0); diff --git a/src/config.h b/src/config.h index d8fb9ac65c2..1f761e1431a 100644 --- a/src/config.h +++ b/src/config.h @@ -77,9 +77,9 @@ #endif /* Test for backtrace() */ -#if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__)) || defined(__FreeBSD__) || \ - ((defined(__OpenBSD__) || defined(__NetBSD__) || defined(__sun)) && defined(USE_BACKTRACE)) || \ - defined(__DragonFly__) || (defined(__UCLIBC__) && defined(__UCLIBC_HAS_BACKTRACE__)) +#if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__)) || defined(__FreeBSD__) \ + || ((defined(__OpenBSD__) || defined(__NetBSD__) || defined(__sun)) && defined(USE_BACKTRACE)) \ + || defined(__DragonFly__) || (defined(__UCLIBC__) && defined(__UCLIBC_HAS_BACKTRACE__)) #define HAVE_BACKTRACE 1 #endif @@ -98,22 +98,22 @@ #endif /* Test for accept4() */ -#if defined(__linux__) || defined(__FreeBSD__) || defined(OpenBSD5_7) || \ - (defined(__DragonFly__) && __DragonFly_version >= 400305) || \ - (defined(__NetBSD__) && (defined(NetBSD8_0) || __NetBSD_Version__ >= 800000000)) +#if defined(__linux__) || defined(__FreeBSD__) || defined(OpenBSD5_7) \ + || (defined(__DragonFly__) && __DragonFly_version >= 400305) \ + || (defined(__NetBSD__) && (defined(NetBSD8_0) || __NetBSD_Version__ >= 800000000)) #define HAVE_ACCEPT4 1 #endif /* Detect for pipe2() */ -#if defined(__linux__) || defined(__FreeBSD__) || defined(OpenBSD5_7) || \ - (defined(__DragonFly__) && __DragonFly_version >= 400106) || \ - (defined(__NetBSD__) && (defined(NetBSD6_0) || __NetBSD_Version__ >= 600000000)) +#if defined(__linux__) || defined(__FreeBSD__) || defined(OpenBSD5_7) \ + || (defined(__DragonFly__) && __DragonFly_version >= 400106) \ + || (defined(__NetBSD__) && (defined(NetBSD6_0) || __NetBSD_Version__ >= 600000000)) #define HAVE_PIPE2 1 #endif /* Detect for kqueue */ -#if (defined(__APPLE__) && defined(MAC_OS_10_6_DETECTED)) || defined(__DragonFly__) || defined(__FreeBSD__) || \ - defined(__OpenBSD__) || defined(__NetBSD__) +#if (defined(__APPLE__) && defined(MAC_OS_10_6_DETECTED)) || defined(__DragonFly__) || defined(__FreeBSD__) \ + || defined(__OpenBSD__) || defined(__NetBSD__) #define HAVE_KQUEUE 1 #endif @@ -236,17 +236,17 @@ void setproctitle(const char *fmt, ...); #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/ -#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || defined(vax) || defined(ns32000) || \ - defined(sun386) || defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) || \ - defined(__alpha) +#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || defined(vax) || defined(ns32000) \ + || defined(sun386) || defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || defined(__alpha__) \ + || defined(__alpha) #define BYTE_ORDER LITTLE_ENDIAN #endif -#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || defined(is68k) || defined(tahoe) || \ - defined(ibm032) || defined(ibm370) || defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) || \ - defined(apollo) || defined(__convex__) || defined(_CRAY) || defined(__hppa) || defined(__hp9000) || \ - defined(__hp9000s300) || defined(__hp9000s700) || defined(BIT_ZERO_ON_LEFT) || defined(m68k) || \ - defined(__sparc) || (defined(__APPLE__) && defined(__POWERPC__)) +#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || defined(is68k) || defined(tahoe) \ + || defined(ibm032) || defined(ibm370) || defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) \ + || defined(apollo) || defined(__convex__) || defined(_CRAY) || defined(__hppa) || defined(__hp9000) \ + || defined(__hp9000s300) || defined(__hp9000s700) || defined(BIT_ZERO_ON_LEFT) || defined(m68k) \ + || defined(__sparc) || (defined(__APPLE__) && defined(__POWERPC__)) #define BYTE_ORDER BIG_ENDIAN #endif #endif /* linux */ @@ -385,7 +385,8 @@ void setcpuaffinity(const char *cpulist); #endif /* Check if we can compile x86 SIMD code */ -#if defined(__x86_64__) && ((defined(__GNUC__) && __GNUC__ >= 5) || (defined(__clang__) && __clang_major__ >= 4)) && defined(__has_attribute) && __has_attribute(target) +#if defined(__x86_64__) && ((defined(__GNUC__) && __GNUC__ >= 5) || (defined(__clang__) && __clang_major__ >= 4)) \ + && defined(__has_attribute) && __has_attribute(target) #define HAVE_X86_SIMD 1 #else #define HAVE_X86_SIMD 0 @@ -408,7 +409,8 @@ void setcpuaffinity(const char *cpulist); #define HAVE_ARM_NEON 0 #endif -#if defined(__linux__) && defined(__GLIBC__) && (defined(__GNUC__) && (__GNUC__ > 4) || defined(__clang__) && (__clang_major__) > 5) +#if defined(__linux__) && defined(__GLIBC__) \ + && (defined(__GNUC__) && (__GNUC__ > 4) || defined(__clang__) && (__clang_major__) > 5) #define HAVE_IFUNC 1 #else #define HAVE_IFUNC 0 diff --git a/src/connection.h b/src/connection.h index 44e15e8f1c1..8dbf758b974 100644 --- a/src/connection.h +++ b/src/connection.h @@ -43,8 +43,9 @@ #define CONN_INFO_LEN 32 #define CONN_ADDR_STR_LEN 128 -#define NET_HOST_STR_LEN 256 /* Longest valid hostname */ -#define NET_IP_STR_LEN 46 /* INET6_ADDRSTRLEN is 46, but we need to be sure */ +#define NET_HOST_STR_LEN 256 /* Longest valid hostname */ +#define NET_IP_STR_LEN 46 /* INET6_ADDRSTRLEN is 46, but we need to be sure */ + #define NET_HOST_PORT_STR_LEN (NET_HOST_STR_LEN + 32) /* Must be enough for hostname:port */ struct aeEventLoop; @@ -76,16 +77,11 @@ typedef enum { static inline const char *getConnectionTypeName(int type) { switch (type) { - case CONN_TYPE_SOCKET: - return "tcp"; - case CONN_TYPE_UNIX: - return "unix"; - case CONN_TYPE_TLS: - return "tls"; - case CONN_TYPE_RDMA: - return "rdma"; - default: - return "invalid type"; + case CONN_TYPE_SOCKET: return "tcp"; + case CONN_TYPE_UNIX: return "unix"; + case CONN_TYPE_TLS: return "tls"; + case CONN_TYPE_RDMA: return "rdma"; + default: return "invalid type"; } } diff --git a/src/crc16_slottable.c b/src/crc16_slottable.c index fae91f89c8e..7b0ac95d7b6 100644 --- a/src/crc16_slottable.c +++ b/src/crc16_slottable.c @@ -13,823 +13,1027 @@ * is guaranteed to make the cluster route a request to the shard holding this slot. */ const char crc16_slot_table[][4] = { - "06S", "Qi", "5L5", "4Iu", "4gY", "460", "1Y7", "1LV", "0QG", "ru", "7Ok", "4ji", "4DE", "65n", "2JH", "I8", "F9", "SX", "7nF", "4KD", - "4eh", "6PK", "2ke", "1Ng", "0Sv", "4L", "491", "4hX", "4Ft", "5C4", "2Hy", "09R", "021", "0cX", "4Xv", "6mU", "6Cy", "42R", "0Mt", "nF", - "cv", "1Pe", "5kK", "6NI", "74L", "4UF", "0nh", "MZ", "2TJ", "0ai", "4ZG", "6od", "6AH", "40c", "0OE", "lw", "aG", "0Bu", "5iz", "6Lx", - "5R7", "4Ww", "0lY", "Ok", "5n3", "4ks", "8YE", "7g", "2KR", "1nP", "714", "64t", "69D", "4Ho", "07I", "Ps", "2hN", "1ML", "4fC", "7CA", - "avs", "4iB", "0Rl", "5V", "2Ic", "08H", "4Gn", "66E", "aUo", "b4e", "05x", "RB", "8f", "8VD", "4dr", "5a2", "4zp", "6OS", "bl", "355", - "0or", "1j2", "75V", "bno", "4Yl", "6lO", "Ap", "0bB", "0Ln", "2yM", "6Bc", "43H", "4xA", "6Mb", "22D", "14", "0mC", "Nq", "6cN", "4Vm", - "ban", "aDl", "CA", "14Z", "8GG", "mm", "549", "41y", "53t", "464", "1Y3", "1LR", "06W", "Qm", "5L1", "4Iq", "4DA", "65j", "2JL", "1oN", - "0QC", "6y", "7Oo", "4jm", "4el", "6PO", "9x", "1Nc", "04f", "2EM", "7nB", "bqs", "4Fp", "5C0", "d6F", "09V", "0Sr", "4H", "495", "bRo", - "aio", "42V", "0Mp", "nB", "025", "17u", "4Xr", "6mQ", "74H", "4UB", "0nl", "3Kn", "cr", "1Pa", "5kO", "6NM", "6AL", "40g", "0OA", "ls", - "2TN", "0am", "4ZC", "aEr", "5R3", "4Ws", "18t", "Oo", "aC", "0Bq", "bCl", "afn", "2KV", "1nT", "5Uz", "64p", "5n7", "4kw", "0PY", "7c", - "2hJ", "1MH", "4fG", "6Sd", "7mi", "4Hk", "07M", "Pw", "2Ig", "08L", "4Gj", "66A", "7LD", "4iF", "0Rh", "5R", "8b", "1Oy", "4dv", "5a6", - "7oX", "4JZ", "0qt", "RF", "0ov", "LD", "4A9", "4TX", "4zt", "6OW", "bh", "0AZ", "z9", "oX", "6Bg", "43L", "4Yh", "6lK", "At", "0bF", - "0mG", "Nu", "6cJ", "4Vi", "4xE", "6Mf", "2vH", "10", "8GC", "mi", "5p5", "4uu", "5Kx", "4N8", "CE", "1pV", "0QO", "6u", "7Oc", "4ja", - "4DM", "65f", "3Za", "I0", "0rS", "Qa", "68V", "b7F", "4gQ", "468", "dSo", "285", "274", "4D", "499", "4hP", "b8G", "67W", "0h3", "09Z", - "F1", "SP", "7nN", "4KL", "51I", "6PC", "9t", "1No", "21g", "1Pm", "5kC", "6NA", "74D", "4UN", "X3", "MR", "029", "0cP", "bbM", "79t", - "4c3", "42Z", "8Dd", "nN", "aO", "8Ke", "4yS", "4l2", "76u", "635", "0lQ", "Oc", "BS", "W2", "4ZO", "6ol", "7Qa", "40k", "0OM", "2zn", - "69L", "4Hg", "07A", "2Fj", "2hF", "k6", "4fK", "6Sh", "7Ny", "6K9", "0PU", "7o", "2KZ", "1nX", "4EW", "4P6", "7oT", "4JV", "05p", "RJ", - "8n", "1Ou", "4dz", "6QY", "7LH", "4iJ", "d7", "qV", "2Ik", "1li", "4Gf", "66M", "4Yd", "6lG", "Ax", "0bJ", "z5", "oT", "6Bk", "4wH", - "4zx", "aeI", "bd", "0AV", "0oz", "LH", "4A5", "4TT", "5Kt", "4N4", "CI", "14R", "0NW", "me", "541", "41q", "4xI", "6Mj", "22L", "u4", - "0mK", "Ny", "6cF", "4Ve", "4DI", "65b", "2JD", "I4", "0QK", "6q", "7Og", "4je", "4gU", "4r4", "2iX", "1LZ", "0rW", "Qe", "5L9", "4Iy", - "4Fx", "5C8", "0h7", "1mw", "0Sz", "pH", "7MV", "4hT", "4ed", "6PG", "9p", "1Nk", "F5", "ST", "7nJ", "4KH", "7pH", "4UJ", "X7", "MV", - "cz", "1Pi", "5kG", "6NE", "4c7", "4vV", "0Mx", "nJ", "0v5", "0cT", "4Xz", "6mY", "6bX", "5GZ", "0lU", "Og", "aK", "0By", "4yW", "4l6", - "6AD", "40o", "0OI", "2zj", "BW", "W6", "4ZK", "6oh", "2hB", "k2", "4fO", "6Sl", "69H", "4Hc", "07E", "2Fn", "d5e", "83m", "4ES", "4P2", - "a0F", "bQL", "0PQ", "7k", "8j", "1Oq", "50W", "hbv", "7oP", "4JR", "05t", "RN", "2Io", "08D", "4Gb", "66I", "7LL", "4iN", "d3", "5Z", - "z1", "oP", "6Bo", "43D", "5IA", "6lC", "2Wm", "0bN", "8ff", "LL", "4A1", "4TP", "cPn", "aeM", "0T3", "0AR", "0NS", "ma", "545", "41u", - "5Kp", "4N0", "CM", "14V", "0mO", "2Xl", "6cB", "4Va", "4xM", "6Mn", "22H", "18", "04s", "SI", "7nW", "4KU", "4ey", "6PZ", "9m", "1Nv", - "e4", "pU", "7MK", "4hI", "4Fe", "67N", "2Hh", "09C", "06B", "Qx", "68O", "4Id", "4gH", "6Rk", "2iE", "j5", "0QV", "6l", "5o8", "4jx", - "4DT", "4Q5", "2JY", "82j", "BJ", "0ax", "4ZV", "4O7", "552", "40r", "0OT", "lf", "aV", "t7", "4yJ", "6Li", "6bE", "4Wf", "0lH", "Oz", - "2Vj", "0cI", "4Xg", "6mD", "6Ch", "42C", "0Me", "nW", "cg", "1Pt", "5kZ", "6NX", "7pU", "4UW", "0ny", "MK", "7LQ", "4iS", "267", "5G", - "0i0", "08Y", "b9D", "66T", "7oM", "4JO", "G2", "RS", "8w", "1Ol", "4dc", "7Aa", "atS", "4kb", "0PL", "7v", "2KC", "H3", "4EN", "64e", - "69U", "b6E", "07X", "Pb", "dRl", "296", "4fR", "4s3", "4xP", "4m1", "22U", "8Jf", "0mR", "0x3", "77v", "626", "5Km", "6no", "CP", "V1", - "0NN", "3kL", "7Pb", "41h", "4za", "6OB", "20d", "0AO", "Y0", "LQ", "6an", "4TM", "bcN", "78w", "Aa", "0bS", "8Eg", "oM", "4b0", "43Y", - "51T", "azL", "9i", "1Nr", "04w", "SM", "7nS", "4KQ", "4Fa", "67J", "2Hl", "09G", "e0", "4Y", "7MO", "4hM", "4gL", "6Ro", "2iA", "j1", - "06F", "2Gm", "68K", "5YA", "4DP", "4Q1", "d4f", "82n", "0QR", "6h", "a1E", "bPO", "556", "40v", "0OP", "lb", "BN", "15U", "4ZR", "4O3", - "6bA", "4Wb", "0lL", "2Yo", "aR", "t3", "4yN", "6Lm", "6Cl", "42G", "0Ma", "nS", "2Vn", "0cM", "4Xc", "79i", "74Y", "4US", "8ge", "MO", - "cc", "1Pp", "bAL", "adN", "0i4", "1lt", "5WZ", "66P", "7LU", "4iW", "0Ry", "5C", "8s", "1Oh", "4dg", "6QD", "7oI", "4JK", "G6", "RW", - "2KG", "H7", "4EJ", "64a", "7Nd", "4kf", "0PH", "7r", "1X8", "1MY", "4fV", "4s7", "69Q", "4Hz", "0sT", "Pf", "0mV", "Nd", "5S8", "4Vx", - "4xT", "4m5", "22Q", "0Cz", "0NJ", "mx", "7Pf", "41l", "5Ki", "6nk", "CT", "V5", "Y4", "LU", "6aj", "4TI", "4ze", "6OF", "by", "0AK", - "2l9", "oI", "4b4", "4wU", "4Yy", "6lZ", "Ae", "0bW", "0So", "4U", "7MC", "4hA", "4Fm", "67F", "3XA", "09K", "0ps", "SA", "aTl", "b5f", - "4eq", "6PR", "9e", "8WG", "8XF", "6d", "5o0", "4jp", "707", "65w", "1z2", "1oS", "06J", "Qp", "68G", "4Il", "53i", "6Rc", "2iM", "1LO", - "23G", "07", "4yB", "6La", "6bM", "4Wn", "18i", "Or", "BB", "0ap", "c4D", "aEo", "5q2", "40z", "8FD", "ln", "co", "346", "5kR", "6NP", - "74U", "bol", "0nq", "MC", "2Vb", "0cA", "4Xo", "6mL", "7SA", "42K", "0Mm", "2xN", "7oE", "4JG", "05a", "2DJ", "2jf", "1Od", "4dk", "6QH", - "482", "5yz", "0Ru", "5O", "0i8", "08Q", "4Gw", "5B7", "5M6", "4Hv", "07P", "Pj", "1X4", "1MU", "4fZ", "473", "7Nh", "4kj", "0PD", "sv", - "2KK", "1nI", "4EF", "64m", "5Ke", "6ng", "CX", "V9", "0NF", "mt", "7Pj", "4uh", "4xX", "4m9", "1F6", "0Cv", "0mZ", "Nh", "5S4", "4Vt", - "4Yu", "6lV", "Ai", "16r", "0Lw", "oE", "4b8", "43Q", "4zi", "6OJ", "bu", "0AG", "Y8", "LY", "6af", "4TE", "4Fi", "67B", "2Hd", "09O", - "e8", "4Q", "7MG", "4hE", "4eu", "6PV", "9a", "1Nz", "0pw", "SE", "aTh", "4KY", "4DX", "4Q9", "1z6", "1oW", "0QZ", "rh", "5o4", "4jt", - "4gD", "6Rg", "2iI", "j9", "06N", "Qt", "68C", "4Ih", "6bI", "4Wj", "0lD", "Ov", "aZ", "03", "4yF", "6Le", "5q6", "4tv", "0OX", "lj", - "BF", "0at", "4ZZ", "6oy", "74Q", "5Ez", "0nu", "MG", "ck", "1Px", "5kV", "6NT", "6Cd", "42O", "0Mi", "2xJ", "2Vf", "0cE", "4Xk", "6mH", - "2jb", "8VY", "4do", "6QL", "7oA", "4JC", "05e", "2DN", "d7E", "08U", "4Gs", "5B3", "486", "bSl", "0Rq", "5K", "1X0", "1MQ", "52w", "477", - "5M2", "4Hr", "07T", "Pn", "2KO", "1nM", "4EB", "64i", "7Nl", "4kn", "8YX", "7z", "0NB", "mp", "7Pn", "41d", "5Ka", "6nc", "2UM", "14G", - "19w", "Nl", "5S0", "4Vp", "bBo", "agm", "1F2", "0Cr", "0Ls", "oA", "ahl", "43U", "4Yq", "6lR", "Am", "16v", "0oo", "2ZL", "6ab", "4TA", - "4zm", "6ON", "bq", "0AC", "2VY", "0cz", "4XT", "4M5", "570", "42p", "0MV", "nd", "cT", "v5", "5ki", "6Nk", "74n", "4Ud", "0nJ", "Mx", - "By", "0aK", "4Ze", "6oF", "6Aj", "40A", "y4", "lU", "ae", "0BW", "4yy", "581", "4B4", "4WU", "18R", "OI", "06q", "QK", "7lU", "4IW", - "53R", "6RX", "0I4", "1Lt", "g6", "rW", "7OI", "4jK", "4Dg", "65L", "2Jj", "1oh", "0pH", "Sz", "7nd", "4Kf", "4eJ", "6Pi", "2kG", "h7", - "0ST", "4n", "7Mx", "4hz", "4FV", "4S7", "1x8", "09p", "4zR", "4o3", "bN", "8Hd", "0oP", "Lb", "75t", "604", "4YN", "6lm", "AR", "T3", - "0LL", "2yo", "6BA", "43j", "4xc", "agR", "22f", "0CM", "0ma", "NS", "6cl", "4VO", "baL", "aDN", "Cc", "14x", "8Ge", "mO", "7PQ", "4uS", - "7NS", "4kQ", "245", "7E", "0k2", "1nr", "coo", "64V", "69f", "4HM", "E0", "PQ", "2hl", "1Mn", "4fa", "6SB", "7Lb", "5yA", "0RN", "5t", - "2IA", "J1", "4GL", "66g", "aUM", "b4G", "05Z", "0d3", "8D", "8Vf", "4dP", "459", "574", "42t", "0MR", "0X3", "dln", "17W", "4XP", "4M1", - "74j", "5EA", "0nN", "3KL", "cP", "29", "5km", "6No", "6An", "40E", "y0", "lQ", "2Tl", "0aO", "4Za", "6oB", "4B0", "4WQ", "18V", "OM", - "aa", "0BS", "bCN", "585", "53V", "axN", "0I0", "1Lp", "06u", "QO", "68x", "4IS", "4Dc", "65H", "2Jn", "1ol", "g2", "rS", "7OM", "4jO", - "4eN", "6Pm", "9Z", "h3", "04D", "2Eo", "aTS", "4Kb", "4FR", "4S3", "d6d", "09t", "0SP", "4j", "a3G", "bRM", "0oT", "Lf", "6aY", "4Tz", - "4zV", "4o7", "bJ", "0Ax", "0LH", "oz", "6BE", "43n", "4YJ", "6li", "AV", "T7", "0me", "NW", "6ch", "4VK", "4xg", "6MD", "22b", "0CI", - "0Ny", "mK", "7PU", "4uW", "5KZ", "6nX", "Cg", "1pt", "0k6", "1nv", "4Ey", "64R", "7NW", "4kU", "241", "7A", "2hh", "1Mj", "4fe", "6SF", - "69b", "4HI", "E4", "PU", "2IE", "J5", "4GH", "66c", "7Lf", "4id", "0RJ", "5p", "2jY", "8Vb", "4dT", "4q5", "5O8", "4Jx", "0qV", "Rd", - "21E", "25", "5ka", "6Nc", "74f", "4Ul", "0nB", "Mp", "1f2", "0cr", "bbo", "79V", "578", "42x", "395", "nl", "am", "364", "4yq", "589", - "76W", "bmn", "0ls", "OA", "Bq", "0aC", "4Zm", "6oN", "6Ab", "40I", "0Oo", "2zL", "0Qm", "6W", "7OA", "4jC", "4Do", "65D", "2Jb", "82Q", - "06y", "QC", "68t", "b7d", "4gs", "5b3", "dSM", "8UE", "8ZD", "4f", "5m2", "4hr", "725", "67u", "1x0", "09x", "04H", "Sr", "7nl", "4Kn", - "4eB", "6Pa", "9V", "1NM", "4YF", "6le", "AZ", "0bh", "0LD", "ov", "6BI", "43b", "4zZ", "6Oy", "bF", "0At", "0oX", "Lj", "5Q6", "4Tv", - "5KV", "6nT", "Ck", "14p", "0Nu", "mG", "7PY", "41S", "4xk", "6MH", "22n", "0CE", "0mi", "2XJ", "6cd", "4VG", "69n", "4HE", "E8", "PY", - "2hd", "1Mf", "4fi", "6SJ", "ath", "4kY", "0Pw", "7M", "2Kx", "1nz", "4Eu", "6pV", "5O4", "4Jt", "05R", "Rh", "8L", "1OW", "4dX", "451", - "7Lj", "4ih", "0RF", "qt", "2II", "J9", "4GD", "66o", "74b", "4Uh", "0nF", "Mt", "cX", "21", "5ke", "6Ng", "5s4", "4vt", "0MZ", "nh", - "1f6", "0cv", "4XX", "4M9", "4B8", "4WY", "0lw", "OE", "ai", "1Rz", "4yu", "6LV", "6Af", "40M", "y8", "lY", "Bu", "0aG", "4Zi", "6oJ", - "4Dk", "6qH", "2Jf", "1od", "0Qi", "6S", "7OE", "4jG", "4gw", "5b7", "0I8", "1Lx", "0ru", "QG", "68p", "5Yz", "4FZ", "67q", "1x4", "1mU", - "0SX", "4b", "5m6", "4hv", "4eF", "6Pe", "9R", "1NI", "04L", "Sv", "7nh", "4Kj", "8EX", "or", "6BM", "43f", "4YB", "6la", "2WO", "0bl", - "8fD", "Ln", "5Q2", "4Tr", "cPL", "aeo", "bB", "0Ap", "0Nq", "mC", "ajn", "41W", "5KR", "6nP", "Co", "14t", "0mm", "2XN", "77I", "4VC", - "4xo", "6ML", "22j", "0CA", "3xA", "1Mb", "4fm", "6SN", "69j", "4HA", "07g", "2FL", "d5G", "83O", "4Eq", "64Z", "a0d", "bQn", "0Ps", "7I", - "8H", "1OS", "50u", "455", "5O0", "4Jp", "05V", "Rl", "2IM", "08f", "5Wa", "66k", "7Ln", "4il", "0RB", "5x", "Bh", "0aZ", "4Zt", "6oW", - "4a9", "40P", "0Ov", "lD", "at", "0BF", "4yh", "6LK", "6bg", "4WD", "Z9", "OX", "2VH", "U8", "4XE", "6mf", "6CJ", "42a", "0MG", "nu", - "cE", "1PV", "5kx", "4n8", "5P5", "4Uu", "8gC", "Mi", "04Q", "Sk", "5N7", "4Kw", "51r", "442", "9O", "1NT", "0SE", "pw", "7Mi", "4hk", - "4FG", "67l", "2HJ", "09a", "3", "QZ", "68m", "4IF", "4gj", "6RI", "2ig", "1Le", "0Qt", "6N", "7OX", "4jZ", "4Dv", "5A6", "0j9", "1oy", - "4xr", "6MQ", "22w", "377", "0mp", "NB", "77T", "blm", "5KO", "6nM", "Cr", "14i", "0Nl", "3kn", "ajs", "41J", "4zC", "aer", "20F", "36", - "0oA", "Ls", "6aL", "4To", "bcl", "78U", "AC", "0bq", "386", "oo", "5r3", "4ws", "5l1", "4iq", "9Kf", "5e", "1y3", "1lR", "736", "66v", - "7oo", "4Jm", "05K", "Rq", "8U", "1ON", "4dA", "6Qb", "7NB", "bQs", "0Pn", "7T", "2Ka", "1nc", "4El", "64G", "69w", "b6g", "07z", "1v2", - "dRN", "8TF", "4fp", "5c0", "akm", "40T", "0Or", "1J2", "Bl", "15w", "4Zp", "6oS", "6bc", "5Ga", "0ln", "2YM", "ap", "0BB", "4yl", "6LO", - "6CN", "42e", "0MC", "nq", "2VL", "0co", "4XA", "6mb", "5P1", "4Uq", "8gG", "Mm", "cA", "1PR", "bAn", "adl", "51v", "446", "9K", "1NP", - "04U", "So", "5N3", "4Ks", "4FC", "67h", "2HN", "09e", "0SA", "ps", "7Mm", "4ho", "4gn", "6RM", "2ic", "1La", "7", "2GO", "68i", "4IB", - "4Dr", "5A2", "d4D", "82L", "0Qp", "6J", "a1g", "bPm", "0mt", "NF", "6cy", "4VZ", "4xv", "6MU", "0V9", "0CX", "0Nh", "mZ", "7PD", "41N", - "5KK", "6nI", "Cv", "14m", "0oE", "Lw", "6aH", "4Tk", "4zG", "6Od", "20B", "32", "0LY", "ok", "5r7", "4ww", "5Iz", "6lx", "AG", "0bu", - "1y7", "1lV", "4GY", "4R8", "5l5", "4iu", "1Bz", "5a", "8Q", "i8", "4dE", "6Qf", "7ok", "4Ji", "05O", "Ru", "2Ke", "1ng", "4Eh", "64C", - "7NF", "4kD", "f9", "7P", "2hy", "3m9", "4ft", "5c4", "69s", "4HX", "0sv", "PD", "23e", "0BN", "5iA", "6LC", "6bo", "4WL", "Z1", "OP", - "0t3", "0aR", "c4f", "aEM", "4a1", "40X", "8Ff", "lL", "cM", "8Ig", "5kp", "4n0", "74w", "617", "0nS", "Ma", "3Fa", "U0", "4XM", "6mn", - "6CB", "42i", "0MO", "2xl", "0SM", "4w", "7Ma", "4hc", "4FO", "67d", "2HB", "K2", "04Y", "Sc", "aTN", "b5D", "4eS", "4p2", "9G", "8We", - "256", "6F", "7OP", "4jR", "cnl", "65U", "0j1", "1oq", "D3", "QR", "68e", "4IN", "4gb", "6RA", "2io", "1Lm", "5KG", "6nE", "Cz", "14a", - "x7", "mV", "7PH", "41B", "4xz", "592", "0V5", "0CT", "0mx", "NJ", "4C7", "4VV", "4YW", "4L6", "AK", "0by", "0LU", "og", "563", "43s", - "4zK", "6Oh", "bW", "w6", "0oI", "2Zj", "6aD", "4Tg", "7og", "4Je", "05C", "Ry", "2jD", "i4", "4dI", "6Qj", "5l9", "4iy", "0RW", "5m", - "2IX", "08s", "4GU", "4R4", "7mV", "4HT", "07r", "PH", "0H7", "1Mw", "4fx", "5c8", "7NJ", "4kH", "f5", "sT", "2Ki", "1nk", "4Ed", "64O", - "6bk", "4WH", "Z5", "OT", "ax", "0BJ", "4yd", "6LG", "4a5", "4tT", "0Oz", "lH", "Bd", "0aV", "4Zx", "aEI", "5P9", "4Uy", "0nW", "Me", - "cI", "1PZ", "5kt", "4n4", "6CF", "42m", "0MK", "ny", "2VD", "U4", "4XI", "6mj", "4FK", "6sh", "2HF", "K6", "0SI", "4s", "7Me", "4hg", - "4eW", "4p6", "9C", "1NX", "0pU", "Sg", "7ny", "6k9", "4Dz", "65Q", "0j5", "1ou", "0Qx", "6B", "7OT", "4jV", "4gf", "6RE", "2ik", "1Li", - "D7", "QV", "68a", "4IJ", "x3", "mR", "7PL", "41F", "5KC", "6nA", "2Uo", "14e", "19U", "NN", "4C3", "4VR", "bBM", "596", "0V1", "0CP", - "0LQ", "oc", "567", "43w", "4YS", "4L2", "AO", "16T", "0oM", "2Zn", "75i", "4Tc", "4zO", "6Ol", "bS", "w2", "8Y", "i0", "4dM", "6Qn", - "7oc", "4Ja", "05G", "2Dl", "d7g", "08w", "4GQ", "4R0", "a2D", "bSN", "0RS", "5i", "0H3", "1Ms", "52U", "ayM", "7mR", "4HP", "07v", "PL", - "2Km", "1no", "5UA", "64K", "7NN", "4kL", "f1", "7X", "5nw", "4k7", "fJ", "0Ex", "0kT", "Hf", "6eY", "4Pz", "5Mk", "6hi", "EV", "P7", - "0HH", "kz", "6FE", "47n", "48o", "6ID", "26b", "0GI", "0ie", "JW", "6gh", "4RK", "5OZ", "6jX", "Gg", "0dU", "0Jy", "iK", "4d6", "4qW", - "4z4", "4oU", "1DZ", "3A", "Ye", "0zW", "4Ay", "5D9", "6yj", "4LI", "A4", "TU", "zy", "0YK", "4be", "6WF", "6XG", "4md", "0VJ", "1p", - "2ME", "N5", "4CH", "62c", "5K8", "4Nx", "0uV", "Vd", "xH", "8Rb", "5pu", "4u5", "D", "13W", "5Lq", "4I1", "534", "46t", "0IR", "28y", - "gP", "69", "5om", "6Jo", "6dC", "5AA", "0jN", "3OL", "2Pl", "0eO", "aT1", "6kB", "6En", "44E", "98", "hQ", "ea", "0FS", "49u", "abL", - "4F0", "4SQ", "8ag", "KM", "02u", "UO", "4X2", "4MS", "57V", "a8F", "0M0", "0XQ", "c2", "vS", "7KM", "4nO", "5PB", "61H", "2Nn", "1kl", - "00D", "2Ao", "6zA", "4Ob", "4aN", "6Tm", "yR", "l3", "0WP", "0j", "a7G", "58W", "4BR", "4W3", "ZN", "84l", "0kP", "Hb", "71t", "644", - "5ns", "4k3", "fN", "8Ld", "0HL", "29g", "6FA", "47j", "5Mo", "6hm", "ER", "P3", "0ia", "JS", "6gl", "4RO", "48k", "7Ya", "26f", "0GM", - "8Ce", "iO", "4d2", "4qS", "beL", "hYw", "Gc", "0dQ", "Ya", "0zS", "cko", "60V", "4z0", "4oQ", "205", "3E", "2ll", "0YO", "4ba", "6WB", - "6yn", "4LM", "A0", "TQ", "2MA", "N1", "4CL", "62g", "6XC", "59I", "0VN", "1t", "xL", "8Rf", "54y", "419", "aQM", "b0G", "01Z", "3PP", - "530", "46p", "0IV", "jd", "DH", "0gz", "5Lu", "4I5", "6dG", "4Qd", "0jJ", "Ix", "gT", "r5", "5oi", "6Jk", "6Ej", "44A", "0Kg", "hU", - "Fy", "0eK", "5ND", "6kF", "4F4", "4SU", "1xZ", "KI", "ee", "0FW", "49q", "5x9", "57R", "6VX", "0M4", "0XU", "02q", "UK", "4X6", "4MW", - "5PF", "61L", "2Nj", "1kh", "c6", "vW", "7KI", "4nK", "4aJ", "6Ti", "yV", "l7", "0tH", "Wz", "6zE", "4Of", "4BV", "4W7", "ZJ", "0yx", - "0WT", "0n", "6YY", "4lz", "5Mc", "6ha", "2SO", "0fl", "1Xa", "kr", "6FM", "47f", "bDm", "aao", "fB", "0Ep", "8bD", "Hn", "5U2", "4Pr", - "5OR", "5Z3", "Go", "10t", "0Jq", "iC", "ann", "45W", "48g", "6IL", "ds", "0GA", "0im", "3Lo", "73I", "4RC", "6yb", "4LA", "03g", "2BL", - "zq", "0YC", "4bm", "6WN", "a4d", "bUn", "0Ts", "3I", "Ym", "87O", "4Aq", "5D1", "5K0", "4Np", "01V", "Vl", "2nQ", "1KS", "54u", "415", - "6XO", "4ml", "0VB", "1x", "2MM", "0xn", "5Sa", "62k", "gX", "61", "5oe", "6Jg", "6dK", "4Qh", "0jF", "It", "L", "0gv", "5Ly", "4I9", - "5w4", "4rt", "0IZ", "jh", "ei", "1Vz", "5mT", "5x5", "4F8", "4SY", "0hw", "KE", "Fu", "0eG", "5NH", "6kJ", "6Ef", "44M", "90", "hY", - "0Ui", "2S", "7KE", "4nG", "5PJ", "6uH", "Xw", "1kd", "0vu", "UG", "6xx", "790", "4cw", "5f7", "0M8", "0XY", "0WX", "0b", "5i6", "4lv", - "4BZ", "63q", "ZF", "0yt", "00L", "Wv", "6zI", "4Oj", "4aF", "6Te", "yZ", "0Zh", "0HD", "kv", "6FI", "47b", "5Mg", "6he", "EZ", "0fh", - "0kX", "Hj", "5U6", "4Pv", "7N9", "6Ky", "fF", "0Et", "0Ju", "iG", "6Dx", "45S", "5OV", "5Z7", "Gk", "0dY", "0ii", "3Lk", "6gd", "4RG", - "48c", "6IH", "dw", "0GE", "zu", "0YG", "4bi", "6WJ", "6yf", "4LE", "A8", "TY", "Yi", "1jz", "4Au", "5D5", "4z8", "4oY", "0Tw", "3M", - "xD", "1KW", "54q", "411", "5K4", "4Nt", "01R", "Vh", "2MI", "N9", "4CD", "62o", "6XK", "4mh", "0VF", "ut", "6dO", "4Ql", "0jB", "Ip", - "25E", "65", "5oa", "6Jc", "538", "46x", "9Pg", "jl", "H", "0gr", "bfo", "aCm", "72W", "bin", "0hs", "KA", "em", "324", "49y", "5x1", - "6Eb", "44I", "94", "3nm", "Fq", "0eC", "5NL", "6kN", "5PN", "61D", "Xs", "86Q", "0Um", "2W", "7KA", "4nC", "4cs", "5f3", "39W", "8QE", - "02y", "UC", "aRn", "794", "765", "63u", "ZB", "0yp", "9Ne", "0f", "5i2", "4lr", "4aB", "6Ta", "2oO", "0Zl", "00H", "Wr", "6zM", "4On", - "5lW", "5y6", "dj", "0GX", "0it", "JF", "6gy", "4RZ", "5OK", "6jI", "Gv", "0dD", "83", "iZ", "6De", "45N", "5nf", "6Kd", "24B", "72", - "0kE", "Hw", "6eH", "4Pk", "5Mz", "6hx", "EG", "0fu", "0HY", "kk", "5v7", "4sw", "5h5", "4mu", "1Fz", "1a", "2MT", "0xw", "4CY", "4V8", - "7kk", "4Ni", "01O", "Vu", "xY", "m8", "54l", "6Uf", "6Zg", "4oD", "b9", "3P", "Yt", "0zF", "4Ah", "60C", "4Y9", "4LX", "0wv", "TD", - "zh", "0YZ", "4bt", "5g4", "Fl", "11w", "5NQ", "6kS", "aom", "44T", "0Kr", "1N2", "ep", "0FB", "49d", "6HO", "6fc", "5Ca", "0hn", "3Ml", - "U", "0go", "bfr", "6ib", "6GN", "46e", "0IC", "jq", "gA", "0Ds", "bEn", "hyU", "5T1", "4Qq", "8cG", "Im", "00U", "Wo", "5J3", "4Os", - "55v", "406", "yC", "0Zq", "0WA", "ts", "6YL", "4lo", "4BC", "63h", "2LN", "0ym", "02d", "2CO", "6xa", "4MB", "4cn", "6VM", "2mc", "1Ha", - "0Up", "2J", "a5g", "bTm", "5PS", "5E2", "Xn", "86L", "0ip", "JB", "73T", "bhm", "48z", "5y2", "dn", "337", "87", "3on", "6Da", "45J", - "5OO", "6jM", "Gr", "10i", "0kA", "Hs", "6eL", "4Po", "5nb", "aar", "24F", "76", "8AE", "ko", "5v3", "4ss", "bgl", "aBn", "EC", "0fq", - "2MP", "0xs", "776", "62v", "5h1", "4mq", "9Of", "1e", "2nL", "1KN", "54h", "6Ub", "7ko", "4Nm", "01K", "Vq", "Yp", "0zB", "4Al", "60G", - "6Zc", "bUs", "0Tn", "3T", "zl", "8PF", "4bp", "5g0", "aSm", "787", "03z", "1r2", "4e9", "44P", "0Kv", "hD", "Fh", "0eZ", "5NU", "6kW", - "6fg", "4SD", "0hj", "KX", "et", "0FF", "5mI", "6HK", "6GJ", "46a", "0IG", "ju", "Q", "Q8", "5Ld", "6if", "5T5", "4Qu", "1zz", "Ii", - "gE", "0Dw", "5ox", "4j8", "55r", "402", "yG", "0Zu", "00Q", "Wk", "5J7", "4Ow", "4BG", "63l", "2LJ", "0yi", "0WE", "tw", "6YH", "4lk", - "4cj", "6VI", "2mg", "0XD", "0vh", "UZ", "6xe", "4MF", "5PW", "5E6", "Xj", "1ky", "0Ut", "2N", "7KX", "4nZ", "5OC", "6jA", "2Qo", "0dL", - "1ZA", "iR", "6Dm", "45F", "48v", "acO", "db", "0GP", "94M", "JN", "4G3", "4RR", "5Mr", "4H2", "EO", "12T", "0HQ", "kc", "527", "47w", - "5nn", "6Kl", "fS", "s2", "0kM", "3NO", "71i", "4Pc", "7kc", "4Na", "01G", "3PM", "xQ", "m0", "54d", "6Un", "a6D", "59T", "0VS", "1i", - "197", "85o", "4CQ", "4V0", "4Y1", "4LP", "03v", "TL", "0L3", "0YR", "56U", "a9E", "6Zo", "4oL", "b1", "3X", "2Om", "0zN", "5QA", "60K", - "ex", "0FJ", "49l", "6HG", "6fk", "4SH", "0hf", "KT", "Fd", "0eV", "5NY", "aAI", "4e5", "4pT", "0Kz", "hH", "gI", "1TZ", "5ot", "4j4", - "5T9", "4Qy", "0jW", "Ie", "DU", "Q4", "5Lh", "6ij", "6GF", "46m", "0IK", "jy", "0WI", "0s", "6YD", "4lg", "4BK", "6wh", "ZW", "O6", - "0tU", "Wg", "6zX", "6o9", "4aW", "4t6", "yK", "0Zy", "0Ux", "2B", "7KT", "4nV", "bzI", "61Q", "Xf", "1ku", "02l", "UV", "6xi", "4MJ", - "4cf", "6VE", "2mk", "0XH", "0Jd", "iV", "6Di", "45B", "5OG", "6jE", "Gz", "0dH", "0ix", "JJ", "4G7", "4RV", "48r", "6IY", "df", "0GT", - "0HU", "kg", "523", "47s", "5Mv", "4H6", "EK", "0fy", "0kI", "3NK", "6eD", "4Pg", "5nj", "6Kh", "fW", "s6", "xU", "m4", "5ph", "6Uj", - "7kg", "4Ne", "01C", "Vy", "193", "1hZ", "4CU", "4V4", "5h9", "4my", "0VW", "1m", "zd", "0YV", "4bx", "5g8", "4Y5", "4LT", "03r", "TH", - "Yx", "0zJ", "4Ad", "60O", "6Zk", "4oH", "b5", "wT", "6fo", "4SL", "0hb", "KP", "27e", "0FN", "49h", "6HC", "4e1", "44X", "8Bf", "hL", - "0p3", "0eR", "bdO", "aAM", "70w", "657", "0jS", "Ia", "gM", "8Mg", "5op", "4j0", "6GB", "46i", "0IO", "28d", "Y", "Q0", "5Ll", "6in", - "4BO", "63d", "ZS", "O2", "0WM", "0w", "7Ia", "4lc", "4aS", "4t2", "yO", "8Se", "00Y", "Wc", "aPN", "b1D", "bzM", "61U", "Xb", "1kq", - "216", "2F", "7KP", "4nR", "4cb", "6VA", "2mo", "0XL", "02h", "UR", "6xm", "4MN", "5j7", "4ow", "0TY", "3c", "YG", "0zu", "5Qz", "60p", - "6yH", "4Lk", "03M", "Tw", "2lJ", "0Yi", "4bG", "6Wd", "6Xe", "4mF", "0Vh", "1R", "2Mg", "0xD", "4Cj", "62A", "7kX", "4NZ", "0ut", "VF", - "xj", "1Ky", "5pW", "5e6", "5nU", "6KW", "fh", "0EZ", "0kv", "HD", "4E9", "4PX", "5MI", "6hK", "Et", "0fF", "0Hj", "kX", "6Fg", "47L", - "48M", "6If", "dY", "50", "0iG", "Ju", "6gJ", "4Ri", "5Ox", "4J8", "GE", "0dw", "1Zz", "ii", "5t5", "4qu", "02W", "Um", "5H1", "4Mq", - "57t", "424", "2mP", "0Xs", "0UC", "2y", "7Ko", "4nm", "bzr", "61j", "2NL", "1kN", "00f", "2AM", "6zc", "bus", "4al", "6TO", "yp", "0ZB", - "0Wr", "0H", "a7e", "58u", "4Bp", "5G0", "Zl", "84N", "f", "13u", "5LS", "5Y2", "amo", "46V", "0Ip", "jB", "gr", "1Ta", "5oO", "6JM", - "6da", "4QB", "0jl", "3On", "2PN", "0em", "5Nb", "aAr", "6EL", "44g", "0KA", "hs", "eC", "0Fq", "49W", "abn", "5V3", "4Ss", "8aE", "Ko", - "YC", "0zq", "754", "60t", "5j3", "4os", "9Md", "3g", "2lN", "0Ym", "4bC", "7GA", "6yL", "4Lo", "03I", "Ts", "2Mc", "1ha", "4Cn", "62E", - "6Xa", "4mB", "0Vl", "1V", "xn", "8RD", "5pS", "5e2", "aQo", "b0e", "01x", "VB", "0kr", "1n2", "71V", "bjo", "5nQ", "6KS", "fl", "315", - "0Hn", "29E", "6Fc", "47H", "5MM", "6hO", "Ep", "0fB", "0iC", "Jq", "6gN", "4Rm", "48I", "6Ib", "26D", "54", "8CG", "im", "509", "45y", - "ben", "hYU", "GA", "0ds", "4cY", "420", "2mT", "0Xw", "02S", "Ui", "5H5", "4Mu", "5Pd", "61n", "XY", "M8", "0UG", "vu", "7Kk", "4ni", - "4ah", "6TK", "yt", "0ZF", "B9", "WX", "6zg", "4OD", "4Bt", "5G4", "Zh", "0yZ", "0Wv", "0L", "4y9", "4lX", "6Gy", "46R", "0It", "jF", - "b", "0gX", "5LW", "5Y6", "6de", "4QF", "0jh", "IZ", "gv", "0DD", "5oK", "6JI", "6EH", "44c", "0KE", "hw", "2PJ", "0ei", "5Nf", "6kd", - "5V7", "4Sw", "0hY", "Kk", "eG", "0Fu", "49S", "6Hx", "7ia", "4Lc", "03E", "2Bn", "zS", "o2", "4bO", "6Wl", "a4F", "bUL", "0TQ", "3k", - "YO", "87m", "4AS", "4T2", "7kP", "4NR", "01t", "VN", "xb", "1Kq", "54W", "hfv", "6Xm", "4mN", "1FA", "1Z", "2Mo", "0xL", "4Cb", "62I", - "5MA", "6hC", "2Sm", "0fN", "0Hb", "kP", "6Fo", "47D", "bDO", "aaM", "0P3", "0ER", "8bf", "HL", "4E1", "4PP", "5Op", "4J0", "GM", "10V", - "0JS", "ia", "505", "45u", "48E", "6In", "dQ", "58", "0iO", "3LM", "6gB", "4Ra", "0UK", "2q", "7Kg", "4ne", "5Ph", "61b", "XU", "M4", - "0vW", "Ue", "5H9", "4My", "4cU", "4v4", "2mX", "1HZ", "0Wz", "tH", "4y5", "4lT", "4Bx", "5G8", "Zd", "0yV", "B5", "WT", "6zk", "4OH", - "4ad", "6TG", "yx", "0ZJ", "gz", "0DH", "5oG", "6JE", "6di", "4QJ", "0jd", "IV", "n", "0gT", "680", "6iY", "4g7", "4rV", "0Ix", "jJ", - "eK", "0Fy", "5mv", "4h6", "6fX", "5CZ", "0hU", "Kg", "FW", "S6", "5Nj", "6kh", "6ED", "44o", "0KI", "3nK", "zW", "o6", "4bK", "6Wh", - "6yD", "4Lg", "03A", "2Bj", "YK", "0zy", "4AW", "4T6", "6ZX", "6O9", "0TU", "3o", "xf", "1Ku", "54S", "6UY", "7kT", "4NV", "01p", "VJ", - "2Mk", "0xH", "4Cf", "62M", "6Xi", "4mJ", "0Vd", "uV", "0Hf", "kT", "6Fk", "4sH", "5ME", "6hG", "Ex", "0fJ", "0kz", "HH", "4E5", "4PT", - "5nY", "aaI", "fd", "0EV", "0JW", "ie", "501", "45q", "5Ot", "4J4", "GI", "10R", "0iK", "Jy", "6gF", "4Re", "48A", "6Ij", "dU", "q4", - "5Pl", "61f", "XQ", "M0", "0UO", "2u", "7Kc", "4na", "4cQ", "428", "39u", "8Qg", "0vS", "Ua", "aRL", "b3F", "bxO", "63W", "0l3", "0yR", - "234", "0D", "4y1", "4lP", "55I", "6TC", "2om", "0ZN", "B1", "WP", "6zo", "4OL", "6dm", "4QN", "1zA", "IR", "25g", "0DL", "5oC", "6JA", - "4g3", "46Z", "9PE", "jN", "j", "0gP", "684", "aCO", "72u", "675", "0hQ", "Kc", "eO", "8Oe", "5mr", "4h2", "7Ua", "44k", "0KM", "3nO", - "FS", "S2", "5Nn", "6kl", "4x6", "4mW", "0Vy", "1C", "0m4", "0xU", "5SZ", "62P", "7kI", "4NK", "C6", "VW", "2nj", "1Kh", "54N", "6UD", - "6ZE", "4of", "0TH", "3r", "YV", "L7", "4AJ", "60a", "6yY", "4Lz", "0wT", "Tf", "zJ", "0Yx", "4bV", "4w7", "5lu", "4i5", "dH", "0Gz", - "0iV", "Jd", "5W8", "4Rx", "5Oi", "6jk", "GT", "R5", "0JJ", "ix", "6DG", "45l", "5nD", "6KF", "fy", "0EK", "0kg", "HU", "6ej", "4PI", - "5MX", "5X9", "Ee", "0fW", "1XZ", "kI", "4f4", "4sU", "00w", "WM", "4Z0", "4OQ", "55T", "hgu", "ya", "0ZS", "a0", "0Y", "6Yn", "4lM", - "4Ba", "63J", "2Ll", "0yO", "02F", "2Cm", "6xC", "aG0", "4cL", "6Vo", "2mA", "n1", "0UR", "2h", "a5E", "bTO", "5Pq", "4U1", "XL", "86n", - "FN", "11U", "5Ns", "4K3", "516", "44v", "0KP", "hb", "eR", "p3", "49F", "6Hm", "6fA", "4Sb", "0hL", "3MN", "w", "0gM", "5LB", "7ya", - "6Gl", "46G", "0Ia", "jS", "gc", "0DQ", "bEL", "hyw", "4D2", "4QS", "8ce", "IO", "0m0", "0xQ", "byL", "62T", "4x2", "4mS", "227", "1G", - "2nn", "1Kl", "54J", "7Ea", "7kM", "4NO", "C2", "VS", "YR", "L3", "4AN", "60e", "6ZA", "4ob", "0TL", "3v", "zN", "8Pd", "4bR", "4w3", - "aSO", "b2E", "03X", "Tb", "0iR", "3LP", "73v", "666", "48X", "4i1", "dL", "8Nf", "0JN", "3oL", "6DC", "45h", "5Om", "6jo", "GP", "R1", - "0kc", "HQ", "6en", "4PM", "a09", "6KB", "24d", "0EO", "8Ag", "kM", "4f0", "47Y", "697", "aBL", "Ea", "0fS", "4ay", "5d9", "ye", "0ZW", - "00s", "WI", "4Z4", "4OU", "4Be", "63N", "Zy", "0yK", "a4", "tU", "6Yj", "4lI", "4cH", "6Vk", "2mE", "n5", "02B", "Ux", "6xG", "4Md", - "5Pu", "4U5", "XH", "86j", "0UV", "2l", "5k8", "4nx", "512", "44r", "0KT", "hf", "FJ", "0ex", "5Nw", "4K7", "6fE", "4Sf", "0hH", "Kz", - "eV", "p7", "49B", "6Hi", "6Gh", "46C", "0Ie", "jW", "s", "0gI", "5LF", "6iD", "4D6", "4QW", "0jy", "IK", "gg", "0DU", "5oZ", "6JX", - "7kA", "4NC", "01e", "3Po", "xs", "8RY", "54F", "6UL", "a6f", "59v", "0Vq", "1K", "d3E", "85M", "4Cs", "5F3", "5I2", "4Lr", "03T", "Tn", - "zB", "0Yp", "56w", "437", "6ZM", "4on", "1Da", "3z", "2OO", "0zl", "4AB", "60i", "5Oa", "6jc", "2QM", "0dn", "0JB", "ip", "6DO", "45d", - "48T", "acm", "1B2", "0Gr", "94o", "Jl", "5W0", "4Rp", "5MP", "5X1", "Em", "12v", "0Hs", "kA", "all", "47U", "5nL", "6KN", "fq", "0EC", - "0ko", "3Nm", "6eb", "4PA", "a8", "0Q", "6Yf", "4lE", "4Bi", "63B", "Zu", "0yG", "0tw", "WE", "4Z8", "4OY", "4au", "5d5", "yi", "1Jz", - "0UZ", "vh", "5k4", "4nt", "5Py", "4U9", "XD", "1kW", "02N", "Ut", "6xK", "4Mh", "4cD", "6Vg", "2mI", "n9", "eZ", "43", "49N", "6He", - "6fI", "4Sj", "0hD", "Kv", "FF", "0et", "7n9", "6ky", "5u6", "4pv", "0KX", "hj", "gk", "0DY", "5oV", "5z7", "6dx", "5Az", "0ju", "IG", - "Dw", "0gE", "5LJ", "6iH", "6Gd", "46O", "0Ii", "28B", "xw", "1Kd", "54B", "6UH", "7kE", "4NG", "01a", "3Pk", "0m8", "0xY", "4Cw", "5F7", - "6Xx", "59r", "0Vu", "1O", "zF", "0Yt", "4bZ", "433", "5I6", "4Lv", "03P", "Tj", "YZ", "0zh", "4AF", "60m", "6ZI", "4oj", "0TD", "wv", - "0JF", "it", "6DK", "4qh", "5Oe", "6jg", "GX", "R9", "0iZ", "Jh", "5W4", "4Rt", "48P", "4i9", "dD", "0Gv", "0Hw", "kE", "4f8", "47Q", - "5MT", "5X5", "Ei", "12r", "0kk", "HY", "6ef", "4PE", "5nH", "6KJ", "fu", "0EG", "4Bm", "63F", "Zq", "0yC", "0Wo", "0U", "6Yb", "4lA", - "4aq", "5d1", "ym", "8SG", "0ts", "WA", "aPl", "b1f", "747", "61w", "2NQ", "1kS", "9Lg", "2d", "5k0", "4np", "57i", "6Vc", "2mM", "0Xn", - "02J", "Up", "6xO", "4Ml", "6fM", "4Sn", "1xa", "Kr", "27G", "47", "49J", "6Ha", "5u2", "44z", "8BD", "hn", "FB", "0ep", "bdm", "aAo", - "70U", "bkl", "0jq", "IC", "go", "306", "5oR", "5z3", "7WA", "46K", "0Im", "28F", "Ds", "0gA", "5LN", "6iL", "0cY", "020", "6mT", "4Xw", - "42S", "6Cx", "nG", "0Mu", "1Pd", "cw", "6NH", "5kJ", "4UG", "74M", "3Kk", "0ni", "0ah", "BZ", "6oe", "4ZF", "40b", "6AI", "lv", "0OD", - "0Bt", "aF", "6Ly", "4yZ", "4Wv", "5R6", "Oj", "0lX", "Qh", "06R", "4It", "5L4", "461", "4gX", "1LW", "1Y6", "rt", "0QF", "4jh", "7Oj", - "65o", "4DD", "I9", "2JI", "SY", "F8", "4KE", "7nG", "6PJ", "4ei", "1Nf", "2kd", "4M", "0Sw", "4hY", "490", "5C5", "4Fu", "09S", "2Hx", - "6OR", "4zq", "354", "bm", "LA", "0os", "bnn", "75W", "6lN", "4Ym", "0bC", "Aq", "2yL", "0Lo", "43I", "6Bb", "6Mc", "5ha", "15", "22E", - "Np", "0mB", "4Vl", "6cO", "aDm", "bao", "1pS", "1e2", "ml", "8GF", "41x", "548", "4kr", "5n2", "7f", "8YD", "1nQ", "2KS", "64u", "715", - "4Hn", "69E", "Pr", "07H", "1MM", "2hO", "6Sa", "4fB", "4iC", "7LA", "5W", "0Rm", "08I", "2Ib", "66D", "4Go", "b4d", "aUn", "RC", "05y", - "8VE", "8g", "5a3", "4ds", "42W", "ain", "nC", "0Mq", "17t", "024", "6mP", "4Xs", "4UC", "74I", "3Ko", "0nm", "8IY", "cs", "6NL", "5kN", - "40f", "6AM", "lr", "8FX", "0al", "2TO", "6oa", "4ZB", "4Wr", "5R2", "On", "18u", "0Bp", "aB", "afo", "bCm", "465", "53u", "1LS", "1Y2", - "Ql", "06V", "4Ip", "5L0", "65k", "5Ta", "1oO", "2JM", "6x", "0QB", "4jl", "7On", "6PN", "4em", "1Nb", "9y", "2EL", "04g", "4KA", "7nC", - "5C1", "4Fq", "09W", "d6G", "4I", "0Ss", "bRn", "494", "LE", "0ow", "4TY", "4A8", "6OV", "4zu", "1Qz", "bi", "oY", "z8", "43M", "6Bf", - "6lJ", "4Yi", "0bG", "Au", "Nt", "0mF", "4Vh", "6cK", "6Mg", "4xD", "11", "22A", "mh", "0NZ", "4ut", "5p4", "4N9", "5Ky", "1pW", "CD", - "1nU", "2KW", "64q", "4EZ", "4kv", "5n6", "7b", "0PX", "1MI", "2hK", "6Se", "4fF", "4Hj", "69A", "Pv", "07L", "08M", "2If", "6rH", "4Gk", - "4iG", "7LE", "5S", "0Ri", "1Ox", "8c", "5a7", "4dw", "5Zz", "7oY", "RG", "0qu", "1Pl", "21f", "adR", "5kB", "4UO", "74E", "MS", "X2", - "0cQ", "028", "79u", "bbL", "4vS", "4c2", "nO", "8De", "8Kd", "aN", "4l3", "4yR", "634", "76t", "Ob", "0lP", "W3", "BR", "6om", "4ZN", - "40j", "6AA", "2zo", "0OL", "6t", "0QN", "5zA", "7Ob", "65g", "4DL", "I1", "2JA", "0g3", "06Z", "b7G", "68W", "469", "4gP", "284", "dSn", - "4E", "275", "4hQ", "498", "67V", "b8F", "1mr", "0h2", "SQ", "F0", "4KM", "7nO", "6PB", "4ea", "1Nn", "9u", "6lF", "4Ye", "0bK", "Ay", - "oU", "z4", "43A", "6Bj", "6OZ", "4zy", "0AW", "be", "LI", "2O9", "4TU", "4A4", "4N5", "5Ku", "14S", "CH", "md", "0NV", "41p", "540", - "6Mk", "4xH", "u5", "22M", "Nx", "0mJ", "4Vd", "6cG", "4Hf", "69M", "Pz", "0sH", "k7", "2hG", "6Si", "4fJ", "4kz", "7Nx", "7n", "0PT", - "1nY", "dqh", "4P7", "4EV", "4JW", "7oU", "RK", "05q", "1Ot", "8o", "6QX", "50R", "4iK", "7LI", "qW", "d6", "08A", "2Ij", "66L", "4Gg", - "4UK", "74A", "MW", "X6", "1Ph", "21b", "6ND", "5kF", "4vW", "4c6", "nK", "0My", "0cU", "0v4", "6mX", "5HZ", "4Wz", "6bY", "Of", "0lT", - "0Bx", "aJ", "4l7", "4yV", "40n", "6AE", "lz", "0OH", "W7", "BV", "6oi", "4ZJ", "65c", "4DH", "I5", "2JE", "6p", "0QJ", "4jd", "7Of", - "4r5", "4gT", "280", "2iY", "Qd", "0rV", "4Ix", "5L8", "5C9", "4Fy", "1mv", "0h6", "4A", "1CZ", "4hU", "7MW", "6PF", "4ee", "1Nj", "9q", - "SU", "F4", "4KI", "7nK", "oQ", "z0", "43E", "6Bn", "6lB", "4Ya", "0bO", "2Wl", "LM", "8fg", "4TQ", "4A0", "aeL", "cPo", "0AS", "ba", - "3kP", "0NR", "41t", "544", "4N1", "5Kq", "14W", "CL", "2Xm", "0mN", "5FA", "6cC", "6Mo", "4xL", "19", "22I", "k3", "2hC", "6Sm", "4fN", - "4Hb", "69I", "2Fo", "07D", "83l", "d5d", "4P3", "4ER", "bQM", "a0G", "7j", "0PP", "1Op", "8k", "hbw", "50V", "4JS", "7oQ", "RO", "05u", - "08E", "2In", "66H", "4Gc", "4iO", "7LM", "qS", "d2", "0ay", "BK", "4O6", "4ZW", "40s", "553", "lg", "0OU", "t6", "aW", "6Lh", "4yK", - "4Wg", "6bD", "2Yj", "0lI", "0cH", "2Vk", "6mE", "4Xf", "42B", "6Ci", "nV", "0Md", "1Pu", "cf", "6NY", "bAI", "4UV", "7pT", "MJ", "0nx", - "SH", "04r", "4KT", "7nV", "azI", "4ex", "1Nw", "9l", "pT", "e5", "4hH", "7MJ", "67O", "4Fd", "09B", "2Hi", "Qy", "06C", "4Ie", "68N", - "6Rj", "4gI", "j4", "2iD", "6m", "0QW", "4jy", "5o9", "4Q4", "4DU", "1oZ", "2JX", "4m0", "4xQ", "8Jg", "22T", "Na", "0mS", "627", "77w", - "6nn", "5Kl", "V0", "CQ", "3kM", "0NO", "41i", "7Pc", "6OC", "5jA", "0AN", "20e", "LP", "Y1", "4TL", "6ao", "78v", "bcO", "0bR", "0w3", - "oL", "8Ef", "43X", "4b1", "4iR", "7LP", "5F", "266", "08X", "0i1", "66U", "b9E", "4JN", "7oL", "RR", "G3", "1Om", "8v", "6QA", "4db", - "4kc", "7Na", "7w", "0PM", "H2", "2KB", "64d", "4EO", "b6D", "69T", "Pc", "07Y", "297", "dRm", "4s2", "4fS", "40w", "557", "lc", "0OQ", - "15T", "BO", "4O2", "4ZS", "4Wc", "76i", "2Yn", "0lM", "t2", "aS", "6Ll", "4yO", "42F", "6Cm", "nR", "8Dx", "0cL", "2Vo", "6mA", "4Xb", - "4UR", "74X", "MN", "8gd", "1Pq", "cb", "adO", "bAM", "azM", "51U", "1Ns", "9h", "SL", "04v", "4KP", "7nR", "67K", "5VA", "09F", "2Hm", - "4X", "e1", "4hL", "7MN", "6Rn", "4gM", "j0", "3ya", "2Gl", "06G", "4Ia", "68J", "4Q0", "4DQ", "82o", "d4g", "6i", "0QS", "bPN", "a1D", - "Ne", "0mW", "4Vy", "5S9", "4m4", "4xU", "1SZ", "22P", "my", "0NK", "41m", "7Pg", "6nj", "5Kh", "V4", "CU", "LT", "Y5", "4TH", "6ak", - "6OG", "4zd", "0AJ", "bx", "oH", "0Lz", "4wT", "4b5", "78r", "4Yx", "0bV", "Ad", "1lu", "0i5", "66Q", "4Gz", "4iV", "7LT", "5B", "0Rx", - "1Oi", "8r", "6QE", "4df", "4JJ", "7oH", "RV", "G7", "H6", "2KF", "6ph", "4EK", "4kg", "7Ne", "7s", "0PI", "1MX", "1X9", "4s6", "4fW", - "5XZ", "69P", "Pg", "0sU", "06", "23F", "afr", "4yC", "4Wo", "6bL", "Os", "0lA", "0aq", "BC", "aEn", "c4E", "4ts", "5q3", "lo", "8FE", - "347", "cn", "6NQ", "5kS", "bom", "74T", "MB", "0np", "17i", "2Vc", "6mM", "4Xn", "42J", "6Ca", "2xO", "0Ml", "4T", "0Sn", "5xa", "7MB", - "67G", "4Fl", "09J", "2Ha", "1u2", "04z", "b5g", "aTm", "6PS", "4ep", "8WF", "9d", "6e", "8XG", "4jq", "5o1", "65v", "706", "1oR", "1z3", - "Qq", "06K", "4Im", "68F", "6Rb", "4gA", "1LN", "2iL", "6nf", "5Kd", "V8", "CY", "mu", "0NG", "41a", "7Pk", "4m8", "4xY", "0Cw", "1F7", - "Ni", "19r", "4Vu", "5S5", "6lW", "4Yt", "0bZ", "Ah", "oD", "0Lv", "43P", "4b9", "6OK", "4zh", "0AF", "bt", "LX", "Y9", "4TD", "6ag", - "4JF", "7oD", "RZ", "0qh", "1Oe", "2jg", "6QI", "4dj", "4iZ", "483", "5N", "0Rt", "08P", "0i9", "5B6", "4Gv", "4Hw", "5M7", "Pk", "07Q", - "1MT", "1X5", "472", "52r", "4kk", "7Ni", "sw", "0PE", "1nH", "2KJ", "64l", "4EG", "4Wk", "6bH", "Ow", "0lE", "02", "23B", "6Ld", "4yG", - "4tw", "5q7", "lk", "0OY", "0au", "BG", "6ox", "5Jz", "4UZ", "74P", "MF", "0nt", "1Py", "cj", "6NU", "5kW", "42N", "6Ce", "nZ", "0Mh", - "0cD", "2Vg", "6mI", "4Xj", "67C", "4Fh", "09N", "2He", "4P", "e9", "4hD", "7MF", "6PW", "4et", "3n9", "2ky", "SD", "0pv", "4KX", "7nZ", - "4Q8", "4DY", "1oV", "1z7", "6a", "1Az", "4ju", "5o5", "6Rf", "4gE", "j8", "2iH", "Qu", "06O", "4Ii", "68B", "mq", "0NC", "41e", "7Po", - "6nb", "bar", "14F", "2UL", "Nm", "19v", "4Vq", "5S1", "agl", "bBn", "0Cs", "1F3", "1I2", "0Lr", "43T", "ahm", "6lS", "4Yp", "16w", "Al", - "2ZM", "0on", "5Da", "6ac", "6OO", "4zl", "0AB", "bp", "1Oa", "8z", "6QM", "4dn", "4JB", "aUs", "2DO", "05d", "08T", "d7D", "5B2", "4Gr", - "bSm", "487", "5J", "0Rp", "1MP", "1X1", "476", "52v", "4Hs", "5M3", "Po", "07U", "1nL", "2KN", "64h", "4EC", "4ko", "7Nm", "ss", "0PA", - "QJ", "06p", "4IV", "7lT", "6RY", "4gz", "1Lu", "0I5", "rV", "g7", "4jJ", "7OH", "65M", "4Df", "1oi", "2Jk", "2Ej", "04A", "4Kg", "7ne", - "6Ph", "4eK", "h6", "2kF", "4o", "0SU", "5xZ", "7My", "4S6", "4FW", "09q", "1x9", "17R", "2VX", "4M4", "4XU", "42q", "571", "ne", "0MW", - "v4", "cU", "6Nj", "5kh", "4Ue", "74o", "My", "0nK", "0aJ", "Bx", "6oG", "4Zd", "4tH", "6Ak", "lT", "y5", "0BV", "ad", "580", "4yx", - "4WT", "4B5", "OH", "0lz", "4kP", "7NR", "7D", "244", "1ns", "0k3", "64W", "con", "4HL", "69g", "PP", "E1", "1Mo", "2hm", "6SC", "52I", - "4ia", "7Lc", "5u", "0RO", "J0", "3Ya", "66f", "4GM", "b4F", "aUL", "Ra", "0qS", "8Vg", "8E", "458", "4dQ", "4o2", "4zS", "8He", "bO", - "Lc", "0oQ", "605", "75u", "6ll", "4YO", "T2", "AS", "2yn", "0LM", "43k", "7Ra", "6MA", "4xb", "0CL", "22g", "NR", "19I", "4VN", "6cm", - "aDO", "baM", "14y", "Cb", "mN", "8Gd", "41Z", "7PP", "axO", "53W", "1Lq", "0I1", "QN", "06t", "4IR", "68y", "65I", "4Db", "1om", "2Jo", - "6Z", "g3", "4jN", "7OL", "6Pl", "4eO", "h2", "2kB", "2En", "04E", "4Kc", "7na", "4S2", "4FS", "09u", "d6e", "4k", "0SQ", "bRL", "a3F", - "42u", "575", "na", "0MS", "17V", "dlo", "4M0", "4XQ", "4Ua", "74k", "3KM", "0nO", "28", "cQ", "6Nn", "5kl", "40D", "6Ao", "lP", "y1", - "0aN", "2Tm", "6oC", "5JA", "4WP", "4B1", "OL", "18W", "0BR", "0W3", "584", "bCO", "1nw", "0k7", "64S", "4Ex", "4kT", "7NV", "sH", "0Pz", - "1Mk", "2hi", "6SG", "4fd", "4HH", "69c", "PT", "E5", "J4", "2ID", "66b", "4GI", "4ie", "7Lg", "5q", "0RK", "1OZ", "8A", "4q4", "4dU", - "4Jy", "5O9", "Re", "0qW", "Lg", "0oU", "5DZ", "6aX", "4o6", "4zW", "0Ay", "bK", "2yj", "0LI", "43o", "6BD", "6lh", "4YK", "T6", "AW", - "NV", "0md", "4VJ", "6ci", "6ME", "4xf", "0CH", "22c", "mJ", "0Nx", "4uV", "7PT", "6nY", "baI", "1pu", "Cf", "6V", "0Ql", "4jB", "aus", - "65E", "4Dn", "1oa", "2Jc", "QB", "06x", "b7e", "68u", "5b2", "4gr", "8UD", "dSL", "4g", "8ZE", "4hs", "5m3", "67t", "724", "09y", "1x1", - "Ss", "04I", "4Ko", "7nm", "azr", "4eC", "1NL", "9W", "24", "21D", "6Nb", "bAr", "4Um", "74g", "Mq", "0nC", "0cs", "1f3", "79W", "bbn", - "42y", "579", "nm", "394", "365", "al", "588", "4yp", "bmo", "76V", "1i2", "0lr", "0aB", "Bp", "6oO", "4Zl", "40H", "6Ac", "2zM", "0On", - "4HD", "69o", "PX", "E9", "1Mg", "2he", "6SK", "4fh", "4kX", "7NZ", "7L", "0Pv", "3N9", "2Ky", "6pW", "4Et", "4Ju", "5O5", "Ri", "05S", - "1OV", "8M", "450", "4dY", "4ii", "7Lk", "qu", "0RG", "J8", "2IH", "66n", "4GE", "6ld", "4YG", "0bi", "2WJ", "ow", "0LE", "43c", "6BH", - "6Ox", "5jz", "0Au", "bG", "Lk", "0oY", "4Tw", "5Q7", "6nU", "5KW", "14q", "Cj", "mF", "0Nt", "41R", "7PX", "6MI", "4xj", "0CD", "22o", - "NZ", "0mh", "4VF", "6ce", "65A", "4Dj", "1oe", "2Jg", "6R", "0Qh", "4jF", "7OD", "5b6", "4gv", "1Ly", "0I9", "QF", "0rt", "4IZ", "68q", - "67p", "5Vz", "1mT", "1x5", "4c", "0SY", "4hw", "5m7", "6Pd", "4eG", "1NH", "9S", "Sw", "04M", "4Kk", "7ni", "4Ui", "74c", "Mu", "0nG", - "20", "cY", "6Nf", "5kd", "4vu", "5s5", "ni", "390", "0cw", "1f7", "4M8", "4XY", "4WX", "4B9", "OD", "0lv", "0BZ", "ah", "6LW", "4yt", - "40L", "6Ag", "lX", "y9", "0aF", "Bt", "6oK", "4Zh", "1Mc", "2ha", "6SO", "4fl", "5Xa", "69k", "2FM", "07f", "83N", "d5F", "6pS", "4Ep", - "bQo", "a0e", "7H", "0Pr", "1OR", "8I", "454", "50t", "4Jq", "5O1", "Rm", "05W", "08g", "2IL", "66j", "4GA", "4im", "7Lo", "5y", "0RC", - "os", "0LA", "43g", "6BL", "78I", "4YC", "0bm", "2WN", "Lo", "8fE", "4Ts", "5Q3", "aen", "cPM", "0Aq", "bC", "mB", "0Np", "41V", "ajo", - "6nQ", "5KS", "14u", "Cn", "2XO", "0ml", "4VB", "6ca", "6MM", "4xn", "1Sa", "22k", "Sj", "04P", "4Kv", "5N6", "443", "4eZ", "1NU", "9N", - "pv", "0SD", "4hj", "7Mh", "67m", "4FF", "1mI", "2HK", "2GJ", "2", "4IG", "68l", "6RH", "4gk", "1Ld", "2if", "6O", "0Qu", "5zz", "7OY", - "5A7", "4Dw", "1ox", "0j8", "15r", "Bi", "6oV", "4Zu", "40Q", "4a8", "lE", "0Ow", "0BG", "au", "6LJ", "4yi", "4WE", "6bf", "OY", "Z8", - "U9", "2VI", "6mg", "4XD", "4vh", "6CK", "nt", "0MF", "1PW", "cD", "4n9", "5ky", "4Ut", "5P4", "Mh", "0nZ", "4ip", "5l0", "5d", "9Kg", - "08z", "1y2", "66w", "737", "4Jl", "7on", "Rp", "05J", "1OO", "8T", "6Qc", "50i", "4kA", "7NC", "7U", "0Po", "1nb", "dqS", "64F", "4Em", - "b6f", "69v", "PA", "0ss", "8TG", "dRO", "5c1", "4fq", "6MP", "4xs", "376", "22v", "NC", "0mq", "bll", "77U", "6nL", "5KN", "14h", "Cs", - "3ko", "0Nm", "41K", "7PA", "6Oa", "4zB", "37", "20G", "Lr", "8fX", "4Tn", "6aM", "78T", "bcm", "0bp", "AB", "on", "387", "43z", "5r2", - "447", "51w", "1NQ", "9J", "Sn", "04T", "4Kr", "5N2", "67i", "4FB", "09d", "2HO", "4z", "1Ca", "4hn", "7Ml", "6RL", "4go", "8UY", "2ib", - "2GN", "6", "4IC", "68h", "5A3", "4Ds", "82M", "d4E", "6K", "0Qq", "bPl", "a1f", "40U", "akl", "lA", "0Os", "15v", "Bm", "6oR", "4Zq", - "4WA", "6bb", "2YL", "0lo", "0BC", "aq", "6LN", "4ym", "42d", "6CO", "np", "0MB", "0cn", "2VM", "6mc", "5Ha", "4Up", "5P0", "Ml", "8gF", - "1PS", "1E2", "adm", "bAo", "1lW", "1y6", "4R9", "4GX", "4it", "5l4", "qh", "0RZ", "i9", "8P", "6Qg", "4dD", "4Jh", "7oj", "Rt", "05N", - "1nf", "2Kd", "64B", "4Ei", "4kE", "7NG", "7Q", "f8", "1Mz", "2hx", "5c5", "4fu", "4HY", "69r", "PE", "0sw", "NG", "0mu", "5Fz", "6cx", - "6MT", "4xw", "0CY", "0V8", "3kk", "0Ni", "41O", "7PE", "6nH", "5KJ", "14l", "Cw", "Lv", "0oD", "4Tj", "6aI", "6Oe", "4zF", "33", "bZ", - "oj", "0LX", "4wv", "5r6", "6ly", "4YZ", "0bt", "AF", "4v", "0SL", "4hb", "awS", "67e", "4FN", "K3", "2HC", "Sb", "04X", "b5E", "aTO", - "4p3", "4eR", "8Wd", "9F", "6G", "257", "4jS", "7OQ", "65T", "cnm", "1op", "0j0", "QS", "D2", "4IO", "68d", "7Ba", "4gc", "1Ll", "2in", - "0BO", "23d", "6LB", "4ya", "4WM", "6bn", "OQ", "Z0", "0aS", "Ba", "aEL", "c4g", "40Y", "4a0", "lM", "8Fg", "8If", "cL", "4n1", "5kq", - "616", "74v", "3KP", "0nR", "U1", "2VA", "6mo", "4XL", "42h", "6CC", "2xm", "0MN", "4Jd", "7of", "Rx", "05B", "i5", "2jE", "6Qk", "4dH", - "4ix", "5l8", "5l", "0RV", "08r", "2IY", "4R5", "4GT", "4HU", "7mW", "PI", "07s", "1Mv", "0H6", "5c9", "4fy", "4kI", "7NK", "sU", "f4", - "1nj", "2Kh", "64N", "4Ee", "6nD", "5KF", "1ph", "2Uj", "mW", "x6", "41C", "7PI", "593", "5hZ", "0CU", "0V4", "NK", "0my", "4VW", "4C6", - "4L7", "4YV", "0bx", "AJ", "of", "0LT", "43r", "562", "6Oi", "4zJ", "w7", "bV", "Lz", "0oH", "4Tf", "6aE", "67a", "4FJ", "K7", "2HG", - "4r", "0SH", "4hf", "7Md", "4p7", "4eV", "1NY", "9B", "Sf", "0pT", "4Kz", "7nx", "65P", "5TZ", "1ot", "0j4", "6C", "0Qy", "4jW", "7OU", - "6RD", "4gg", "1Lh", "2ij", "QW", "D6", "4IK", "7lI", "4WI", "6bj", "OU", "Z4", "0BK", "ay", "6LF", "4ye", "4tU", "4a4", "lI", "2o9", - "0aW", "Be", "6oZ", "4Zy", "4Ux", "5P8", "Md", "0nV", "8Ib", "cH", "4n5", "5ku", "42l", "6CG", "nx", "0MJ", "U5", "2VE", "6mk", "4XH", - "i1", "8X", "6Qo", "4dL", "5ZA", "7ob", "2Dm", "05F", "08v", "d7f", "4R1", "4GP", "bSO", "a2E", "5h", "0RR", "1Mr", "0H2", "ayL", "52T", - "4HQ", "69z", "PM", "07w", "1nn", "2Kl", "64J", "4Ea", "4kM", "7NO", "7Y", "f0", "mS", "x2", "41G", "7PM", "aDR", "5KB", "14d", "2Un", - "NO", "19T", "4VS", "4C2", "597", "bBL", "0CQ", "0V0", "ob", "0LP", "43v", "566", "4L3", "4YR", "16U", "AN", "2Zo", "0oL", "4Tb", "6aA", - "6Om", "4zN", "w3", "bR", "4oT", "4z5", "wH", "0Tz", "0zV", "Yd", "5D8", "4Ax", "4LH", "6yk", "TT", "A5", "0YJ", "zx", "6WG", "4bd", - "4me", "6XF", "1q", "0VK", "N4", "2MD", "62b", "4CI", "4Ny", "5K9", "Ve", "0uW", "1KZ", "xI", "4u4", "5pt", "4k6", "5nv", "0Ey", "fK", - "Hg", "0kU", "641", "6eX", "6hh", "5Mj", "P6", "EW", "29b", "0HI", "47o", "6FD", "6IE", "48n", "0GH", "dz", "JV", "0id", "4RJ", "6gi", - "6jY", "beI", "0dT", "Gf", "iJ", "0Jx", "4qV", "4d7", "UN", "02t", "4MR", "4X3", "a8G", "57W", "0XP", "0M1", "2Z", "c3", "4nN", "7KL", - "61I", "5PC", "1km", "2No", "2An", "00E", "4Oc", "7ja", "6Tl", "4aO", "l2", "yS", "0k", "0WQ", "58V", "a7F", "4W2", "4BS", "84m", "ZO", - "13V", "E", "4I0", "5Lp", "46u", "535", "ja", "0IS", "68", "gQ", "6Jn", "5ol", "4Qa", "6dB", "3OM", "0jO", "0eN", "2Pm", "6kC", "5NA", - "44D", "6Eo", "hP", "99", "0FR", "0S3", "abM", "49t", "4SP", "4F1", "KL", "8af", "0zR", "0o3", "60W", "ckn", "4oP", "4z1", "3D", "204", - "0YN", "2lm", "6WC", "56I", "4LL", "6yo", "TP", "A1", "N0", "903", "62f", "4CM", "4ma", "6XB", "1u", "0VO", "8Rg", "xM", "418", "54x", - "b0F", "aQL", "Va", "0uS", "Hc", "0kQ", "645", "71u", "4k2", "5nr", "8Le", "fO", "29f", "0HM", "47k", "7Va", "6hl", "5Mn", "P2", "ES", - "JR", "1yA", "4RN", "6gm", "6IA", "48j", "0GL", "26g", "iN", "8Cd", "45Z", "4d3", "hYv", "beM", "0dP", "Gb", "6VY", "4cz", "0XT", "0M5", - "UJ", "02p", "4MV", "4X7", "61M", "5PG", "1ki", "Xz", "vV", "c7", "4nJ", "7KH", "6Th", "4aK", "l6", "yW", "2Aj", "00A", "4Og", "6zD", - "4W6", "4BW", "0yy", "ZK", "0o", "0WU", "58R", "6YX", "46q", "531", "je", "0IW", "13R", "A", "4I4", "5Lt", "4Qe", "6dF", "Iy", "0jK", - "r4", "gU", "6Jj", "5oh", "4pH", "6Ek", "hT", "0Kf", "0eJ", "Fx", "6kG", "5NE", "4ST", "4F5", "KH", "0hz", "0FV", "ed", "5x8", "49p", - "bvs", "6yc", "2BM", "03f", "0YB", "zp", "6WO", "4bl", "bUo", "a4e", "3H", "0Tr", "87N", "Yl", "5D0", "4Ap", "4Nq", "5K1", "Vm", "01W", - "1KR", "xA", "414", "54t", "4mm", "6XN", "1y", "0VC", "0xo", "2ML", "62j", "4CA", "7xA", "5Mb", "0fm", "2SN", "ks", "0HA", "47g", "6FL", - "aan", "bDl", "0Eq", "fC", "Ho", "8bE", "4Ps", "5U3", "5Z2", "5OS", "10u", "Gn", "iB", "0Jp", "45V", "ano", "6IM", "48f", "1Wa", "dr", - "3Ln", "0il", "4RB", "6ga", "2R", "0Uh", "4nF", "7KD", "61A", "5PK", "1ke", "Xv", "UF", "0vt", "4MZ", "6xy", "5f6", "4cv", "0XX", "0M9", - "0c", "0WY", "4lw", "5i7", "63p", "5Rz", "0yu", "ZG", "Ww", "00M", "4Ok", "6zH", "6Td", "4aG", "0Zi", "2oJ", "60", "gY", "6Jf", "5od", - "4Qi", "6dJ", "Iu", "0jG", "0gw", "M", "4I8", "5Lx", "4ru", "5w5", "ji", "1Yz", "0FZ", "eh", "5x4", "5mU", "4SX", "4F9", "KD", "0hv", - "0eF", "Ft", "6kK", "5NI", "44L", "6Eg", "hX", "91", "0YF", "zt", "6WK", "4bh", "4LD", "6yg", "TX", "A9", "0zZ", "Yh", "5D4", "4At", - "4oX", "4z9", "3L", "0Tv", "1KV", "xE", "410", "54p", "4Nu", "5K5", "Vi", "01S", "N8", "2MH", "62n", "4CE", "4mi", "6XJ", "uu", "0VG", - "kw", "0HE", "47c", "6FH", "6hd", "5Mf", "0fi", "2SJ", "Hk", "0kY", "4Pw", "5U7", "6Kx", "5nz", "0Eu", "fG", "iF", "0Jt", "45R", "6Dy", - "5Z6", "5OW", "0dX", "Gj", "JZ", "0ih", "4RF", "6ge", "6II", "48b", "0GD", "dv", "61E", "5PO", "1ka", "Xr", "2V", "0Ul", "4nB", "aqs", - "5f2", "4cr", "8QD", "39V", "UB", "02x", "795", "aRo", "63t", "764", "0yq", "ZC", "0g", "9Nd", "4ls", "5i3", "7DA", "4aC", "0Zm", "2oN", - "Ws", "00I", "4Oo", "6zL", "4Qm", "6dN", "Iq", "0jC", "64", "25D", "6Jb", "bEr", "46y", "539", "jm", "9Pf", "0gs", "I", "aCl", "bfn", - "bio", "72V", "1m2", "0hr", "325", "el", "5x0", "49x", "44H", "6Ec", "3nl", "95", "0eB", "Fp", "6kO", "5NM", "4mt", "5h4", "uh", "0VZ", - "0xv", "2MU", "4V9", "4CX", "4Nh", "7kj", "Vt", "01N", "m9", "xX", "6Ug", "54m", "4oE", "6Zf", "3Q", "b8", "0zG", "Yu", "60B", "4Ai", - "4LY", "4Y8", "TE", "0ww", "1Iz", "zi", "5g5", "4bu", "5y7", "5lV", "0GY", "dk", "JG", "0iu", "5Bz", "6gx", "6jH", "5OJ", "0dE", "Gw", - "3ok", "82", "45O", "6Dd", "6Ke", "5ng", "73", "fZ", "Hv", "0kD", "4Pj", "6eI", "6hy", "7m9", "0ft", "EF", "kj", "0HX", "4sv", "5v6", - "Wn", "00T", "4Or", "5J2", "407", "55w", "0Zp", "yB", "0z", "1Ga", "4ln", "6YM", "63i", "4BB", "0yl", "2LO", "2CN", "02e", "4MC", "7hA", - "6VL", "4co", "0XA", "2mb", "2K", "0Uq", "bTl", "a5f", "5E3", "5PR", "86M", "Xo", "11v", "Fm", "6kR", "5NP", "44U", "aol", "hA", "0Ks", - "0FC", "eq", "6HN", "49e", "4SA", "6fb", "3Mm", "0ho", "0gn", "T", "6ic", "5La", "46d", "6GO", "jp", "0IB", "0Dr", "1A2", "hyT", "bEo", - "4Qp", "5T0", "Il", "8cF", "0xr", "2MQ", "62w", "777", "4mp", "5h0", "1d", "9Og", "1KO", "2nM", "6Uc", "54i", "4Nl", "7kn", "Vp", "01J", - "0zC", "Yq", "60F", "4Am", "4oA", "6Zb", "3U", "0To", "8PG", "zm", "5g1", "4bq", "786", "aSl", "TA", "0ws", "JC", "0iq", "bhl", "73U", - "5y3", "5lR", "336", "do", "3oo", "86", "45K", "7TA", "6jL", "5ON", "0dA", "Gs", "Hr", "8bX", "4Pn", "6eM", "6Ka", "5nc", "77", "24G", - "kn", "8AD", "47z", "5v2", "aBo", "bgm", "0fp", "EB", "403", "4aZ", "0Zt", "yF", "Wj", "00P", "4Ov", "5J6", "63m", "4BF", "0yh", "ZZ", - "tv", "0WD", "4lj", "6YI", "6VH", "4ck", "0XE", "2mf", "2CJ", "02a", "4MG", "6xd", "5E7", "5PV", "1kx", "Xk", "2O", "0Uu", "bTh", "7KY", - "44Q", "4e8", "hE", "0Kw", "11r", "Fi", "6kV", "5NT", "4SE", "6ff", "KY", "0hk", "0FG", "eu", "6HJ", "49a", "4rh", "6GK", "jt", "0IF", - "Q9", "P", "6ig", "5Le", "4Qt", "5T4", "Ih", "0jZ", "0Dv", "gD", "4j9", "5oy", "aD0", "7kb", "3PL", "01F", "m1", "xP", "6Uo", "54e", - "59U", "a6E", "1h", "0VR", "85n", "196", "4V1", "4CP", "4LQ", "4Y0", "TM", "03w", "0YS", "za", "a9D", "56T", "4oM", "6Zn", "3Y", "b0", - "0zO", "2Ol", "60J", "4Aa", "7za", "5OB", "0dM", "2Qn", "iS", "0Ja", "45G", "6Dl", "acN", "48w", "0GQ", "dc", "JO", "94L", "4RS", "4G2", - "4H3", "5Ms", "12U", "EN", "kb", "0HP", "47v", "526", "6Km", "5no", "s3", "fR", "3NN", "0kL", "4Pb", "6eA", "0r", "0WH", "4lf", "6YE", - "63a", "4BJ", "O7", "ZV", "Wf", "0tT", "4Oz", "6zY", "4t7", "4aV", "0Zx", "yJ", "2C", "0Uy", "4nW", "7KU", "61P", "5PZ", "1kt", "Xg", - "UW", "02m", "4MK", "6xh", "6VD", "4cg", "0XI", "2mj", "0FK", "ey", "6HF", "49m", "4SI", "6fj", "KU", "0hg", "0eW", "Fe", "6kZ", "5NX", - "4pU", "4e4", "hI", "2k9", "0Dz", "gH", "4j5", "5ou", "4Qx", "5T8", "Id", "0jV", "Q5", "DT", "6ik", "5Li", "46l", "6GG", "jx", "0IJ", - "m5", "xT", "6Uk", "54a", "4Nd", "7kf", "Vx", "01B", "0xz", "192", "4V5", "4CT", "4mx", "5h8", "1l", "0VV", "0YW", "ze", "5g9", "4by", - "4LU", "4Y4", "TI", "03s", "0zK", "Yy", "60N", "4Ae", "4oI", "6Zj", "wU", "b4", "iW", "0Je", "45C", "6Dh", "6jD", "5OF", "0dI", "2Qj", - "JK", "0iy", "4RW", "4G6", "6IX", "48s", "0GU", "dg", "kf", "0HT", "47r", "522", "4H7", "5Mw", "0fx", "EJ", "Hz", "0kH", "4Pf", "6eE", - "6Ki", "5nk", "s7", "fV", "63e", "4BN", "O3", "ZR", "0v", "0WL", "4lb", "6YA", "4t3", "4aR", "8Sd", "yN", "Wb", "00X", "b1E", "aPO", - "61T", "bzL", "1kp", "Xc", "2G", "217", "4nS", "7KQ", "7Fa", "4cc", "0XM", "2mn", "US", "02i", "4MO", "6xl", "4SM", "6fn", "KQ", "0hc", - "0FO", "27d", "6HB", "49i", "44Y", "4e0", "hM", "8Bg", "0eS", "Fa", "aAL", "bdN", "656", "70v", "3OP", "0jR", "8Mf", "gL", "4j1", "5oq", - "46h", "6GC", "28e", "0IN", "Q1", "X", "6io", "5Lm", "6KV", "5nT", "1Uz", "fi", "HE", "0kw", "4PY", "4E8", "6hJ", "5MH", "0fG", "Eu", - "kY", "0Hk", "47M", "6Ff", "6Ig", "48L", "51", "dX", "Jt", "0iF", "4Rh", "6gK", "4J9", "5Oy", "0dv", "GD", "ih", "0JZ", "4qt", "5t4", - "4ov", "5j6", "3b", "0TX", "0zt", "YF", "60q", "4AZ", "4Lj", "6yI", "Tv", "03L", "0Yh", "zZ", "6We", "4bF", "4mG", "6Xd", "1S", "0Vi", - "0xE", "2Mf", "6vH", "4Ck", "bth", "7kY", "VG", "0uu", "1Kx", "xk", "5e7", "5pV", "13t", "g", "5Y3", "5LR", "46W", "amn", "jC", "0Iq", - "0DA", "gs", "6JL", "5oN", "4QC", "70I", "3Oo", "0jm", "0el", "2PO", "6ka", "5Nc", "44f", "6EM", "hr", "8BX", "0Fp", "eB", "abo", "49V", - "4Sr", "5V2", "Kn", "8aD", "Ul", "02V", "4Mp", "5H0", "425", "57u", "0Xr", "2mQ", "2x", "0UB", "4nl", "7Kn", "61k", "5Pa", "1kO", "2NM", - "2AL", "00g", "4OA", "6zb", "6TN", "4am", "0ZC", "yq", "0I", "0Ws", "58t", "a7d", "5G1", "4Bq", "84O", "Zm", "HA", "0ks", "bjn", "71W", - "6KR", "5nP", "314", "fm", "29D", "0Ho", "47I", "6Fb", "6hN", "5ML", "0fC", "Eq", "Jp", "0iB", "4Rl", "6gO", "6Ic", "48H", "55", "26E", - "il", "8CF", "45x", "508", "hYT", "beo", "0dr", "1a2", "0zp", "YB", "60u", "755", "4or", "5j2", "3f", "9Me", "0Yl", "2lO", "6Wa", "4bB", - "4Ln", "6yM", "Tr", "03H", "0xA", "2Mb", "62D", "4Co", "4mC", "7HA", "1W", "0Vm", "8RE", "xo", "5e3", "54Z", "b0d", "aQn", "VC", "01y", - "46S", "6Gx", "jG", "0Iu", "0gY", "c", "5Y7", "5LV", "4QG", "6dd", "3Ok", "0ji", "0DE", "gw", "6JH", "5oJ", "44b", "6EI", "hv", "0KD", - "0eh", "FZ", "6ke", "5Ng", "4Sv", "5V6", "Kj", "0hX", "0Ft", "eF", "6Hy", "49R", "421", "4cX", "0Xv", "2mU", "Uh", "02R", "4Mt", "5H4", - "61o", "5Pe", "M9", "XX", "vt", "0UF", "4nh", "7Kj", "6TJ", "4ai", "0ZG", "yu", "WY", "B8", "4OE", "6zf", "5G5", "4Bu", "1iz", "Zi", - "0M", "0Ww", "4lY", "4y8", "6hB", "aW1", "0fO", "2Sl", "kQ", "0Hc", "47E", "6Fn", "aaL", "bDN", "0ES", "fa", "HM", "8bg", "4PQ", "4E0", - "4J1", "5Oq", "10W", "GL", "3oP", "0JR", "45t", "504", "6Io", "48D", "59", "dP", "3LL", "0iN", "5BA", "6gC", "4Lb", "6yA", "2Bo", "03D", - "o3", "zR", "6Wm", "4bN", "bUM", "a4G", "3j", "0TP", "87l", "YN", "4T3", "4AR", "4NS", "7kQ", "VO", "01u", "1Kp", "xc", "hfw", "54V", - "4mO", "6Xl", "uS", "0Va", "0xM", "2Mn", "62H", "4Cc", "0DI", "25b", "6JD", "5oF", "4QK", "6dh", "IW", "0je", "0gU", "o", "6iX", "5LZ", - "4rW", "4g6", "jK", "0Iy", "0Fx", "eJ", "4h7", "5mw", "4Sz", "6fY", "Kf", "0hT", "S7", "FV", "6ki", "5Nk", "44n", "6EE", "hz", "0KH", - "2p", "0UJ", "4nd", "7Kf", "61c", "5Pi", "M5", "XT", "Ud", "0vV", "4Mx", "5H8", "4v5", "4cT", "0Xz", "2mY", "0A", "1GZ", "4lU", "4y4", - "5G9", "4By", "0yW", "Ze", "WU", "B4", "4OI", "6zj", "6TF", "4ae", "0ZK", "yy", "kU", "0Hg", "47A", "6Fj", "6hF", "5MD", "0fK", "Ey", - "HI", "2K9", "4PU", "4E4", "6KZ", "5nX", "0EW", "fe", "id", "0JV", "45p", "500", "4J5", "5Ou", "0dz", "GH", "Jx", "0iJ", "4Rd", "6gG", - "6Ik", "5li", "q5", "dT", "o7", "zV", "6Wi", "4bJ", "4Lf", "6yE", "Tz", "0wH", "0zx", "YJ", "4T7", "4AV", "4oz", "6ZY", "3n", "0TT", - "1Kt", "xg", "6UX", "54R", "4NW", "7kU", "VK", "01q", "0xI", "2Mj", "62L", "4Cg", "4mK", "6Xh", "uW", "0Ve", "4QO", "6dl", "IS", "0ja", - "0DM", "25f", "7Za", "5oB", "4rS", "4g2", "jO", "9PD", "0gQ", "k", "aCN", "685", "674", "72t", "Kb", "0hP", "8Od", "eN", "4h3", "49Z", - "44j", "6EA", "3nN", "0KL", "S3", "FR", "6km", "5No", "61g", "5Pm", "M1", "XP", "2t", "0UN", "ad0", "7Kb", "429", "4cP", "8Qf", "39t", - "0c3", "02Z", "b3G", "aRM", "63V", "bxN", "0yS", "Za", "0E", "235", "4lQ", "4y0", "6TB", "4aa", "0ZO", "2ol", "WQ", "B0", "4OM", "6zn", - "4i4", "5lt", "1WZ", "dI", "Je", "0iW", "4Ry", "5W9", "6jj", "5Oh", "R4", "GU", "iy", "0JK", "45m", "6DF", "6KG", "5nE", "0EJ", "fx", - "HT", "0kf", "4PH", "6ek", "5X8", "5MY", "0fV", "Ed", "kH", "0Hz", "4sT", "4f5", "4mV", "4x7", "1B", "0Vx", "0xT", "0m5", "62Q", "4Cz", - "4NJ", "7kH", "VV", "C7", "1Ki", "xz", "6UE", "54O", "4og", "6ZD", "3s", "0TI", "L6", "YW", "6th", "4AK", "6l9", "6yX", "Tg", "0wU", - "0Yy", "zK", "4w6", "4bW", "11T", "FO", "4K2", "5Nr", "44w", "517", "hc", "0KQ", "p2", "eS", "6Hl", "49G", "4Sc", "72i", "3MO", "0hM", - "0gL", "v", "6iA", "5LC", "46F", "6Gm", "jR", "1YA", "0DP", "gb", "hyv", "bEM", "4QR", "4D3", "IN", "8cd", "WL", "00v", "4OP", "4Z1", - "hgt", "55U", "0ZR", "0O3", "0X", "a1", "4lL", "6Yo", "63K", "5RA", "0yN", "2Lm", "2Cl", "02G", "4Ma", "6xB", "6Vn", "4cM", "n0", "39i", - "2i", "0US", "bTN", "a5D", "4U0", "5Pp", "86o", "XM", "Ja", "0iS", "667", "73w", "4i0", "48Y", "8Ng", "dM", "3oM", "0JO", "45i", "6DB", - "6jn", "5Ol", "R0", "GQ", "HP", "0kb", "4PL", "6eo", "6KC", "5nA", "0EN", "24e", "kL", "8Af", "47X", "4f1", "aBM", "696", "0fR", "0s3", - "0xP", "0m1", "62U", "byM", "4mR", "4x3", "1F", "226", "1Km", "2no", "6UA", "54K", "4NN", "7kL", "VR", "C3", "L2", "YS", "60d", "4AO", - "4oc", "7Ja", "3w", "0TM", "8Pe", "zO", "4w2", "4bS", "b2D", "aSN", "Tc", "03Y", "44s", "513", "hg", "0KU", "0ey", "FK", "4K6", "5Nv", - "4Sg", "6fD", "3MK", "0hI", "p6", "eW", "6Hh", "49C", "46B", "6Gi", "jV", "0Id", "0gH", "r", "6iE", "5LG", "4QV", "4D7", "IJ", "0jx", - "0DT", "gf", "6JY", "bEI", "5d8", "4ax", "0ZV", "yd", "WH", "00r", "4OT", "4Z5", "63O", "4Bd", "0yJ", "Zx", "tT", "a5", "4lH", "6Yk", - "6Vj", "4cI", "n4", "2mD", "Uy", "02C", "4Me", "6xF", "4U4", "5Pt", "1kZ", "XI", "2m", "0UW", "4ny", "5k9", "6jb", "ber", "0do", "2QL", - "iq", "0JC", "45e", "6DN", "acl", "48U", "0Gs", "dA", "Jm", "94n", "4Rq", "5W1", "5X0", "5MQ", "12w", "El", "1M2", "0Hr", "47T", "alm", - "6KO", "5nM", "0EB", "fp", "3Nl", "0kn", "bjs", "6ec", "4NB", "aQs", "3Pn", "01d", "1Ka", "xr", "6UM", "54G", "59w", "a6g", "1J", "0Vp", - "85L", "d3D", "5F2", "4Cr", "4Ls", "5I3", "To", "03U", "0Yq", "zC", "436", "56v", "4oo", "6ZL", "ws", "0TA", "0zm", "2ON", "60h", "4AC", - "42", "27B", "6Hd", "49O", "4Sk", "6fH", "Kw", "0hE", "0eu", "FG", "6kx", "5Nz", "4pw", "5u7", "hk", "0KY", "0DX", "gj", "5z6", "5oW", - "4QZ", "6dy", "IF", "0jt", "0gD", "Dv", "6iI", "5LK", "46N", "6Ge", "jZ", "0Ih", "0P", "a9", "4lD", "6Yg", "63C", "4Bh", "0yF", "Zt", - "WD", "0tv", "4OX", "4Z9", "5d4", "4at", "0ZZ", "yh", "2a", "1Ez", "4nu", "5k5", "4U8", "5Px", "1kV", "XE", "Uu", "02O", "4Mi", "6xJ", - "6Vf", "4cE", "n8", "2mH", "iu", "0JG", "45a", "6DJ", "6jf", "5Od", "R8", "GY", "Ji", "1yz", "4Ru", "5W5", "4i8", "48Q", "0Gw", "dE", - "kD", "0Hv", "47P", "4f9", "5X4", "5MU", "0fZ", "Eh", "HX", "0kj", "4PD", "6eg", "6KK", "5nI", "0EF", "ft", "1Ke", "xv", "6UI", "54C", - "4NF", "7kD", "VZ", "0uh", "0xX", "0m9", "5F6", "4Cv", "4mZ", "6Xy", "1N", "0Vt", "0Yu", "zG", "432", "56r", "4Lw", "5I7", "Tk", "03Q", - "0zi", "2OJ", "60l", "4AG", "4ok", "6ZH", "ww", "0TE", "4So", "6fL", "Ks", "0hA", "46", "27F", "7XA", "49K", "4ps", "5u3", "ho", "8BE", - "0eq", "FC", "aAn", "bdl", "bkm", "70T", "IB", "0jp", "307", "gn", "5z2", "5oS", "46J", "6Ga", "28G", "0Il", "13i", "z", "6iM", "5LO", - "63G", "4Bl", "0yB", "Zp", "0T", "0Wn", "58i", "6Yc", "5d0", "4ap", "8SF", "yl", "1q2", "00z", "b1g", "aPm", "61v", "746", "1kR", "XA", - "2e", "9Lf", "4nq", "5k1", "6Vb", "4cA", "0Xo", "2mL", "Uq", "02K", "4Mm", "6xN", "8YG", "7e", "5n1", "4kq", "716", "64v", "2KP", "1nR", - "07K", "Pq", "69F", "4Hm", "4fA", "6Sb", "2hL", "1MN", "0Rn", "5T", "7LB", "5ya", "4Gl", "66G", "2Ia", "08J", "05z", "1t2", "aUm", "b4g", - "4dp", "5a0", "8d", "8VF", "bn", "357", "4zr", "6OQ", "75T", "bnm", "0op", "LB", "Ar", "16i", "4Yn", "6lM", "6Ba", "43J", "0Ll", "2yO", - "22F", "16", "4xC", "agr", "6cL", "4Vo", "0mA", "Ns", "CC", "14X", "bal", "aDn", "5p3", "4us", "8GE", "mo", "5L7", "4Iw", "06Q", "Qk", - "1Y5", "1LT", "53r", "462", "7Oi", "4jk", "0QE", "rw", "2JJ", "1oH", "4DG", "65l", "7nD", "4KF", "0ph", "SZ", "2kg", "1Ne", "4ej", "6PI", - "493", "4hZ", "0St", "4N", "0h9", "09P", "4Fv", "5C6", "4Xt", "6mW", "023", "0cZ", "0Mv", "nD", "4c9", "42P", "5kI", "6NK", "ct", "1Pg", - "X9", "MX", "74N", "4UD", "4ZE", "6of", "BY", "W8", "0OG", "lu", "6AJ", "40a", "4yY", "4l8", "aE", "0Bw", "18r", "Oi", "5R5", "4Wu", - "4EY", "4P8", "2KT", "1nV", "8YC", "7a", "5n5", "4ku", "4fE", "6Sf", "2hH", "k8", "07O", "Pu", "69B", "4Hi", "4Gh", "66C", "2Ie", "08N", - "d9", "5P", "7LF", "4iD", "4dt", "5a4", "2jy", "3o9", "0qv", "RD", "7oZ", "4JX", "6ay", "4TZ", "0ot", "LF", "bj", "0AX", "4zv", "6OU", - "6Be", "43N", "0Lh", "oZ", "Av", "0bD", "4Yj", "6lI", "6cH", "4Vk", "0mE", "Nw", "22B", "12", "4xG", "6Md", "5p7", "4uw", "0NY", "mk", - "CG", "1pT", "5Kz", "6nx", "1Y1", "1LP", "53v", "466", "5L3", "4Is", "06U", "Qo", "2JN", "1oL", "4DC", "65h", "7Om", "4jo", "0QA", "rs", - "9z", "1Na", "4en", "6PM", "aTs", "4KB", "04d", "2EO", "d6D", "09T", "4Fr", "5C2", "497", "bRm", "0Sp", "4J", "0Mr", "1H2", "aim", "42T", - "4Xp", "6mS", "027", "17w", "0nn", "3Kl", "74J", "5Ea", "5kM", "6NO", "cp", "1Pc", "0OC", "lq", "6AN", "40e", "4ZA", "6ob", "2TL", "0ao", - "18v", "Om", "5R1", "4Wq", "bCn", "afl", "aA", "0Bs", "07C", "Py", "69N", "4He", "4fI", "6Sj", "2hD", "k4", "0PW", "7m", "5n9", "4ky", - "4EU", "4P4", "2KX", "1nZ", "05r", "RH", "7oV", "4JT", "4dx", "5a8", "8l", "1Ow", "d5", "qT", "7LJ", "4iH", "4Gd", "66O", "2Ii", "08B", - "Az", "0bH", "4Yf", "6lE", "6Bi", "43B", "z7", "oV", "bf", "0AT", "4zz", "6OY", "4A7", "4TV", "0ox", "LJ", "CK", "14P", "5Kv", "4N6", - "543", "41s", "0NU", "mg", "22N", "u6", "4xK", "6Mh", "6cD", "4Vg", "0mI", "2Xj", "7Oa", "4jc", "0QM", "6w", "2JB", "I2", "4DO", "65d", - "68T", "b7D", "06Y", "Qc", "dSm", "287", "4gS", "4r2", "7MP", "4hR", "276", "4F", "0h1", "09X", "b8E", "67U", "7nL", "4KN", "F3", "SR", - "9v", "1Nm", "4eb", "6PA", "5kA", "6NC", "21e", "1Po", "X1", "MP", "74F", "4UL", "bbO", "79v", "0v3", "0cR", "8Df", "nL", "4c1", "42X", - "4yQ", "4l0", "aM", "8Kg", "0lS", "Oa", "76w", "637", "4ZM", "6on", "BQ", "W0", "0OO", "2zl", "6AB", "40i", "4fM", "6Sn", "3xa", "k0", - "07G", "2Fl", "69J", "4Ha", "4EQ", "4P0", "d5g", "83o", "0PS", "7i", "a0D", "bQN", "50U", "hbt", "8h", "1Os", "05v", "RL", "7oR", "4JP", - "5WA", "66K", "2Im", "08F", "d1", "5X", "7LN", "4iL", "6Bm", "43F", "z3", "oR", "2Wo", "0bL", "4Yb", "6lA", "4A3", "4TR", "8fd", "LN", - "bb", "0AP", "cPl", "aeO", "547", "41w", "0NQ", "mc", "CO", "14T", "5Kr", "4N2", "77i", "4Vc", "0mM", "2Xn", "22J", "u2", "4xO", "6Ml", - "2JF", "I6", "4DK", "6qh", "7Oe", "4jg", "0QI", "6s", "1Y9", "1LX", "4gW", "4r6", "68P", "5YZ", "0rU", "Qg", "0h5", "1mu", "4Fz", "67Q", - "7MT", "4hV", "0Sx", "4B", "9r", "1Ni", "4ef", "6PE", "7nH", "4KJ", "F7", "SV", "X5", "MT", "74B", "4UH", "5kE", "6NG", "cx", "1Pk", - "0Mz", "nH", "4c5", "4vT", "4Xx", "79r", "0v7", "0cV", "0lW", "Oe", "5R9", "4Wy", "4yU", "4l4", "aI", "1RZ", "0OK", "ly", "6AF", "40m", - "4ZI", "6oj", "BU", "W4", "265", "5E", "488", "4iQ", "b9F", "66V", "0i2", "1lr", "G0", "RQ", "7oO", "4JM", "4da", "6QB", "8u", "1On", - "0PN", "7t", "7Nb", "aa0", "4EL", "64g", "2KA", "H1", "07Z", "0f3", "69W", "b6G", "4fP", "479", "dRn", "294", "22W", "8Jd", "4xR", "4m3", - "77t", "624", "0mP", "Nb", "CR", "V3", "5Ko", "6nm", "ajS", "41j", "0NL", "3kN", "20f", "0AM", "4zc", "aeR", "6al", "4TO", "Y2", "LS", - "Ac", "0bQ", "bcL", "78u", "4b2", "4wS", "8Ee", "oO", "7nU", "4KW", "04q", "SK", "9o", "1Nt", "51R", "6PX", "7MI", "4hK", "e6", "pW", - "2Hj", "09A", "4Fg", "67L", "68M", "4If", "0rH", "Qz", "2iG", "j7", "4gJ", "6Ri", "7Ox", "4jz", "0QT", "6n", "1z8", "1oY", "4DV", "4Q7", - "4ZT", "4O5", "BH", "0az", "0OV", "ld", "550", "40p", "4yH", "6Lk", "aT", "t5", "0lJ", "Ox", "6bG", "4Wd", "4Xe", "6mF", "2Vh", "0cK", - "0Mg", "nU", "6Cj", "42A", "5kX", "6NZ", "ce", "1Pv", "2N9", "MI", "7pW", "4UU", "4Gy", "5B9", "0i6", "1lv", "1BZ", "5A", "7LW", "4iU", - "4de", "6QF", "8q", "1Oj", "G4", "RU", "7oK", "4JI", "4EH", "64c", "2KE", "H5", "0PJ", "7p", "7Nf", "4kd", "4fT", "4s5", "2hY", "290", - "0sV", "Pd", "5M8", "4Hx", "6cY", "4Vz", "0mT", "Nf", "1F8", "0Cx", "4xV", "4m7", "7Pd", "41n", "0NH", "mz", "CV", "V7", "5Kk", "6ni", - "6ah", "4TK", "Y6", "LW", "20b", "0AI", "4zg", "6OD", "4b6", "4wW", "0Ly", "oK", "Ag", "0bU", "5IZ", "6lX", "9k", "1Np", "51V", "azN", - "7nQ", "4KS", "04u", "SO", "2Hn", "09E", "4Fc", "67H", "7MM", "4hO", "e2", "pS", "2iC", "j3", "4gN", "6Rm", "68I", "4Ib", "06D", "2Go", - "d4d", "82l", "4DR", "4Q3", "a1G", "bPM", "0QP", "6j", "0OR", "0Z3", "554", "40t", "4ZP", "4O1", "BL", "15W", "0lN", "2Ym", "6bC", "5GA", - "4yL", "6Lo", "aP", "09", "0Mc", "nQ", "6Cn", "42E", "4Xa", "6mB", "2Vl", "0cO", "8gg", "MM", "7pS", "4UQ", "bAN", "adL", "ca", "1Pr", - "G8", "RY", "7oG", "4JE", "4di", "6QJ", "2jd", "1Of", "0Rw", "5M", "480", "4iY", "4Gu", "5B5", "2Ix", "08S", "07R", "Ph", "5M4", "4Ht", - "4fX", "471", "1X6", "1MW", "0PF", "st", "7Nj", "4kh", "4ED", "64o", "2KI", "H9", "CZ", "14A", "5Kg", "6ne", "7Ph", "41b", "0ND", "mv", - "1F4", "0Ct", "4xZ", "6My", "5S6", "4Vv", "0mX", "Nj", "Ak", "0bY", "4Yw", "6lT", "6Bx", "43S", "0Lu", "oG", "bw", "0AE", "4zk", "6OH", - "6ad", "4TG", "0oi", "2ZJ", "7MA", "4hC", "0Sm", "4W", "2Hb", "09I", "4Fo", "67D", "aTn", "b5d", "04y", "SC", "9g", "8WE", "4es", "6PP", - "5o2", "4jr", "8XD", "6f", "1z0", "1oQ", "705", "65u", "68E", "4In", "06H", "Qr", "2iO", "1LM", "4gB", "6Ra", "5ia", "6Lc", "23E", "05", - "0lB", "Op", "6bO", "4Wl", "c4F", "aEm", "1d2", "0ar", "8FF", "ll", "558", "40x", "5kP", "6NR", "cm", "344", "0ns", "MA", "74W", "bon", - "4Xm", "6mN", "3FA", "0cC", "0Mo", "2xL", "6Cb", "42I", "4dm", "6QN", "8y", "1Ob", "05g", "2DL", "7oC", "4JA", "4Gq", "5B1", "d7G", "08W", - "0Rs", "5I", "484", "bSn", "52u", "475", "1X2", "1MS", "07V", "Pl", "5M0", "4Hp", "5Ua", "64k", "2KM", "1nO", "0PB", "7x", "7Nn", "4kl", - "7Pl", "41f", "8GX", "mr", "2UO", "14E", "5Kc", "6na", "5S2", "4Vr", "19u", "Nn", "1F0", "0Cp", "bBm", "ago", "ahn", "43W", "0Lq", "oC", - "Ao", "16t", "4Ys", "6lP", "75I", "4TC", "0om", "2ZN", "bs", "0AA", "4zo", "6OL", "2Hf", "09M", "4Fk", "6sH", "7ME", "4hG", "0Si", "4S", - "9c", "1Nx", "4ew", "6PT", "7nY", "bqh", "0pu", "SG", "1z4", "1oU", "4DZ", "65q", "5o6", "4jv", "0QX", "6b", "2iK", "1LI", "4gF", "6Re", - "68A", "4Ij", "06L", "Qv", "0lF", "Ot", "6bK", "4Wh", "4yD", "6Lg", "aX", "01", "0OZ", "lh", "5q4", "4tt", "4ZX", "4O9", "BD", "0av", - "0nw", "ME", "74S", "4UY", "5kT", "6NV", "ci", "1Pz", "0Mk", "nY", "6Cf", "42M", "4Xi", "6mJ", "2Vd", "0cG", "bL", "8Hf", "4zP", "4o1", - "75v", "606", "0oR", "0z3", "AP", "T1", "4YL", "6lo", "6BC", "43h", "0LN", "2ym", "22d", "0CO", "4xa", "6MB", "6cn", "4VM", "0mc", "NQ", - "Ca", "14z", "baN", "aDL", "7PS", "41Y", "8Gg", "mM", "247", "7G", "7NQ", "4kS", "com", "64T", "0k0", "1np", "E2", "PS", "69d", "4HO", - "4fc", "7Ca", "2hn", "1Ml", "0RL", "5v", "avS", "4ib", "4GN", "66e", "2IC", "J3", "05X", "Rb", "aUO", "b4E", "4dR", "4q3", "8F", "8Vd", - "4XV", "4M7", "1f8", "0cx", "0MT", "nf", "572", "42r", "5kk", "6Ni", "cV", "v7", "0nH", "Mz", "74l", "4Uf", "4Zg", "6oD", "2Tj", "0aI", - "y6", "lW", "6Ah", "40C", "5iZ", "583", "ag", "0BU", "0ly", "OK", "4B6", "4WW", "7lW", "4IU", "06s", "QI", "0I6", "1Lv", "4gy", "5b9", - "7OK", "4jI", "g4", "rU", "2Jh", "1oj", "4De", "65N", "7nf", "4Kd", "04B", "Sx", "2kE", "h5", "4eH", "6Pk", "5m8", "4hx", "0SV", "4l", - "2HY", "09r", "4FT", "4S5", "5Q8", "4Tx", "0oV", "Ld", "bH", "0Az", "4zT", "4o5", "6BG", "43l", "0LJ", "ox", "AT", "T5", "4YH", "6lk", - "6cj", "4VI", "0mg", "NU", "2vh", "0CK", "4xe", "6MF", "7PW", "4uU", "2n9", "mI", "Ce", "1pv", "5KX", "6nZ", "5UZ", "64P", "0k4", "1nt", - "0Py", "7C", "7NU", "4kW", "4fg", "6SD", "2hj", "1Mh", "E6", "PW", "7mI", "4HK", "4GJ", "66a", "2IG", "J7", "0RH", "5r", "7Ld", "4if", - "4dV", "4q7", "8B", "1OY", "0qT", "Rf", "7ox", "4Jz", "0MP", "nb", "576", "42v", "4XR", "4M3", "dll", "17U", "0nL", "3KN", "74h", "4Ub", - "5ko", "6Nm", "cR", "v3", "y2", "lS", "6Al", "40G", "4Zc", "aER", "2Tn", "0aM", "18T", "OO", "4B2", "4WS", "bCL", "587", "ac", "0BQ", - "0I2", "1Lr", "53T", "axL", "68z", "4IQ", "06w", "QM", "2Jl", "1on", "4Da", "65J", "7OO", "4jM", "g0", "6Y", "9X", "h1", "4eL", "6Po", - "7nb", "aA0", "04F", "2Em", "d6f", "09v", "4FP", "4S1", "a3E", "bRO", "0SR", "4h", "AX", "T9", "4YD", "6lg", "6BK", "4wh", "0LF", "ot", - "bD", "0Av", "4zX", "4o9", "5Q4", "4Tt", "0oZ", "Lh", "Ci", "14r", "5KT", "6nV", "ajh", "41Q", "0Nw", "mE", "22l", "0CG", "4xi", "6MJ", - "6cf", "4VE", "0mk", "NY", "07a", "2FJ", "69l", "4HG", "4fk", "6SH", "2hf", "1Md", "0Pu", "7O", "7NY", "bQh", "4Ew", "6pT", "0k8", "1nx", - "05P", "Rj", "5O6", "4Jv", "4dZ", "453", "8N", "1OU", "0RD", "qv", "7Lh", "4ij", "4GF", "66m", "2IK", "1lI", "5kc", "6Na", "21G", "27", - "8gX", "Mr", "74d", "4Un", "bbm", "79T", "1f0", "0cp", "397", "nn", "5s2", "42z", "4ys", "6LP", "ao", "366", "0lq", "OC", "76U", "bml", - "4Zo", "6oL", "Bs", "0aA", "0Om", "2zN", "7QA", "40K", "7OC", "4jA", "0Qo", "6U", "3ZA", "1ob", "4Dm", "65F", "68v", "b7f", "0rs", "QA", - "dSO", "8UG", "4gq", "5b1", "5m0", "4hp", "8ZF", "4d", "1x2", "09z", "727", "67w", "7nn", "4Kl", "04J", "Sp", "9T", "1NO", "51i", "6Pc", - "6BO", "43d", "0LB", "op", "2WM", "0bn", "5Ia", "6lc", "5Q0", "4Tp", "8fF", "Ll", "1D2", "0Ar", "cPN", "aem", "ajl", "41U", "0Ns", "mA", - "Cm", "14v", "5KP", "6nR", "6cb", "4VA", "0mo", "2XL", "22h", "0CC", "4xm", "6MN", "4fo", "6SL", "2hb", "8TY", "07e", "2FN", "69h", "4HC", - "4Es", "64X", "d5E", "83M", "0Pq", "7K", "a0f", "bQl", "50w", "457", "8J", "1OQ", "05T", "Rn", "5O2", "4Jr", "4GB", "66i", "2IO", "08d", - "1Ba", "5z", "7Ll", "4in", "0nD", "Mv", "7ph", "4Uj", "5kg", "6Ne", "cZ", "23", "0MX", "nj", "5s6", "4vv", "4XZ", "6my", "1f4", "0ct", - "0lu", "OG", "6bx", "5Gz", "4yw", "6LT", "ak", "0BY", "0Oi", "2zJ", "6Ad", "40O", "4Zk", "6oH", "Bw", "0aE", "2Jd", "1of", "4Di", "65B", - "7OG", "4jE", "g8", "6Q", "2ix", "1Lz", "4gu", "5b5", "68r", "4IY", "0rw", "QE", "1x6", "1mW", "4FX", "4S9", "5m4", "4ht", "0SZ", "ph", - "9P", "h9", "4eD", "6Pg", "7nj", "4Kh", "04N", "St", "22u", "375", "4xp", "598", "77V", "blo", "0mr", "1h2", "Cp", "14k", "5KM", "6nO", - "7PB", "41H", "0Nn", "3kl", "20D", "34", "4zA", "6Ob", "6aN", "4Tm", "0oC", "Lq", "AA", "0bs", "bcn", "78W", "569", "43y", "384", "om", - "9Kd", "5g", "5l3", "4is", "734", "66t", "1y1", "08y", "05I", "Rs", "7om", "4Jo", "4dC", "7AA", "8W", "1OL", "0Pl", "7V", "ats", "4kB", - "4En", "64E", "2Kc", "1na", "07x", "PB", "69u", "b6e", "4fr", "5c2", "dRL", "8TD", "4Zv", "6oU", "Bj", "0aX", "0Ot", "lF", "6Ay", "40R", - "4yj", "6LI", "av", "0BD", "0lh", "OZ", "6be", "4WF", "4XG", "6md", "2VJ", "0ci", "0ME", "nw", "6CH", "42c", "5kz", "6Nx", "cG", "1PT", - "0nY", "Mk", "5P7", "4Uw", "5N5", "4Ku", "04S", "Si", "9M", "1NV", "4eY", "440", "7Mk", "4hi", "0SG", "pu", "2HH", "K8", "4FE", "67n", - "68o", "4ID", "1", "QX", "2ie", "1Lg", "4gh", "6RK", "7OZ", "4jX", "0Qv", "6L", "2Jy", "3O9", "4Dt", "5A4", "4C9", "4VX", "0mv", "ND", - "22q", "0CZ", "4xt", "6MW", "7PF", "41L", "x9", "mX", "Ct", "14o", "5KI", "6nK", "6aJ", "4Ti", "0oG", "Lu", "bY", "30", "4zE", "6Of", - "5r5", "4wu", "380", "oi", "AE", "0bw", "4YY", "4L8", "5Wz", "66p", "1y5", "1lT", "0RY", "5c", "5l7", "4iw", "4dG", "6Qd", "8S", "1OH", - "05M", "Rw", "7oi", "4Jk", "4Ej", "64A", "2Kg", "1ne", "0Ph", "7R", "7ND", "4kF", "4fv", "5c6", "0H9", "1My", "0st", "PF", "69q", "4HZ", - "0Op", "lB", "ako", "40V", "4Zr", "6oQ", "Bn", "15u", "0ll", "2YO", "6ba", "4WB", "4yn", "6LM", "ar", "1Ra", "0MA", "ns", "6CL", "42g", - "4XC", "79I", "2VN", "0cm", "8gE", "Mo", "5P3", "4Us", "bAl", "adn", "cC", "1PP", "9I", "1NR", "51t", "444", "5N1", "4Kq", "04W", "Sm", - "2HL", "09g", "4FA", "67j", "7Mo", "4hm", "0SC", "4y", "2ia", "1Lc", "4gl", "6RO", "68k", "5Ya", "5", "2GM", "d4F", "82N", "4Dp", "5A0", - "a1e", "bPo", "0Qr", "6H", "Cx", "14c", "5KE", "6nG", "7PJ", "4uH", "x5", "mT", "0V7", "0CV", "4xx", "590", "4C5", "4VT", "0mz", "NH", - "AI", "16R", "4YU", "4L4", "561", "43q", "0LW", "oe", "bU", "w4", "4zI", "6Oj", "6aF", "4Te", "0oK", "Ly", "05A", "2Dj", "7oe", "4Jg", - "4dK", "6Qh", "2jF", "i6", "0RU", "5o", "7Ly", "5yZ", "4GW", "4R6", "1y9", "08q", "07p", "PJ", "7mT", "4HV", "4fz", "6SY", "0H5", "1Mu", - "f7", "sV", "7NH", "4kJ", "4Ef", "64M", "2Kk", "1ni", "4yb", "6LA", "23g", "0BL", "Z3", "OR", "6bm", "4WN", "c4d", "aEO", "Bb", "0aP", - "8Fd", "lN", "4a3", "40Z", "5kr", "4n2", "cO", "8Ie", "0nQ", "Mc", "74u", "615", "4XO", "6ml", "2VB", "U2", "0MM", "2xn", "7Sa", "42k", - "7Mc", "4ha", "0SO", "4u", "3Xa", "K0", "4FM", "67f", "aTL", "b5F", "0pS", "Sa", "9E", "8Wg", "4eQ", "448", "7OR", "4jP", "254", "6D", - "0j3", "1os", "cnn", "65W", "68g", "4IL", "9", "QP", "2im", "1Lo", "53I", "6RC", "7PN", "41D", "x1", "mP", "2Um", "14g", "5KA", "6nC", - "4C1", "4VP", "19W", "NL", "0V3", "0CR", "bBO", "594", "565", "43u", "0LS", "oa", "AM", "16V", "4YQ", "4L0", "6aB", "4Ta", "0oO", "2Zl", - "bQ", "38", "4zM", "6On", "4dO", "6Ql", "2jB", "i2", "05E", "2Dn", "7oa", "4Jc", "4GS", "4R2", "d7e", "08u", "0RQ", "5k", "a2F", "bSL", - "52W", "ayO", "0H1", "1Mq", "07t", "PN", "69y", "4HR", "4Eb", "64I", "2Ko", "1nm", "f3", "7Z", "7NL", "4kN", "Z7", "OV", "6bi", "4WJ", - "4yf", "6LE", "az", "0BH", "0Ox", "lJ", "4a7", "4tV", "4Zz", "6oY", "Bf", "0aT", "0nU", "Mg", "74q", "5EZ", "5kv", "4n6", "cK", "1PX", - "0MI", "2xj", "6CD", "42o", "4XK", "6mh", "2VF", "U6", "2HD", "K4", "4FI", "67b", "7Mg", "4he", "0SK", "4q", "9A", "1NZ", "4eU", "4p4", - "5N9", "4Ky", "0pW", "Se", "0j7", "1ow", "4Dx", "5A8", "7OV", "4jT", "0Qz", "rH", "2ii", "1Lk", "4gd", "6RG", "68c", "4IH", "D5", "QT", - "5Ls", "4I3", "F", "13U", "0IP", "jb", "536", "46v", "5oo", "6Jm", "gR", "r3", "0jL", "3ON", "6dA", "4Qb", "5NB", "aAR", "2Pn", "0eM", - "0Ka", "hS", "6El", "44G", "49w", "abN", "ec", "0FQ", "8ae", "KO", "4F2", "4SS", "4X0", "4MQ", "02w", "UM", "0M2", "0XS", "57T", "a8D", - "7KO", "4nM", "c0", "2Y", "2Nl", "1kn", "aJ1", "61J", "6zC", "aE0", "00F", "2Am", "yP", "l1", "4aL", "6To", "a7E", "58U", "0WR", "0h", - "ZL", "84n", "4BP", "4W1", "fH", "0Ez", "5nu", "4k5", "5U8", "4Px", "0kV", "Hd", "ET", "P5", "5Mi", "6hk", "6FG", "47l", "0HJ", "kx", - "dy", "0GK", "48m", "6IF", "6gj", "4RI", "0ig", "JU", "Ge", "0dW", "5OX", "5Z9", "4d4", "4qU", "1ZZ", "iI", "0Ty", "3C", "4z6", "4oW", - "5QZ", "60P", "Yg", "0zU", "A6", "TW", "6yh", "4LK", "4bg", "6WD", "2lj", "0YI", "0VH", "1r", "6XE", "4mf", "4CJ", "62a", "2MG", "N7", - "0uT", "Vf", "7kx", "4Nz", "5pw", "4u7", "xJ", "1KY", "0IT", "jf", "532", "46r", "5Lw", "4I7", "B", "0gx", "0jH", "Iz", "6dE", "4Qf", - "5ok", "6Ji", "gV", "r7", "0Ke", "hW", "6Eh", "44C", "5NF", "6kD", "2Pj", "0eI", "0hy", "KK", "4F6", "4SW", "49s", "6HX", "eg", "0FU", - "0M6", "0XW", "4cy", "5f9", "4X4", "4MU", "02s", "UI", "Xy", "1kj", "5PD", "61N", "7KK", "4nI", "c4", "vU", "yT", "l5", "4aH", "6Tk", - "6zG", "4Od", "00B", "Wx", "ZH", "0yz", "4BT", "4W5", "5i8", "4lx", "0WV", "0l", "71v", "646", "0kR", "3NP", "fL", "8Lf", "5nq", "4k1", - "6FC", "47h", "0HN", "29e", "EP", "P1", "5Mm", "6ho", "6gn", "4RM", "0ic", "JQ", "26d", "0GO", "48i", "6IB", "4d0", "45Y", "8Cg", "iM", - "Ga", "0dS", "beN", "hYu", "ckm", "60T", "Yc", "0zQ", "207", "3G", "4z2", "4oS", "4bc", "7Ga", "2ln", "0YM", "A2", "TS", "6yl", "4LO", - "4CN", "62e", "2MC", "N3", "0VL", "1v", "6XA", "4mb", "5ps", "4u3", "xN", "8Rd", "01X", "Vb", "aQO", "b0E", "5og", "6Je", "gZ", "63", - "0jD", "Iv", "6dI", "4Qj", "7l9", "6iy", "N", "0gt", "0IX", "jj", "5w6", "4rv", "5mV", "5x7", "ek", "0FY", "0hu", "KG", "6fx", "5Cz", - "5NJ", "6kH", "Fw", "0eE", "92", "3nk", "6Ed", "44O", "7KG", "4nE", "c8", "2Q", "Xu", "1kf", "5PH", "61B", "4X8", "4MY", "0vw", "UE", - "2mx", "1Hz", "4cu", "5f5", "5i4", "4lt", "0WZ", "th", "ZD", "0yv", "4BX", "4W9", "6zK", "4Oh", "00N", "Wt", "yX", "l9", "4aD", "6Tg", - "2SM", "0fn", "5Ma", "6hc", "6FO", "47d", "0HB", "kp", "24Y", "0Er", "bDo", "aam", "5U0", "4Pp", "8bF", "Hl", "Gm", "10v", "5OP", "5Z1", - "anl", "45U", "0Js", "iA", "dq", "0GC", "48e", "6IN", "6gb", "4RA", "0io", "3Lm", "03e", "2BN", "7iA", "4LC", "4bo", "6WL", "zs", "0YA", - "0Tq", "3K", "a4f", "bUl", "4As", "5D3", "Yo", "87M", "01T", "Vn", "5K2", "4Nr", "54w", "417", "xB", "1KQ", "1Fa", "1z", "6XM", "4mn", - "4CB", "62i", "2MO", "0xl", "1za", "Ir", "6dM", "4Qn", "5oc", "6Ja", "25G", "67", "9Pe", "jn", "5w2", "46z", "bfm", "aCo", "J", "0gp", - "0hq", "KC", "72U", "bil", "5mR", "5x3", "eo", "326", "96", "3no", "7UA", "44K", "5NN", "6kL", "Fs", "0eA", "Xq", "1kb", "5PL", "61F", - "7KC", "4nA", "0Uo", "2U", "39U", "8QG", "4cq", "5f1", "aRl", "796", "0vs", "UA", "2LQ", "0yr", "767", "63w", "5i0", "4lp", "9Ng", "0d", - "2oM", "0Zn", "55i", "6Tc", "6zO", "4Ol", "00J", "Wp", "6FK", "4sh", "0HF", "kt", "EX", "P9", "5Me", "6hg", "5U4", "4Pt", "0kZ", "Hh", - "fD", "0Ev", "5ny", "4k9", "4d8", "45Q", "0Jw", "iE", "Gi", "10r", "5OT", "5Z5", "6gf", "4RE", "0ik", "JY", "du", "0GG", "48a", "6IJ", - "4bk", "6WH", "zw", "0YE", "03a", "2BJ", "6yd", "4LG", "4Aw", "5D7", "Yk", "0zY", "0Tu", "3O", "6Zx", "bUh", "54s", "413", "xF", "1KU", - "01P", "Vj", "5K6", "4Nv", "4CF", "62m", "2MK", "0xh", "0VD", "uv", "6XI", "4mj", "5NS", "6kQ", "Fn", "11u", "0Kp", "hB", "aoo", "44V", - "49f", "6HM", "er", "1Va", "0hl", "3Mn", "6fa", "4SB", "5Lb", "7yA", "W", "0gm", "0IA", "js", "6GL", "46g", "bEl", "hyW", "gC", "0Dq", - "8cE", "Io", "5T3", "4Qs", "5J1", "4Oq", "00W", "Wm", "yA", "0Zs", "55t", "404", "6YN", "4lm", "0WC", "0y", "2LL", "0yo", "4BA", "63j", - "6xc", "bws", "02f", "2CM", "2ma", "0XB", "4cl", "6VO", "a5e", "bTo", "0Ur", "2H", "Xl", "86N", "5PQ", "5E0", "dh", "0GZ", "5lU", "5y4", - "4G9", "4RX", "0iv", "JD", "Gt", "0dF", "5OI", "6jK", "6Dg", "45L", "81", "iX", "fY", "70", "5nd", "6Kf", "6eJ", "4Pi", "0kG", "Hu", - "EE", "0fw", "5Mx", "4H8", "5v5", "4su", "1Xz", "ki", "0VY", "1c", "5h7", "4mw", "5Sz", "62p", "2MV", "0xu", "01M", "Vw", "7ki", "4Nk", - "54n", "6Ud", "2nJ", "1KH", "0Th", "3R", "6Ze", "4oF", "4Aj", "60A", "Yv", "0zD", "0wt", "TF", "6yy", "4LZ", "4bv", "5g6", "zj", "0YX", - "0Kt", "hF", "6Ey", "44R", "5NW", "6kU", "Fj", "0eX", "0hh", "KZ", "6fe", "4SF", "49b", "6HI", "ev", "0FD", "0IE", "jw", "6GH", "46c", - "5Lf", "6id", "S", "0gi", "0jY", "Ik", "5T7", "4Qw", "5oz", "6Jx", "gG", "0Du", "yE", "0Zw", "4aY", "400", "5J5", "4Ou", "00S", "Wi", - "ZY", "O8", "4BE", "63n", "6YJ", "4li", "0WG", "tu", "2me", "0XF", "4ch", "6VK", "6xg", "4MD", "02b", "UX", "Xh", "3K9", "5PU", "5E4", - "7KZ", "4nX", "0Uv", "2L", "73V", "bho", "0ir", "1l2", "dl", "335", "48x", "5y0", "6Dc", "45H", "85", "3ol", "Gp", "0dB", "5OM", "6jO", - "6eN", "4Pm", "0kC", "Hq", "24D", "74", "bDr", "6Kb", "529", "47y", "8AG", "km", "EA", "0fs", "bgn", "aBl", "774", "62t", "199", "0xq", - "9Od", "1g", "5h3", "4ms", "54j", "7EA", "2nN", "1KL", "01I", "Vs", "7km", "4No", "4An", "60E", "Yr", "1ja", "0Tl", "3V", "6Za", "4oB", - "4br", "5g2", "zn", "8PD", "03x", "TB", "aSo", "785", "49n", "6HE", "ez", "0FH", "0hd", "KV", "6fi", "4SJ", "bdI", "6kY", "Ff", "0eT", - "0Kx", "hJ", "4e7", "4pV", "5ov", "4j6", "gK", "0Dy", "0jU", "Ig", "6dX", "5AZ", "5Lj", "6ih", "DW", "Q6", "0II", "28b", "6GD", "46o", - "6YF", "4le", "0WK", "0q", "ZU", "O4", "4BI", "63b", "5J9", "4Oy", "0tW", "We", "yI", "1JZ", "4aU", "4t4", "7KV", "4nT", "0Uz", "vH", - "Xd", "1kw", "5PY", "5E8", "6xk", "4MH", "02n", "UT", "2mi", "0XJ", "4cd", "6VG", "2Qm", "0dN", "5OA", "6jC", "6Do", "45D", "89", "iP", - "0R3", "0GR", "48t", "acM", "4G1", "4RP", "94O", "JL", "EM", "12V", "5Mp", "4H0", "525", "47u", "0HS", "ka", "fQ", "78", "5nl", "6Kn", - "6eB", "4Pa", "0kO", "3NM", "01E", "3PO", "7ka", "4Nc", "54f", "6Ul", "xS", "m2", "0VQ", "1k", "a6F", "59V", "4CS", "4V2", "195", "85m", - "03t", "TN", "4Y3", "4LR", "56W", "a9G", "zb", "0YP", "b3", "3Z", "6Zm", "4oN", "4Ab", "60I", "2Oo", "0zL", "1xA", "KR", "6fm", "4SN", - "49j", "6HA", "27g", "0FL", "8Bd", "hN", "4e3", "44Z", "bdM", "aAO", "Fb", "0eP", "0jQ", "Ic", "70u", "655", "5or", "4j2", "gO", "8Me", - "0IM", "28f", "7Wa", "46k", "5Ln", "6il", "DS", "Q2", "ZQ", "O0", "4BM", "63f", "6YB", "4la", "0WO", "0u", "yM", "8Sg", "4aQ", "408", - "aPL", "b1F", "0tS", "Wa", "0n3", "1ks", "bzO", "61W", "7KR", "4nP", "214", "2D", "2mm", "0XN", "57I", "6VC", "6xo", "4ML", "02j", "UP", - "6Dk", "4qH", "0Jf", "iT", "Gx", "0dJ", "5OE", "6jG", "4G5", "4RT", "0iz", "JH", "dd", "0GV", "48p", "5y8", "521", "47q", "0HW", "ke", - "EI", "12R", "5Mt", "4H4", "6eF", "4Pe", "0kK", "Hy", "fU", "s4", "5nh", "6Kj", "54b", "6Uh", "xW", "m6", "01A", "3PK", "7ke", "4Ng", - "4CW", "4V6", "191", "0xy", "0VU", "1o", "6XX", "59R", "4bz", "6WY", "zf", "0YT", "03p", "TJ", "4Y7", "4LV", "4Af", "60M", "Yz", "0zH", - "b7", "wV", "6Zi", "4oJ", "5H3", "4Ms", "02U", "Uo", "2mR", "0Xq", "57v", "426", "7Km", "4no", "0UA", "vs", "2NN", "1kL", "5Pb", "61h", - "6za", "4OB", "00d", "2AO", "yr", "1Ja", "4an", "6TM", "a7g", "58w", "0Wp", "0J", "Zn", "84L", "4Br", "5G2", "5LQ", "5Y0", "d", "13w", - "0Ir", "1L2", "amm", "46T", "5oM", "6JO", "gp", "0DB", "0jn", "3Ol", "6dc", "5Aa", "bdr", "6kb", "2PL", "0eo", "0KC", "hq", "6EN", "44e", - "49U", "abl", "eA", "0Fs", "8aG", "Km", "5V1", "4Sq", "1Dz", "3a", "5j5", "4ou", "4AY", "4T8", "YE", "0zw", "03O", "Tu", "6yJ", "4Li", - "4bE", "6Wf", "zY", "o8", "0Vj", "1P", "6Xg", "4mD", "4Ch", "62C", "2Me", "0xF", "0uv", "VD", "7kZ", "4NX", "5pU", "5e4", "xh", "3k9", - "fj", "0EX", "5nW", "6KU", "6ey", "4PZ", "0kt", "HF", "Ev", "0fD", "5MK", "6hI", "6Fe", "47N", "0Hh", "kZ", "26B", "52", "48O", "6Id", - "6gH", "4Rk", "0iE", "Jw", "GG", "0du", "5Oz", "6jx", "5t7", "4qw", "0JY", "ik", "2mV", "0Xu", "57r", "422", "5H7", "4Mw", "02Q", "Uk", - "2NJ", "1kH", "5Pf", "61l", "7Ki", "4nk", "0UE", "vw", "yv", "0ZD", "4aj", "6TI", "6ze", "4OF", "0th", "WZ", "Zj", "0yX", "4Bv", "5G6", - "6Yy", "4lZ", "0Wt", "0N", "0Iv", "jD", "4g9", "46P", "5LU", "5Y4", "Dh", "0gZ", "0jj", "IX", "6dg", "4QD", "5oI", "6JK", "gt", "0DF", - "0KG", "hu", "6EJ", "44a", "5Nd", "6kf", "FY", "S8", "1xz", "Ki", "5V5", "4Su", "49Q", "4h8", "eE", "0Fw", "756", "60v", "YA", "0zs", - "9Mf", "3e", "5j1", "4oq", "4bA", "6Wb", "2lL", "0Yo", "03K", "Tq", "6yN", "4Lm", "4Cl", "62G", "2Ma", "0xB", "0Vn", "1T", "6Xc", "59i", - "54Y", "5e0", "xl", "8RF", "01z", "1p2", "aQm", "b0g", "71T", "bjm", "0kp", "HB", "fn", "317", "5nS", "6KQ", "6Fa", "47J", "0Hl", "29G", - "Er", "12i", "5MO", "6hM", "6gL", "4Ro", "0iA", "Js", "26F", "56", "48K", "7YA", "5t3", "4qs", "8CE", "io", "GC", "0dq", "bel", "hYW", - "7Ke", "4ng", "0UI", "2s", "XW", "M6", "5Pj", "6uh", "6xX", "6m9", "0vU", "Ug", "2mZ", "0Xy", "4cW", "4v6", "4y7", "4lV", "0Wx", "0B", - "Zf", "0yT", "4Bz", "63Q", "6zi", "4OJ", "B7", "WV", "yz", "0ZH", "4af", "6TE", "5oE", "6JG", "gx", "0DJ", "0jf", "IT", "6dk", "4QH", - "5LY", "5Y8", "l", "0gV", "0Iz", "jH", "4g5", "4rT", "5mt", "4h4", "eI", "1VZ", "0hW", "Ke", "5V9", "4Sy", "5Nh", "6kj", "FU", "S4", - "0KK", "hy", "6EF", "44m", "03G", "2Bl", "6yB", "4La", "4bM", "6Wn", "zQ", "o0", "0TS", "3i", "a4D", "bUN", "4AQ", "4T0", "YM", "87o", - "01v", "VL", "7kR", "4NP", "54U", "hft", "0N3", "1Ks", "0Vb", "1X", "6Xo", "4mL", "5SA", "62K", "2Mm", "0xN", "2So", "0fL", "5MC", "6hA", - "6Fm", "47F", "1XA", "kR", "fb", "0EP", "bDM", "aaO", "4E3", "4PR", "8bd", "HN", "GO", "10T", "5Or", "4J2", "507", "45w", "0JQ", "ic", - "dS", "q2", "48G", "6Il", "73i", "4Rc", "0iM", "3LO", "XS", "M2", "5Pn", "61d", "7Ka", "4nc", "0UM", "2w", "39w", "8Qe", "4cS", "4v2", - "aRN", "b3D", "02Y", "Uc", "Zb", "0yP", "bxM", "63U", "4y3", "4lR", "236", "0F", "2oo", "0ZL", "4ab", "6TA", "6zm", "4ON", "B3", "WR", - "0jb", "IP", "6do", "4QL", "5oA", "6JC", "25e", "0DN", "9PG", "jL", "4g1", "46X", "686", "aCM", "h", "0gR", "0hS", "Ka", "72w", "677", - "49Y", "4h0", "eM", "8Og", "0KO", "3nM", "6EB", "44i", "5Nl", "6kn", "FQ", "S0", "4bI", "6Wj", "zU", "o4", "03C", "Ty", "6yF", "4Le", - "4AU", "4T4", "YI", "1jZ", "0TW", "3m", "5j9", "4oy", "54Q", "5e8", "xd", "1Kw", "01r", "VH", "7kV", "4NT", "4Cd", "62O", "2Mi", "0xJ", - "0Vf", "uT", "6Xk", "4mH", "6Fi", "47B", "0Hd", "kV", "Ez", "0fH", "5MG", "6hE", "4E7", "4PV", "0kx", "HJ", "ff", "0ET", "bDI", "6KY", - "503", "45s", "0JU", "ig", "GK", "0dy", "5Ov", "4J6", "6gD", "4Rg", "0iI", "3LK", "dW", "q6", "48C", "6Ih", "4Z2", "4OS", "00u", "WO", - "yc", "0ZQ", "55V", "hgw", "6Yl", "4lO", "a2", "tS", "2Ln", "0yM", "4Bc", "63H", "6xA", "4Mb", "02D", "2Co", "2mC", "n3", "4cN", "6Vm", - "a5G", "bTM", "0UP", "2j", "XN", "86l", "5Ps", "4U3", "5Nq", "4K1", "FL", "11W", "0KR", "3nP", "514", "44t", "49D", "6Ho", "eP", "49", - "0hN", "3ML", "6fC", "5CA", "aV1", "6iB", "u", "0gO", "0Ic", "jQ", "6Gn", "46E", "bEN", "hyu", "ga", "0DS", "8cg", "IM", "4D0", "4QQ", - "1FZ", "1A", "4x4", "4mU", "4Cy", "5F9", "0m6", "0xW", "C4", "VU", "7kK", "4NI", "54L", "6UF", "xy", "1Kj", "0TJ", "3p", "6ZG", "4od", - "4AH", "60c", "YT", "L5", "0wV", "Td", "5I8", "4Lx", "4bT", "4w5", "zH", "0Yz", "dJ", "0Gx", "5lw", "4i7", "6gY", "4Rz", "0iT", "Jf", - "GV", "R7", "5Ok", "6ji", "6DE", "45n", "0JH", "iz", "24b", "0EI", "5nF", "6KD", "6eh", "4PK", "0ke", "HW", "Eg", "0fU", "5MZ", "6hX", - "4f6", "4sW", "0Hy", "kK", "yg", "0ZU", "55R", "6TX", "4Z6", "4OW", "00q", "WK", "2Lj", "0yI", "4Bg", "63L", "6Yh", "4lK", "a6", "tW", - "2mG", "n7", "4cJ", "6Vi", "6xE", "4Mf", "0vH", "Uz", "XJ", "1kY", "5Pw", "4U7", "7Kx", "4nz", "0UT", "2n", "0KV", "hd", "510", "44p", - "5Nu", "4K5", "FH", "0ez", "0hJ", "Kx", "6fG", "4Sd", "5mi", "6Hk", "eT", "p5", "0Ig", "jU", "6Gj", "46A", "5LD", "6iF", "q", "0gK", - "1zZ", "II", "4D4", "4QU", "5oX", "5z9", "ge", "0DW", "byN", "62V", "0m2", "0xS", "225", "1E", "4x0", "4mQ", "54H", "6UB", "2nl", "1Kn", - "C0", "VQ", "7kO", "4NM", "4AL", "60g", "YP", "L1", "0TN", "3t", "6ZC", "ae0", "4bP", "439", "zL", "8Pf", "03Z", "0b3", "aSM", "b2G", - "73t", "664", "0iP", "Jb", "dN", "8Nd", "48Z", "4i3", "6DA", "45j", "0JL", "3oN", "GR", "R3", "5Oo", "6jm", "6el", "4PO", "0ka", "HS", - "24f", "0EM", "5nB", "aaR", "4f2", "4sS", "8Ae", "kO", "Ec", "0fQ", "695", "aBN", "6Yd", "4lG", "0Wi", "0S", "Zw", "0yE", "4Bk", "6wH", - "6zx", "buh", "0tu", "WG", "yk", "0ZY", "4aw", "5d7", "5k6", "4nv", "0UX", "2b", "XF", "1kU", "741", "61q", "6xI", "4Mj", "02L", "Uv", - "2mK", "0Xh", "4cF", "6Ve", "49L", "6Hg", "eX", "41", "0hF", "Kt", "6fK", "4Sh", "5Ny", "4K9", "FD", "0ev", "0KZ", "hh", "5u4", "4pt", - "5oT", "5z5", "gi", "1Tz", "0jw", "IE", "4D8", "4QY", "5LH", "6iJ", "Du", "0gG", "0Ik", "jY", "6Gf", "46M", "01g", "3Pm", "7kC", "4NA", - "54D", "6UN", "xq", "1Kb", "0Vs", "1I", "a6d", "59t", "4Cq", "5F1", "d3G", "85O", "03V", "Tl", "5I0", "4Lp", "56u", "435", "2lQ", "0Yr", - "0TB", "3x", "6ZO", "4ol", "5Qa", "60k", "2OM", "0zn", "2QO", "0dl", "5Oc", "6ja", "6DM", "45f", "1Za", "ir", "dB", "0Gp", "48V", "aco", - "5W2", "4Rr", "94m", "Jn", "Eo", "12t", "5MR", "5X3", "aln", "47W", "0Hq", "kC", "fs", "0EA", "5nN", "6KL", "71I", "4PC", "0km", "3No", - "Zs", "0yA", "4Bo", "63D", "7IA", "4lC", "0Wm", "0W", "yo", "8SE", "4as", "5d3", "aPn", "b1d", "00y", "WC", "XB", "1kQ", "745", "61u", - "5k2", "4nr", "9Le", "2f", "2mO", "0Xl", "4cB", "6Va", "6xM", "4Mn", "02H", "Ur", "0hB", "Kp", "6fO", "4Sl", "49H", "6Hc", "27E", "45", - "8BF", "hl", "518", "44x", "bdo", "aAm", "2PQ", "0er", "0js", "IA", "70W", "bkn", "5oP", "5z1", "gm", "304", "0Io", "28D", "6Gb", "46I", - "5LL", "6iN", "y", "0gC", "5pH", "6UJ", "xu", "1Kf", "C8", "VY", "7kG", "4NE", "4Cu", "5F5", "2Mx", "1hz", "0Vw", "1M", "4x8", "4mY", - "4bX", "431", "zD", "0Yv", "03R", "Th", "5I4", "4Lt", "4AD", "60o", "YX", "L9", "0TF", "wt", "6ZK", "4oh", "6DI", "45b", "0JD", "iv", - "GZ", "0dh", "5Og", "6je", "5W6", "4Rv", "0iX", "Jj", "dF", "0Gt", "48R", "6Iy", "6Fx", "47S", "0Hu", "kG", "Ek", "0fY", "5MV", "5X7", - "6ed", "4PG", "0ki", "3Nk", "fw", "0EE", "5nJ", "6KH", "356", "bo", "6OP", "4zs", "bnl", "75U", "LC", "0oq", "0bA", "As", "6lL", "4Yo", - "43K", "7RA", "2yN", "0Lm", "17", "22G", "6Ma", "4xB", "4Vn", "6cM", "Nr", "19i", "14Y", "CB", "aDo", "bam", "41z", "5p2", "mn", "8GD", - "7d", "8YF", "4kp", "5n0", "64w", "717", "1nS", "2KQ", "Pp", "07J", "4Hl", "69G", "6Sc", "52i", "1MO", "2hM", "5U", "0Ro", "4iA", "7LC", - "66F", "4Gm", "08K", "3YA", "RA", "0qs", "b4f", "aUl", "5a1", "4dq", "8VG", "8e", "6mV", "4Xu", "17r", "022", "nE", "0Mw", "42Q", "4c8", - "6NJ", "5kH", "1Pf", "cu", "MY", "X8", "4UE", "74O", "6og", "4ZD", "W9", "BX", "lt", "0OF", "4th", "6AK", "4l9", "4yX", "0Bv", "aD", - "Oh", "0lZ", "4Wt", "5R4", "4Iv", "5L6", "Qj", "06P", "1LU", "1Y4", "463", "4gZ", "4jj", "7Oh", "rv", "0QD", "1oI", "2JK", "65m", "4DF", - "4KG", "7nE", "2EJ", "04a", "1Nd", "2kf", "6PH", "4ek", "5xz", "492", "4O", "0Su", "09Q", "0h8", "5C7", "4Fw", "5Dz", "6ax", "LG", "0ou", - "0AY", "bk", "6OT", "4zw", "43O", "6Bd", "2yJ", "0Li", "0bE", "Aw", "6lH", "4Yk", "4Vj", "6cI", "Nv", "0mD", "13", "22C", "6Me", "4xF", - "4uv", "5p6", "mj", "0NX", "1pU", "CF", "6ny", "7k9", "4P9", "4EX", "1nW", "2KU", "sh", "0PZ", "4kt", "5n4", "6Sg", "4fD", "k9", "2hI", - "Pt", "07N", "4Hh", "69C", "66B", "4Gi", "08O", "2Id", "5Q", "d8", "4iE", "7LG", "5a5", "4du", "1Oz", "8a", "RE", "0qw", "4JY", "aUh", - "nA", "0Ms", "42U", "ail", "6mR", "4Xq", "17v", "026", "3Km", "0no", "4UA", "74K", "6NN", "5kL", "1Pb", "cq", "lp", "0OB", "40d", "6AO", - "6oc", "5Ja", "0an", "2TM", "Ol", "18w", "4Wp", "5R0", "afm", "bCo", "0Br", "1G2", "1LQ", "1Y0", "467", "53w", "4Ir", "5L2", "Qn", "06T", - "1oM", "2JO", "65i", "4DB", "4jn", "7Ol", "6z", "1Aa", "8WY", "2kb", "6PL", "4eo", "4KC", "7nA", "2EN", "04e", "09U", "d6E", "5C3", "4Fs", - "bRl", "496", "4K", "0Sq", "0bI", "2Wj", "6lD", "4Yg", "43C", "6Bh", "oW", "z6", "0AU", "bg", "6OX", "5jZ", "4TW", "4A6", "LK", "0oy", - "14Q", "CJ", "4N7", "5Kw", "41r", "542", "mf", "0NT", "u7", "22O", "6Mi", "4xJ", "4Vf", "6cE", "Nz", "0mH", "Px", "07B", "4Hd", "69O", - "6Sk", "4fH", "k5", "2hE", "7l", "0PV", "4kx", "5n8", "4P5", "4ET", "83j", "2KY", "RI", "05s", "4JU", "7oW", "5a9", "4dy", "1Ov", "8m", - "qU", "d4", "4iI", "7LK", "66N", "4Ge", "08C", "2Ih", "6NB", "a59", "1Pn", "21d", "MQ", "X0", "4UM", "74G", "79w", "bbN", "0cS", "0v2", - "nM", "8Dg", "42Y", "4c0", "4l1", "4yP", "8Kf", "aL", "0y3", "0lR", "636", "76v", "6oo", "4ZL", "W1", "BP", "2zm", "0ON", "40h", "6AC", - "4jb", "auS", "6v", "0QL", "I3", "2JC", "65e", "4DN", "b7E", "68U", "Qb", "06X", "286", "dSl", "4r3", "4gR", "4hS", "7MQ", "4G", "277", - "09Y", "0h0", "67T", "b8D", "4KO", "7nM", "SS", "F2", "1Nl", "9w", "azR", "4ec", "43G", "6Bl", "oS", "z2", "0bM", "2Wn", "78i", "4Yc", - "4TS", "4A2", "LO", "8fe", "0AQ", "bc", "aeN", "cPm", "41v", "546", "mb", "0NP", "14U", "CN", "4N3", "5Ks", "4Vb", "6cA", "2Xo", "0mL", - "u3", "22K", "6Mm", "4xN", "6So", "4fL", "k1", "2hA", "2Fm", "07F", "5XA", "69K", "4P1", "4EP", "83n", "d5f", "7h", "0PR", "bQO", "a0E", - "hbu", "50T", "1Or", "8i", "RM", "05w", "4JQ", "7oS", "66J", "4Ga", "08G", "2Il", "5Y", "d0", "4iM", "7LO", "MU", "X4", "4UI", "74C", - "6NF", "5kD", "1Pj", "cy", "nI", "2m9", "4vU", "4c4", "6mZ", "4Xy", "0cW", "0v6", "Od", "0lV", "4Wx", "5R8", "4l5", "4yT", "0Bz", "aH", - "lx", "0OJ", "40l", "6AG", "6ok", "4ZH", "W5", "BT", "I7", "2JG", "65a", "4DJ", "4jf", "7Od", "6r", "0QH", "1LY", "1Y8", "4r7", "4gV", - "4Iz", "68Q", "Qf", "0rT", "1mt", "0h4", "67P", "5VZ", "4hW", "7MU", "4C", "0Sy", "1Nh", "9s", "6PD", "4eg", "4KK", "7nI", "SW", "F6", - "8Je", "22V", "4m2", "4xS", "625", "77u", "Nc", "0mQ", "V2", "CS", "6nl", "5Kn", "41k", "7Pa", "3kO", "0NM", "0AL", "20g", "6OA", "4zb", - "4TN", "6am", "LR", "Y3", "0bP", "Ab", "78t", "bcM", "43Z", "4b3", "oN", "8Ed", "5D", "264", "4iP", "489", "66W", "b9G", "08Z", "0i3", - "RP", "G1", "4JL", "7oN", "6QC", "50I", "1Oo", "8t", "7u", "0PO", "4ka", "7Nc", "64f", "4EM", "H0", "963", "Pa", "0sS", "b6F", "69V", - "478", "4fQ", "295", "dRo", "4O4", "4ZU", "15R", "BI", "le", "0OW", "40q", "551", "6Lj", "4yI", "t4", "aU", "Oy", "0lK", "4We", "6bF", - "6mG", "4Xd", "0cJ", "2Vi", "nT", "0Mf", "4vH", "6Ck", "adI", "5kY", "1Pw", "cd", "MH", "0nz", "4UT", "7pV", "4KV", "7nT", "SJ", "04p", - "1Nu", "9n", "6PY", "4ez", "4hJ", "7MH", "pV", "e7", "1mi", "2Hk", "67M", "4Ff", "4Ig", "68L", "2Gj", "06A", "j6", "2iF", "6Rh", "4gK", - "5zZ", "7Oy", "6o", "0QU", "1oX", "1z9", "4Q6", "4DW", "5FZ", "6cX", "Ng", "0mU", "0Cy", "1F9", "4m6", "4xW", "41o", "7Pe", "3kK", "0NI", - "V6", "CW", "6nh", "5Kj", "4TJ", "6ai", "LV", "Y7", "0AH", "bz", "6OE", "4zf", "4wV", "4b7", "oJ", "0Lx", "0bT", "Af", "6lY", "4Yz", - "5B8", "4Gx", "1lw", "0i7", "qH", "0Rz", "4iT", "7LV", "6QG", "4dd", "1Ok", "8p", "RT", "G5", "4JH", "7oJ", "64b", "4EI", "H4", "2KD", - "7q", "0PK", "4ke", "7Ng", "4s4", "4fU", "1MZ", "2hX", "Pe", "0sW", "4Hy", "5M9", "la", "0OS", "40u", "555", "4O0", "4ZQ", "15V", "BM", - "2Yl", "0lO", "4Wa", "6bB", "6Ln", "4yM", "08", "aQ", "nP", "0Mb", "42D", "6Co", "6mC", "5HA", "0cN", "2Vm", "ML", "8gf", "4UP", "74Z", - "adM", "bAO", "1Ps", "0U3", "1Nq", "9j", "azO", "51W", "4KR", "7nP", "SN", "04t", "09D", "2Ho", "67I", "4Fb", "4hN", "7ML", "4Z", "e3", - "j2", "2iB", "6Rl", "4gO", "4Ic", "68H", "2Gn", "06E", "82m", "d4e", "4Q2", "4DS", "bPL", "a1F", "6k", "0QQ", "1pH", "2UJ", "6nd", "5Kf", - "41c", "7Pi", "mw", "0NE", "0Cu", "1F5", "6Mx", "5hz", "4Vw", "5S7", "Nk", "0mY", "0bX", "Aj", "6lU", "4Yv", "43R", "6By", "oF", "0Lt", - "0AD", "bv", "6OI", "4zj", "4TF", "6ae", "LZ", "0oh", "RX", "G9", "4JD", "7oF", "6QK", "4dh", "1Og", "2je", "5L", "0Rv", "4iX", "481", - "5B4", "4Gt", "08R", "2Iy", "Pi", "07S", "4Hu", "5M5", "470", "4fY", "1MV", "1X7", "su", "0PG", "4ki", "7Nk", "64n", "4EE", "H8", "2KH", - "6Lb", "4yA", "04", "23D", "Oq", "0lC", "4Wm", "6bN", "aEl", "c4G", "0as", "BA", "lm", "8FG", "40y", "559", "6NS", "5kQ", "345", "cl", - "1k2", "0nr", "boo", "74V", "6mO", "4Xl", "0cB", "2Va", "2xM", "0Mn", "42H", "6Cc", "4hB", "aws", "4V", "0Sl", "09H", "2Hc", "67E", "4Fn", - "b5e", "aTo", "SB", "04x", "8WD", "9f", "6PQ", "4er", "4js", "5o3", "6g", "8XE", "1oP", "1z1", "65t", "704", "4Io", "68D", "Qs", "06I", - "1LL", "2iN", "7BA", "4gC", "41g", "7Pm", "ms", "0NA", "14D", "2UN", "aDr", "5Kb", "4Vs", "5S3", "No", "19t", "0Cq", "1F1", "agn", "bBl", - "43V", "aho", "oB", "0Lp", "16u", "An", "6lQ", "4Yr", "4TB", "6aa", "2ZO", "0ol", "1Qa", "br", "6OM", "4zn", "6QO", "4dl", "1Oc", "8x", - "2DM", "05f", "5Za", "7oB", "5B0", "4Gp", "08V", "d7F", "5H", "0Rr", "bSo", "485", "474", "52t", "1MR", "1X3", "Pm", "07W", "4Hq", "5M1", - "64j", "4EA", "1nN", "2KL", "7y", "0PC", "4km", "7No", "Ou", "0lG", "4Wi", "6bJ", "6Lf", "4yE", "00", "aY", "li", "8FC", "4tu", "5q5", - "4O8", "4ZY", "0aw", "BE", "MD", "0nv", "4UX", "74R", "6NW", "5kU", "341", "ch", "nX", "0Mj", "42L", "6Cg", "6mK", "4Xh", "0cF", "2Ve", - "09L", "2Hg", "67A", "4Fj", "4hF", "7MD", "4R", "0Sh", "1Ny", "9b", "6PU", "4ev", "4KZ", "7nX", "SF", "0pt", "1oT", "1z5", "65p", "5Tz", - "4jw", "5o7", "6c", "0QY", "1LH", "2iJ", "6Rd", "4gG", "4Ik", "7li", "Qw", "06M", "7F", "246", "4kR", "7NP", "64U", "col", "1nq", "0k1", - "PR", "E3", "4HN", "69e", "6SA", "4fb", "1Mm", "2ho", "5w", "0RM", "4ic", "7La", "66d", "4GO", "J2", "2IB", "Rc", "05Y", "b4D", "aUN", - "4q2", "4dS", "8Ve", "8G", "8Hg", "bM", "4o0", "4zQ", "607", "75w", "La", "0oS", "T0", "AQ", "6ln", "4YM", "43i", "6BB", "2yl", "0LO", - "0CN", "22e", "6MC", "5hA", "4VL", "6co", "NP", "0mb", "1ps", "0u3", "aDM", "baO", "41X", "7PR", "mL", "8Gf", "4IT", "7lV", "QH", "06r", - "1Lw", "0I7", "5b8", "4gx", "4jH", "7OJ", "rT", "g5", "1ok", "2Ji", "65O", "4Dd", "4Ke", "7ng", "Sy", "04C", "h4", "2kD", "6Pj", "4eI", - "4hy", "5m9", "4m", "0SW", "09s", "2HX", "4S4", "4FU", "4M6", "4XW", "0cy", "1f9", "ng", "0MU", "42s", "573", "6Nh", "5kj", "v6", "cW", - "3KK", "0nI", "4Ug", "74m", "6oE", "4Zf", "0aH", "Bz", "lV", "y7", "40B", "6Ai", "582", "4yz", "0BT", "af", "OJ", "0lx", "4WV", "4B7", - "64Q", "4Ez", "1nu", "0k5", "7B", "0Px", "4kV", "7NT", "6SE", "4ff", "1Mi", "2hk", "PV", "E7", "4HJ", "69a", "6rh", "4GK", "J6", "2IF", - "5s", "0RI", "4ig", "7Le", "4q6", "4dW", "1OX", "8C", "Rg", "0qU", "5ZZ", "7oy", "4Ty", "5Q9", "Le", "0oW", "1QZ", "bI", "4o4", "4zU", - "43m", "6BF", "oy", "0LK", "T4", "AU", "6lj", "4YI", "4VH", "6ck", "NT", "0mf", "0CJ", "22a", "6MG", "4xd", "4uT", "7PV", "mH", "0Nz", - "1pw", "Cd", "aDI", "5KY", "1Ls", "0I3", "axM", "53U", "4IP", "7lR", "QL", "06v", "1oo", "2Jm", "65K", "5TA", "4jL", "7ON", "6X", "g1", - "h0", "9Y", "6Pn", "4eM", "4Ka", "7nc", "2El", "04G", "09w", "d6g", "4S0", "4FQ", "bRN", "a3D", "4i", "0SS", "nc", "0MQ", "42w", "577", - "4M2", "4XS", "17T", "dlm", "3KO", "0nM", "4Uc", "74i", "6Nl", "5kn", "v2", "cS", "lR", "y3", "40F", "6Am", "6oA", "4Zb", "0aL", "2To", - "ON", "18U", "4WR", "4B3", "586", "bCM", "0BP", "ab", "PZ", "0sh", "4HF", "69m", "6SI", "4fj", "1Me", "2hg", "7N", "0Pt", "4kZ", "7NX", - "6pU", "4Ev", "1ny", "0k9", "Rk", "05Q", "4Jw", "5O7", "452", "50r", "1OT", "8O", "qw", "0RE", "4ik", "7Li", "66l", "4GG", "08a", "2IJ", - "T8", "AY", "6lf", "4YE", "43a", "6BJ", "ou", "0LG", "0Aw", "bE", "4o8", "4zY", "4Tu", "5Q5", "Li", "8fC", "14s", "Ch", "6nW", "5KU", - "41P", "7PZ", "mD", "0Nv", "0CF", "22m", "6MK", "4xh", "4VD", "6cg", "NX", "0mj", "5za", "7OB", "6T", "0Qn", "1oc", "2Ja", "65G", "4Dl", - "b7g", "68w", "1w2", "06z", "8UF", "dSN", "5b0", "4gp", "4hq", "5m1", "4e", "8ZG", "1mR", "1x3", "67v", "726", "4Km", "7no", "Sq", "04K", - "1NN", "9U", "6Pb", "4eA", "adr", "5kb", "26", "21F", "Ms", "0nA", "4Uo", "74e", "79U", "bbl", "0cq", "1f1", "no", "396", "4vs", "5s3", - "6LQ", "4yr", "367", "an", "OB", "0lp", "bmm", "76T", "6oM", "4Zn", "15i", "Br", "2zO", "0Ol", "40J", "6Aa", "6SM", "4fn", "1Ma", "2hc", - "2FO", "07d", "4HB", "69i", "64Y", "4Er", "83L", "d5D", "7J", "0Pp", "bQm", "a0g", "456", "50v", "1OP", "8K", "Ro", "05U", "4Js", "5O3", - "66h", "4GC", "08e", "2IN", "qs", "0RA", "4io", "7Lm", "43e", "6BN", "oq", "0LC", "0bo", "2WL", "6lb", "4YA", "4Tq", "5Q1", "Lm", "8fG", - "0As", "bA", "ael", "cPO", "41T", "ajm", "1K2", "0Nr", "14w", "Cl", "6nS", "5KQ", "5Fa", "6cc", "2XM", "0mn", "0CB", "22i", "6MO", "4xl", - "1og", "2Je", "65C", "4Dh", "4jD", "7OF", "6P", "g9", "3l9", "2iy", "5b4", "4gt", "4IX", "68s", "QD", "0rv", "1mV", "1x7", "4S8", "4FY", - "4hu", "5m5", "4a", "1Cz", "h8", "9Q", "6Pf", "4eE", "4Ki", "7nk", "Su", "04O", "Mw", "0nE", "4Uk", "74a", "6Nd", "5kf", "22", "21B", - "nk", "0MY", "4vw", "5s7", "6mx", "5Hz", "0cu", "1f5", "OF", "0lt", "4WZ", "6by", "6LU", "4yv", "0BX", "aj", "lZ", "0Oh", "40N", "6Ae", - "6oI", "4Zj", "0aD", "Bv", "5f", "9Ke", "4ir", "5l2", "66u", "735", "08x", "1y0", "Rr", "05H", "4Jn", "7ol", "6Qa", "4dB", "1OM", "8V", - "7W", "0Pm", "4kC", "7NA", "64D", "4Eo", "83Q", "2Kb", "PC", "07y", "b6d", "69t", "5c3", "4fs", "8TE", "dRM", "374", "22t", "599", "4xq", - "bln", "77W", "NA", "0ms", "14j", "Cq", "6nN", "5KL", "41I", "7PC", "3km", "0No", "35", "20E", "6Oc", "5ja", "4Tl", "6aO", "Lp", "0oB", - "0br", "1g2", "78V", "bco", "43x", "568", "ol", "385", "4Kt", "5N4", "Sh", "04R", "1NW", "9L", "441", "4eX", "4hh", "7Mj", "pt", "0SF", - "K9", "2HI", "67o", "4FD", "4IE", "68n", "QY", "0", "1Lf", "2id", "6RJ", "4gi", "4jY", "auh", "6M", "0Qw", "1oz", "2Jx", "5A5", "4Du", - "6oT", "4Zw", "0aY", "Bk", "lG", "0Ou", "40S", "6Ax", "6LH", "4yk", "0BE", "aw", "2YJ", "0li", "4WG", "6bd", "6me", "4XF", "0ch", "2VK", - "nv", "0MD", "42b", "6CI", "6Ny", "7K9", "1PU", "cF", "Mj", "0nX", "4Uv", "5P6", "66q", "4GZ", "1lU", "1y4", "5b", "0RX", "4iv", "5l6", - "6Qe", "4dF", "1OI", "8R", "Rv", "05L", "4Jj", "7oh", "6pH", "4Ek", "1nd", "2Kf", "7S", "0Pi", "4kG", "7NE", "5c7", "4fw", "1Mx", "0H8", - "PG", "0su", "5Xz", "69p", "4VY", "4C8", "NE", "0mw", "1Sz", "22p", "6MV", "4xu", "41M", "7PG", "mY", "x8", "14n", "Cu", "6nJ", "5KH", - "4Th", "6aK", "Lt", "0oF", "31", "bX", "6Og", "4zD", "4wt", "5r4", "oh", "0LZ", "0bv", "AD", "4L9", "4YX", "1NS", "9H", "445", "51u", - "4Kp", "5N0", "Sl", "04V", "09f", "2HM", "67k", "5Va", "4hl", "7Mn", "4x", "0SB", "1Lb", "3yA", "6RN", "4gm", "4IA", "68j", "2GL", "4", - "82O", "d4G", "5A1", "4Dq", "bPn", "a1d", "6I", "0Qs", "lC", "0Oq", "40W", "akn", "6oP", "4Zs", "15t", "Bo", "2YN", "0lm", "4WC", "76I", - "6LL", "4yo", "0BA", "as", "nr", "8DX", "42f", "6CM", "6ma", "4XB", "0cl", "2VO", "Mn", "8gD", "4Ur", "5P2", "ado", "bAm", "1PQ", "cB", - "Rz", "0qH", "4Jf", "7od", "6Qi", "4dJ", "i7", "2jG", "5n", "0RT", "4iz", "7Lx", "4R7", "4GV", "08p", "1y8", "PK", "07q", "4HW", "7mU", - "6SX", "52R", "1Mt", "0H4", "sW", "f6", "4kK", "7NI", "64L", "4Eg", "1nh", "2Kj", "14b", "Cy", "6nF", "5KD", "41A", "7PK", "mU", "x4", - "0CW", "0V6", "591", "4xy", "4VU", "4C4", "NI", "19R", "0bz", "AH", "4L5", "4YT", "43p", "560", "od", "0LV", "w5", "bT", "6Ok", "4zH", - "4Td", "6aG", "Lx", "0oJ", "5xA", "7Mb", "4t", "0SN", "K1", "2HA", "67g", "4FL", "b5G", "aTM", "0e3", "04Z", "8Wf", "9D", "449", "4eP", - "4jQ", "7OS", "6E", "255", "1or", "0j2", "65V", "cno", "4IM", "68f", "QQ", "8", "1Ln", "2il", "6RB", "4ga", "afR", "4yc", "0BM", "23f", - "OS", "Z2", "4WO", "6bl", "aEN", "c4e", "0aQ", "Bc", "lO", "8Fe", "4tS", "4a2", "4n3", "5ks", "8Id", "cN", "Mb", "0nP", "614", "74t", - "6mm", "4XN", "U3", "2VC", "2xo", "0ML", "42j", "6CA", "6Qm", "4dN", "i3", "8Z", "2Do", "05D", "4Jb", "aUS", "4R3", "4GR", "08t", "d7d", - "5j", "0RP", "bSM", "a2G", "ayN", "52V", "1Mp", "0H0", "PO", "07u", "4HS", "69x", "64H", "4Ec", "1nl", "2Kn", "sS", "f2", "4kO", "7NM", - "41E", "7PO", "mQ", "x0", "14f", "2Ul", "6nB", "aQ1", "4VQ", "4C0", "NM", "19V", "0CS", "0V2", "595", "bBN", "43t", "564", "0Y3", "0LR", - "16W", "AL", "4L1", "4YP", "5DA", "6aC", "2Zm", "0oN", "39", "bP", "6Oo", "4zL", "K5", "2HE", "67c", "4FH", "4hd", "7Mf", "4p", "0SJ", - "8Wb", "2kY", "4p5", "4eT", "4Kx", "5N8", "Sd", "0pV", "1ov", "0j6", "5A9", "4Dy", "4jU", "7OW", "6A", "1AZ", "1Lj", "2ih", "6RF", "4ge", - "4II", "68b", "QU", "D4", "OW", "Z6", "4WK", "6bh", "6LD", "4yg", "0BI", "23b", "lK", "0Oy", "4tW", "4a6", "6oX", "5JZ", "0aU", "Bg", - "Mf", "0nT", "4Uz", "74p", "4n7", "5kw", "1PY", "cJ", "nz", "0MH", "42n", "6CE", "6mi", "4XJ", "U7", "2VG", "4MP", "4X1", "UL", "02v", - "0XR", "0M3", "a8E", "57U", "4nL", "7KN", "2X", "c1", "1ko", "2Nm", "61K", "5PA", "4Oa", "6zB", "2Al", "00G", "l0", "yQ", "6Tn", "4aM", - "58T", "a7D", "0i", "0WS", "84o", "ZM", "4W0", "4BQ", "4I2", "5Lr", "13T", "G", "jc", "0IQ", "46w", "537", "6Jl", "5on", "r2", "gS", - "3OO", "0jM", "4Qc", "70i", "6kA", "5NC", "0eL", "2Po", "hR", "8Bx", "44F", "6Em", "abO", "49v", "0FP", "eb", "KN", "8ad", "4SR", "4F3", - "3B", "0Tx", "4oV", "4z7", "60Q", "4Az", "0zT", "Yf", "TV", "A7", "4LJ", "6yi", "6WE", "4bf", "0YH", "zz", "1s", "0VI", "4mg", "6XD", - "6vh", "4CK", "N6", "2MF", "Vg", "0uU", "6n9", "7ky", "4u6", "5pv", "1KX", "xK", "1UZ", "fI", "4k4", "5nt", "4Py", "5U9", "He", "0kW", - "P4", "EU", "6hj", "5Mh", "47m", "6FF", "ky", "0HK", "0GJ", "dx", "6IG", "48l", "4RH", "6gk", "JT", "0if", "0dV", "Gd", "5Z8", "5OY", - "4qT", "4d5", "iH", "0Jz", "0XV", "0M7", "5f8", "4cx", "4MT", "4X5", "UH", "02r", "1kk", "Xx", "61O", "5PE", "4nH", "7KJ", "vT", "c5", - "l4", "yU", "6Tj", "4aI", "4Oe", "6zF", "Wy", "00C", "1iZ", "ZI", "4W4", "4BU", "4ly", "5i9", "0m", "0WW", "jg", "0IU", "46s", "533", - "4I6", "5Lv", "0gy", "C", "3OK", "0jI", "4Qg", "6dD", "6Jh", "5oj", "r6", "gW", "hV", "0Kd", "44B", "6Ei", "6kE", "5NG", "0eH", "Fz", - "KJ", "0hx", "4SV", "4F7", "6HY", "49r", "0FT", "ef", "60U", "ckl", "0zP", "Yb", "3F", "206", "4oR", "4z3", "6WA", "4bb", "0YL", "2lo", - "TR", "A3", "4LN", "6ym", "62d", "4CO", "N2", "2MB", "1w", "0VM", "4mc", "7Ha", "4u2", "54z", "8Re", "xO", "Vc", "01Y", "b0D", "aQN", - "647", "71w", "Ha", "0kS", "8Lg", "fM", "4k0", "5np", "47i", "6FB", "29d", "0HO", "P0", "EQ", "6hn", "5Ml", "4RL", "6go", "JP", "0ib", - "0GN", "26e", "6IC", "48h", "45X", "4d1", "iL", "8Cf", "0dR", "0q3", "hYt", "beO", "4nD", "7KF", "2P", "c9", "1kg", "Xt", "61C", "5PI", - "4MX", "4X9", "UD", "0vv", "0XZ", "2my", "5f4", "4ct", "4lu", "5i5", "0a", "1Gz", "0yw", "ZE", "4W8", "4BY", "4Oi", "6zJ", "Wu", "00O", - "l8", "yY", "6Tf", "4aE", "6Jd", "5of", "62", "25B", "Iw", "0jE", "4Qk", "6dH", "6ix", "5Lz", "0gu", "O", "jk", "0IY", "4rw", "5w7", - "5x6", "5mW", "0FX", "ej", "KF", "0ht", "4SZ", "6fy", "6kI", "5NK", "0eD", "Fv", "hZ", "93", "44N", "6Ee", "2BO", "03d", "4LB", "6ya", - "6WM", "4bn", "1Ia", "zr", "3J", "0Tp", "bUm", "a4g", "5D2", "4Ar", "87L", "Yn", "Vo", "01U", "4Ns", "5K3", "416", "54v", "1KP", "xC", - "us", "0VA", "4mo", "6XL", "62h", "4CC", "0xm", "2MN", "0fo", "2SL", "6hb", "bgr", "47e", "6FN", "kq", "0HC", "0Es", "fA", "aal", "bDn", - "4Pq", "5U1", "Hm", "8bG", "10w", "Gl", "5Z0", "5OQ", "45T", "anm", "1O2", "0Jr", "0GB", "dp", "6IO", "48d", "5Ba", "6gc", "3Ll", "0in", - "1kc", "Xp", "61G", "5PM", "bTs", "7KB", "2T", "0Un", "8QF", "39T", "5f0", "4cp", "797", "aRm", "1s2", "02z", "0ys", "ZA", "63v", "766", - "4lq", "5i1", "0e", "9Nf", "0Zo", "2oL", "6Tb", "4aA", "4Om", "6zN", "Wq", "00K", "Is", "0jA", "4Qo", "6dL", "7ZA", "5ob", "66", "25F", - "jo", "9Pd", "4rs", "5w3", "aCn", "bfl", "0gq", "K", "KB", "0hp", "bim", "72T", "5x2", "49z", "327", "en", "3nn", "97", "44J", "6Ea", - "6kM", "5NO", "11i", "Fr", "6WI", "4bj", "0YD", "zv", "TZ", "0wh", "4LF", "6ye", "5D6", "4Av", "0zX", "Yj", "3N", "0Tt", "4oZ", "6Zy", - "412", "54r", "1KT", "xG", "Vk", "01Q", "4Nw", "5K7", "62l", "4CG", "0xi", "2MJ", "uw", "0VE", "4mk", "6XH", "47a", "6FJ", "ku", "0HG", - "P8", "EY", "6hf", "5Md", "4Pu", "5U5", "Hi", "8bC", "0Ew", "fE", "4k8", "5nx", "45P", "4d9", "iD", "0Jv", "0dZ", "Gh", "5Z4", "5OU", - "4RD", "6gg", "JX", "0ij", "0GF", "dt", "6IK", "5lI", "4Op", "5J0", "Wl", "00V", "0Zr", "2oQ", "405", "55u", "4ll", "6YO", "0x", "0WB", - "0yn", "2LM", "63k", "5Ra", "4MA", "6xb", "2CL", "02g", "0XC", "39I", "6VN", "4cm", "bTn", "a5d", "2I", "0Us", "86O", "Xm", "5E1", "5PP", - "6kP", "5NR", "11t", "Fo", "hC", "0Kq", "44W", "aon", "6HL", "49g", "0FA", "es", "3Mo", "0hm", "4SC", "72I", "6ia", "5Lc", "0gl", "V", - "jr", "1Ya", "46f", "6GM", "hyV", "bEm", "0Dp", "gB", "In", "8cD", "4Qr", "5T2", "1b", "0VX", "4mv", "5h6", "62q", "4CZ", "0xt", "2MW", - "Vv", "01L", "4Nj", "7kh", "6Ue", "54o", "1KI", "xZ", "3S", "0Ti", "4oG", "6Zd", "6tH", "4Ak", "0zE", "Yw", "TG", "0wu", "780", "6yx", - "5g7", "4bw", "0YY", "zk", "1Wz", "di", "5y5", "5lT", "4RY", "4G8", "JE", "0iw", "0dG", "Gu", "6jJ", "5OH", "45M", "6Df", "iY", "80", - "71", "fX", "6Kg", "5ne", "4Ph", "6eK", "Ht", "0kF", "0fv", "ED", "4H9", "5My", "4st", "5v4", "kh", "0HZ", "0Zv", "yD", "401", "4aX", - "4Ot", "5J4", "Wh", "00R", "O9", "ZX", "63o", "4BD", "4lh", "6YK", "tt", "0WF", "0XG", "2md", "6VJ", "4ci", "4ME", "6xf", "UY", "02c", - "1kz", "Xi", "5E5", "5PT", "4nY", "aqh", "2M", "0Uw", "hG", "0Ku", "44S", "6Ex", "6kT", "5NV", "0eY", "Fk", "3Mk", "0hi", "4SG", "6fd", - "6HH", "49c", "0FE", "ew", "jv", "0ID", "46b", "6GI", "6ie", "5Lg", "0gh", "R", "Ij", "0jX", "4Qv", "5T6", "6Jy", "7O9", "0Dt", "gF", - "62u", "775", "0xp", "198", "1f", "9Oe", "4mr", "5h2", "6Ua", "54k", "1KM", "2nO", "Vr", "01H", "4Nn", "7kl", "60D", "4Ao", "0zA", "Ys", - "3W", "0Tm", "4oC", "7JA", "5g3", "4bs", "8PE", "zo", "TC", "03y", "784", "aSn", "bhn", "73W", "JA", "0is", "334", "dm", "5y1", "48y", - "45I", "6Db", "3om", "84", "0dC", "Gq", "6jN", "5OL", "4Pl", "6eO", "Hp", "0kB", "75", "24E", "6Kc", "5na", "47x", "528", "kl", "8AF", - "0fr", "1c2", "aBm", "bgo", "4ld", "6YG", "0p", "0WJ", "O5", "ZT", "63c", "4BH", "4Ox", "5J8", "Wd", "0tV", "0Zz", "yH", "4t5", "4aT", - "4nU", "7KW", "2A", "1EZ", "1kv", "Xe", "5E9", "5PX", "4MI", "6xj", "UU", "02o", "0XK", "2mh", "6VF", "4ce", "6HD", "49o", "0FI", "27b", - "KW", "0he", "4SK", "6fh", "6kX", "5NZ", "0eU", "Fg", "hK", "0Ky", "4pW", "4e6", "4j7", "5ow", "0Dx", "gJ", "If", "0jT", "4Qz", "6dY", - "6ii", "5Lk", "Q7", "DV", "jz", "0IH", "46n", "6GE", "3PN", "01D", "4Nb", "aQS", "6Um", "54g", "m3", "xR", "1j", "0VP", "59W", "a6G", - "4V3", "4CR", "85l", "194", "TO", "03u", "4LS", "4Y2", "a9F", "56V", "0YQ", "zc", "wS", "b2", "4oO", "6Zl", "60H", "4Ac", "0zM", "2On", - "0dO", "2Ql", "6jB", "aU1", "45E", "6Dn", "iQ", "88", "0GS", "da", "acL", "48u", "4RQ", "4G0", "JM", "94N", "12W", "EL", "4H1", "5Mq", - "47t", "524", "29y", "0HR", "79", "fP", "6Ko", "5nm", "aZ0", "6eC", "3NL", "0kN", "O1", "ZP", "63g", "4BL", "58I", "6YC", "0t", "0WN", - "8Sf", "yL", "409", "4aP", "b1G", "aPM", "0a3", "00Z", "1kr", "Xa", "61V", "bzN", "4nQ", "7KS", "2E", "215", "0XO", "2ml", "6VB", "4ca", - "4MM", "6xn", "UQ", "02k", "KS", "0ha", "4SO", "6fl", "7Xa", "49k", "0FM", "27f", "hO", "8Be", "4pS", "4e2", "aAN", "bdL", "0eQ", "Fc", - "Ib", "0jP", "654", "70t", "4j3", "5os", "8Md", "gN", "28g", "0IL", "46j", "6GA", "6im", "5Lo", "Q3", "Z", "6Ui", "54c", "m7", "xV", - "Vz", "0uH", "4Nf", "7kd", "4V7", "4CV", "0xx", "190", "1n", "0VT", "4mz", "6XY", "6WX", "56R", "0YU", "zg", "TK", "03q", "4LW", "4Y6", - "60L", "4Ag", "0zI", "2Oj", "wW", "b6", "4oK", "6Zh", "45A", "6Dj", "iU", "0Jg", "0dK", "Gy", "6jF", "5OD", "4RU", "4G4", "JI", "1yZ", - "0GW", "de", "5y9", "48q", "47p", "520", "kd", "0HV", "0fz", "EH", "4H5", "5Mu", "4Pd", "6eG", "Hx", "0kJ", "s5", "fT", "6Kk", "5ni", - "5Y1", "5LP", "13v", "e", "jA", "0Is", "46U", "aml", "6JN", "5oL", "0DC", "gq", "3Om", "0jo", "4QA", "6db", "6kc", "5Na", "0en", "2PM", - "hp", "0KB", "44d", "6EO", "abm", "49T", "0Fr", "1C2", "Kl", "8aF", "4Sp", "5V0", "4Mr", "5H2", "Un", "02T", "0Xp", "2mS", "427", "57w", - "4nn", "7Kl", "2z", "1Ea", "1kM", "2NO", "61i", "5Pc", "4OC", "7jA", "2AN", "00e", "0ZA", "ys", "6TL", "4ao", "58v", "a7f", "0K", "0Wq", - "84M", "Zo", "5G3", "4Bs", "0EY", "fk", "6KT", "5nV", "bjh", "6ex", "HG", "0ku", "0fE", "Ew", "6hH", "5MJ", "47O", "6Fd", "29B", "0Hi", - "53", "dZ", "6Ie", "48N", "4Rj", "6gI", "Jv", "0iD", "0dt", "GF", "6jy", "7o9", "4qv", "5t6", "ij", "0JX", "wh", "0TZ", "4ot", "5j4", - "4T9", "4AX", "0zv", "YD", "Tt", "03N", "4Lh", "6yK", "6Wg", "4bD", "o9", "zX", "1Q", "0Vk", "4mE", "6Xf", "62B", "4Ci", "0xG", "2Md", - "VE", "0uw", "4NY", "aQh", "5e5", "5pT", "1Kz", "xi", "jE", "0Iw", "46Q", "4g8", "5Y5", "5LT", "13r", "a", "IY", "0jk", "4QE", "6df", - "6JJ", "5oH", "0DG", "gu", "ht", "0KF", "4ph", "6EK", "6kg", "5Ne", "S9", "FX", "Kh", "0hZ", "4St", "5V4", "4h9", "49P", "0Fv", "eD", - "0Xt", "2mW", "423", "4cZ", "4Mv", "5H6", "Uj", "02P", "1kI", "XZ", "61m", "5Pg", "4nj", "7Kh", "vv", "0UD", "0ZE", "yw", "6TH", "4ak", - "4OG", "6zd", "2AJ", "00a", "0yY", "Zk", "5G7", "4Bw", "58r", "6Yx", "0O", "0Wu", "bjl", "71U", "HC", "0kq", "316", "fo", "6KP", "5nR", - "47K", "7VA", "29F", "0Hm", "0fA", "Es", "6hL", "5MN", "4Rn", "6gM", "Jr", "1ya", "57", "26G", "6Ia", "48J", "45z", "5t2", "in", "8CD", - "0dp", "GB", "hYV", "bem", "60w", "757", "0zr", "2OQ", "3d", "9Mg", "4op", "5j0", "6Wc", "56i", "0Yn", "2lM", "Tp", "03J", "4Ll", "6yO", - "62F", "4Cm", "0xC", "dwS", "1U", "0Vo", "4mA", "6Xb", "5e1", "54X", "8RG", "xm", "VA", "0us", "b0f", "aQl", "6JF", "5oD", "0DK", "gy", - "IU", "0jg", "4QI", "6dj", "5Y9", "5LX", "0gW", "m", "jI", "1YZ", "4rU", "4g4", "4h5", "5mu", "0Fz", "eH", "Kd", "0hV", "4Sx", "5V8", - "6kk", "5Ni", "S5", "FT", "hx", "0KJ", "44l", "6EG", "4nf", "7Kd", "2r", "0UH", "M7", "XV", "61a", "5Pk", "4Mz", "6xY", "Uf", "0vT", - "0Xx", "39r", "4v7", "4cV", "4lW", "4y6", "0C", "0Wy", "0yU", "Zg", "63P", "5RZ", "4OK", "6zh", "WW", "B6", "0ZI", "2oj", "6TD", "4ag", - "0fM", "2Sn", "7xa", "5MB", "47G", "6Fl", "kS", "0Ha", "0EQ", "fc", "aaN", "bDL", "4PS", "4E2", "HO", "8be", "10U", "GN", "4J3", "5Os", - "45v", "506", "ib", "0JP", "q3", "dR", "6Im", "48F", "4Rb", "6gA", "3LN", "0iL", "2Bm", "03F", "aF0", "6yC", "6Wo", "4bL", "o1", "zP", - "3h", "0TR", "bUO", "a4E", "4T1", "4AP", "87n", "YL", "VM", "01w", "4NQ", "7kS", "hfu", "54T", "1Kr", "xa", "1Y", "0Vc", "4mM", "6Xn", - "62J", "4Ca", "0xO", "2Ml", "IQ", "0jc", "4QM", "6dn", "6JB", "a19", "0DO", "25d", "jM", "9PF", "46Y", "4g0", "aCL", "687", "0gS", "i", - "3MP", "0hR", "676", "72v", "4h1", "49X", "8Of", "eL", "3nL", "0KN", "44h", "6EC", "6ko", "5Nm", "S1", "FP", "M3", "XR", "61e", "5Po", - "4nb", "aqS", "2v", "0UL", "8Qd", "39v", "4v3", "4cR", "b3E", "aRO", "Ub", "02X", "0yQ", "Zc", "63T", "bxL", "4lS", "4y2", "0G", "237", - "0ZM", "2on", "7Da", "4ac", "4OO", "6zl", "WS", "B2", "47C", "6Fh", "kW", "0He", "0fI", "2Sj", "6hD", "5MF", "4PW", "4E6", "HK", "0ky", - "0EU", "fg", "6KX", "5nZ", "45r", "502", "if", "0JT", "0dx", "GJ", "4J7", "5Ow", "4Rf", "6gE", "Jz", "0iH", "q7", "dV", "6Ii", "48B", - "6Wk", "4bH", "o5", "zT", "Tx", "03B", "4Ld", "6yG", "4T5", "4AT", "0zz", "YH", "3l", "0TV", "4ox", "5j8", "5e9", "54P", "1Kv", "xe", - "VI", "01s", "4NU", "7kW", "62N", "4Ce", "0xK", "2Mh", "uU", "0Vg", "4mI", "6Xj", "4K0", "5Np", "11V", "FM", "ha", "0KS", "44u", "515", - "6Hn", "49E", "48", "eQ", "3MM", "0hO", "4Sa", "6fB", "6iC", "5LA", "0gN", "t", "jP", "0Ib", "46D", "6Go", "hyt", "bEO", "0DR", "0Q3", - "IL", "8cf", "4QP", "4D1", "4OR", "4Z3", "WN", "00t", "0ZP", "yb", "hgv", "55W", "4lN", "6Ym", "0Z", "a3", "0yL", "2Lo", "63I", "4Bb", - "4Mc", "7ha", "2Cn", "02E", "n2", "2mB", "6Vl", "4cO", "bTL", "a5F", "2k", "0UQ", "86m", "XO", "4U2", "5Pr", "0Gy", "dK", "4i6", "5lv", - "5BZ", "6gX", "Jg", "0iU", "R6", "GW", "6jh", "5Oj", "45o", "6DD", "3oK", "0JI", "0EH", "fz", "6KE", "5nG", "4PJ", "6ei", "HV", "0kd", - "0fT", "Ef", "6hY", "690", "4sV", "4f7", "kJ", "0Hx", "uH", "0Vz", "4mT", "4x5", "5F8", "4Cx", "0xV", "0m7", "VT", "C5", "4NH", "7kJ", - "6UG", "54M", "1Kk", "xx", "3q", "0TK", "4oe", "6ZF", "60b", "4AI", "L4", "YU", "Te", "0wW", "4Ly", "5I9", "4w4", "4bU", "1IZ", "zI", - "he", "0KW", "44q", "511", "4K4", "5Nt", "11R", "FI", "Ky", "0hK", "4Se", "6fF", "6Hj", "49A", "p4", "eU", "jT", "0If", "4rH", "6Gk", - "6iG", "5LE", "0gJ", "p", "IH", "0jz", "4QT", "4D5", "5z8", "5oY", "0DV", "gd", "0ZT", "yf", "6TY", "4az", "4OV", "4Z7", "WJ", "00p", - "0yH", "Zz", "63M", "4Bf", "4lJ", "6Yi", "tV", "a7", "n6", "2mF", "6Vh", "4cK", "4Mg", "6xD", "2Cj", "02A", "1kX", "XK", "4U6", "5Pv", - "6N9", "7Ky", "2o", "0UU", "665", "73u", "Jc", "0iQ", "8Ne", "dO", "4i2", "5lr", "45k", "7Ta", "3oO", "0JM", "R2", "GS", "6jl", "5On", - "4PN", "6em", "HR", "8bx", "0EL", "24g", "6KA", "5nC", "47Z", "4f3", "kN", "8Ad", "0fP", "Eb", "aBO", "694", "62W", "byO", "0xR", "0m3", - "1D", "224", "4mP", "4x1", "6UC", "54I", "1Ko", "2nm", "VP", "C1", "4NL", "7kN", "60f", "4AM", "L0", "YQ", "3u", "0TO", "4oa", "6ZB", - "438", "4bQ", "8Pg", "zM", "Ta", "0wS", "b2F", "aSL", "6Hf", "49M", "40", "eY", "Ku", "0hG", "4Si", "6fJ", "4K8", "5Nx", "0ew", "FE", - "hi", "8BC", "4pu", "5u5", "5z4", "5oU", "0DZ", "gh", "ID", "0jv", "4QX", "4D9", "6iK", "5LI", "0gF", "Dt", "jX", "0Ij", "46L", "6Gg", - "4lF", "6Ye", "0R", "0Wh", "0yD", "Zv", "63A", "4Bj", "4OZ", "6zy", "WF", "0tt", "0ZX", "yj", "5d6", "4av", "4nw", "5k7", "2c", "0UY", - "1kT", "XG", "61p", "5Pz", "4Mk", "6xH", "Uw", "02M", "0Xi", "2mJ", "6Vd", "4cG", "0dm", "2QN", "7zA", "5Ob", "45g", "6DL", "is", "0JA", - "0Gq", "dC", "acn", "48W", "4Rs", "5W3", "Jo", "94l", "12u", "En", "5X2", "5MS", "47V", "alo", "kB", "0Hp", "1Ua", "fr", "6KM", "5nO", - "4PB", "6ea", "3Nn", "0kl", "3Pl", "01f", "bts", "7kB", "6UO", "54E", "1Kc", "xp", "1H", "0Vr", "59u", "a6e", "5F0", "4Cp", "85N", "d3F", - "Tm", "03W", "4Lq", "5I1", "434", "56t", "0Ys", "zA", "3y", "0TC", "4om", "6ZN", "60j", "4AA", "0zo", "2OL", "Kq", "0hC", "4Sm", "6fN", - "6Hb", "49I", "44", "27D", "hm", "8BG", "44y", "519", "aAl", "bdn", "0es", "FA", "1o2", "0jr", "bko", "70V", "5z0", "5oQ", "305", "gl", - "28E", "0In", "46H", "6Gc", "6iO", "5LM", "0gB", "x", "1ia", "Zr", "63E", "4Bn", "4lB", "6Ya", "0V", "0Wl", "8SD", "yn", "5d2", "4ar", - "b1e", "aPo", "WB", "00x", "1kP", "XC", "61t", "744", "4ns", "5k3", "2g", "9Ld", "0Xm", "2mN", "7FA", "4cC", "4Mo", "6xL", "Us", "02I", - "45c", "6DH", "iw", "0JE", "0di", "2QJ", "6jd", "5Of", "4Rw", "5W7", "Jk", "0iY", "0Gu", "dG", "6Ix", "48S", "47R", "6Fy", "kF", "0Ht", - "0fX", "Ej", "5X6", "5MW", "4PF", "6ee", "HZ", "0kh", "0ED", "fv", "6KI", "5nK", "6UK", "54A", "1Kg", "xt", "VX", "C9", "4ND", "7kF", - "5F4", "4Ct", "0xZ", "2My", "1L", "0Vv", "4mX", "4x9", "430", "4bY", "0Yw", "zE", "Ti", "03S", "4Lu", "5I5", "60n", "4AE", "L8", "YY", - "wu", "0TG", "4oi", "6ZJ"}; + "06S", "Qi", "5L5", "4Iu", "4gY", "460", "1Y7", "1LV", "0QG", "ru", "7Ok", "4ji", "4DE", "65n", "2JH", "I8", + "F9", "SX", "7nF", "4KD", "4eh", "6PK", "2ke", "1Ng", "0Sv", "4L", "491", "4hX", "4Ft", "5C4", "2Hy", "09R", + "021", "0cX", "4Xv", "6mU", "6Cy", "42R", "0Mt", "nF", "cv", "1Pe", "5kK", "6NI", "74L", "4UF", "0nh", "MZ", + "2TJ", "0ai", "4ZG", "6od", "6AH", "40c", "0OE", "lw", "aG", "0Bu", "5iz", "6Lx", "5R7", "4Ww", "0lY", "Ok", + "5n3", "4ks", "8YE", "7g", "2KR", "1nP", "714", "64t", "69D", "4Ho", "07I", "Ps", "2hN", "1ML", "4fC", "7CA", + "avs", "4iB", "0Rl", "5V", "2Ic", "08H", "4Gn", "66E", "aUo", "b4e", "05x", "RB", "8f", "8VD", "4dr", "5a2", + "4zp", "6OS", "bl", "355", "0or", "1j2", "75V", "bno", "4Yl", "6lO", "Ap", "0bB", "0Ln", "2yM", "6Bc", "43H", + "4xA", "6Mb", "22D", "14", "0mC", "Nq", "6cN", "4Vm", "ban", "aDl", "CA", "14Z", "8GG", "mm", "549", "41y", + "53t", "464", "1Y3", "1LR", "06W", "Qm", "5L1", "4Iq", "4DA", "65j", "2JL", "1oN", "0QC", "6y", "7Oo", "4jm", + "4el", "6PO", "9x", "1Nc", "04f", "2EM", "7nB", "bqs", "4Fp", "5C0", "d6F", "09V", "0Sr", "4H", "495", "bRo", + "aio", "42V", "0Mp", "nB", "025", "17u", "4Xr", "6mQ", "74H", "4UB", "0nl", "3Kn", "cr", "1Pa", "5kO", "6NM", + "6AL", "40g", "0OA", "ls", "2TN", "0am", "4ZC", "aEr", "5R3", "4Ws", "18t", "Oo", "aC", "0Bq", "bCl", "afn", + "2KV", "1nT", "5Uz", "64p", "5n7", "4kw", "0PY", "7c", "2hJ", "1MH", "4fG", "6Sd", "7mi", "4Hk", "07M", "Pw", + "2Ig", "08L", "4Gj", "66A", "7LD", "4iF", "0Rh", "5R", "8b", "1Oy", "4dv", "5a6", "7oX", "4JZ", "0qt", "RF", + "0ov", "LD", "4A9", "4TX", "4zt", "6OW", "bh", "0AZ", "z9", "oX", "6Bg", "43L", "4Yh", "6lK", "At", "0bF", + "0mG", "Nu", "6cJ", "4Vi", "4xE", "6Mf", "2vH", "10", "8GC", "mi", "5p5", "4uu", "5Kx", "4N8", "CE", "1pV", + "0QO", "6u", "7Oc", "4ja", "4DM", "65f", "3Za", "I0", "0rS", "Qa", "68V", "b7F", "4gQ", "468", "dSo", "285", + "274", "4D", "499", "4hP", "b8G", "67W", "0h3", "09Z", "F1", "SP", "7nN", "4KL", "51I", "6PC", "9t", "1No", + "21g", "1Pm", "5kC", "6NA", "74D", "4UN", "X3", "MR", "029", "0cP", "bbM", "79t", "4c3", "42Z", "8Dd", "nN", + "aO", "8Ke", "4yS", "4l2", "76u", "635", "0lQ", "Oc", "BS", "W2", "4ZO", "6ol", "7Qa", "40k", "0OM", "2zn", + "69L", "4Hg", "07A", "2Fj", "2hF", "k6", "4fK", "6Sh", "7Ny", "6K9", "0PU", "7o", "2KZ", "1nX", "4EW", "4P6", + "7oT", "4JV", "05p", "RJ", "8n", "1Ou", "4dz", "6QY", "7LH", "4iJ", "d7", "qV", "2Ik", "1li", "4Gf", "66M", + "4Yd", "6lG", "Ax", "0bJ", "z5", "oT", "6Bk", "4wH", "4zx", "aeI", "bd", "0AV", "0oz", "LH", "4A5", "4TT", + "5Kt", "4N4", "CI", "14R", "0NW", "me", "541", "41q", "4xI", "6Mj", "22L", "u4", "0mK", "Ny", "6cF", "4Ve", + "4DI", "65b", "2JD", "I4", "0QK", "6q", "7Og", "4je", "4gU", "4r4", "2iX", "1LZ", "0rW", "Qe", "5L9", "4Iy", + "4Fx", "5C8", "0h7", "1mw", "0Sz", "pH", "7MV", "4hT", "4ed", "6PG", "9p", "1Nk", "F5", "ST", "7nJ", "4KH", + "7pH", "4UJ", "X7", "MV", "cz", "1Pi", "5kG", "6NE", "4c7", "4vV", "0Mx", "nJ", "0v5", "0cT", "4Xz", "6mY", + "6bX", "5GZ", "0lU", "Og", "aK", "0By", "4yW", "4l6", "6AD", "40o", "0OI", "2zj", "BW", "W6", "4ZK", "6oh", + "2hB", "k2", "4fO", "6Sl", "69H", "4Hc", "07E", "2Fn", "d5e", "83m", "4ES", "4P2", "a0F", "bQL", "0PQ", "7k", + "8j", "1Oq", "50W", "hbv", "7oP", "4JR", "05t", "RN", "2Io", "08D", "4Gb", "66I", "7LL", "4iN", "d3", "5Z", + "z1", "oP", "6Bo", "43D", "5IA", "6lC", "2Wm", "0bN", "8ff", "LL", "4A1", "4TP", "cPn", "aeM", "0T3", "0AR", + "0NS", "ma", "545", "41u", "5Kp", "4N0", "CM", "14V", "0mO", "2Xl", "6cB", "4Va", "4xM", "6Mn", "22H", "18", + "04s", "SI", "7nW", "4KU", "4ey", "6PZ", "9m", "1Nv", "e4", "pU", "7MK", "4hI", "4Fe", "67N", "2Hh", "09C", + "06B", "Qx", "68O", "4Id", "4gH", "6Rk", "2iE", "j5", "0QV", "6l", "5o8", "4jx", "4DT", "4Q5", "2JY", "82j", + "BJ", "0ax", "4ZV", "4O7", "552", "40r", "0OT", "lf", "aV", "t7", "4yJ", "6Li", "6bE", "4Wf", "0lH", "Oz", + "2Vj", "0cI", "4Xg", "6mD", "6Ch", "42C", "0Me", "nW", "cg", "1Pt", "5kZ", "6NX", "7pU", "4UW", "0ny", "MK", + "7LQ", "4iS", "267", "5G", "0i0", "08Y", "b9D", "66T", "7oM", "4JO", "G2", "RS", "8w", "1Ol", "4dc", "7Aa", + "atS", "4kb", "0PL", "7v", "2KC", "H3", "4EN", "64e", "69U", "b6E", "07X", "Pb", "dRl", "296", "4fR", "4s3", + "4xP", "4m1", "22U", "8Jf", "0mR", "0x3", "77v", "626", "5Km", "6no", "CP", "V1", "0NN", "3kL", "7Pb", "41h", + "4za", "6OB", "20d", "0AO", "Y0", "LQ", "6an", "4TM", "bcN", "78w", "Aa", "0bS", "8Eg", "oM", "4b0", "43Y", + "51T", "azL", "9i", "1Nr", "04w", "SM", "7nS", "4KQ", "4Fa", "67J", "2Hl", "09G", "e0", "4Y", "7MO", "4hM", + "4gL", "6Ro", "2iA", "j1", "06F", "2Gm", "68K", "5YA", "4DP", "4Q1", "d4f", "82n", "0QR", "6h", "a1E", "bPO", + "556", "40v", "0OP", "lb", "BN", "15U", "4ZR", "4O3", "6bA", "4Wb", "0lL", "2Yo", "aR", "t3", "4yN", "6Lm", + "6Cl", "42G", "0Ma", "nS", "2Vn", "0cM", "4Xc", "79i", "74Y", "4US", "8ge", "MO", "cc", "1Pp", "bAL", "adN", + "0i4", "1lt", "5WZ", "66P", "7LU", "4iW", "0Ry", "5C", "8s", "1Oh", "4dg", "6QD", "7oI", "4JK", "G6", "RW", + "2KG", "H7", "4EJ", "64a", "7Nd", "4kf", "0PH", "7r", "1X8", "1MY", "4fV", "4s7", "69Q", "4Hz", "0sT", "Pf", + "0mV", "Nd", "5S8", "4Vx", "4xT", "4m5", "22Q", "0Cz", "0NJ", "mx", "7Pf", "41l", "5Ki", "6nk", "CT", "V5", + "Y4", "LU", "6aj", "4TI", "4ze", "6OF", "by", "0AK", "2l9", "oI", "4b4", "4wU", "4Yy", "6lZ", "Ae", "0bW", + "0So", "4U", "7MC", "4hA", "4Fm", "67F", "3XA", "09K", "0ps", "SA", "aTl", "b5f", "4eq", "6PR", "9e", "8WG", + "8XF", "6d", "5o0", "4jp", "707", "65w", "1z2", "1oS", "06J", "Qp", "68G", "4Il", "53i", "6Rc", "2iM", "1LO", + "23G", "07", "4yB", "6La", "6bM", "4Wn", "18i", "Or", "BB", "0ap", "c4D", "aEo", "5q2", "40z", "8FD", "ln", + "co", "346", "5kR", "6NP", "74U", "bol", "0nq", "MC", "2Vb", "0cA", "4Xo", "6mL", "7SA", "42K", "0Mm", "2xN", + "7oE", "4JG", "05a", "2DJ", "2jf", "1Od", "4dk", "6QH", "482", "5yz", "0Ru", "5O", "0i8", "08Q", "4Gw", "5B7", + "5M6", "4Hv", "07P", "Pj", "1X4", "1MU", "4fZ", "473", "7Nh", "4kj", "0PD", "sv", "2KK", "1nI", "4EF", "64m", + "5Ke", "6ng", "CX", "V9", "0NF", "mt", "7Pj", "4uh", "4xX", "4m9", "1F6", "0Cv", "0mZ", "Nh", "5S4", "4Vt", + "4Yu", "6lV", "Ai", "16r", "0Lw", "oE", "4b8", "43Q", "4zi", "6OJ", "bu", "0AG", "Y8", "LY", "6af", "4TE", + "4Fi", "67B", "2Hd", "09O", "e8", "4Q", "7MG", "4hE", "4eu", "6PV", "9a", "1Nz", "0pw", "SE", "aTh", "4KY", + "4DX", "4Q9", "1z6", "1oW", "0QZ", "rh", "5o4", "4jt", "4gD", "6Rg", "2iI", "j9", "06N", "Qt", "68C", "4Ih", + "6bI", "4Wj", "0lD", "Ov", "aZ", "03", "4yF", "6Le", "5q6", "4tv", "0OX", "lj", "BF", "0at", "4ZZ", "6oy", + "74Q", "5Ez", "0nu", "MG", "ck", "1Px", "5kV", "6NT", "6Cd", "42O", "0Mi", "2xJ", "2Vf", "0cE", "4Xk", "6mH", + "2jb", "8VY", "4do", "6QL", "7oA", "4JC", "05e", "2DN", "d7E", "08U", "4Gs", "5B3", "486", "bSl", "0Rq", "5K", + "1X0", "1MQ", "52w", "477", "5M2", "4Hr", "07T", "Pn", "2KO", "1nM", "4EB", "64i", "7Nl", "4kn", "8YX", "7z", + "0NB", "mp", "7Pn", "41d", "5Ka", "6nc", "2UM", "14G", "19w", "Nl", "5S0", "4Vp", "bBo", "agm", "1F2", "0Cr", + "0Ls", "oA", "ahl", "43U", "4Yq", "6lR", "Am", "16v", "0oo", "2ZL", "6ab", "4TA", "4zm", "6ON", "bq", "0AC", + "2VY", "0cz", "4XT", "4M5", "570", "42p", "0MV", "nd", "cT", "v5", "5ki", "6Nk", "74n", "4Ud", "0nJ", "Mx", + "By", "0aK", "4Ze", "6oF", "6Aj", "40A", "y4", "lU", "ae", "0BW", "4yy", "581", "4B4", "4WU", "18R", "OI", + "06q", "QK", "7lU", "4IW", "53R", "6RX", "0I4", "1Lt", "g6", "rW", "7OI", "4jK", "4Dg", "65L", "2Jj", "1oh", + "0pH", "Sz", "7nd", "4Kf", "4eJ", "6Pi", "2kG", "h7", "0ST", "4n", "7Mx", "4hz", "4FV", "4S7", "1x8", "09p", + "4zR", "4o3", "bN", "8Hd", "0oP", "Lb", "75t", "604", "4YN", "6lm", "AR", "T3", "0LL", "2yo", "6BA", "43j", + "4xc", "agR", "22f", "0CM", "0ma", "NS", "6cl", "4VO", "baL", "aDN", "Cc", "14x", "8Ge", "mO", "7PQ", "4uS", + "7NS", "4kQ", "245", "7E", "0k2", "1nr", "coo", "64V", "69f", "4HM", "E0", "PQ", "2hl", "1Mn", "4fa", "6SB", + "7Lb", "5yA", "0RN", "5t", "2IA", "J1", "4GL", "66g", "aUM", "b4G", "05Z", "0d3", "8D", "8Vf", "4dP", "459", + "574", "42t", "0MR", "0X3", "dln", "17W", "4XP", "4M1", "74j", "5EA", "0nN", "3KL", "cP", "29", "5km", "6No", + "6An", "40E", "y0", "lQ", "2Tl", "0aO", "4Za", "6oB", "4B0", "4WQ", "18V", "OM", "aa", "0BS", "bCN", "585", + "53V", "axN", "0I0", "1Lp", "06u", "QO", "68x", "4IS", "4Dc", "65H", "2Jn", "1ol", "g2", "rS", "7OM", "4jO", + "4eN", "6Pm", "9Z", "h3", "04D", "2Eo", "aTS", "4Kb", "4FR", "4S3", "d6d", "09t", "0SP", "4j", "a3G", "bRM", + "0oT", "Lf", "6aY", "4Tz", "4zV", "4o7", "bJ", "0Ax", "0LH", "oz", "6BE", "43n", "4YJ", "6li", "AV", "T7", + "0me", "NW", "6ch", "4VK", "4xg", "6MD", "22b", "0CI", "0Ny", "mK", "7PU", "4uW", "5KZ", "6nX", "Cg", "1pt", + "0k6", "1nv", "4Ey", "64R", "7NW", "4kU", "241", "7A", "2hh", "1Mj", "4fe", "6SF", "69b", "4HI", "E4", "PU", + "2IE", "J5", "4GH", "66c", "7Lf", "4id", "0RJ", "5p", "2jY", "8Vb", "4dT", "4q5", "5O8", "4Jx", "0qV", "Rd", + "21E", "25", "5ka", "6Nc", "74f", "4Ul", "0nB", "Mp", "1f2", "0cr", "bbo", "79V", "578", "42x", "395", "nl", + "am", "364", "4yq", "589", "76W", "bmn", "0ls", "OA", "Bq", "0aC", "4Zm", "6oN", "6Ab", "40I", "0Oo", "2zL", + "0Qm", "6W", "7OA", "4jC", "4Do", "65D", "2Jb", "82Q", "06y", "QC", "68t", "b7d", "4gs", "5b3", "dSM", "8UE", + "8ZD", "4f", "5m2", "4hr", "725", "67u", "1x0", "09x", "04H", "Sr", "7nl", "4Kn", "4eB", "6Pa", "9V", "1NM", + "4YF", "6le", "AZ", "0bh", "0LD", "ov", "6BI", "43b", "4zZ", "6Oy", "bF", "0At", "0oX", "Lj", "5Q6", "4Tv", + "5KV", "6nT", "Ck", "14p", "0Nu", "mG", "7PY", "41S", "4xk", "6MH", "22n", "0CE", "0mi", "2XJ", "6cd", "4VG", + "69n", "4HE", "E8", "PY", "2hd", "1Mf", "4fi", "6SJ", "ath", "4kY", "0Pw", "7M", "2Kx", "1nz", "4Eu", "6pV", + "5O4", "4Jt", "05R", "Rh", "8L", "1OW", "4dX", "451", "7Lj", "4ih", "0RF", "qt", "2II", "J9", "4GD", "66o", + "74b", "4Uh", "0nF", "Mt", "cX", "21", "5ke", "6Ng", "5s4", "4vt", "0MZ", "nh", "1f6", "0cv", "4XX", "4M9", + "4B8", "4WY", "0lw", "OE", "ai", "1Rz", "4yu", "6LV", "6Af", "40M", "y8", "lY", "Bu", "0aG", "4Zi", "6oJ", + "4Dk", "6qH", "2Jf", "1od", "0Qi", "6S", "7OE", "4jG", "4gw", "5b7", "0I8", "1Lx", "0ru", "QG", "68p", "5Yz", + "4FZ", "67q", "1x4", "1mU", "0SX", "4b", "5m6", "4hv", "4eF", "6Pe", "9R", "1NI", "04L", "Sv", "7nh", "4Kj", + "8EX", "or", "6BM", "43f", "4YB", "6la", "2WO", "0bl", "8fD", "Ln", "5Q2", "4Tr", "cPL", "aeo", "bB", "0Ap", + "0Nq", "mC", "ajn", "41W", "5KR", "6nP", "Co", "14t", "0mm", "2XN", "77I", "4VC", "4xo", "6ML", "22j", "0CA", + "3xA", "1Mb", "4fm", "6SN", "69j", "4HA", "07g", "2FL", "d5G", "83O", "4Eq", "64Z", "a0d", "bQn", "0Ps", "7I", + "8H", "1OS", "50u", "455", "5O0", "4Jp", "05V", "Rl", "2IM", "08f", "5Wa", "66k", "7Ln", "4il", "0RB", "5x", + "Bh", "0aZ", "4Zt", "6oW", "4a9", "40P", "0Ov", "lD", "at", "0BF", "4yh", "6LK", "6bg", "4WD", "Z9", "OX", + "2VH", "U8", "4XE", "6mf", "6CJ", "42a", "0MG", "nu", "cE", "1PV", "5kx", "4n8", "5P5", "4Uu", "8gC", "Mi", + "04Q", "Sk", "5N7", "4Kw", "51r", "442", "9O", "1NT", "0SE", "pw", "7Mi", "4hk", "4FG", "67l", "2HJ", "09a", + "3", "QZ", "68m", "4IF", "4gj", "6RI", "2ig", "1Le", "0Qt", "6N", "7OX", "4jZ", "4Dv", "5A6", "0j9", "1oy", + "4xr", "6MQ", "22w", "377", "0mp", "NB", "77T", "blm", "5KO", "6nM", "Cr", "14i", "0Nl", "3kn", "ajs", "41J", + "4zC", "aer", "20F", "36", "0oA", "Ls", "6aL", "4To", "bcl", "78U", "AC", "0bq", "386", "oo", "5r3", "4ws", + "5l1", "4iq", "9Kf", "5e", "1y3", "1lR", "736", "66v", "7oo", "4Jm", "05K", "Rq", "8U", "1ON", "4dA", "6Qb", + "7NB", "bQs", "0Pn", "7T", "2Ka", "1nc", "4El", "64G", "69w", "b6g", "07z", "1v2", "dRN", "8TF", "4fp", "5c0", + "akm", "40T", "0Or", "1J2", "Bl", "15w", "4Zp", "6oS", "6bc", "5Ga", "0ln", "2YM", "ap", "0BB", "4yl", "6LO", + "6CN", "42e", "0MC", "nq", "2VL", "0co", "4XA", "6mb", "5P1", "4Uq", "8gG", "Mm", "cA", "1PR", "bAn", "adl", + "51v", "446", "9K", "1NP", "04U", "So", "5N3", "4Ks", "4FC", "67h", "2HN", "09e", "0SA", "ps", "7Mm", "4ho", + "4gn", "6RM", "2ic", "1La", "7", "2GO", "68i", "4IB", "4Dr", "5A2", "d4D", "82L", "0Qp", "6J", "a1g", "bPm", + "0mt", "NF", "6cy", "4VZ", "4xv", "6MU", "0V9", "0CX", "0Nh", "mZ", "7PD", "41N", "5KK", "6nI", "Cv", "14m", + "0oE", "Lw", "6aH", "4Tk", "4zG", "6Od", "20B", "32", "0LY", "ok", "5r7", "4ww", "5Iz", "6lx", "AG", "0bu", + "1y7", "1lV", "4GY", "4R8", "5l5", "4iu", "1Bz", "5a", "8Q", "i8", "4dE", "6Qf", "7ok", "4Ji", "05O", "Ru", + "2Ke", "1ng", "4Eh", "64C", "7NF", "4kD", "f9", "7P", "2hy", "3m9", "4ft", "5c4", "69s", "4HX", "0sv", "PD", + "23e", "0BN", "5iA", "6LC", "6bo", "4WL", "Z1", "OP", "0t3", "0aR", "c4f", "aEM", "4a1", "40X", "8Ff", "lL", + "cM", "8Ig", "5kp", "4n0", "74w", "617", "0nS", "Ma", "3Fa", "U0", "4XM", "6mn", "6CB", "42i", "0MO", "2xl", + "0SM", "4w", "7Ma", "4hc", "4FO", "67d", "2HB", "K2", "04Y", "Sc", "aTN", "b5D", "4eS", "4p2", "9G", "8We", + "256", "6F", "7OP", "4jR", "cnl", "65U", "0j1", "1oq", "D3", "QR", "68e", "4IN", "4gb", "6RA", "2io", "1Lm", + "5KG", "6nE", "Cz", "14a", "x7", "mV", "7PH", "41B", "4xz", "592", "0V5", "0CT", "0mx", "NJ", "4C7", "4VV", + "4YW", "4L6", "AK", "0by", "0LU", "og", "563", "43s", "4zK", "6Oh", "bW", "w6", "0oI", "2Zj", "6aD", "4Tg", + "7og", "4Je", "05C", "Ry", "2jD", "i4", "4dI", "6Qj", "5l9", "4iy", "0RW", "5m", "2IX", "08s", "4GU", "4R4", + "7mV", "4HT", "07r", "PH", "0H7", "1Mw", "4fx", "5c8", "7NJ", "4kH", "f5", "sT", "2Ki", "1nk", "4Ed", "64O", + "6bk", "4WH", "Z5", "OT", "ax", "0BJ", "4yd", "6LG", "4a5", "4tT", "0Oz", "lH", "Bd", "0aV", "4Zx", "aEI", + "5P9", "4Uy", "0nW", "Me", "cI", "1PZ", "5kt", "4n4", "6CF", "42m", "0MK", "ny", "2VD", "U4", "4XI", "6mj", + "4FK", "6sh", "2HF", "K6", "0SI", "4s", "7Me", "4hg", "4eW", "4p6", "9C", "1NX", "0pU", "Sg", "7ny", "6k9", + "4Dz", "65Q", "0j5", "1ou", "0Qx", "6B", "7OT", "4jV", "4gf", "6RE", "2ik", "1Li", "D7", "QV", "68a", "4IJ", + "x3", "mR", "7PL", "41F", "5KC", "6nA", "2Uo", "14e", "19U", "NN", "4C3", "4VR", "bBM", "596", "0V1", "0CP", + "0LQ", "oc", "567", "43w", "4YS", "4L2", "AO", "16T", "0oM", "2Zn", "75i", "4Tc", "4zO", "6Ol", "bS", "w2", + "8Y", "i0", "4dM", "6Qn", "7oc", "4Ja", "05G", "2Dl", "d7g", "08w", "4GQ", "4R0", "a2D", "bSN", "0RS", "5i", + "0H3", "1Ms", "52U", "ayM", "7mR", "4HP", "07v", "PL", "2Km", "1no", "5UA", "64K", "7NN", "4kL", "f1", "7X", + "5nw", "4k7", "fJ", "0Ex", "0kT", "Hf", "6eY", "4Pz", "5Mk", "6hi", "EV", "P7", "0HH", "kz", "6FE", "47n", + "48o", "6ID", "26b", "0GI", "0ie", "JW", "6gh", "4RK", "5OZ", "6jX", "Gg", "0dU", "0Jy", "iK", "4d6", "4qW", + "4z4", "4oU", "1DZ", "3A", "Ye", "0zW", "4Ay", "5D9", "6yj", "4LI", "A4", "TU", "zy", "0YK", "4be", "6WF", + "6XG", "4md", "0VJ", "1p", "2ME", "N5", "4CH", "62c", "5K8", "4Nx", "0uV", "Vd", "xH", "8Rb", "5pu", "4u5", + "D", "13W", "5Lq", "4I1", "534", "46t", "0IR", "28y", "gP", "69", "5om", "6Jo", "6dC", "5AA", "0jN", "3OL", + "2Pl", "0eO", "aT1", "6kB", "6En", "44E", "98", "hQ", "ea", "0FS", "49u", "abL", "4F0", "4SQ", "8ag", "KM", + "02u", "UO", "4X2", "4MS", "57V", "a8F", "0M0", "0XQ", "c2", "vS", "7KM", "4nO", "5PB", "61H", "2Nn", "1kl", + "00D", "2Ao", "6zA", "4Ob", "4aN", "6Tm", "yR", "l3", "0WP", "0j", "a7G", "58W", "4BR", "4W3", "ZN", "84l", + "0kP", "Hb", "71t", "644", "5ns", "4k3", "fN", "8Ld", "0HL", "29g", "6FA", "47j", "5Mo", "6hm", "ER", "P3", + "0ia", "JS", "6gl", "4RO", "48k", "7Ya", "26f", "0GM", "8Ce", "iO", "4d2", "4qS", "beL", "hYw", "Gc", "0dQ", + "Ya", "0zS", "cko", "60V", "4z0", "4oQ", "205", "3E", "2ll", "0YO", "4ba", "6WB", "6yn", "4LM", "A0", "TQ", + "2MA", "N1", "4CL", "62g", "6XC", "59I", "0VN", "1t", "xL", "8Rf", "54y", "419", "aQM", "b0G", "01Z", "3PP", + "530", "46p", "0IV", "jd", "DH", "0gz", "5Lu", "4I5", "6dG", "4Qd", "0jJ", "Ix", "gT", "r5", "5oi", "6Jk", + "6Ej", "44A", "0Kg", "hU", "Fy", "0eK", "5ND", "6kF", "4F4", "4SU", "1xZ", "KI", "ee", "0FW", "49q", "5x9", + "57R", "6VX", "0M4", "0XU", "02q", "UK", "4X6", "4MW", "5PF", "61L", "2Nj", "1kh", "c6", "vW", "7KI", "4nK", + "4aJ", "6Ti", "yV", "l7", "0tH", "Wz", "6zE", "4Of", "4BV", "4W7", "ZJ", "0yx", "0WT", "0n", "6YY", "4lz", + "5Mc", "6ha", "2SO", "0fl", "1Xa", "kr", "6FM", "47f", "bDm", "aao", "fB", "0Ep", "8bD", "Hn", "5U2", "4Pr", + "5OR", "5Z3", "Go", "10t", "0Jq", "iC", "ann", "45W", "48g", "6IL", "ds", "0GA", "0im", "3Lo", "73I", "4RC", + "6yb", "4LA", "03g", "2BL", "zq", "0YC", "4bm", "6WN", "a4d", "bUn", "0Ts", "3I", "Ym", "87O", "4Aq", "5D1", + "5K0", "4Np", "01V", "Vl", "2nQ", "1KS", "54u", "415", "6XO", "4ml", "0VB", "1x", "2MM", "0xn", "5Sa", "62k", + "gX", "61", "5oe", "6Jg", "6dK", "4Qh", "0jF", "It", "L", "0gv", "5Ly", "4I9", "5w4", "4rt", "0IZ", "jh", + "ei", "1Vz", "5mT", "5x5", "4F8", "4SY", "0hw", "KE", "Fu", "0eG", "5NH", "6kJ", "6Ef", "44M", "90", "hY", + "0Ui", "2S", "7KE", "4nG", "5PJ", "6uH", "Xw", "1kd", "0vu", "UG", "6xx", "790", "4cw", "5f7", "0M8", "0XY", + "0WX", "0b", "5i6", "4lv", "4BZ", "63q", "ZF", "0yt", "00L", "Wv", "6zI", "4Oj", "4aF", "6Te", "yZ", "0Zh", + "0HD", "kv", "6FI", "47b", "5Mg", "6he", "EZ", "0fh", "0kX", "Hj", "5U6", "4Pv", "7N9", "6Ky", "fF", "0Et", + "0Ju", "iG", "6Dx", "45S", "5OV", "5Z7", "Gk", "0dY", "0ii", "3Lk", "6gd", "4RG", "48c", "6IH", "dw", "0GE", + "zu", "0YG", "4bi", "6WJ", "6yf", "4LE", "A8", "TY", "Yi", "1jz", "4Au", "5D5", "4z8", "4oY", "0Tw", "3M", + "xD", "1KW", "54q", "411", "5K4", "4Nt", "01R", "Vh", "2MI", "N9", "4CD", "62o", "6XK", "4mh", "0VF", "ut", + "6dO", "4Ql", "0jB", "Ip", "25E", "65", "5oa", "6Jc", "538", "46x", "9Pg", "jl", "H", "0gr", "bfo", "aCm", + "72W", "bin", "0hs", "KA", "em", "324", "49y", "5x1", "6Eb", "44I", "94", "3nm", "Fq", "0eC", "5NL", "6kN", + "5PN", "61D", "Xs", "86Q", "0Um", "2W", "7KA", "4nC", "4cs", "5f3", "39W", "8QE", "02y", "UC", "aRn", "794", + "765", "63u", "ZB", "0yp", "9Ne", "0f", "5i2", "4lr", "4aB", "6Ta", "2oO", "0Zl", "00H", "Wr", "6zM", "4On", + "5lW", "5y6", "dj", "0GX", "0it", "JF", "6gy", "4RZ", "5OK", "6jI", "Gv", "0dD", "83", "iZ", "6De", "45N", + "5nf", "6Kd", "24B", "72", "0kE", "Hw", "6eH", "4Pk", "5Mz", "6hx", "EG", "0fu", "0HY", "kk", "5v7", "4sw", + "5h5", "4mu", "1Fz", "1a", "2MT", "0xw", "4CY", "4V8", "7kk", "4Ni", "01O", "Vu", "xY", "m8", "54l", "6Uf", + "6Zg", "4oD", "b9", "3P", "Yt", "0zF", "4Ah", "60C", "4Y9", "4LX", "0wv", "TD", "zh", "0YZ", "4bt", "5g4", + "Fl", "11w", "5NQ", "6kS", "aom", "44T", "0Kr", "1N2", "ep", "0FB", "49d", "6HO", "6fc", "5Ca", "0hn", "3Ml", + "U", "0go", "bfr", "6ib", "6GN", "46e", "0IC", "jq", "gA", "0Ds", "bEn", "hyU", "5T1", "4Qq", "8cG", "Im", + "00U", "Wo", "5J3", "4Os", "55v", "406", "yC", "0Zq", "0WA", "ts", "6YL", "4lo", "4BC", "63h", "2LN", "0ym", + "02d", "2CO", "6xa", "4MB", "4cn", "6VM", "2mc", "1Ha", "0Up", "2J", "a5g", "bTm", "5PS", "5E2", "Xn", "86L", + "0ip", "JB", "73T", "bhm", "48z", "5y2", "dn", "337", "87", "3on", "6Da", "45J", "5OO", "6jM", "Gr", "10i", + "0kA", "Hs", "6eL", "4Po", "5nb", "aar", "24F", "76", "8AE", "ko", "5v3", "4ss", "bgl", "aBn", "EC", "0fq", + "2MP", "0xs", "776", "62v", "5h1", "4mq", "9Of", "1e", "2nL", "1KN", "54h", "6Ub", "7ko", "4Nm", "01K", "Vq", + "Yp", "0zB", "4Al", "60G", "6Zc", "bUs", "0Tn", "3T", "zl", "8PF", "4bp", "5g0", "aSm", "787", "03z", "1r2", + "4e9", "44P", "0Kv", "hD", "Fh", "0eZ", "5NU", "6kW", "6fg", "4SD", "0hj", "KX", "et", "0FF", "5mI", "6HK", + "6GJ", "46a", "0IG", "ju", "Q", "Q8", "5Ld", "6if", "5T5", "4Qu", "1zz", "Ii", "gE", "0Dw", "5ox", "4j8", + "55r", "402", "yG", "0Zu", "00Q", "Wk", "5J7", "4Ow", "4BG", "63l", "2LJ", "0yi", "0WE", "tw", "6YH", "4lk", + "4cj", "6VI", "2mg", "0XD", "0vh", "UZ", "6xe", "4MF", "5PW", "5E6", "Xj", "1ky", "0Ut", "2N", "7KX", "4nZ", + "5OC", "6jA", "2Qo", "0dL", "1ZA", "iR", "6Dm", "45F", "48v", "acO", "db", "0GP", "94M", "JN", "4G3", "4RR", + "5Mr", "4H2", "EO", "12T", "0HQ", "kc", "527", "47w", "5nn", "6Kl", "fS", "s2", "0kM", "3NO", "71i", "4Pc", + "7kc", "4Na", "01G", "3PM", "xQ", "m0", "54d", "6Un", "a6D", "59T", "0VS", "1i", "197", "85o", "4CQ", "4V0", + "4Y1", "4LP", "03v", "TL", "0L3", "0YR", "56U", "a9E", "6Zo", "4oL", "b1", "3X", "2Om", "0zN", "5QA", "60K", + "ex", "0FJ", "49l", "6HG", "6fk", "4SH", "0hf", "KT", "Fd", "0eV", "5NY", "aAI", "4e5", "4pT", "0Kz", "hH", + "gI", "1TZ", "5ot", "4j4", "5T9", "4Qy", "0jW", "Ie", "DU", "Q4", "5Lh", "6ij", "6GF", "46m", "0IK", "jy", + "0WI", "0s", "6YD", "4lg", "4BK", "6wh", "ZW", "O6", "0tU", "Wg", "6zX", "6o9", "4aW", "4t6", "yK", "0Zy", + "0Ux", "2B", "7KT", "4nV", "bzI", "61Q", "Xf", "1ku", "02l", "UV", "6xi", "4MJ", "4cf", "6VE", "2mk", "0XH", + "0Jd", "iV", "6Di", "45B", "5OG", "6jE", "Gz", "0dH", "0ix", "JJ", "4G7", "4RV", "48r", "6IY", "df", "0GT", + "0HU", "kg", "523", "47s", "5Mv", "4H6", "EK", "0fy", "0kI", "3NK", "6eD", "4Pg", "5nj", "6Kh", "fW", "s6", + "xU", "m4", "5ph", "6Uj", "7kg", "4Ne", "01C", "Vy", "193", "1hZ", "4CU", "4V4", "5h9", "4my", "0VW", "1m", + "zd", "0YV", "4bx", "5g8", "4Y5", "4LT", "03r", "TH", "Yx", "0zJ", "4Ad", "60O", "6Zk", "4oH", "b5", "wT", + "6fo", "4SL", "0hb", "KP", "27e", "0FN", "49h", "6HC", "4e1", "44X", "8Bf", "hL", "0p3", "0eR", "bdO", "aAM", + "70w", "657", "0jS", "Ia", "gM", "8Mg", "5op", "4j0", "6GB", "46i", "0IO", "28d", "Y", "Q0", "5Ll", "6in", + "4BO", "63d", "ZS", "O2", "0WM", "0w", "7Ia", "4lc", "4aS", "4t2", "yO", "8Se", "00Y", "Wc", "aPN", "b1D", + "bzM", "61U", "Xb", "1kq", "216", "2F", "7KP", "4nR", "4cb", "6VA", "2mo", "0XL", "02h", "UR", "6xm", "4MN", + "5j7", "4ow", "0TY", "3c", "YG", "0zu", "5Qz", "60p", "6yH", "4Lk", "03M", "Tw", "2lJ", "0Yi", "4bG", "6Wd", + "6Xe", "4mF", "0Vh", "1R", "2Mg", "0xD", "4Cj", "62A", "7kX", "4NZ", "0ut", "VF", "xj", "1Ky", "5pW", "5e6", + "5nU", "6KW", "fh", "0EZ", "0kv", "HD", "4E9", "4PX", "5MI", "6hK", "Et", "0fF", "0Hj", "kX", "6Fg", "47L", + "48M", "6If", "dY", "50", "0iG", "Ju", "6gJ", "4Ri", "5Ox", "4J8", "GE", "0dw", "1Zz", "ii", "5t5", "4qu", + "02W", "Um", "5H1", "4Mq", "57t", "424", "2mP", "0Xs", "0UC", "2y", "7Ko", "4nm", "bzr", "61j", "2NL", "1kN", + "00f", "2AM", "6zc", "bus", "4al", "6TO", "yp", "0ZB", "0Wr", "0H", "a7e", "58u", "4Bp", "5G0", "Zl", "84N", + "f", "13u", "5LS", "5Y2", "amo", "46V", "0Ip", "jB", "gr", "1Ta", "5oO", "6JM", "6da", "4QB", "0jl", "3On", + "2PN", "0em", "5Nb", "aAr", "6EL", "44g", "0KA", "hs", "eC", "0Fq", "49W", "abn", "5V3", "4Ss", "8aE", "Ko", + "YC", "0zq", "754", "60t", "5j3", "4os", "9Md", "3g", "2lN", "0Ym", "4bC", "7GA", "6yL", "4Lo", "03I", "Ts", + "2Mc", "1ha", "4Cn", "62E", "6Xa", "4mB", "0Vl", "1V", "xn", "8RD", "5pS", "5e2", "aQo", "b0e", "01x", "VB", + "0kr", "1n2", "71V", "bjo", "5nQ", "6KS", "fl", "315", "0Hn", "29E", "6Fc", "47H", "5MM", "6hO", "Ep", "0fB", + "0iC", "Jq", "6gN", "4Rm", "48I", "6Ib", "26D", "54", "8CG", "im", "509", "45y", "ben", "hYU", "GA", "0ds", + "4cY", "420", "2mT", "0Xw", "02S", "Ui", "5H5", "4Mu", "5Pd", "61n", "XY", "M8", "0UG", "vu", "7Kk", "4ni", + "4ah", "6TK", "yt", "0ZF", "B9", "WX", "6zg", "4OD", "4Bt", "5G4", "Zh", "0yZ", "0Wv", "0L", "4y9", "4lX", + "6Gy", "46R", "0It", "jF", "b", "0gX", "5LW", "5Y6", "6de", "4QF", "0jh", "IZ", "gv", "0DD", "5oK", "6JI", + "6EH", "44c", "0KE", "hw", "2PJ", "0ei", "5Nf", "6kd", "5V7", "4Sw", "0hY", "Kk", "eG", "0Fu", "49S", "6Hx", + "7ia", "4Lc", "03E", "2Bn", "zS", "o2", "4bO", "6Wl", "a4F", "bUL", "0TQ", "3k", "YO", "87m", "4AS", "4T2", + "7kP", "4NR", "01t", "VN", "xb", "1Kq", "54W", "hfv", "6Xm", "4mN", "1FA", "1Z", "2Mo", "0xL", "4Cb", "62I", + "5MA", "6hC", "2Sm", "0fN", "0Hb", "kP", "6Fo", "47D", "bDO", "aaM", "0P3", "0ER", "8bf", "HL", "4E1", "4PP", + "5Op", "4J0", "GM", "10V", "0JS", "ia", "505", "45u", "48E", "6In", "dQ", "58", "0iO", "3LM", "6gB", "4Ra", + "0UK", "2q", "7Kg", "4ne", "5Ph", "61b", "XU", "M4", "0vW", "Ue", "5H9", "4My", "4cU", "4v4", "2mX", "1HZ", + "0Wz", "tH", "4y5", "4lT", "4Bx", "5G8", "Zd", "0yV", "B5", "WT", "6zk", "4OH", "4ad", "6TG", "yx", "0ZJ", + "gz", "0DH", "5oG", "6JE", "6di", "4QJ", "0jd", "IV", "n", "0gT", "680", "6iY", "4g7", "4rV", "0Ix", "jJ", + "eK", "0Fy", "5mv", "4h6", "6fX", "5CZ", "0hU", "Kg", "FW", "S6", "5Nj", "6kh", "6ED", "44o", "0KI", "3nK", + "zW", "o6", "4bK", "6Wh", "6yD", "4Lg", "03A", "2Bj", "YK", "0zy", "4AW", "4T6", "6ZX", "6O9", "0TU", "3o", + "xf", "1Ku", "54S", "6UY", "7kT", "4NV", "01p", "VJ", "2Mk", "0xH", "4Cf", "62M", "6Xi", "4mJ", "0Vd", "uV", + "0Hf", "kT", "6Fk", "4sH", "5ME", "6hG", "Ex", "0fJ", "0kz", "HH", "4E5", "4PT", "5nY", "aaI", "fd", "0EV", + "0JW", "ie", "501", "45q", "5Ot", "4J4", "GI", "10R", "0iK", "Jy", "6gF", "4Re", "48A", "6Ij", "dU", "q4", + "5Pl", "61f", "XQ", "M0", "0UO", "2u", "7Kc", "4na", "4cQ", "428", "39u", "8Qg", "0vS", "Ua", "aRL", "b3F", + "bxO", "63W", "0l3", "0yR", "234", "0D", "4y1", "4lP", "55I", "6TC", "2om", "0ZN", "B1", "WP", "6zo", "4OL", + "6dm", "4QN", "1zA", "IR", "25g", "0DL", "5oC", "6JA", "4g3", "46Z", "9PE", "jN", "j", "0gP", "684", "aCO", + "72u", "675", "0hQ", "Kc", "eO", "8Oe", "5mr", "4h2", "7Ua", "44k", "0KM", "3nO", "FS", "S2", "5Nn", "6kl", + "4x6", "4mW", "0Vy", "1C", "0m4", "0xU", "5SZ", "62P", "7kI", "4NK", "C6", "VW", "2nj", "1Kh", "54N", "6UD", + "6ZE", "4of", "0TH", "3r", "YV", "L7", "4AJ", "60a", "6yY", "4Lz", "0wT", "Tf", "zJ", "0Yx", "4bV", "4w7", + "5lu", "4i5", "dH", "0Gz", "0iV", "Jd", "5W8", "4Rx", "5Oi", "6jk", "GT", "R5", "0JJ", "ix", "6DG", "45l", + "5nD", "6KF", "fy", "0EK", "0kg", "HU", "6ej", "4PI", "5MX", "5X9", "Ee", "0fW", "1XZ", "kI", "4f4", "4sU", + "00w", "WM", "4Z0", "4OQ", "55T", "hgu", "ya", "0ZS", "a0", "0Y", "6Yn", "4lM", "4Ba", "63J", "2Ll", "0yO", + "02F", "2Cm", "6xC", "aG0", "4cL", "6Vo", "2mA", "n1", "0UR", "2h", "a5E", "bTO", "5Pq", "4U1", "XL", "86n", + "FN", "11U", "5Ns", "4K3", "516", "44v", "0KP", "hb", "eR", "p3", "49F", "6Hm", "6fA", "4Sb", "0hL", "3MN", + "w", "0gM", "5LB", "7ya", "6Gl", "46G", "0Ia", "jS", "gc", "0DQ", "bEL", "hyw", "4D2", "4QS", "8ce", "IO", + "0m0", "0xQ", "byL", "62T", "4x2", "4mS", "227", "1G", "2nn", "1Kl", "54J", "7Ea", "7kM", "4NO", "C2", "VS", + "YR", "L3", "4AN", "60e", "6ZA", "4ob", "0TL", "3v", "zN", "8Pd", "4bR", "4w3", "aSO", "b2E", "03X", "Tb", + "0iR", "3LP", "73v", "666", "48X", "4i1", "dL", "8Nf", "0JN", "3oL", "6DC", "45h", "5Om", "6jo", "GP", "R1", + "0kc", "HQ", "6en", "4PM", "a09", "6KB", "24d", "0EO", "8Ag", "kM", "4f0", "47Y", "697", "aBL", "Ea", "0fS", + "4ay", "5d9", "ye", "0ZW", "00s", "WI", "4Z4", "4OU", "4Be", "63N", "Zy", "0yK", "a4", "tU", "6Yj", "4lI", + "4cH", "6Vk", "2mE", "n5", "02B", "Ux", "6xG", "4Md", "5Pu", "4U5", "XH", "86j", "0UV", "2l", "5k8", "4nx", + "512", "44r", "0KT", "hf", "FJ", "0ex", "5Nw", "4K7", "6fE", "4Sf", "0hH", "Kz", "eV", "p7", "49B", "6Hi", + "6Gh", "46C", "0Ie", "jW", "s", "0gI", "5LF", "6iD", "4D6", "4QW", "0jy", "IK", "gg", "0DU", "5oZ", "6JX", + "7kA", "4NC", "01e", "3Po", "xs", "8RY", "54F", "6UL", "a6f", "59v", "0Vq", "1K", "d3E", "85M", "4Cs", "5F3", + "5I2", "4Lr", "03T", "Tn", "zB", "0Yp", "56w", "437", "6ZM", "4on", "1Da", "3z", "2OO", "0zl", "4AB", "60i", + "5Oa", "6jc", "2QM", "0dn", "0JB", "ip", "6DO", "45d", "48T", "acm", "1B2", "0Gr", "94o", "Jl", "5W0", "4Rp", + "5MP", "5X1", "Em", "12v", "0Hs", "kA", "all", "47U", "5nL", "6KN", "fq", "0EC", "0ko", "3Nm", "6eb", "4PA", + "a8", "0Q", "6Yf", "4lE", "4Bi", "63B", "Zu", "0yG", "0tw", "WE", "4Z8", "4OY", "4au", "5d5", "yi", "1Jz", + "0UZ", "vh", "5k4", "4nt", "5Py", "4U9", "XD", "1kW", "02N", "Ut", "6xK", "4Mh", "4cD", "6Vg", "2mI", "n9", + "eZ", "43", "49N", "6He", "6fI", "4Sj", "0hD", "Kv", "FF", "0et", "7n9", "6ky", "5u6", "4pv", "0KX", "hj", + "gk", "0DY", "5oV", "5z7", "6dx", "5Az", "0ju", "IG", "Dw", "0gE", "5LJ", "6iH", "6Gd", "46O", "0Ii", "28B", + "xw", "1Kd", "54B", "6UH", "7kE", "4NG", "01a", "3Pk", "0m8", "0xY", "4Cw", "5F7", "6Xx", "59r", "0Vu", "1O", + "zF", "0Yt", "4bZ", "433", "5I6", "4Lv", "03P", "Tj", "YZ", "0zh", "4AF", "60m", "6ZI", "4oj", "0TD", "wv", + "0JF", "it", "6DK", "4qh", "5Oe", "6jg", "GX", "R9", "0iZ", "Jh", "5W4", "4Rt", "48P", "4i9", "dD", "0Gv", + "0Hw", "kE", "4f8", "47Q", "5MT", "5X5", "Ei", "12r", "0kk", "HY", "6ef", "4PE", "5nH", "6KJ", "fu", "0EG", + "4Bm", "63F", "Zq", "0yC", "0Wo", "0U", "6Yb", "4lA", "4aq", "5d1", "ym", "8SG", "0ts", "WA", "aPl", "b1f", + "747", "61w", "2NQ", "1kS", "9Lg", "2d", "5k0", "4np", "57i", "6Vc", "2mM", "0Xn", "02J", "Up", "6xO", "4Ml", + "6fM", "4Sn", "1xa", "Kr", "27G", "47", "49J", "6Ha", "5u2", "44z", "8BD", "hn", "FB", "0ep", "bdm", "aAo", + "70U", "bkl", "0jq", "IC", "go", "306", "5oR", "5z3", "7WA", "46K", "0Im", "28F", "Ds", "0gA", "5LN", "6iL", + "0cY", "020", "6mT", "4Xw", "42S", "6Cx", "nG", "0Mu", "1Pd", "cw", "6NH", "5kJ", "4UG", "74M", "3Kk", "0ni", + "0ah", "BZ", "6oe", "4ZF", "40b", "6AI", "lv", "0OD", "0Bt", "aF", "6Ly", "4yZ", "4Wv", "5R6", "Oj", "0lX", + "Qh", "06R", "4It", "5L4", "461", "4gX", "1LW", "1Y6", "rt", "0QF", "4jh", "7Oj", "65o", "4DD", "I9", "2JI", + "SY", "F8", "4KE", "7nG", "6PJ", "4ei", "1Nf", "2kd", "4M", "0Sw", "4hY", "490", "5C5", "4Fu", "09S", "2Hx", + "6OR", "4zq", "354", "bm", "LA", "0os", "bnn", "75W", "6lN", "4Ym", "0bC", "Aq", "2yL", "0Lo", "43I", "6Bb", + "6Mc", "5ha", "15", "22E", "Np", "0mB", "4Vl", "6cO", "aDm", "bao", "1pS", "1e2", "ml", "8GF", "41x", "548", + "4kr", "5n2", "7f", "8YD", "1nQ", "2KS", "64u", "715", "4Hn", "69E", "Pr", "07H", "1MM", "2hO", "6Sa", "4fB", + "4iC", "7LA", "5W", "0Rm", "08I", "2Ib", "66D", "4Go", "b4d", "aUn", "RC", "05y", "8VE", "8g", "5a3", "4ds", + "42W", "ain", "nC", "0Mq", "17t", "024", "6mP", "4Xs", "4UC", "74I", "3Ko", "0nm", "8IY", "cs", "6NL", "5kN", + "40f", "6AM", "lr", "8FX", "0al", "2TO", "6oa", "4ZB", "4Wr", "5R2", "On", "18u", "0Bp", "aB", "afo", "bCm", + "465", "53u", "1LS", "1Y2", "Ql", "06V", "4Ip", "5L0", "65k", "5Ta", "1oO", "2JM", "6x", "0QB", "4jl", "7On", + "6PN", "4em", "1Nb", "9y", "2EL", "04g", "4KA", "7nC", "5C1", "4Fq", "09W", "d6G", "4I", "0Ss", "bRn", "494", + "LE", "0ow", "4TY", "4A8", "6OV", "4zu", "1Qz", "bi", "oY", "z8", "43M", "6Bf", "6lJ", "4Yi", "0bG", "Au", + "Nt", "0mF", "4Vh", "6cK", "6Mg", "4xD", "11", "22A", "mh", "0NZ", "4ut", "5p4", "4N9", "5Ky", "1pW", "CD", + "1nU", "2KW", "64q", "4EZ", "4kv", "5n6", "7b", "0PX", "1MI", "2hK", "6Se", "4fF", "4Hj", "69A", "Pv", "07L", + "08M", "2If", "6rH", "4Gk", "4iG", "7LE", "5S", "0Ri", "1Ox", "8c", "5a7", "4dw", "5Zz", "7oY", "RG", "0qu", + "1Pl", "21f", "adR", "5kB", "4UO", "74E", "MS", "X2", "0cQ", "028", "79u", "bbL", "4vS", "4c2", "nO", "8De", + "8Kd", "aN", "4l3", "4yR", "634", "76t", "Ob", "0lP", "W3", "BR", "6om", "4ZN", "40j", "6AA", "2zo", "0OL", + "6t", "0QN", "5zA", "7Ob", "65g", "4DL", "I1", "2JA", "0g3", "06Z", "b7G", "68W", "469", "4gP", "284", "dSn", + "4E", "275", "4hQ", "498", "67V", "b8F", "1mr", "0h2", "SQ", "F0", "4KM", "7nO", "6PB", "4ea", "1Nn", "9u", + "6lF", "4Ye", "0bK", "Ay", "oU", "z4", "43A", "6Bj", "6OZ", "4zy", "0AW", "be", "LI", "2O9", "4TU", "4A4", + "4N5", "5Ku", "14S", "CH", "md", "0NV", "41p", "540", "6Mk", "4xH", "u5", "22M", "Nx", "0mJ", "4Vd", "6cG", + "4Hf", "69M", "Pz", "0sH", "k7", "2hG", "6Si", "4fJ", "4kz", "7Nx", "7n", "0PT", "1nY", "dqh", "4P7", "4EV", + "4JW", "7oU", "RK", "05q", "1Ot", "8o", "6QX", "50R", "4iK", "7LI", "qW", "d6", "08A", "2Ij", "66L", "4Gg", + "4UK", "74A", "MW", "X6", "1Ph", "21b", "6ND", "5kF", "4vW", "4c6", "nK", "0My", "0cU", "0v4", "6mX", "5HZ", + "4Wz", "6bY", "Of", "0lT", "0Bx", "aJ", "4l7", "4yV", "40n", "6AE", "lz", "0OH", "W7", "BV", "6oi", "4ZJ", + "65c", "4DH", "I5", "2JE", "6p", "0QJ", "4jd", "7Of", "4r5", "4gT", "280", "2iY", "Qd", "0rV", "4Ix", "5L8", + "5C9", "4Fy", "1mv", "0h6", "4A", "1CZ", "4hU", "7MW", "6PF", "4ee", "1Nj", "9q", "SU", "F4", "4KI", "7nK", + "oQ", "z0", "43E", "6Bn", "6lB", "4Ya", "0bO", "2Wl", "LM", "8fg", "4TQ", "4A0", "aeL", "cPo", "0AS", "ba", + "3kP", "0NR", "41t", "544", "4N1", "5Kq", "14W", "CL", "2Xm", "0mN", "5FA", "6cC", "6Mo", "4xL", "19", "22I", + "k3", "2hC", "6Sm", "4fN", "4Hb", "69I", "2Fo", "07D", "83l", "d5d", "4P3", "4ER", "bQM", "a0G", "7j", "0PP", + "1Op", "8k", "hbw", "50V", "4JS", "7oQ", "RO", "05u", "08E", "2In", "66H", "4Gc", "4iO", "7LM", "qS", "d2", + "0ay", "BK", "4O6", "4ZW", "40s", "553", "lg", "0OU", "t6", "aW", "6Lh", "4yK", "4Wg", "6bD", "2Yj", "0lI", + "0cH", "2Vk", "6mE", "4Xf", "42B", "6Ci", "nV", "0Md", "1Pu", "cf", "6NY", "bAI", "4UV", "7pT", "MJ", "0nx", + "SH", "04r", "4KT", "7nV", "azI", "4ex", "1Nw", "9l", "pT", "e5", "4hH", "7MJ", "67O", "4Fd", "09B", "2Hi", + "Qy", "06C", "4Ie", "68N", "6Rj", "4gI", "j4", "2iD", "6m", "0QW", "4jy", "5o9", "4Q4", "4DU", "1oZ", "2JX", + "4m0", "4xQ", "8Jg", "22T", "Na", "0mS", "627", "77w", "6nn", "5Kl", "V0", "CQ", "3kM", "0NO", "41i", "7Pc", + "6OC", "5jA", "0AN", "20e", "LP", "Y1", "4TL", "6ao", "78v", "bcO", "0bR", "0w3", "oL", "8Ef", "43X", "4b1", + "4iR", "7LP", "5F", "266", "08X", "0i1", "66U", "b9E", "4JN", "7oL", "RR", "G3", "1Om", "8v", "6QA", "4db", + "4kc", "7Na", "7w", "0PM", "H2", "2KB", "64d", "4EO", "b6D", "69T", "Pc", "07Y", "297", "dRm", "4s2", "4fS", + "40w", "557", "lc", "0OQ", "15T", "BO", "4O2", "4ZS", "4Wc", "76i", "2Yn", "0lM", "t2", "aS", "6Ll", "4yO", + "42F", "6Cm", "nR", "8Dx", "0cL", "2Vo", "6mA", "4Xb", "4UR", "74X", "MN", "8gd", "1Pq", "cb", "adO", "bAM", + "azM", "51U", "1Ns", "9h", "SL", "04v", "4KP", "7nR", "67K", "5VA", "09F", "2Hm", "4X", "e1", "4hL", "7MN", + "6Rn", "4gM", "j0", "3ya", "2Gl", "06G", "4Ia", "68J", "4Q0", "4DQ", "82o", "d4g", "6i", "0QS", "bPN", "a1D", + "Ne", "0mW", "4Vy", "5S9", "4m4", "4xU", "1SZ", "22P", "my", "0NK", "41m", "7Pg", "6nj", "5Kh", "V4", "CU", + "LT", "Y5", "4TH", "6ak", "6OG", "4zd", "0AJ", "bx", "oH", "0Lz", "4wT", "4b5", "78r", "4Yx", "0bV", "Ad", + "1lu", "0i5", "66Q", "4Gz", "4iV", "7LT", "5B", "0Rx", "1Oi", "8r", "6QE", "4df", "4JJ", "7oH", "RV", "G7", + "H6", "2KF", "6ph", "4EK", "4kg", "7Ne", "7s", "0PI", "1MX", "1X9", "4s6", "4fW", "5XZ", "69P", "Pg", "0sU", + "06", "23F", "afr", "4yC", "4Wo", "6bL", "Os", "0lA", "0aq", "BC", "aEn", "c4E", "4ts", "5q3", "lo", "8FE", + "347", "cn", "6NQ", "5kS", "bom", "74T", "MB", "0np", "17i", "2Vc", "6mM", "4Xn", "42J", "6Ca", "2xO", "0Ml", + "4T", "0Sn", "5xa", "7MB", "67G", "4Fl", "09J", "2Ha", "1u2", "04z", "b5g", "aTm", "6PS", "4ep", "8WF", "9d", + "6e", "8XG", "4jq", "5o1", "65v", "706", "1oR", "1z3", "Qq", "06K", "4Im", "68F", "6Rb", "4gA", "1LN", "2iL", + "6nf", "5Kd", "V8", "CY", "mu", "0NG", "41a", "7Pk", "4m8", "4xY", "0Cw", "1F7", "Ni", "19r", "4Vu", "5S5", + "6lW", "4Yt", "0bZ", "Ah", "oD", "0Lv", "43P", "4b9", "6OK", "4zh", "0AF", "bt", "LX", "Y9", "4TD", "6ag", + "4JF", "7oD", "RZ", "0qh", "1Oe", "2jg", "6QI", "4dj", "4iZ", "483", "5N", "0Rt", "08P", "0i9", "5B6", "4Gv", + "4Hw", "5M7", "Pk", "07Q", "1MT", "1X5", "472", "52r", "4kk", "7Ni", "sw", "0PE", "1nH", "2KJ", "64l", "4EG", + "4Wk", "6bH", "Ow", "0lE", "02", "23B", "6Ld", "4yG", "4tw", "5q7", "lk", "0OY", "0au", "BG", "6ox", "5Jz", + "4UZ", "74P", "MF", "0nt", "1Py", "cj", "6NU", "5kW", "42N", "6Ce", "nZ", "0Mh", "0cD", "2Vg", "6mI", "4Xj", + "67C", "4Fh", "09N", "2He", "4P", "e9", "4hD", "7MF", "6PW", "4et", "3n9", "2ky", "SD", "0pv", "4KX", "7nZ", + "4Q8", "4DY", "1oV", "1z7", "6a", "1Az", "4ju", "5o5", "6Rf", "4gE", "j8", "2iH", "Qu", "06O", "4Ii", "68B", + "mq", "0NC", "41e", "7Po", "6nb", "bar", "14F", "2UL", "Nm", "19v", "4Vq", "5S1", "agl", "bBn", "0Cs", "1F3", + "1I2", "0Lr", "43T", "ahm", "6lS", "4Yp", "16w", "Al", "2ZM", "0on", "5Da", "6ac", "6OO", "4zl", "0AB", "bp", + "1Oa", "8z", "6QM", "4dn", "4JB", "aUs", "2DO", "05d", "08T", "d7D", "5B2", "4Gr", "bSm", "487", "5J", "0Rp", + "1MP", "1X1", "476", "52v", "4Hs", "5M3", "Po", "07U", "1nL", "2KN", "64h", "4EC", "4ko", "7Nm", "ss", "0PA", + "QJ", "06p", "4IV", "7lT", "6RY", "4gz", "1Lu", "0I5", "rV", "g7", "4jJ", "7OH", "65M", "4Df", "1oi", "2Jk", + "2Ej", "04A", "4Kg", "7ne", "6Ph", "4eK", "h6", "2kF", "4o", "0SU", "5xZ", "7My", "4S6", "4FW", "09q", "1x9", + "17R", "2VX", "4M4", "4XU", "42q", "571", "ne", "0MW", "v4", "cU", "6Nj", "5kh", "4Ue", "74o", "My", "0nK", + "0aJ", "Bx", "6oG", "4Zd", "4tH", "6Ak", "lT", "y5", "0BV", "ad", "580", "4yx", "4WT", "4B5", "OH", "0lz", + "4kP", "7NR", "7D", "244", "1ns", "0k3", "64W", "con", "4HL", "69g", "PP", "E1", "1Mo", "2hm", "6SC", "52I", + "4ia", "7Lc", "5u", "0RO", "J0", "3Ya", "66f", "4GM", "b4F", "aUL", "Ra", "0qS", "8Vg", "8E", "458", "4dQ", + "4o2", "4zS", "8He", "bO", "Lc", "0oQ", "605", "75u", "6ll", "4YO", "T2", "AS", "2yn", "0LM", "43k", "7Ra", + "6MA", "4xb", "0CL", "22g", "NR", "19I", "4VN", "6cm", "aDO", "baM", "14y", "Cb", "mN", "8Gd", "41Z", "7PP", + "axO", "53W", "1Lq", "0I1", "QN", "06t", "4IR", "68y", "65I", "4Db", "1om", "2Jo", "6Z", "g3", "4jN", "7OL", + "6Pl", "4eO", "h2", "2kB", "2En", "04E", "4Kc", "7na", "4S2", "4FS", "09u", "d6e", "4k", "0SQ", "bRL", "a3F", + "42u", "575", "na", "0MS", "17V", "dlo", "4M0", "4XQ", "4Ua", "74k", "3KM", "0nO", "28", "cQ", "6Nn", "5kl", + "40D", "6Ao", "lP", "y1", "0aN", "2Tm", "6oC", "5JA", "4WP", "4B1", "OL", "18W", "0BR", "0W3", "584", "bCO", + "1nw", "0k7", "64S", "4Ex", "4kT", "7NV", "sH", "0Pz", "1Mk", "2hi", "6SG", "4fd", "4HH", "69c", "PT", "E5", + "J4", "2ID", "66b", "4GI", "4ie", "7Lg", "5q", "0RK", "1OZ", "8A", "4q4", "4dU", "4Jy", "5O9", "Re", "0qW", + "Lg", "0oU", "5DZ", "6aX", "4o6", "4zW", "0Ay", "bK", "2yj", "0LI", "43o", "6BD", "6lh", "4YK", "T6", "AW", + "NV", "0md", "4VJ", "6ci", "6ME", "4xf", "0CH", "22c", "mJ", "0Nx", "4uV", "7PT", "6nY", "baI", "1pu", "Cf", + "6V", "0Ql", "4jB", "aus", "65E", "4Dn", "1oa", "2Jc", "QB", "06x", "b7e", "68u", "5b2", "4gr", "8UD", "dSL", + "4g", "8ZE", "4hs", "5m3", "67t", "724", "09y", "1x1", "Ss", "04I", "4Ko", "7nm", "azr", "4eC", "1NL", "9W", + "24", "21D", "6Nb", "bAr", "4Um", "74g", "Mq", "0nC", "0cs", "1f3", "79W", "bbn", "42y", "579", "nm", "394", + "365", "al", "588", "4yp", "bmo", "76V", "1i2", "0lr", "0aB", "Bp", "6oO", "4Zl", "40H", "6Ac", "2zM", "0On", + "4HD", "69o", "PX", "E9", "1Mg", "2he", "6SK", "4fh", "4kX", "7NZ", "7L", "0Pv", "3N9", "2Ky", "6pW", "4Et", + "4Ju", "5O5", "Ri", "05S", "1OV", "8M", "450", "4dY", "4ii", "7Lk", "qu", "0RG", "J8", "2IH", "66n", "4GE", + "6ld", "4YG", "0bi", "2WJ", "ow", "0LE", "43c", "6BH", "6Ox", "5jz", "0Au", "bG", "Lk", "0oY", "4Tw", "5Q7", + "6nU", "5KW", "14q", "Cj", "mF", "0Nt", "41R", "7PX", "6MI", "4xj", "0CD", "22o", "NZ", "0mh", "4VF", "6ce", + "65A", "4Dj", "1oe", "2Jg", "6R", "0Qh", "4jF", "7OD", "5b6", "4gv", "1Ly", "0I9", "QF", "0rt", "4IZ", "68q", + "67p", "5Vz", "1mT", "1x5", "4c", "0SY", "4hw", "5m7", "6Pd", "4eG", "1NH", "9S", "Sw", "04M", "4Kk", "7ni", + "4Ui", "74c", "Mu", "0nG", "20", "cY", "6Nf", "5kd", "4vu", "5s5", "ni", "390", "0cw", "1f7", "4M8", "4XY", + "4WX", "4B9", "OD", "0lv", "0BZ", "ah", "6LW", "4yt", "40L", "6Ag", "lX", "y9", "0aF", "Bt", "6oK", "4Zh", + "1Mc", "2ha", "6SO", "4fl", "5Xa", "69k", "2FM", "07f", "83N", "d5F", "6pS", "4Ep", "bQo", "a0e", "7H", "0Pr", + "1OR", "8I", "454", "50t", "4Jq", "5O1", "Rm", "05W", "08g", "2IL", "66j", "4GA", "4im", "7Lo", "5y", "0RC", + "os", "0LA", "43g", "6BL", "78I", "4YC", "0bm", "2WN", "Lo", "8fE", "4Ts", "5Q3", "aen", "cPM", "0Aq", "bC", + "mB", "0Np", "41V", "ajo", "6nQ", "5KS", "14u", "Cn", "2XO", "0ml", "4VB", "6ca", "6MM", "4xn", "1Sa", "22k", + "Sj", "04P", "4Kv", "5N6", "443", "4eZ", "1NU", "9N", "pv", "0SD", "4hj", "7Mh", "67m", "4FF", "1mI", "2HK", + "2GJ", "2", "4IG", "68l", "6RH", "4gk", "1Ld", "2if", "6O", "0Qu", "5zz", "7OY", "5A7", "4Dw", "1ox", "0j8", + "15r", "Bi", "6oV", "4Zu", "40Q", "4a8", "lE", "0Ow", "0BG", "au", "6LJ", "4yi", "4WE", "6bf", "OY", "Z8", + "U9", "2VI", "6mg", "4XD", "4vh", "6CK", "nt", "0MF", "1PW", "cD", "4n9", "5ky", "4Ut", "5P4", "Mh", "0nZ", + "4ip", "5l0", "5d", "9Kg", "08z", "1y2", "66w", "737", "4Jl", "7on", "Rp", "05J", "1OO", "8T", "6Qc", "50i", + "4kA", "7NC", "7U", "0Po", "1nb", "dqS", "64F", "4Em", "b6f", "69v", "PA", "0ss", "8TG", "dRO", "5c1", "4fq", + "6MP", "4xs", "376", "22v", "NC", "0mq", "bll", "77U", "6nL", "5KN", "14h", "Cs", "3ko", "0Nm", "41K", "7PA", + "6Oa", "4zB", "37", "20G", "Lr", "8fX", "4Tn", "6aM", "78T", "bcm", "0bp", "AB", "on", "387", "43z", "5r2", + "447", "51w", "1NQ", "9J", "Sn", "04T", "4Kr", "5N2", "67i", "4FB", "09d", "2HO", "4z", "1Ca", "4hn", "7Ml", + "6RL", "4go", "8UY", "2ib", "2GN", "6", "4IC", "68h", "5A3", "4Ds", "82M", "d4E", "6K", "0Qq", "bPl", "a1f", + "40U", "akl", "lA", "0Os", "15v", "Bm", "6oR", "4Zq", "4WA", "6bb", "2YL", "0lo", "0BC", "aq", "6LN", "4ym", + "42d", "6CO", "np", "0MB", "0cn", "2VM", "6mc", "5Ha", "4Up", "5P0", "Ml", "8gF", "1PS", "1E2", "adm", "bAo", + "1lW", "1y6", "4R9", "4GX", "4it", "5l4", "qh", "0RZ", "i9", "8P", "6Qg", "4dD", "4Jh", "7oj", "Rt", "05N", + "1nf", "2Kd", "64B", "4Ei", "4kE", "7NG", "7Q", "f8", "1Mz", "2hx", "5c5", "4fu", "4HY", "69r", "PE", "0sw", + "NG", "0mu", "5Fz", "6cx", "6MT", "4xw", "0CY", "0V8", "3kk", "0Ni", "41O", "7PE", "6nH", "5KJ", "14l", "Cw", + "Lv", "0oD", "4Tj", "6aI", "6Oe", "4zF", "33", "bZ", "oj", "0LX", "4wv", "5r6", "6ly", "4YZ", "0bt", "AF", + "4v", "0SL", "4hb", "awS", "67e", "4FN", "K3", "2HC", "Sb", "04X", "b5E", "aTO", "4p3", "4eR", "8Wd", "9F", + "6G", "257", "4jS", "7OQ", "65T", "cnm", "1op", "0j0", "QS", "D2", "4IO", "68d", "7Ba", "4gc", "1Ll", "2in", + "0BO", "23d", "6LB", "4ya", "4WM", "6bn", "OQ", "Z0", "0aS", "Ba", "aEL", "c4g", "40Y", "4a0", "lM", "8Fg", + "8If", "cL", "4n1", "5kq", "616", "74v", "3KP", "0nR", "U1", "2VA", "6mo", "4XL", "42h", "6CC", "2xm", "0MN", + "4Jd", "7of", "Rx", "05B", "i5", "2jE", "6Qk", "4dH", "4ix", "5l8", "5l", "0RV", "08r", "2IY", "4R5", "4GT", + "4HU", "7mW", "PI", "07s", "1Mv", "0H6", "5c9", "4fy", "4kI", "7NK", "sU", "f4", "1nj", "2Kh", "64N", "4Ee", + "6nD", "5KF", "1ph", "2Uj", "mW", "x6", "41C", "7PI", "593", "5hZ", "0CU", "0V4", "NK", "0my", "4VW", "4C6", + "4L7", "4YV", "0bx", "AJ", "of", "0LT", "43r", "562", "6Oi", "4zJ", "w7", "bV", "Lz", "0oH", "4Tf", "6aE", + "67a", "4FJ", "K7", "2HG", "4r", "0SH", "4hf", "7Md", "4p7", "4eV", "1NY", "9B", "Sf", "0pT", "4Kz", "7nx", + "65P", "5TZ", "1ot", "0j4", "6C", "0Qy", "4jW", "7OU", "6RD", "4gg", "1Lh", "2ij", "QW", "D6", "4IK", "7lI", + "4WI", "6bj", "OU", "Z4", "0BK", "ay", "6LF", "4ye", "4tU", "4a4", "lI", "2o9", "0aW", "Be", "6oZ", "4Zy", + "4Ux", "5P8", "Md", "0nV", "8Ib", "cH", "4n5", "5ku", "42l", "6CG", "nx", "0MJ", "U5", "2VE", "6mk", "4XH", + "i1", "8X", "6Qo", "4dL", "5ZA", "7ob", "2Dm", "05F", "08v", "d7f", "4R1", "4GP", "bSO", "a2E", "5h", "0RR", + "1Mr", "0H2", "ayL", "52T", "4HQ", "69z", "PM", "07w", "1nn", "2Kl", "64J", "4Ea", "4kM", "7NO", "7Y", "f0", + "mS", "x2", "41G", "7PM", "aDR", "5KB", "14d", "2Un", "NO", "19T", "4VS", "4C2", "597", "bBL", "0CQ", "0V0", + "ob", "0LP", "43v", "566", "4L3", "4YR", "16U", "AN", "2Zo", "0oL", "4Tb", "6aA", "6Om", "4zN", "w3", "bR", + "4oT", "4z5", "wH", "0Tz", "0zV", "Yd", "5D8", "4Ax", "4LH", "6yk", "TT", "A5", "0YJ", "zx", "6WG", "4bd", + "4me", "6XF", "1q", "0VK", "N4", "2MD", "62b", "4CI", "4Ny", "5K9", "Ve", "0uW", "1KZ", "xI", "4u4", "5pt", + "4k6", "5nv", "0Ey", "fK", "Hg", "0kU", "641", "6eX", "6hh", "5Mj", "P6", "EW", "29b", "0HI", "47o", "6FD", + "6IE", "48n", "0GH", "dz", "JV", "0id", "4RJ", "6gi", "6jY", "beI", "0dT", "Gf", "iJ", "0Jx", "4qV", "4d7", + "UN", "02t", "4MR", "4X3", "a8G", "57W", "0XP", "0M1", "2Z", "c3", "4nN", "7KL", "61I", "5PC", "1km", "2No", + "2An", "00E", "4Oc", "7ja", "6Tl", "4aO", "l2", "yS", "0k", "0WQ", "58V", "a7F", "4W2", "4BS", "84m", "ZO", + "13V", "E", "4I0", "5Lp", "46u", "535", "ja", "0IS", "68", "gQ", "6Jn", "5ol", "4Qa", "6dB", "3OM", "0jO", + "0eN", "2Pm", "6kC", "5NA", "44D", "6Eo", "hP", "99", "0FR", "0S3", "abM", "49t", "4SP", "4F1", "KL", "8af", + "0zR", "0o3", "60W", "ckn", "4oP", "4z1", "3D", "204", "0YN", "2lm", "6WC", "56I", "4LL", "6yo", "TP", "A1", + "N0", "903", "62f", "4CM", "4ma", "6XB", "1u", "0VO", "8Rg", "xM", "418", "54x", "b0F", "aQL", "Va", "0uS", + "Hc", "0kQ", "645", "71u", "4k2", "5nr", "8Le", "fO", "29f", "0HM", "47k", "7Va", "6hl", "5Mn", "P2", "ES", + "JR", "1yA", "4RN", "6gm", "6IA", "48j", "0GL", "26g", "iN", "8Cd", "45Z", "4d3", "hYv", "beM", "0dP", "Gb", + "6VY", "4cz", "0XT", "0M5", "UJ", "02p", "4MV", "4X7", "61M", "5PG", "1ki", "Xz", "vV", "c7", "4nJ", "7KH", + "6Th", "4aK", "l6", "yW", "2Aj", "00A", "4Og", "6zD", "4W6", "4BW", "0yy", "ZK", "0o", "0WU", "58R", "6YX", + "46q", "531", "je", "0IW", "13R", "A", "4I4", "5Lt", "4Qe", "6dF", "Iy", "0jK", "r4", "gU", "6Jj", "5oh", + "4pH", "6Ek", "hT", "0Kf", "0eJ", "Fx", "6kG", "5NE", "4ST", "4F5", "KH", "0hz", "0FV", "ed", "5x8", "49p", + "bvs", "6yc", "2BM", "03f", "0YB", "zp", "6WO", "4bl", "bUo", "a4e", "3H", "0Tr", "87N", "Yl", "5D0", "4Ap", + "4Nq", "5K1", "Vm", "01W", "1KR", "xA", "414", "54t", "4mm", "6XN", "1y", "0VC", "0xo", "2ML", "62j", "4CA", + "7xA", "5Mb", "0fm", "2SN", "ks", "0HA", "47g", "6FL", "aan", "bDl", "0Eq", "fC", "Ho", "8bE", "4Ps", "5U3", + "5Z2", "5OS", "10u", "Gn", "iB", "0Jp", "45V", "ano", "6IM", "48f", "1Wa", "dr", "3Ln", "0il", "4RB", "6ga", + "2R", "0Uh", "4nF", "7KD", "61A", "5PK", "1ke", "Xv", "UF", "0vt", "4MZ", "6xy", "5f6", "4cv", "0XX", "0M9", + "0c", "0WY", "4lw", "5i7", "63p", "5Rz", "0yu", "ZG", "Ww", "00M", "4Ok", "6zH", "6Td", "4aG", "0Zi", "2oJ", + "60", "gY", "6Jf", "5od", "4Qi", "6dJ", "Iu", "0jG", "0gw", "M", "4I8", "5Lx", "4ru", "5w5", "ji", "1Yz", + "0FZ", "eh", "5x4", "5mU", "4SX", "4F9", "KD", "0hv", "0eF", "Ft", "6kK", "5NI", "44L", "6Eg", "hX", "91", + "0YF", "zt", "6WK", "4bh", "4LD", "6yg", "TX", "A9", "0zZ", "Yh", "5D4", "4At", "4oX", "4z9", "3L", "0Tv", + "1KV", "xE", "410", "54p", "4Nu", "5K5", "Vi", "01S", "N8", "2MH", "62n", "4CE", "4mi", "6XJ", "uu", "0VG", + "kw", "0HE", "47c", "6FH", "6hd", "5Mf", "0fi", "2SJ", "Hk", "0kY", "4Pw", "5U7", "6Kx", "5nz", "0Eu", "fG", + "iF", "0Jt", "45R", "6Dy", "5Z6", "5OW", "0dX", "Gj", "JZ", "0ih", "4RF", "6ge", "6II", "48b", "0GD", "dv", + "61E", "5PO", "1ka", "Xr", "2V", "0Ul", "4nB", "aqs", "5f2", "4cr", "8QD", "39V", "UB", "02x", "795", "aRo", + "63t", "764", "0yq", "ZC", "0g", "9Nd", "4ls", "5i3", "7DA", "4aC", "0Zm", "2oN", "Ws", "00I", "4Oo", "6zL", + "4Qm", "6dN", "Iq", "0jC", "64", "25D", "6Jb", "bEr", "46y", "539", "jm", "9Pf", "0gs", "I", "aCl", "bfn", + "bio", "72V", "1m2", "0hr", "325", "el", "5x0", "49x", "44H", "6Ec", "3nl", "95", "0eB", "Fp", "6kO", "5NM", + "4mt", "5h4", "uh", "0VZ", "0xv", "2MU", "4V9", "4CX", "4Nh", "7kj", "Vt", "01N", "m9", "xX", "6Ug", "54m", + "4oE", "6Zf", "3Q", "b8", "0zG", "Yu", "60B", "4Ai", "4LY", "4Y8", "TE", "0ww", "1Iz", "zi", "5g5", "4bu", + "5y7", "5lV", "0GY", "dk", "JG", "0iu", "5Bz", "6gx", "6jH", "5OJ", "0dE", "Gw", "3ok", "82", "45O", "6Dd", + "6Ke", "5ng", "73", "fZ", "Hv", "0kD", "4Pj", "6eI", "6hy", "7m9", "0ft", "EF", "kj", "0HX", "4sv", "5v6", + "Wn", "00T", "4Or", "5J2", "407", "55w", "0Zp", "yB", "0z", "1Ga", "4ln", "6YM", "63i", "4BB", "0yl", "2LO", + "2CN", "02e", "4MC", "7hA", "6VL", "4co", "0XA", "2mb", "2K", "0Uq", "bTl", "a5f", "5E3", "5PR", "86M", "Xo", + "11v", "Fm", "6kR", "5NP", "44U", "aol", "hA", "0Ks", "0FC", "eq", "6HN", "49e", "4SA", "6fb", "3Mm", "0ho", + "0gn", "T", "6ic", "5La", "46d", "6GO", "jp", "0IB", "0Dr", "1A2", "hyT", "bEo", "4Qp", "5T0", "Il", "8cF", + "0xr", "2MQ", "62w", "777", "4mp", "5h0", "1d", "9Og", "1KO", "2nM", "6Uc", "54i", "4Nl", "7kn", "Vp", "01J", + "0zC", "Yq", "60F", "4Am", "4oA", "6Zb", "3U", "0To", "8PG", "zm", "5g1", "4bq", "786", "aSl", "TA", "0ws", + "JC", "0iq", "bhl", "73U", "5y3", "5lR", "336", "do", "3oo", "86", "45K", "7TA", "6jL", "5ON", "0dA", "Gs", + "Hr", "8bX", "4Pn", "6eM", "6Ka", "5nc", "77", "24G", "kn", "8AD", "47z", "5v2", "aBo", "bgm", "0fp", "EB", + "403", "4aZ", "0Zt", "yF", "Wj", "00P", "4Ov", "5J6", "63m", "4BF", "0yh", "ZZ", "tv", "0WD", "4lj", "6YI", + "6VH", "4ck", "0XE", "2mf", "2CJ", "02a", "4MG", "6xd", "5E7", "5PV", "1kx", "Xk", "2O", "0Uu", "bTh", "7KY", + "44Q", "4e8", "hE", "0Kw", "11r", "Fi", "6kV", "5NT", "4SE", "6ff", "KY", "0hk", "0FG", "eu", "6HJ", "49a", + "4rh", "6GK", "jt", "0IF", "Q9", "P", "6ig", "5Le", "4Qt", "5T4", "Ih", "0jZ", "0Dv", "gD", "4j9", "5oy", + "aD0", "7kb", "3PL", "01F", "m1", "xP", "6Uo", "54e", "59U", "a6E", "1h", "0VR", "85n", "196", "4V1", "4CP", + "4LQ", "4Y0", "TM", "03w", "0YS", "za", "a9D", "56T", "4oM", "6Zn", "3Y", "b0", "0zO", "2Ol", "60J", "4Aa", + "7za", "5OB", "0dM", "2Qn", "iS", "0Ja", "45G", "6Dl", "acN", "48w", "0GQ", "dc", "JO", "94L", "4RS", "4G2", + "4H3", "5Ms", "12U", "EN", "kb", "0HP", "47v", "526", "6Km", "5no", "s3", "fR", "3NN", "0kL", "4Pb", "6eA", + "0r", "0WH", "4lf", "6YE", "63a", "4BJ", "O7", "ZV", "Wf", "0tT", "4Oz", "6zY", "4t7", "4aV", "0Zx", "yJ", + "2C", "0Uy", "4nW", "7KU", "61P", "5PZ", "1kt", "Xg", "UW", "02m", "4MK", "6xh", "6VD", "4cg", "0XI", "2mj", + "0FK", "ey", "6HF", "49m", "4SI", "6fj", "KU", "0hg", "0eW", "Fe", "6kZ", "5NX", "4pU", "4e4", "hI", "2k9", + "0Dz", "gH", "4j5", "5ou", "4Qx", "5T8", "Id", "0jV", "Q5", "DT", "6ik", "5Li", "46l", "6GG", "jx", "0IJ", + "m5", "xT", "6Uk", "54a", "4Nd", "7kf", "Vx", "01B", "0xz", "192", "4V5", "4CT", "4mx", "5h8", "1l", "0VV", + "0YW", "ze", "5g9", "4by", "4LU", "4Y4", "TI", "03s", "0zK", "Yy", "60N", "4Ae", "4oI", "6Zj", "wU", "b4", + "iW", "0Je", "45C", "6Dh", "6jD", "5OF", "0dI", "2Qj", "JK", "0iy", "4RW", "4G6", "6IX", "48s", "0GU", "dg", + "kf", "0HT", "47r", "522", "4H7", "5Mw", "0fx", "EJ", "Hz", "0kH", "4Pf", "6eE", "6Ki", "5nk", "s7", "fV", + "63e", "4BN", "O3", "ZR", "0v", "0WL", "4lb", "6YA", "4t3", "4aR", "8Sd", "yN", "Wb", "00X", "b1E", "aPO", + "61T", "bzL", "1kp", "Xc", "2G", "217", "4nS", "7KQ", "7Fa", "4cc", "0XM", "2mn", "US", "02i", "4MO", "6xl", + "4SM", "6fn", "KQ", "0hc", "0FO", "27d", "6HB", "49i", "44Y", "4e0", "hM", "8Bg", "0eS", "Fa", "aAL", "bdN", + "656", "70v", "3OP", "0jR", "8Mf", "gL", "4j1", "5oq", "46h", "6GC", "28e", "0IN", "Q1", "X", "6io", "5Lm", + "6KV", "5nT", "1Uz", "fi", "HE", "0kw", "4PY", "4E8", "6hJ", "5MH", "0fG", "Eu", "kY", "0Hk", "47M", "6Ff", + "6Ig", "48L", "51", "dX", "Jt", "0iF", "4Rh", "6gK", "4J9", "5Oy", "0dv", "GD", "ih", "0JZ", "4qt", "5t4", + "4ov", "5j6", "3b", "0TX", "0zt", "YF", "60q", "4AZ", "4Lj", "6yI", "Tv", "03L", "0Yh", "zZ", "6We", "4bF", + "4mG", "6Xd", "1S", "0Vi", "0xE", "2Mf", "6vH", "4Ck", "bth", "7kY", "VG", "0uu", "1Kx", "xk", "5e7", "5pV", + "13t", "g", "5Y3", "5LR", "46W", "amn", "jC", "0Iq", "0DA", "gs", "6JL", "5oN", "4QC", "70I", "3Oo", "0jm", + "0el", "2PO", "6ka", "5Nc", "44f", "6EM", "hr", "8BX", "0Fp", "eB", "abo", "49V", "4Sr", "5V2", "Kn", "8aD", + "Ul", "02V", "4Mp", "5H0", "425", "57u", "0Xr", "2mQ", "2x", "0UB", "4nl", "7Kn", "61k", "5Pa", "1kO", "2NM", + "2AL", "00g", "4OA", "6zb", "6TN", "4am", "0ZC", "yq", "0I", "0Ws", "58t", "a7d", "5G1", "4Bq", "84O", "Zm", + "HA", "0ks", "bjn", "71W", "6KR", "5nP", "314", "fm", "29D", "0Ho", "47I", "6Fb", "6hN", "5ML", "0fC", "Eq", + "Jp", "0iB", "4Rl", "6gO", "6Ic", "48H", "55", "26E", "il", "8CF", "45x", "508", "hYT", "beo", "0dr", "1a2", + "0zp", "YB", "60u", "755", "4or", "5j2", "3f", "9Me", "0Yl", "2lO", "6Wa", "4bB", "4Ln", "6yM", "Tr", "03H", + "0xA", "2Mb", "62D", "4Co", "4mC", "7HA", "1W", "0Vm", "8RE", "xo", "5e3", "54Z", "b0d", "aQn", "VC", "01y", + "46S", "6Gx", "jG", "0Iu", "0gY", "c", "5Y7", "5LV", "4QG", "6dd", "3Ok", "0ji", "0DE", "gw", "6JH", "5oJ", + "44b", "6EI", "hv", "0KD", "0eh", "FZ", "6ke", "5Ng", "4Sv", "5V6", "Kj", "0hX", "0Ft", "eF", "6Hy", "49R", + "421", "4cX", "0Xv", "2mU", "Uh", "02R", "4Mt", "5H4", "61o", "5Pe", "M9", "XX", "vt", "0UF", "4nh", "7Kj", + "6TJ", "4ai", "0ZG", "yu", "WY", "B8", "4OE", "6zf", "5G5", "4Bu", "1iz", "Zi", "0M", "0Ww", "4lY", "4y8", + "6hB", "aW1", "0fO", "2Sl", "kQ", "0Hc", "47E", "6Fn", "aaL", "bDN", "0ES", "fa", "HM", "8bg", "4PQ", "4E0", + "4J1", "5Oq", "10W", "GL", "3oP", "0JR", "45t", "504", "6Io", "48D", "59", "dP", "3LL", "0iN", "5BA", "6gC", + "4Lb", "6yA", "2Bo", "03D", "o3", "zR", "6Wm", "4bN", "bUM", "a4G", "3j", "0TP", "87l", "YN", "4T3", "4AR", + "4NS", "7kQ", "VO", "01u", "1Kp", "xc", "hfw", "54V", "4mO", "6Xl", "uS", "0Va", "0xM", "2Mn", "62H", "4Cc", + "0DI", "25b", "6JD", "5oF", "4QK", "6dh", "IW", "0je", "0gU", "o", "6iX", "5LZ", "4rW", "4g6", "jK", "0Iy", + "0Fx", "eJ", "4h7", "5mw", "4Sz", "6fY", "Kf", "0hT", "S7", "FV", "6ki", "5Nk", "44n", "6EE", "hz", "0KH", + "2p", "0UJ", "4nd", "7Kf", "61c", "5Pi", "M5", "XT", "Ud", "0vV", "4Mx", "5H8", "4v5", "4cT", "0Xz", "2mY", + "0A", "1GZ", "4lU", "4y4", "5G9", "4By", "0yW", "Ze", "WU", "B4", "4OI", "6zj", "6TF", "4ae", "0ZK", "yy", + "kU", "0Hg", "47A", "6Fj", "6hF", "5MD", "0fK", "Ey", "HI", "2K9", "4PU", "4E4", "6KZ", "5nX", "0EW", "fe", + "id", "0JV", "45p", "500", "4J5", "5Ou", "0dz", "GH", "Jx", "0iJ", "4Rd", "6gG", "6Ik", "5li", "q5", "dT", + "o7", "zV", "6Wi", "4bJ", "4Lf", "6yE", "Tz", "0wH", "0zx", "YJ", "4T7", "4AV", "4oz", "6ZY", "3n", "0TT", + "1Kt", "xg", "6UX", "54R", "4NW", "7kU", "VK", "01q", "0xI", "2Mj", "62L", "4Cg", "4mK", "6Xh", "uW", "0Ve", + "4QO", "6dl", "IS", "0ja", "0DM", "25f", "7Za", "5oB", "4rS", "4g2", "jO", "9PD", "0gQ", "k", "aCN", "685", + "674", "72t", "Kb", "0hP", "8Od", "eN", "4h3", "49Z", "44j", "6EA", "3nN", "0KL", "S3", "FR", "6km", "5No", + "61g", "5Pm", "M1", "XP", "2t", "0UN", "ad0", "7Kb", "429", "4cP", "8Qf", "39t", "0c3", "02Z", "b3G", "aRM", + "63V", "bxN", "0yS", "Za", "0E", "235", "4lQ", "4y0", "6TB", "4aa", "0ZO", "2ol", "WQ", "B0", "4OM", "6zn", + "4i4", "5lt", "1WZ", "dI", "Je", "0iW", "4Ry", "5W9", "6jj", "5Oh", "R4", "GU", "iy", "0JK", "45m", "6DF", + "6KG", "5nE", "0EJ", "fx", "HT", "0kf", "4PH", "6ek", "5X8", "5MY", "0fV", "Ed", "kH", "0Hz", "4sT", "4f5", + "4mV", "4x7", "1B", "0Vx", "0xT", "0m5", "62Q", "4Cz", "4NJ", "7kH", "VV", "C7", "1Ki", "xz", "6UE", "54O", + "4og", "6ZD", "3s", "0TI", "L6", "YW", "6th", "4AK", "6l9", "6yX", "Tg", "0wU", "0Yy", "zK", "4w6", "4bW", + "11T", "FO", "4K2", "5Nr", "44w", "517", "hc", "0KQ", "p2", "eS", "6Hl", "49G", "4Sc", "72i", "3MO", "0hM", + "0gL", "v", "6iA", "5LC", "46F", "6Gm", "jR", "1YA", "0DP", "gb", "hyv", "bEM", "4QR", "4D3", "IN", "8cd", + "WL", "00v", "4OP", "4Z1", "hgt", "55U", "0ZR", "0O3", "0X", "a1", "4lL", "6Yo", "63K", "5RA", "0yN", "2Lm", + "2Cl", "02G", "4Ma", "6xB", "6Vn", "4cM", "n0", "39i", "2i", "0US", "bTN", "a5D", "4U0", "5Pp", "86o", "XM", + "Ja", "0iS", "667", "73w", "4i0", "48Y", "8Ng", "dM", "3oM", "0JO", "45i", "6DB", "6jn", "5Ol", "R0", "GQ", + "HP", "0kb", "4PL", "6eo", "6KC", "5nA", "0EN", "24e", "kL", "8Af", "47X", "4f1", "aBM", "696", "0fR", "0s3", + "0xP", "0m1", "62U", "byM", "4mR", "4x3", "1F", "226", "1Km", "2no", "6UA", "54K", "4NN", "7kL", "VR", "C3", + "L2", "YS", "60d", "4AO", "4oc", "7Ja", "3w", "0TM", "8Pe", "zO", "4w2", "4bS", "b2D", "aSN", "Tc", "03Y", + "44s", "513", "hg", "0KU", "0ey", "FK", "4K6", "5Nv", "4Sg", "6fD", "3MK", "0hI", "p6", "eW", "6Hh", "49C", + "46B", "6Gi", "jV", "0Id", "0gH", "r", "6iE", "5LG", "4QV", "4D7", "IJ", "0jx", "0DT", "gf", "6JY", "bEI", + "5d8", "4ax", "0ZV", "yd", "WH", "00r", "4OT", "4Z5", "63O", "4Bd", "0yJ", "Zx", "tT", "a5", "4lH", "6Yk", + "6Vj", "4cI", "n4", "2mD", "Uy", "02C", "4Me", "6xF", "4U4", "5Pt", "1kZ", "XI", "2m", "0UW", "4ny", "5k9", + "6jb", "ber", "0do", "2QL", "iq", "0JC", "45e", "6DN", "acl", "48U", "0Gs", "dA", "Jm", "94n", "4Rq", "5W1", + "5X0", "5MQ", "12w", "El", "1M2", "0Hr", "47T", "alm", "6KO", "5nM", "0EB", "fp", "3Nl", "0kn", "bjs", "6ec", + "4NB", "aQs", "3Pn", "01d", "1Ka", "xr", "6UM", "54G", "59w", "a6g", "1J", "0Vp", "85L", "d3D", "5F2", "4Cr", + "4Ls", "5I3", "To", "03U", "0Yq", "zC", "436", "56v", "4oo", "6ZL", "ws", "0TA", "0zm", "2ON", "60h", "4AC", + "42", "27B", "6Hd", "49O", "4Sk", "6fH", "Kw", "0hE", "0eu", "FG", "6kx", "5Nz", "4pw", "5u7", "hk", "0KY", + "0DX", "gj", "5z6", "5oW", "4QZ", "6dy", "IF", "0jt", "0gD", "Dv", "6iI", "5LK", "46N", "6Ge", "jZ", "0Ih", + "0P", "a9", "4lD", "6Yg", "63C", "4Bh", "0yF", "Zt", "WD", "0tv", "4OX", "4Z9", "5d4", "4at", "0ZZ", "yh", + "2a", "1Ez", "4nu", "5k5", "4U8", "5Px", "1kV", "XE", "Uu", "02O", "4Mi", "6xJ", "6Vf", "4cE", "n8", "2mH", + "iu", "0JG", "45a", "6DJ", "6jf", "5Od", "R8", "GY", "Ji", "1yz", "4Ru", "5W5", "4i8", "48Q", "0Gw", "dE", + "kD", "0Hv", "47P", "4f9", "5X4", "5MU", "0fZ", "Eh", "HX", "0kj", "4PD", "6eg", "6KK", "5nI", "0EF", "ft", + "1Ke", "xv", "6UI", "54C", "4NF", "7kD", "VZ", "0uh", "0xX", "0m9", "5F6", "4Cv", "4mZ", "6Xy", "1N", "0Vt", + "0Yu", "zG", "432", "56r", "4Lw", "5I7", "Tk", "03Q", "0zi", "2OJ", "60l", "4AG", "4ok", "6ZH", "ww", "0TE", + "4So", "6fL", "Ks", "0hA", "46", "27F", "7XA", "49K", "4ps", "5u3", "ho", "8BE", "0eq", "FC", "aAn", "bdl", + "bkm", "70T", "IB", "0jp", "307", "gn", "5z2", "5oS", "46J", "6Ga", "28G", "0Il", "13i", "z", "6iM", "5LO", + "63G", "4Bl", "0yB", "Zp", "0T", "0Wn", "58i", "6Yc", "5d0", "4ap", "8SF", "yl", "1q2", "00z", "b1g", "aPm", + "61v", "746", "1kR", "XA", "2e", "9Lf", "4nq", "5k1", "6Vb", "4cA", "0Xo", "2mL", "Uq", "02K", "4Mm", "6xN", + "8YG", "7e", "5n1", "4kq", "716", "64v", "2KP", "1nR", "07K", "Pq", "69F", "4Hm", "4fA", "6Sb", "2hL", "1MN", + "0Rn", "5T", "7LB", "5ya", "4Gl", "66G", "2Ia", "08J", "05z", "1t2", "aUm", "b4g", "4dp", "5a0", "8d", "8VF", + "bn", "357", "4zr", "6OQ", "75T", "bnm", "0op", "LB", "Ar", "16i", "4Yn", "6lM", "6Ba", "43J", "0Ll", "2yO", + "22F", "16", "4xC", "agr", "6cL", "4Vo", "0mA", "Ns", "CC", "14X", "bal", "aDn", "5p3", "4us", "8GE", "mo", + "5L7", "4Iw", "06Q", "Qk", "1Y5", "1LT", "53r", "462", "7Oi", "4jk", "0QE", "rw", "2JJ", "1oH", "4DG", "65l", + "7nD", "4KF", "0ph", "SZ", "2kg", "1Ne", "4ej", "6PI", "493", "4hZ", "0St", "4N", "0h9", "09P", "4Fv", "5C6", + "4Xt", "6mW", "023", "0cZ", "0Mv", "nD", "4c9", "42P", "5kI", "6NK", "ct", "1Pg", "X9", "MX", "74N", "4UD", + "4ZE", "6of", "BY", "W8", "0OG", "lu", "6AJ", "40a", "4yY", "4l8", "aE", "0Bw", "18r", "Oi", "5R5", "4Wu", + "4EY", "4P8", "2KT", "1nV", "8YC", "7a", "5n5", "4ku", "4fE", "6Sf", "2hH", "k8", "07O", "Pu", "69B", "4Hi", + "4Gh", "66C", "2Ie", "08N", "d9", "5P", "7LF", "4iD", "4dt", "5a4", "2jy", "3o9", "0qv", "RD", "7oZ", "4JX", + "6ay", "4TZ", "0ot", "LF", "bj", "0AX", "4zv", "6OU", "6Be", "43N", "0Lh", "oZ", "Av", "0bD", "4Yj", "6lI", + "6cH", "4Vk", "0mE", "Nw", "22B", "12", "4xG", "6Md", "5p7", "4uw", "0NY", "mk", "CG", "1pT", "5Kz", "6nx", + "1Y1", "1LP", "53v", "466", "5L3", "4Is", "06U", "Qo", "2JN", "1oL", "4DC", "65h", "7Om", "4jo", "0QA", "rs", + "9z", "1Na", "4en", "6PM", "aTs", "4KB", "04d", "2EO", "d6D", "09T", "4Fr", "5C2", "497", "bRm", "0Sp", "4J", + "0Mr", "1H2", "aim", "42T", "4Xp", "6mS", "027", "17w", "0nn", "3Kl", "74J", "5Ea", "5kM", "6NO", "cp", "1Pc", + "0OC", "lq", "6AN", "40e", "4ZA", "6ob", "2TL", "0ao", "18v", "Om", "5R1", "4Wq", "bCn", "afl", "aA", "0Bs", + "07C", "Py", "69N", "4He", "4fI", "6Sj", "2hD", "k4", "0PW", "7m", "5n9", "4ky", "4EU", "4P4", "2KX", "1nZ", + "05r", "RH", "7oV", "4JT", "4dx", "5a8", "8l", "1Ow", "d5", "qT", "7LJ", "4iH", "4Gd", "66O", "2Ii", "08B", + "Az", "0bH", "4Yf", "6lE", "6Bi", "43B", "z7", "oV", "bf", "0AT", "4zz", "6OY", "4A7", "4TV", "0ox", "LJ", + "CK", "14P", "5Kv", "4N6", "543", "41s", "0NU", "mg", "22N", "u6", "4xK", "6Mh", "6cD", "4Vg", "0mI", "2Xj", + "7Oa", "4jc", "0QM", "6w", "2JB", "I2", "4DO", "65d", "68T", "b7D", "06Y", "Qc", "dSm", "287", "4gS", "4r2", + "7MP", "4hR", "276", "4F", "0h1", "09X", "b8E", "67U", "7nL", "4KN", "F3", "SR", "9v", "1Nm", "4eb", "6PA", + "5kA", "6NC", "21e", "1Po", "X1", "MP", "74F", "4UL", "bbO", "79v", "0v3", "0cR", "8Df", "nL", "4c1", "42X", + "4yQ", "4l0", "aM", "8Kg", "0lS", "Oa", "76w", "637", "4ZM", "6on", "BQ", "W0", "0OO", "2zl", "6AB", "40i", + "4fM", "6Sn", "3xa", "k0", "07G", "2Fl", "69J", "4Ha", "4EQ", "4P0", "d5g", "83o", "0PS", "7i", "a0D", "bQN", + "50U", "hbt", "8h", "1Os", "05v", "RL", "7oR", "4JP", "5WA", "66K", "2Im", "08F", "d1", "5X", "7LN", "4iL", + "6Bm", "43F", "z3", "oR", "2Wo", "0bL", "4Yb", "6lA", "4A3", "4TR", "8fd", "LN", "bb", "0AP", "cPl", "aeO", + "547", "41w", "0NQ", "mc", "CO", "14T", "5Kr", "4N2", "77i", "4Vc", "0mM", "2Xn", "22J", "u2", "4xO", "6Ml", + "2JF", "I6", "4DK", "6qh", "7Oe", "4jg", "0QI", "6s", "1Y9", "1LX", "4gW", "4r6", "68P", "5YZ", "0rU", "Qg", + "0h5", "1mu", "4Fz", "67Q", "7MT", "4hV", "0Sx", "4B", "9r", "1Ni", "4ef", "6PE", "7nH", "4KJ", "F7", "SV", + "X5", "MT", "74B", "4UH", "5kE", "6NG", "cx", "1Pk", "0Mz", "nH", "4c5", "4vT", "4Xx", "79r", "0v7", "0cV", + "0lW", "Oe", "5R9", "4Wy", "4yU", "4l4", "aI", "1RZ", "0OK", "ly", "6AF", "40m", "4ZI", "6oj", "BU", "W4", + "265", "5E", "488", "4iQ", "b9F", "66V", "0i2", "1lr", "G0", "RQ", "7oO", "4JM", "4da", "6QB", "8u", "1On", + "0PN", "7t", "7Nb", "aa0", "4EL", "64g", "2KA", "H1", "07Z", "0f3", "69W", "b6G", "4fP", "479", "dRn", "294", + "22W", "8Jd", "4xR", "4m3", "77t", "624", "0mP", "Nb", "CR", "V3", "5Ko", "6nm", "ajS", "41j", "0NL", "3kN", + "20f", "0AM", "4zc", "aeR", "6al", "4TO", "Y2", "LS", "Ac", "0bQ", "bcL", "78u", "4b2", "4wS", "8Ee", "oO", + "7nU", "4KW", "04q", "SK", "9o", "1Nt", "51R", "6PX", "7MI", "4hK", "e6", "pW", "2Hj", "09A", "4Fg", "67L", + "68M", "4If", "0rH", "Qz", "2iG", "j7", "4gJ", "6Ri", "7Ox", "4jz", "0QT", "6n", "1z8", "1oY", "4DV", "4Q7", + "4ZT", "4O5", "BH", "0az", "0OV", "ld", "550", "40p", "4yH", "6Lk", "aT", "t5", "0lJ", "Ox", "6bG", "4Wd", + "4Xe", "6mF", "2Vh", "0cK", "0Mg", "nU", "6Cj", "42A", "5kX", "6NZ", "ce", "1Pv", "2N9", "MI", "7pW", "4UU", + "4Gy", "5B9", "0i6", "1lv", "1BZ", "5A", "7LW", "4iU", "4de", "6QF", "8q", "1Oj", "G4", "RU", "7oK", "4JI", + "4EH", "64c", "2KE", "H5", "0PJ", "7p", "7Nf", "4kd", "4fT", "4s5", "2hY", "290", "0sV", "Pd", "5M8", "4Hx", + "6cY", "4Vz", "0mT", "Nf", "1F8", "0Cx", "4xV", "4m7", "7Pd", "41n", "0NH", "mz", "CV", "V7", "5Kk", "6ni", + "6ah", "4TK", "Y6", "LW", "20b", "0AI", "4zg", "6OD", "4b6", "4wW", "0Ly", "oK", "Ag", "0bU", "5IZ", "6lX", + "9k", "1Np", "51V", "azN", "7nQ", "4KS", "04u", "SO", "2Hn", "09E", "4Fc", "67H", "7MM", "4hO", "e2", "pS", + "2iC", "j3", "4gN", "6Rm", "68I", "4Ib", "06D", "2Go", "d4d", "82l", "4DR", "4Q3", "a1G", "bPM", "0QP", "6j", + "0OR", "0Z3", "554", "40t", "4ZP", "4O1", "BL", "15W", "0lN", "2Ym", "6bC", "5GA", "4yL", "6Lo", "aP", "09", + "0Mc", "nQ", "6Cn", "42E", "4Xa", "6mB", "2Vl", "0cO", "8gg", "MM", "7pS", "4UQ", "bAN", "adL", "ca", "1Pr", + "G8", "RY", "7oG", "4JE", "4di", "6QJ", "2jd", "1Of", "0Rw", "5M", "480", "4iY", "4Gu", "5B5", "2Ix", "08S", + "07R", "Ph", "5M4", "4Ht", "4fX", "471", "1X6", "1MW", "0PF", "st", "7Nj", "4kh", "4ED", "64o", "2KI", "H9", + "CZ", "14A", "5Kg", "6ne", "7Ph", "41b", "0ND", "mv", "1F4", "0Ct", "4xZ", "6My", "5S6", "4Vv", "0mX", "Nj", + "Ak", "0bY", "4Yw", "6lT", "6Bx", "43S", "0Lu", "oG", "bw", "0AE", "4zk", "6OH", "6ad", "4TG", "0oi", "2ZJ", + "7MA", "4hC", "0Sm", "4W", "2Hb", "09I", "4Fo", "67D", "aTn", "b5d", "04y", "SC", "9g", "8WE", "4es", "6PP", + "5o2", "4jr", "8XD", "6f", "1z0", "1oQ", "705", "65u", "68E", "4In", "06H", "Qr", "2iO", "1LM", "4gB", "6Ra", + "5ia", "6Lc", "23E", "05", "0lB", "Op", "6bO", "4Wl", "c4F", "aEm", "1d2", "0ar", "8FF", "ll", "558", "40x", + "5kP", "6NR", "cm", "344", "0ns", "MA", "74W", "bon", "4Xm", "6mN", "3FA", "0cC", "0Mo", "2xL", "6Cb", "42I", + "4dm", "6QN", "8y", "1Ob", "05g", "2DL", "7oC", "4JA", "4Gq", "5B1", "d7G", "08W", "0Rs", "5I", "484", "bSn", + "52u", "475", "1X2", "1MS", "07V", "Pl", "5M0", "4Hp", "5Ua", "64k", "2KM", "1nO", "0PB", "7x", "7Nn", "4kl", + "7Pl", "41f", "8GX", "mr", "2UO", "14E", "5Kc", "6na", "5S2", "4Vr", "19u", "Nn", "1F0", "0Cp", "bBm", "ago", + "ahn", "43W", "0Lq", "oC", "Ao", "16t", "4Ys", "6lP", "75I", "4TC", "0om", "2ZN", "bs", "0AA", "4zo", "6OL", + "2Hf", "09M", "4Fk", "6sH", "7ME", "4hG", "0Si", "4S", "9c", "1Nx", "4ew", "6PT", "7nY", "bqh", "0pu", "SG", + "1z4", "1oU", "4DZ", "65q", "5o6", "4jv", "0QX", "6b", "2iK", "1LI", "4gF", "6Re", "68A", "4Ij", "06L", "Qv", + "0lF", "Ot", "6bK", "4Wh", "4yD", "6Lg", "aX", "01", "0OZ", "lh", "5q4", "4tt", "4ZX", "4O9", "BD", "0av", + "0nw", "ME", "74S", "4UY", "5kT", "6NV", "ci", "1Pz", "0Mk", "nY", "6Cf", "42M", "4Xi", "6mJ", "2Vd", "0cG", + "bL", "8Hf", "4zP", "4o1", "75v", "606", "0oR", "0z3", "AP", "T1", "4YL", "6lo", "6BC", "43h", "0LN", "2ym", + "22d", "0CO", "4xa", "6MB", "6cn", "4VM", "0mc", "NQ", "Ca", "14z", "baN", "aDL", "7PS", "41Y", "8Gg", "mM", + "247", "7G", "7NQ", "4kS", "com", "64T", "0k0", "1np", "E2", "PS", "69d", "4HO", "4fc", "7Ca", "2hn", "1Ml", + "0RL", "5v", "avS", "4ib", "4GN", "66e", "2IC", "J3", "05X", "Rb", "aUO", "b4E", "4dR", "4q3", "8F", "8Vd", + "4XV", "4M7", "1f8", "0cx", "0MT", "nf", "572", "42r", "5kk", "6Ni", "cV", "v7", "0nH", "Mz", "74l", "4Uf", + "4Zg", "6oD", "2Tj", "0aI", "y6", "lW", "6Ah", "40C", "5iZ", "583", "ag", "0BU", "0ly", "OK", "4B6", "4WW", + "7lW", "4IU", "06s", "QI", "0I6", "1Lv", "4gy", "5b9", "7OK", "4jI", "g4", "rU", "2Jh", "1oj", "4De", "65N", + "7nf", "4Kd", "04B", "Sx", "2kE", "h5", "4eH", "6Pk", "5m8", "4hx", "0SV", "4l", "2HY", "09r", "4FT", "4S5", + "5Q8", "4Tx", "0oV", "Ld", "bH", "0Az", "4zT", "4o5", "6BG", "43l", "0LJ", "ox", "AT", "T5", "4YH", "6lk", + "6cj", "4VI", "0mg", "NU", "2vh", "0CK", "4xe", "6MF", "7PW", "4uU", "2n9", "mI", "Ce", "1pv", "5KX", "6nZ", + "5UZ", "64P", "0k4", "1nt", "0Py", "7C", "7NU", "4kW", "4fg", "6SD", "2hj", "1Mh", "E6", "PW", "7mI", "4HK", + "4GJ", "66a", "2IG", "J7", "0RH", "5r", "7Ld", "4if", "4dV", "4q7", "8B", "1OY", "0qT", "Rf", "7ox", "4Jz", + "0MP", "nb", "576", "42v", "4XR", "4M3", "dll", "17U", "0nL", "3KN", "74h", "4Ub", "5ko", "6Nm", "cR", "v3", + "y2", "lS", "6Al", "40G", "4Zc", "aER", "2Tn", "0aM", "18T", "OO", "4B2", "4WS", "bCL", "587", "ac", "0BQ", + "0I2", "1Lr", "53T", "axL", "68z", "4IQ", "06w", "QM", "2Jl", "1on", "4Da", "65J", "7OO", "4jM", "g0", "6Y", + "9X", "h1", "4eL", "6Po", "7nb", "aA0", "04F", "2Em", "d6f", "09v", "4FP", "4S1", "a3E", "bRO", "0SR", "4h", + "AX", "T9", "4YD", "6lg", "6BK", "4wh", "0LF", "ot", "bD", "0Av", "4zX", "4o9", "5Q4", "4Tt", "0oZ", "Lh", + "Ci", "14r", "5KT", "6nV", "ajh", "41Q", "0Nw", "mE", "22l", "0CG", "4xi", "6MJ", "6cf", "4VE", "0mk", "NY", + "07a", "2FJ", "69l", "4HG", "4fk", "6SH", "2hf", "1Md", "0Pu", "7O", "7NY", "bQh", "4Ew", "6pT", "0k8", "1nx", + "05P", "Rj", "5O6", "4Jv", "4dZ", "453", "8N", "1OU", "0RD", "qv", "7Lh", "4ij", "4GF", "66m", "2IK", "1lI", + "5kc", "6Na", "21G", "27", "8gX", "Mr", "74d", "4Un", "bbm", "79T", "1f0", "0cp", "397", "nn", "5s2", "42z", + "4ys", "6LP", "ao", "366", "0lq", "OC", "76U", "bml", "4Zo", "6oL", "Bs", "0aA", "0Om", "2zN", "7QA", "40K", + "7OC", "4jA", "0Qo", "6U", "3ZA", "1ob", "4Dm", "65F", "68v", "b7f", "0rs", "QA", "dSO", "8UG", "4gq", "5b1", + "5m0", "4hp", "8ZF", "4d", "1x2", "09z", "727", "67w", "7nn", "4Kl", "04J", "Sp", "9T", "1NO", "51i", "6Pc", + "6BO", "43d", "0LB", "op", "2WM", "0bn", "5Ia", "6lc", "5Q0", "4Tp", "8fF", "Ll", "1D2", "0Ar", "cPN", "aem", + "ajl", "41U", "0Ns", "mA", "Cm", "14v", "5KP", "6nR", "6cb", "4VA", "0mo", "2XL", "22h", "0CC", "4xm", "6MN", + "4fo", "6SL", "2hb", "8TY", "07e", "2FN", "69h", "4HC", "4Es", "64X", "d5E", "83M", "0Pq", "7K", "a0f", "bQl", + "50w", "457", "8J", "1OQ", "05T", "Rn", "5O2", "4Jr", "4GB", "66i", "2IO", "08d", "1Ba", "5z", "7Ll", "4in", + "0nD", "Mv", "7ph", "4Uj", "5kg", "6Ne", "cZ", "23", "0MX", "nj", "5s6", "4vv", "4XZ", "6my", "1f4", "0ct", + "0lu", "OG", "6bx", "5Gz", "4yw", "6LT", "ak", "0BY", "0Oi", "2zJ", "6Ad", "40O", "4Zk", "6oH", "Bw", "0aE", + "2Jd", "1of", "4Di", "65B", "7OG", "4jE", "g8", "6Q", "2ix", "1Lz", "4gu", "5b5", "68r", "4IY", "0rw", "QE", + "1x6", "1mW", "4FX", "4S9", "5m4", "4ht", "0SZ", "ph", "9P", "h9", "4eD", "6Pg", "7nj", "4Kh", "04N", "St", + "22u", "375", "4xp", "598", "77V", "blo", "0mr", "1h2", "Cp", "14k", "5KM", "6nO", "7PB", "41H", "0Nn", "3kl", + "20D", "34", "4zA", "6Ob", "6aN", "4Tm", "0oC", "Lq", "AA", "0bs", "bcn", "78W", "569", "43y", "384", "om", + "9Kd", "5g", "5l3", "4is", "734", "66t", "1y1", "08y", "05I", "Rs", "7om", "4Jo", "4dC", "7AA", "8W", "1OL", + "0Pl", "7V", "ats", "4kB", "4En", "64E", "2Kc", "1na", "07x", "PB", "69u", "b6e", "4fr", "5c2", "dRL", "8TD", + "4Zv", "6oU", "Bj", "0aX", "0Ot", "lF", "6Ay", "40R", "4yj", "6LI", "av", "0BD", "0lh", "OZ", "6be", "4WF", + "4XG", "6md", "2VJ", "0ci", "0ME", "nw", "6CH", "42c", "5kz", "6Nx", "cG", "1PT", "0nY", "Mk", "5P7", "4Uw", + "5N5", "4Ku", "04S", "Si", "9M", "1NV", "4eY", "440", "7Mk", "4hi", "0SG", "pu", "2HH", "K8", "4FE", "67n", + "68o", "4ID", "1", "QX", "2ie", "1Lg", "4gh", "6RK", "7OZ", "4jX", "0Qv", "6L", "2Jy", "3O9", "4Dt", "5A4", + "4C9", "4VX", "0mv", "ND", "22q", "0CZ", "4xt", "6MW", "7PF", "41L", "x9", "mX", "Ct", "14o", "5KI", "6nK", + "6aJ", "4Ti", "0oG", "Lu", "bY", "30", "4zE", "6Of", "5r5", "4wu", "380", "oi", "AE", "0bw", "4YY", "4L8", + "5Wz", "66p", "1y5", "1lT", "0RY", "5c", "5l7", "4iw", "4dG", "6Qd", "8S", "1OH", "05M", "Rw", "7oi", "4Jk", + "4Ej", "64A", "2Kg", "1ne", "0Ph", "7R", "7ND", "4kF", "4fv", "5c6", "0H9", "1My", "0st", "PF", "69q", "4HZ", + "0Op", "lB", "ako", "40V", "4Zr", "6oQ", "Bn", "15u", "0ll", "2YO", "6ba", "4WB", "4yn", "6LM", "ar", "1Ra", + "0MA", "ns", "6CL", "42g", "4XC", "79I", "2VN", "0cm", "8gE", "Mo", "5P3", "4Us", "bAl", "adn", "cC", "1PP", + "9I", "1NR", "51t", "444", "5N1", "4Kq", "04W", "Sm", "2HL", "09g", "4FA", "67j", "7Mo", "4hm", "0SC", "4y", + "2ia", "1Lc", "4gl", "6RO", "68k", "5Ya", "5", "2GM", "d4F", "82N", "4Dp", "5A0", "a1e", "bPo", "0Qr", "6H", + "Cx", "14c", "5KE", "6nG", "7PJ", "4uH", "x5", "mT", "0V7", "0CV", "4xx", "590", "4C5", "4VT", "0mz", "NH", + "AI", "16R", "4YU", "4L4", "561", "43q", "0LW", "oe", "bU", "w4", "4zI", "6Oj", "6aF", "4Te", "0oK", "Ly", + "05A", "2Dj", "7oe", "4Jg", "4dK", "6Qh", "2jF", "i6", "0RU", "5o", "7Ly", "5yZ", "4GW", "4R6", "1y9", "08q", + "07p", "PJ", "7mT", "4HV", "4fz", "6SY", "0H5", "1Mu", "f7", "sV", "7NH", "4kJ", "4Ef", "64M", "2Kk", "1ni", + "4yb", "6LA", "23g", "0BL", "Z3", "OR", "6bm", "4WN", "c4d", "aEO", "Bb", "0aP", "8Fd", "lN", "4a3", "40Z", + "5kr", "4n2", "cO", "8Ie", "0nQ", "Mc", "74u", "615", "4XO", "6ml", "2VB", "U2", "0MM", "2xn", "7Sa", "42k", + "7Mc", "4ha", "0SO", "4u", "3Xa", "K0", "4FM", "67f", "aTL", "b5F", "0pS", "Sa", "9E", "8Wg", "4eQ", "448", + "7OR", "4jP", "254", "6D", "0j3", "1os", "cnn", "65W", "68g", "4IL", "9", "QP", "2im", "1Lo", "53I", "6RC", + "7PN", "41D", "x1", "mP", "2Um", "14g", "5KA", "6nC", "4C1", "4VP", "19W", "NL", "0V3", "0CR", "bBO", "594", + "565", "43u", "0LS", "oa", "AM", "16V", "4YQ", "4L0", "6aB", "4Ta", "0oO", "2Zl", "bQ", "38", "4zM", "6On", + "4dO", "6Ql", "2jB", "i2", "05E", "2Dn", "7oa", "4Jc", "4GS", "4R2", "d7e", "08u", "0RQ", "5k", "a2F", "bSL", + "52W", "ayO", "0H1", "1Mq", "07t", "PN", "69y", "4HR", "4Eb", "64I", "2Ko", "1nm", "f3", "7Z", "7NL", "4kN", + "Z7", "OV", "6bi", "4WJ", "4yf", "6LE", "az", "0BH", "0Ox", "lJ", "4a7", "4tV", "4Zz", "6oY", "Bf", "0aT", + "0nU", "Mg", "74q", "5EZ", "5kv", "4n6", "cK", "1PX", "0MI", "2xj", "6CD", "42o", "4XK", "6mh", "2VF", "U6", + "2HD", "K4", "4FI", "67b", "7Mg", "4he", "0SK", "4q", "9A", "1NZ", "4eU", "4p4", "5N9", "4Ky", "0pW", "Se", + "0j7", "1ow", "4Dx", "5A8", "7OV", "4jT", "0Qz", "rH", "2ii", "1Lk", "4gd", "6RG", "68c", "4IH", "D5", "QT", + "5Ls", "4I3", "F", "13U", "0IP", "jb", "536", "46v", "5oo", "6Jm", "gR", "r3", "0jL", "3ON", "6dA", "4Qb", + "5NB", "aAR", "2Pn", "0eM", "0Ka", "hS", "6El", "44G", "49w", "abN", "ec", "0FQ", "8ae", "KO", "4F2", "4SS", + "4X0", "4MQ", "02w", "UM", "0M2", "0XS", "57T", "a8D", "7KO", "4nM", "c0", "2Y", "2Nl", "1kn", "aJ1", "61J", + "6zC", "aE0", "00F", "2Am", "yP", "l1", "4aL", "6To", "a7E", "58U", "0WR", "0h", "ZL", "84n", "4BP", "4W1", + "fH", "0Ez", "5nu", "4k5", "5U8", "4Px", "0kV", "Hd", "ET", "P5", "5Mi", "6hk", "6FG", "47l", "0HJ", "kx", + "dy", "0GK", "48m", "6IF", "6gj", "4RI", "0ig", "JU", "Ge", "0dW", "5OX", "5Z9", "4d4", "4qU", "1ZZ", "iI", + "0Ty", "3C", "4z6", "4oW", "5QZ", "60P", "Yg", "0zU", "A6", "TW", "6yh", "4LK", "4bg", "6WD", "2lj", "0YI", + "0VH", "1r", "6XE", "4mf", "4CJ", "62a", "2MG", "N7", "0uT", "Vf", "7kx", "4Nz", "5pw", "4u7", "xJ", "1KY", + "0IT", "jf", "532", "46r", "5Lw", "4I7", "B", "0gx", "0jH", "Iz", "6dE", "4Qf", "5ok", "6Ji", "gV", "r7", + "0Ke", "hW", "6Eh", "44C", "5NF", "6kD", "2Pj", "0eI", "0hy", "KK", "4F6", "4SW", "49s", "6HX", "eg", "0FU", + "0M6", "0XW", "4cy", "5f9", "4X4", "4MU", "02s", "UI", "Xy", "1kj", "5PD", "61N", "7KK", "4nI", "c4", "vU", + "yT", "l5", "4aH", "6Tk", "6zG", "4Od", "00B", "Wx", "ZH", "0yz", "4BT", "4W5", "5i8", "4lx", "0WV", "0l", + "71v", "646", "0kR", "3NP", "fL", "8Lf", "5nq", "4k1", "6FC", "47h", "0HN", "29e", "EP", "P1", "5Mm", "6ho", + "6gn", "4RM", "0ic", "JQ", "26d", "0GO", "48i", "6IB", "4d0", "45Y", "8Cg", "iM", "Ga", "0dS", "beN", "hYu", + "ckm", "60T", "Yc", "0zQ", "207", "3G", "4z2", "4oS", "4bc", "7Ga", "2ln", "0YM", "A2", "TS", "6yl", "4LO", + "4CN", "62e", "2MC", "N3", "0VL", "1v", "6XA", "4mb", "5ps", "4u3", "xN", "8Rd", "01X", "Vb", "aQO", "b0E", + "5og", "6Je", "gZ", "63", "0jD", "Iv", "6dI", "4Qj", "7l9", "6iy", "N", "0gt", "0IX", "jj", "5w6", "4rv", + "5mV", "5x7", "ek", "0FY", "0hu", "KG", "6fx", "5Cz", "5NJ", "6kH", "Fw", "0eE", "92", "3nk", "6Ed", "44O", + "7KG", "4nE", "c8", "2Q", "Xu", "1kf", "5PH", "61B", "4X8", "4MY", "0vw", "UE", "2mx", "1Hz", "4cu", "5f5", + "5i4", "4lt", "0WZ", "th", "ZD", "0yv", "4BX", "4W9", "6zK", "4Oh", "00N", "Wt", "yX", "l9", "4aD", "6Tg", + "2SM", "0fn", "5Ma", "6hc", "6FO", "47d", "0HB", "kp", "24Y", "0Er", "bDo", "aam", "5U0", "4Pp", "8bF", "Hl", + "Gm", "10v", "5OP", "5Z1", "anl", "45U", "0Js", "iA", "dq", "0GC", "48e", "6IN", "6gb", "4RA", "0io", "3Lm", + "03e", "2BN", "7iA", "4LC", "4bo", "6WL", "zs", "0YA", "0Tq", "3K", "a4f", "bUl", "4As", "5D3", "Yo", "87M", + "01T", "Vn", "5K2", "4Nr", "54w", "417", "xB", "1KQ", "1Fa", "1z", "6XM", "4mn", "4CB", "62i", "2MO", "0xl", + "1za", "Ir", "6dM", "4Qn", "5oc", "6Ja", "25G", "67", "9Pe", "jn", "5w2", "46z", "bfm", "aCo", "J", "0gp", + "0hq", "KC", "72U", "bil", "5mR", "5x3", "eo", "326", "96", "3no", "7UA", "44K", "5NN", "6kL", "Fs", "0eA", + "Xq", "1kb", "5PL", "61F", "7KC", "4nA", "0Uo", "2U", "39U", "8QG", "4cq", "5f1", "aRl", "796", "0vs", "UA", + "2LQ", "0yr", "767", "63w", "5i0", "4lp", "9Ng", "0d", "2oM", "0Zn", "55i", "6Tc", "6zO", "4Ol", "00J", "Wp", + "6FK", "4sh", "0HF", "kt", "EX", "P9", "5Me", "6hg", "5U4", "4Pt", "0kZ", "Hh", "fD", "0Ev", "5ny", "4k9", + "4d8", "45Q", "0Jw", "iE", "Gi", "10r", "5OT", "5Z5", "6gf", "4RE", "0ik", "JY", "du", "0GG", "48a", "6IJ", + "4bk", "6WH", "zw", "0YE", "03a", "2BJ", "6yd", "4LG", "4Aw", "5D7", "Yk", "0zY", "0Tu", "3O", "6Zx", "bUh", + "54s", "413", "xF", "1KU", "01P", "Vj", "5K6", "4Nv", "4CF", "62m", "2MK", "0xh", "0VD", "uv", "6XI", "4mj", + "5NS", "6kQ", "Fn", "11u", "0Kp", "hB", "aoo", "44V", "49f", "6HM", "er", "1Va", "0hl", "3Mn", "6fa", "4SB", + "5Lb", "7yA", "W", "0gm", "0IA", "js", "6GL", "46g", "bEl", "hyW", "gC", "0Dq", "8cE", "Io", "5T3", "4Qs", + "5J1", "4Oq", "00W", "Wm", "yA", "0Zs", "55t", "404", "6YN", "4lm", "0WC", "0y", "2LL", "0yo", "4BA", "63j", + "6xc", "bws", "02f", "2CM", "2ma", "0XB", "4cl", "6VO", "a5e", "bTo", "0Ur", "2H", "Xl", "86N", "5PQ", "5E0", + "dh", "0GZ", "5lU", "5y4", "4G9", "4RX", "0iv", "JD", "Gt", "0dF", "5OI", "6jK", "6Dg", "45L", "81", "iX", + "fY", "70", "5nd", "6Kf", "6eJ", "4Pi", "0kG", "Hu", "EE", "0fw", "5Mx", "4H8", "5v5", "4su", "1Xz", "ki", + "0VY", "1c", "5h7", "4mw", "5Sz", "62p", "2MV", "0xu", "01M", "Vw", "7ki", "4Nk", "54n", "6Ud", "2nJ", "1KH", + "0Th", "3R", "6Ze", "4oF", "4Aj", "60A", "Yv", "0zD", "0wt", "TF", "6yy", "4LZ", "4bv", "5g6", "zj", "0YX", + "0Kt", "hF", "6Ey", "44R", "5NW", "6kU", "Fj", "0eX", "0hh", "KZ", "6fe", "4SF", "49b", "6HI", "ev", "0FD", + "0IE", "jw", "6GH", "46c", "5Lf", "6id", "S", "0gi", "0jY", "Ik", "5T7", "4Qw", "5oz", "6Jx", "gG", "0Du", + "yE", "0Zw", "4aY", "400", "5J5", "4Ou", "00S", "Wi", "ZY", "O8", "4BE", "63n", "6YJ", "4li", "0WG", "tu", + "2me", "0XF", "4ch", "6VK", "6xg", "4MD", "02b", "UX", "Xh", "3K9", "5PU", "5E4", "7KZ", "4nX", "0Uv", "2L", + "73V", "bho", "0ir", "1l2", "dl", "335", "48x", "5y0", "6Dc", "45H", "85", "3ol", "Gp", "0dB", "5OM", "6jO", + "6eN", "4Pm", "0kC", "Hq", "24D", "74", "bDr", "6Kb", "529", "47y", "8AG", "km", "EA", "0fs", "bgn", "aBl", + "774", "62t", "199", "0xq", "9Od", "1g", "5h3", "4ms", "54j", "7EA", "2nN", "1KL", "01I", "Vs", "7km", "4No", + "4An", "60E", "Yr", "1ja", "0Tl", "3V", "6Za", "4oB", "4br", "5g2", "zn", "8PD", "03x", "TB", "aSo", "785", + "49n", "6HE", "ez", "0FH", "0hd", "KV", "6fi", "4SJ", "bdI", "6kY", "Ff", "0eT", "0Kx", "hJ", "4e7", "4pV", + "5ov", "4j6", "gK", "0Dy", "0jU", "Ig", "6dX", "5AZ", "5Lj", "6ih", "DW", "Q6", "0II", "28b", "6GD", "46o", + "6YF", "4le", "0WK", "0q", "ZU", "O4", "4BI", "63b", "5J9", "4Oy", "0tW", "We", "yI", "1JZ", "4aU", "4t4", + "7KV", "4nT", "0Uz", "vH", "Xd", "1kw", "5PY", "5E8", "6xk", "4MH", "02n", "UT", "2mi", "0XJ", "4cd", "6VG", + "2Qm", "0dN", "5OA", "6jC", "6Do", "45D", "89", "iP", "0R3", "0GR", "48t", "acM", "4G1", "4RP", "94O", "JL", + "EM", "12V", "5Mp", "4H0", "525", "47u", "0HS", "ka", "fQ", "78", "5nl", "6Kn", "6eB", "4Pa", "0kO", "3NM", + "01E", "3PO", "7ka", "4Nc", "54f", "6Ul", "xS", "m2", "0VQ", "1k", "a6F", "59V", "4CS", "4V2", "195", "85m", + "03t", "TN", "4Y3", "4LR", "56W", "a9G", "zb", "0YP", "b3", "3Z", "6Zm", "4oN", "4Ab", "60I", "2Oo", "0zL", + "1xA", "KR", "6fm", "4SN", "49j", "6HA", "27g", "0FL", "8Bd", "hN", "4e3", "44Z", "bdM", "aAO", "Fb", "0eP", + "0jQ", "Ic", "70u", "655", "5or", "4j2", "gO", "8Me", "0IM", "28f", "7Wa", "46k", "5Ln", "6il", "DS", "Q2", + "ZQ", "O0", "4BM", "63f", "6YB", "4la", "0WO", "0u", "yM", "8Sg", "4aQ", "408", "aPL", "b1F", "0tS", "Wa", + "0n3", "1ks", "bzO", "61W", "7KR", "4nP", "214", "2D", "2mm", "0XN", "57I", "6VC", "6xo", "4ML", "02j", "UP", + "6Dk", "4qH", "0Jf", "iT", "Gx", "0dJ", "5OE", "6jG", "4G5", "4RT", "0iz", "JH", "dd", "0GV", "48p", "5y8", + "521", "47q", "0HW", "ke", "EI", "12R", "5Mt", "4H4", "6eF", "4Pe", "0kK", "Hy", "fU", "s4", "5nh", "6Kj", + "54b", "6Uh", "xW", "m6", "01A", "3PK", "7ke", "4Ng", "4CW", "4V6", "191", "0xy", "0VU", "1o", "6XX", "59R", + "4bz", "6WY", "zf", "0YT", "03p", "TJ", "4Y7", "4LV", "4Af", "60M", "Yz", "0zH", "b7", "wV", "6Zi", "4oJ", + "5H3", "4Ms", "02U", "Uo", "2mR", "0Xq", "57v", "426", "7Km", "4no", "0UA", "vs", "2NN", "1kL", "5Pb", "61h", + "6za", "4OB", "00d", "2AO", "yr", "1Ja", "4an", "6TM", "a7g", "58w", "0Wp", "0J", "Zn", "84L", "4Br", "5G2", + "5LQ", "5Y0", "d", "13w", "0Ir", "1L2", "amm", "46T", "5oM", "6JO", "gp", "0DB", "0jn", "3Ol", "6dc", "5Aa", + "bdr", "6kb", "2PL", "0eo", "0KC", "hq", "6EN", "44e", "49U", "abl", "eA", "0Fs", "8aG", "Km", "5V1", "4Sq", + "1Dz", "3a", "5j5", "4ou", "4AY", "4T8", "YE", "0zw", "03O", "Tu", "6yJ", "4Li", "4bE", "6Wf", "zY", "o8", + "0Vj", "1P", "6Xg", "4mD", "4Ch", "62C", "2Me", "0xF", "0uv", "VD", "7kZ", "4NX", "5pU", "5e4", "xh", "3k9", + "fj", "0EX", "5nW", "6KU", "6ey", "4PZ", "0kt", "HF", "Ev", "0fD", "5MK", "6hI", "6Fe", "47N", "0Hh", "kZ", + "26B", "52", "48O", "6Id", "6gH", "4Rk", "0iE", "Jw", "GG", "0du", "5Oz", "6jx", "5t7", "4qw", "0JY", "ik", + "2mV", "0Xu", "57r", "422", "5H7", "4Mw", "02Q", "Uk", "2NJ", "1kH", "5Pf", "61l", "7Ki", "4nk", "0UE", "vw", + "yv", "0ZD", "4aj", "6TI", "6ze", "4OF", "0th", "WZ", "Zj", "0yX", "4Bv", "5G6", "6Yy", "4lZ", "0Wt", "0N", + "0Iv", "jD", "4g9", "46P", "5LU", "5Y4", "Dh", "0gZ", "0jj", "IX", "6dg", "4QD", "5oI", "6JK", "gt", "0DF", + "0KG", "hu", "6EJ", "44a", "5Nd", "6kf", "FY", "S8", "1xz", "Ki", "5V5", "4Su", "49Q", "4h8", "eE", "0Fw", + "756", "60v", "YA", "0zs", "9Mf", "3e", "5j1", "4oq", "4bA", "6Wb", "2lL", "0Yo", "03K", "Tq", "6yN", "4Lm", + "4Cl", "62G", "2Ma", "0xB", "0Vn", "1T", "6Xc", "59i", "54Y", "5e0", "xl", "8RF", "01z", "1p2", "aQm", "b0g", + "71T", "bjm", "0kp", "HB", "fn", "317", "5nS", "6KQ", "6Fa", "47J", "0Hl", "29G", "Er", "12i", "5MO", "6hM", + "6gL", "4Ro", "0iA", "Js", "26F", "56", "48K", "7YA", "5t3", "4qs", "8CE", "io", "GC", "0dq", "bel", "hYW", + "7Ke", "4ng", "0UI", "2s", "XW", "M6", "5Pj", "6uh", "6xX", "6m9", "0vU", "Ug", "2mZ", "0Xy", "4cW", "4v6", + "4y7", "4lV", "0Wx", "0B", "Zf", "0yT", "4Bz", "63Q", "6zi", "4OJ", "B7", "WV", "yz", "0ZH", "4af", "6TE", + "5oE", "6JG", "gx", "0DJ", "0jf", "IT", "6dk", "4QH", "5LY", "5Y8", "l", "0gV", "0Iz", "jH", "4g5", "4rT", + "5mt", "4h4", "eI", "1VZ", "0hW", "Ke", "5V9", "4Sy", "5Nh", "6kj", "FU", "S4", "0KK", "hy", "6EF", "44m", + "03G", "2Bl", "6yB", "4La", "4bM", "6Wn", "zQ", "o0", "0TS", "3i", "a4D", "bUN", "4AQ", "4T0", "YM", "87o", + "01v", "VL", "7kR", "4NP", "54U", "hft", "0N3", "1Ks", "0Vb", "1X", "6Xo", "4mL", "5SA", "62K", "2Mm", "0xN", + "2So", "0fL", "5MC", "6hA", "6Fm", "47F", "1XA", "kR", "fb", "0EP", "bDM", "aaO", "4E3", "4PR", "8bd", "HN", + "GO", "10T", "5Or", "4J2", "507", "45w", "0JQ", "ic", "dS", "q2", "48G", "6Il", "73i", "4Rc", "0iM", "3LO", + "XS", "M2", "5Pn", "61d", "7Ka", "4nc", "0UM", "2w", "39w", "8Qe", "4cS", "4v2", "aRN", "b3D", "02Y", "Uc", + "Zb", "0yP", "bxM", "63U", "4y3", "4lR", "236", "0F", "2oo", "0ZL", "4ab", "6TA", "6zm", "4ON", "B3", "WR", + "0jb", "IP", "6do", "4QL", "5oA", "6JC", "25e", "0DN", "9PG", "jL", "4g1", "46X", "686", "aCM", "h", "0gR", + "0hS", "Ka", "72w", "677", "49Y", "4h0", "eM", "8Og", "0KO", "3nM", "6EB", "44i", "5Nl", "6kn", "FQ", "S0", + "4bI", "6Wj", "zU", "o4", "03C", "Ty", "6yF", "4Le", "4AU", "4T4", "YI", "1jZ", "0TW", "3m", "5j9", "4oy", + "54Q", "5e8", "xd", "1Kw", "01r", "VH", "7kV", "4NT", "4Cd", "62O", "2Mi", "0xJ", "0Vf", "uT", "6Xk", "4mH", + "6Fi", "47B", "0Hd", "kV", "Ez", "0fH", "5MG", "6hE", "4E7", "4PV", "0kx", "HJ", "ff", "0ET", "bDI", "6KY", + "503", "45s", "0JU", "ig", "GK", "0dy", "5Ov", "4J6", "6gD", "4Rg", "0iI", "3LK", "dW", "q6", "48C", "6Ih", + "4Z2", "4OS", "00u", "WO", "yc", "0ZQ", "55V", "hgw", "6Yl", "4lO", "a2", "tS", "2Ln", "0yM", "4Bc", "63H", + "6xA", "4Mb", "02D", "2Co", "2mC", "n3", "4cN", "6Vm", "a5G", "bTM", "0UP", "2j", "XN", "86l", "5Ps", "4U3", + "5Nq", "4K1", "FL", "11W", "0KR", "3nP", "514", "44t", "49D", "6Ho", "eP", "49", "0hN", "3ML", "6fC", "5CA", + "aV1", "6iB", "u", "0gO", "0Ic", "jQ", "6Gn", "46E", "bEN", "hyu", "ga", "0DS", "8cg", "IM", "4D0", "4QQ", + "1FZ", "1A", "4x4", "4mU", "4Cy", "5F9", "0m6", "0xW", "C4", "VU", "7kK", "4NI", "54L", "6UF", "xy", "1Kj", + "0TJ", "3p", "6ZG", "4od", "4AH", "60c", "YT", "L5", "0wV", "Td", "5I8", "4Lx", "4bT", "4w5", "zH", "0Yz", + "dJ", "0Gx", "5lw", "4i7", "6gY", "4Rz", "0iT", "Jf", "GV", "R7", "5Ok", "6ji", "6DE", "45n", "0JH", "iz", + "24b", "0EI", "5nF", "6KD", "6eh", "4PK", "0ke", "HW", "Eg", "0fU", "5MZ", "6hX", "4f6", "4sW", "0Hy", "kK", + "yg", "0ZU", "55R", "6TX", "4Z6", "4OW", "00q", "WK", "2Lj", "0yI", "4Bg", "63L", "6Yh", "4lK", "a6", "tW", + "2mG", "n7", "4cJ", "6Vi", "6xE", "4Mf", "0vH", "Uz", "XJ", "1kY", "5Pw", "4U7", "7Kx", "4nz", "0UT", "2n", + "0KV", "hd", "510", "44p", "5Nu", "4K5", "FH", "0ez", "0hJ", "Kx", "6fG", "4Sd", "5mi", "6Hk", "eT", "p5", + "0Ig", "jU", "6Gj", "46A", "5LD", "6iF", "q", "0gK", "1zZ", "II", "4D4", "4QU", "5oX", "5z9", "ge", "0DW", + "byN", "62V", "0m2", "0xS", "225", "1E", "4x0", "4mQ", "54H", "6UB", "2nl", "1Kn", "C0", "VQ", "7kO", "4NM", + "4AL", "60g", "YP", "L1", "0TN", "3t", "6ZC", "ae0", "4bP", "439", "zL", "8Pf", "03Z", "0b3", "aSM", "b2G", + "73t", "664", "0iP", "Jb", "dN", "8Nd", "48Z", "4i3", "6DA", "45j", "0JL", "3oN", "GR", "R3", "5Oo", "6jm", + "6el", "4PO", "0ka", "HS", "24f", "0EM", "5nB", "aaR", "4f2", "4sS", "8Ae", "kO", "Ec", "0fQ", "695", "aBN", + "6Yd", "4lG", "0Wi", "0S", "Zw", "0yE", "4Bk", "6wH", "6zx", "buh", "0tu", "WG", "yk", "0ZY", "4aw", "5d7", + "5k6", "4nv", "0UX", "2b", "XF", "1kU", "741", "61q", "6xI", "4Mj", "02L", "Uv", "2mK", "0Xh", "4cF", "6Ve", + "49L", "6Hg", "eX", "41", "0hF", "Kt", "6fK", "4Sh", "5Ny", "4K9", "FD", "0ev", "0KZ", "hh", "5u4", "4pt", + "5oT", "5z5", "gi", "1Tz", "0jw", "IE", "4D8", "4QY", "5LH", "6iJ", "Du", "0gG", "0Ik", "jY", "6Gf", "46M", + "01g", "3Pm", "7kC", "4NA", "54D", "6UN", "xq", "1Kb", "0Vs", "1I", "a6d", "59t", "4Cq", "5F1", "d3G", "85O", + "03V", "Tl", "5I0", "4Lp", "56u", "435", "2lQ", "0Yr", "0TB", "3x", "6ZO", "4ol", "5Qa", "60k", "2OM", "0zn", + "2QO", "0dl", "5Oc", "6ja", "6DM", "45f", "1Za", "ir", "dB", "0Gp", "48V", "aco", "5W2", "4Rr", "94m", "Jn", + "Eo", "12t", "5MR", "5X3", "aln", "47W", "0Hq", "kC", "fs", "0EA", "5nN", "6KL", "71I", "4PC", "0km", "3No", + "Zs", "0yA", "4Bo", "63D", "7IA", "4lC", "0Wm", "0W", "yo", "8SE", "4as", "5d3", "aPn", "b1d", "00y", "WC", + "XB", "1kQ", "745", "61u", "5k2", "4nr", "9Le", "2f", "2mO", "0Xl", "4cB", "6Va", "6xM", "4Mn", "02H", "Ur", + "0hB", "Kp", "6fO", "4Sl", "49H", "6Hc", "27E", "45", "8BF", "hl", "518", "44x", "bdo", "aAm", "2PQ", "0er", + "0js", "IA", "70W", "bkn", "5oP", "5z1", "gm", "304", "0Io", "28D", "6Gb", "46I", "5LL", "6iN", "y", "0gC", + "5pH", "6UJ", "xu", "1Kf", "C8", "VY", "7kG", "4NE", "4Cu", "5F5", "2Mx", "1hz", "0Vw", "1M", "4x8", "4mY", + "4bX", "431", "zD", "0Yv", "03R", "Th", "5I4", "4Lt", "4AD", "60o", "YX", "L9", "0TF", "wt", "6ZK", "4oh", + "6DI", "45b", "0JD", "iv", "GZ", "0dh", "5Og", "6je", "5W6", "4Rv", "0iX", "Jj", "dF", "0Gt", "48R", "6Iy", + "6Fx", "47S", "0Hu", "kG", "Ek", "0fY", "5MV", "5X7", "6ed", "4PG", "0ki", "3Nk", "fw", "0EE", "5nJ", "6KH", + "356", "bo", "6OP", "4zs", "bnl", "75U", "LC", "0oq", "0bA", "As", "6lL", "4Yo", "43K", "7RA", "2yN", "0Lm", + "17", "22G", "6Ma", "4xB", "4Vn", "6cM", "Nr", "19i", "14Y", "CB", "aDo", "bam", "41z", "5p2", "mn", "8GD", + "7d", "8YF", "4kp", "5n0", "64w", "717", "1nS", "2KQ", "Pp", "07J", "4Hl", "69G", "6Sc", "52i", "1MO", "2hM", + "5U", "0Ro", "4iA", "7LC", "66F", "4Gm", "08K", "3YA", "RA", "0qs", "b4f", "aUl", "5a1", "4dq", "8VG", "8e", + "6mV", "4Xu", "17r", "022", "nE", "0Mw", "42Q", "4c8", "6NJ", "5kH", "1Pf", "cu", "MY", "X8", "4UE", "74O", + "6og", "4ZD", "W9", "BX", "lt", "0OF", "4th", "6AK", "4l9", "4yX", "0Bv", "aD", "Oh", "0lZ", "4Wt", "5R4", + "4Iv", "5L6", "Qj", "06P", "1LU", "1Y4", "463", "4gZ", "4jj", "7Oh", "rv", "0QD", "1oI", "2JK", "65m", "4DF", + "4KG", "7nE", "2EJ", "04a", "1Nd", "2kf", "6PH", "4ek", "5xz", "492", "4O", "0Su", "09Q", "0h8", "5C7", "4Fw", + "5Dz", "6ax", "LG", "0ou", "0AY", "bk", "6OT", "4zw", "43O", "6Bd", "2yJ", "0Li", "0bE", "Aw", "6lH", "4Yk", + "4Vj", "6cI", "Nv", "0mD", "13", "22C", "6Me", "4xF", "4uv", "5p6", "mj", "0NX", "1pU", "CF", "6ny", "7k9", + "4P9", "4EX", "1nW", "2KU", "sh", "0PZ", "4kt", "5n4", "6Sg", "4fD", "k9", "2hI", "Pt", "07N", "4Hh", "69C", + "66B", "4Gi", "08O", "2Id", "5Q", "d8", "4iE", "7LG", "5a5", "4du", "1Oz", "8a", "RE", "0qw", "4JY", "aUh", + "nA", "0Ms", "42U", "ail", "6mR", "4Xq", "17v", "026", "3Km", "0no", "4UA", "74K", "6NN", "5kL", "1Pb", "cq", + "lp", "0OB", "40d", "6AO", "6oc", "5Ja", "0an", "2TM", "Ol", "18w", "4Wp", "5R0", "afm", "bCo", "0Br", "1G2", + "1LQ", "1Y0", "467", "53w", "4Ir", "5L2", "Qn", "06T", "1oM", "2JO", "65i", "4DB", "4jn", "7Ol", "6z", "1Aa", + "8WY", "2kb", "6PL", "4eo", "4KC", "7nA", "2EN", "04e", "09U", "d6E", "5C3", "4Fs", "bRl", "496", "4K", "0Sq", + "0bI", "2Wj", "6lD", "4Yg", "43C", "6Bh", "oW", "z6", "0AU", "bg", "6OX", "5jZ", "4TW", "4A6", "LK", "0oy", + "14Q", "CJ", "4N7", "5Kw", "41r", "542", "mf", "0NT", "u7", "22O", "6Mi", "4xJ", "4Vf", "6cE", "Nz", "0mH", + "Px", "07B", "4Hd", "69O", "6Sk", "4fH", "k5", "2hE", "7l", "0PV", "4kx", "5n8", "4P5", "4ET", "83j", "2KY", + "RI", "05s", "4JU", "7oW", "5a9", "4dy", "1Ov", "8m", "qU", "d4", "4iI", "7LK", "66N", "4Ge", "08C", "2Ih", + "6NB", "a59", "1Pn", "21d", "MQ", "X0", "4UM", "74G", "79w", "bbN", "0cS", "0v2", "nM", "8Dg", "42Y", "4c0", + "4l1", "4yP", "8Kf", "aL", "0y3", "0lR", "636", "76v", "6oo", "4ZL", "W1", "BP", "2zm", "0ON", "40h", "6AC", + "4jb", "auS", "6v", "0QL", "I3", "2JC", "65e", "4DN", "b7E", "68U", "Qb", "06X", "286", "dSl", "4r3", "4gR", + "4hS", "7MQ", "4G", "277", "09Y", "0h0", "67T", "b8D", "4KO", "7nM", "SS", "F2", "1Nl", "9w", "azR", "4ec", + "43G", "6Bl", "oS", "z2", "0bM", "2Wn", "78i", "4Yc", "4TS", "4A2", "LO", "8fe", "0AQ", "bc", "aeN", "cPm", + "41v", "546", "mb", "0NP", "14U", "CN", "4N3", "5Ks", "4Vb", "6cA", "2Xo", "0mL", "u3", "22K", "6Mm", "4xN", + "6So", "4fL", "k1", "2hA", "2Fm", "07F", "5XA", "69K", "4P1", "4EP", "83n", "d5f", "7h", "0PR", "bQO", "a0E", + "hbu", "50T", "1Or", "8i", "RM", "05w", "4JQ", "7oS", "66J", "4Ga", "08G", "2Il", "5Y", "d0", "4iM", "7LO", + "MU", "X4", "4UI", "74C", "6NF", "5kD", "1Pj", "cy", "nI", "2m9", "4vU", "4c4", "6mZ", "4Xy", "0cW", "0v6", + "Od", "0lV", "4Wx", "5R8", "4l5", "4yT", "0Bz", "aH", "lx", "0OJ", "40l", "6AG", "6ok", "4ZH", "W5", "BT", + "I7", "2JG", "65a", "4DJ", "4jf", "7Od", "6r", "0QH", "1LY", "1Y8", "4r7", "4gV", "4Iz", "68Q", "Qf", "0rT", + "1mt", "0h4", "67P", "5VZ", "4hW", "7MU", "4C", "0Sy", "1Nh", "9s", "6PD", "4eg", "4KK", "7nI", "SW", "F6", + "8Je", "22V", "4m2", "4xS", "625", "77u", "Nc", "0mQ", "V2", "CS", "6nl", "5Kn", "41k", "7Pa", "3kO", "0NM", + "0AL", "20g", "6OA", "4zb", "4TN", "6am", "LR", "Y3", "0bP", "Ab", "78t", "bcM", "43Z", "4b3", "oN", "8Ed", + "5D", "264", "4iP", "489", "66W", "b9G", "08Z", "0i3", "RP", "G1", "4JL", "7oN", "6QC", "50I", "1Oo", "8t", + "7u", "0PO", "4ka", "7Nc", "64f", "4EM", "H0", "963", "Pa", "0sS", "b6F", "69V", "478", "4fQ", "295", "dRo", + "4O4", "4ZU", "15R", "BI", "le", "0OW", "40q", "551", "6Lj", "4yI", "t4", "aU", "Oy", "0lK", "4We", "6bF", + "6mG", "4Xd", "0cJ", "2Vi", "nT", "0Mf", "4vH", "6Ck", "adI", "5kY", "1Pw", "cd", "MH", "0nz", "4UT", "7pV", + "4KV", "7nT", "SJ", "04p", "1Nu", "9n", "6PY", "4ez", "4hJ", "7MH", "pV", "e7", "1mi", "2Hk", "67M", "4Ff", + "4Ig", "68L", "2Gj", "06A", "j6", "2iF", "6Rh", "4gK", "5zZ", "7Oy", "6o", "0QU", "1oX", "1z9", "4Q6", "4DW", + "5FZ", "6cX", "Ng", "0mU", "0Cy", "1F9", "4m6", "4xW", "41o", "7Pe", "3kK", "0NI", "V6", "CW", "6nh", "5Kj", + "4TJ", "6ai", "LV", "Y7", "0AH", "bz", "6OE", "4zf", "4wV", "4b7", "oJ", "0Lx", "0bT", "Af", "6lY", "4Yz", + "5B8", "4Gx", "1lw", "0i7", "qH", "0Rz", "4iT", "7LV", "6QG", "4dd", "1Ok", "8p", "RT", "G5", "4JH", "7oJ", + "64b", "4EI", "H4", "2KD", "7q", "0PK", "4ke", "7Ng", "4s4", "4fU", "1MZ", "2hX", "Pe", "0sW", "4Hy", "5M9", + "la", "0OS", "40u", "555", "4O0", "4ZQ", "15V", "BM", "2Yl", "0lO", "4Wa", "6bB", "6Ln", "4yM", "08", "aQ", + "nP", "0Mb", "42D", "6Co", "6mC", "5HA", "0cN", "2Vm", "ML", "8gf", "4UP", "74Z", "adM", "bAO", "1Ps", "0U3", + "1Nq", "9j", "azO", "51W", "4KR", "7nP", "SN", "04t", "09D", "2Ho", "67I", "4Fb", "4hN", "7ML", "4Z", "e3", + "j2", "2iB", "6Rl", "4gO", "4Ic", "68H", "2Gn", "06E", "82m", "d4e", "4Q2", "4DS", "bPL", "a1F", "6k", "0QQ", + "1pH", "2UJ", "6nd", "5Kf", "41c", "7Pi", "mw", "0NE", "0Cu", "1F5", "6Mx", "5hz", "4Vw", "5S7", "Nk", "0mY", + "0bX", "Aj", "6lU", "4Yv", "43R", "6By", "oF", "0Lt", "0AD", "bv", "6OI", "4zj", "4TF", "6ae", "LZ", "0oh", + "RX", "G9", "4JD", "7oF", "6QK", "4dh", "1Og", "2je", "5L", "0Rv", "4iX", "481", "5B4", "4Gt", "08R", "2Iy", + "Pi", "07S", "4Hu", "5M5", "470", "4fY", "1MV", "1X7", "su", "0PG", "4ki", "7Nk", "64n", "4EE", "H8", "2KH", + "6Lb", "4yA", "04", "23D", "Oq", "0lC", "4Wm", "6bN", "aEl", "c4G", "0as", "BA", "lm", "8FG", "40y", "559", + "6NS", "5kQ", "345", "cl", "1k2", "0nr", "boo", "74V", "6mO", "4Xl", "0cB", "2Va", "2xM", "0Mn", "42H", "6Cc", + "4hB", "aws", "4V", "0Sl", "09H", "2Hc", "67E", "4Fn", "b5e", "aTo", "SB", "04x", "8WD", "9f", "6PQ", "4er", + "4js", "5o3", "6g", "8XE", "1oP", "1z1", "65t", "704", "4Io", "68D", "Qs", "06I", "1LL", "2iN", "7BA", "4gC", + "41g", "7Pm", "ms", "0NA", "14D", "2UN", "aDr", "5Kb", "4Vs", "5S3", "No", "19t", "0Cq", "1F1", "agn", "bBl", + "43V", "aho", "oB", "0Lp", "16u", "An", "6lQ", "4Yr", "4TB", "6aa", "2ZO", "0ol", "1Qa", "br", "6OM", "4zn", + "6QO", "4dl", "1Oc", "8x", "2DM", "05f", "5Za", "7oB", "5B0", "4Gp", "08V", "d7F", "5H", "0Rr", "bSo", "485", + "474", "52t", "1MR", "1X3", "Pm", "07W", "4Hq", "5M1", "64j", "4EA", "1nN", "2KL", "7y", "0PC", "4km", "7No", + "Ou", "0lG", "4Wi", "6bJ", "6Lf", "4yE", "00", "aY", "li", "8FC", "4tu", "5q5", "4O8", "4ZY", "0aw", "BE", + "MD", "0nv", "4UX", "74R", "6NW", "5kU", "341", "ch", "nX", "0Mj", "42L", "6Cg", "6mK", "4Xh", "0cF", "2Ve", + "09L", "2Hg", "67A", "4Fj", "4hF", "7MD", "4R", "0Sh", "1Ny", "9b", "6PU", "4ev", "4KZ", "7nX", "SF", "0pt", + "1oT", "1z5", "65p", "5Tz", "4jw", "5o7", "6c", "0QY", "1LH", "2iJ", "6Rd", "4gG", "4Ik", "7li", "Qw", "06M", + "7F", "246", "4kR", "7NP", "64U", "col", "1nq", "0k1", "PR", "E3", "4HN", "69e", "6SA", "4fb", "1Mm", "2ho", + "5w", "0RM", "4ic", "7La", "66d", "4GO", "J2", "2IB", "Rc", "05Y", "b4D", "aUN", "4q2", "4dS", "8Ve", "8G", + "8Hg", "bM", "4o0", "4zQ", "607", "75w", "La", "0oS", "T0", "AQ", "6ln", "4YM", "43i", "6BB", "2yl", "0LO", + "0CN", "22e", "6MC", "5hA", "4VL", "6co", "NP", "0mb", "1ps", "0u3", "aDM", "baO", "41X", "7PR", "mL", "8Gf", + "4IT", "7lV", "QH", "06r", "1Lw", "0I7", "5b8", "4gx", "4jH", "7OJ", "rT", "g5", "1ok", "2Ji", "65O", "4Dd", + "4Ke", "7ng", "Sy", "04C", "h4", "2kD", "6Pj", "4eI", "4hy", "5m9", "4m", "0SW", "09s", "2HX", "4S4", "4FU", + "4M6", "4XW", "0cy", "1f9", "ng", "0MU", "42s", "573", "6Nh", "5kj", "v6", "cW", "3KK", "0nI", "4Ug", "74m", + "6oE", "4Zf", "0aH", "Bz", "lV", "y7", "40B", "6Ai", "582", "4yz", "0BT", "af", "OJ", "0lx", "4WV", "4B7", + "64Q", "4Ez", "1nu", "0k5", "7B", "0Px", "4kV", "7NT", "6SE", "4ff", "1Mi", "2hk", "PV", "E7", "4HJ", "69a", + "6rh", "4GK", "J6", "2IF", "5s", "0RI", "4ig", "7Le", "4q6", "4dW", "1OX", "8C", "Rg", "0qU", "5ZZ", "7oy", + "4Ty", "5Q9", "Le", "0oW", "1QZ", "bI", "4o4", "4zU", "43m", "6BF", "oy", "0LK", "T4", "AU", "6lj", "4YI", + "4VH", "6ck", "NT", "0mf", "0CJ", "22a", "6MG", "4xd", "4uT", "7PV", "mH", "0Nz", "1pw", "Cd", "aDI", "5KY", + "1Ls", "0I3", "axM", "53U", "4IP", "7lR", "QL", "06v", "1oo", "2Jm", "65K", "5TA", "4jL", "7ON", "6X", "g1", + "h0", "9Y", "6Pn", "4eM", "4Ka", "7nc", "2El", "04G", "09w", "d6g", "4S0", "4FQ", "bRN", "a3D", "4i", "0SS", + "nc", "0MQ", "42w", "577", "4M2", "4XS", "17T", "dlm", "3KO", "0nM", "4Uc", "74i", "6Nl", "5kn", "v2", "cS", + "lR", "y3", "40F", "6Am", "6oA", "4Zb", "0aL", "2To", "ON", "18U", "4WR", "4B3", "586", "bCM", "0BP", "ab", + "PZ", "0sh", "4HF", "69m", "6SI", "4fj", "1Me", "2hg", "7N", "0Pt", "4kZ", "7NX", "6pU", "4Ev", "1ny", "0k9", + "Rk", "05Q", "4Jw", "5O7", "452", "50r", "1OT", "8O", "qw", "0RE", "4ik", "7Li", "66l", "4GG", "08a", "2IJ", + "T8", "AY", "6lf", "4YE", "43a", "6BJ", "ou", "0LG", "0Aw", "bE", "4o8", "4zY", "4Tu", "5Q5", "Li", "8fC", + "14s", "Ch", "6nW", "5KU", "41P", "7PZ", "mD", "0Nv", "0CF", "22m", "6MK", "4xh", "4VD", "6cg", "NX", "0mj", + "5za", "7OB", "6T", "0Qn", "1oc", "2Ja", "65G", "4Dl", "b7g", "68w", "1w2", "06z", "8UF", "dSN", "5b0", "4gp", + "4hq", "5m1", "4e", "8ZG", "1mR", "1x3", "67v", "726", "4Km", "7no", "Sq", "04K", "1NN", "9U", "6Pb", "4eA", + "adr", "5kb", "26", "21F", "Ms", "0nA", "4Uo", "74e", "79U", "bbl", "0cq", "1f1", "no", "396", "4vs", "5s3", + "6LQ", "4yr", "367", "an", "OB", "0lp", "bmm", "76T", "6oM", "4Zn", "15i", "Br", "2zO", "0Ol", "40J", "6Aa", + "6SM", "4fn", "1Ma", "2hc", "2FO", "07d", "4HB", "69i", "64Y", "4Er", "83L", "d5D", "7J", "0Pp", "bQm", "a0g", + "456", "50v", "1OP", "8K", "Ro", "05U", "4Js", "5O3", "66h", "4GC", "08e", "2IN", "qs", "0RA", "4io", "7Lm", + "43e", "6BN", "oq", "0LC", "0bo", "2WL", "6lb", "4YA", "4Tq", "5Q1", "Lm", "8fG", "0As", "bA", "ael", "cPO", + "41T", "ajm", "1K2", "0Nr", "14w", "Cl", "6nS", "5KQ", "5Fa", "6cc", "2XM", "0mn", "0CB", "22i", "6MO", "4xl", + "1og", "2Je", "65C", "4Dh", "4jD", "7OF", "6P", "g9", "3l9", "2iy", "5b4", "4gt", "4IX", "68s", "QD", "0rv", + "1mV", "1x7", "4S8", "4FY", "4hu", "5m5", "4a", "1Cz", "h8", "9Q", "6Pf", "4eE", "4Ki", "7nk", "Su", "04O", + "Mw", "0nE", "4Uk", "74a", "6Nd", "5kf", "22", "21B", "nk", "0MY", "4vw", "5s7", "6mx", "5Hz", "0cu", "1f5", + "OF", "0lt", "4WZ", "6by", "6LU", "4yv", "0BX", "aj", "lZ", "0Oh", "40N", "6Ae", "6oI", "4Zj", "0aD", "Bv", + "5f", "9Ke", "4ir", "5l2", "66u", "735", "08x", "1y0", "Rr", "05H", "4Jn", "7ol", "6Qa", "4dB", "1OM", "8V", + "7W", "0Pm", "4kC", "7NA", "64D", "4Eo", "83Q", "2Kb", "PC", "07y", "b6d", "69t", "5c3", "4fs", "8TE", "dRM", + "374", "22t", "599", "4xq", "bln", "77W", "NA", "0ms", "14j", "Cq", "6nN", "5KL", "41I", "7PC", "3km", "0No", + "35", "20E", "6Oc", "5ja", "4Tl", "6aO", "Lp", "0oB", "0br", "1g2", "78V", "bco", "43x", "568", "ol", "385", + "4Kt", "5N4", "Sh", "04R", "1NW", "9L", "441", "4eX", "4hh", "7Mj", "pt", "0SF", "K9", "2HI", "67o", "4FD", + "4IE", "68n", "QY", "0", "1Lf", "2id", "6RJ", "4gi", "4jY", "auh", "6M", "0Qw", "1oz", "2Jx", "5A5", "4Du", + "6oT", "4Zw", "0aY", "Bk", "lG", "0Ou", "40S", "6Ax", "6LH", "4yk", "0BE", "aw", "2YJ", "0li", "4WG", "6bd", + "6me", "4XF", "0ch", "2VK", "nv", "0MD", "42b", "6CI", "6Ny", "7K9", "1PU", "cF", "Mj", "0nX", "4Uv", "5P6", + "66q", "4GZ", "1lU", "1y4", "5b", "0RX", "4iv", "5l6", "6Qe", "4dF", "1OI", "8R", "Rv", "05L", "4Jj", "7oh", + "6pH", "4Ek", "1nd", "2Kf", "7S", "0Pi", "4kG", "7NE", "5c7", "4fw", "1Mx", "0H8", "PG", "0su", "5Xz", "69p", + "4VY", "4C8", "NE", "0mw", "1Sz", "22p", "6MV", "4xu", "41M", "7PG", "mY", "x8", "14n", "Cu", "6nJ", "5KH", + "4Th", "6aK", "Lt", "0oF", "31", "bX", "6Og", "4zD", "4wt", "5r4", "oh", "0LZ", "0bv", "AD", "4L9", "4YX", + "1NS", "9H", "445", "51u", "4Kp", "5N0", "Sl", "04V", "09f", "2HM", "67k", "5Va", "4hl", "7Mn", "4x", "0SB", + "1Lb", "3yA", "6RN", "4gm", "4IA", "68j", "2GL", "4", "82O", "d4G", "5A1", "4Dq", "bPn", "a1d", "6I", "0Qs", + "lC", "0Oq", "40W", "akn", "6oP", "4Zs", "15t", "Bo", "2YN", "0lm", "4WC", "76I", "6LL", "4yo", "0BA", "as", + "nr", "8DX", "42f", "6CM", "6ma", "4XB", "0cl", "2VO", "Mn", "8gD", "4Ur", "5P2", "ado", "bAm", "1PQ", "cB", + "Rz", "0qH", "4Jf", "7od", "6Qi", "4dJ", "i7", "2jG", "5n", "0RT", "4iz", "7Lx", "4R7", "4GV", "08p", "1y8", + "PK", "07q", "4HW", "7mU", "6SX", "52R", "1Mt", "0H4", "sW", "f6", "4kK", "7NI", "64L", "4Eg", "1nh", "2Kj", + "14b", "Cy", "6nF", "5KD", "41A", "7PK", "mU", "x4", "0CW", "0V6", "591", "4xy", "4VU", "4C4", "NI", "19R", + "0bz", "AH", "4L5", "4YT", "43p", "560", "od", "0LV", "w5", "bT", "6Ok", "4zH", "4Td", "6aG", "Lx", "0oJ", + "5xA", "7Mb", "4t", "0SN", "K1", "2HA", "67g", "4FL", "b5G", "aTM", "0e3", "04Z", "8Wf", "9D", "449", "4eP", + "4jQ", "7OS", "6E", "255", "1or", "0j2", "65V", "cno", "4IM", "68f", "QQ", "8", "1Ln", "2il", "6RB", "4ga", + "afR", "4yc", "0BM", "23f", "OS", "Z2", "4WO", "6bl", "aEN", "c4e", "0aQ", "Bc", "lO", "8Fe", "4tS", "4a2", + "4n3", "5ks", "8Id", "cN", "Mb", "0nP", "614", "74t", "6mm", "4XN", "U3", "2VC", "2xo", "0ML", "42j", "6CA", + "6Qm", "4dN", "i3", "8Z", "2Do", "05D", "4Jb", "aUS", "4R3", "4GR", "08t", "d7d", "5j", "0RP", "bSM", "a2G", + "ayN", "52V", "1Mp", "0H0", "PO", "07u", "4HS", "69x", "64H", "4Ec", "1nl", "2Kn", "sS", "f2", "4kO", "7NM", + "41E", "7PO", "mQ", "x0", "14f", "2Ul", "6nB", "aQ1", "4VQ", "4C0", "NM", "19V", "0CS", "0V2", "595", "bBN", + "43t", "564", "0Y3", "0LR", "16W", "AL", "4L1", "4YP", "5DA", "6aC", "2Zm", "0oN", "39", "bP", "6Oo", "4zL", + "K5", "2HE", "67c", "4FH", "4hd", "7Mf", "4p", "0SJ", "8Wb", "2kY", "4p5", "4eT", "4Kx", "5N8", "Sd", "0pV", + "1ov", "0j6", "5A9", "4Dy", "4jU", "7OW", "6A", "1AZ", "1Lj", "2ih", "6RF", "4ge", "4II", "68b", "QU", "D4", + "OW", "Z6", "4WK", "6bh", "6LD", "4yg", "0BI", "23b", "lK", "0Oy", "4tW", "4a6", "6oX", "5JZ", "0aU", "Bg", + "Mf", "0nT", "4Uz", "74p", "4n7", "5kw", "1PY", "cJ", "nz", "0MH", "42n", "6CE", "6mi", "4XJ", "U7", "2VG", + "4MP", "4X1", "UL", "02v", "0XR", "0M3", "a8E", "57U", "4nL", "7KN", "2X", "c1", "1ko", "2Nm", "61K", "5PA", + "4Oa", "6zB", "2Al", "00G", "l0", "yQ", "6Tn", "4aM", "58T", "a7D", "0i", "0WS", "84o", "ZM", "4W0", "4BQ", + "4I2", "5Lr", "13T", "G", "jc", "0IQ", "46w", "537", "6Jl", "5on", "r2", "gS", "3OO", "0jM", "4Qc", "70i", + "6kA", "5NC", "0eL", "2Po", "hR", "8Bx", "44F", "6Em", "abO", "49v", "0FP", "eb", "KN", "8ad", "4SR", "4F3", + "3B", "0Tx", "4oV", "4z7", "60Q", "4Az", "0zT", "Yf", "TV", "A7", "4LJ", "6yi", "6WE", "4bf", "0YH", "zz", + "1s", "0VI", "4mg", "6XD", "6vh", "4CK", "N6", "2MF", "Vg", "0uU", "6n9", "7ky", "4u6", "5pv", "1KX", "xK", + "1UZ", "fI", "4k4", "5nt", "4Py", "5U9", "He", "0kW", "P4", "EU", "6hj", "5Mh", "47m", "6FF", "ky", "0HK", + "0GJ", "dx", "6IG", "48l", "4RH", "6gk", "JT", "0if", "0dV", "Gd", "5Z8", "5OY", "4qT", "4d5", "iH", "0Jz", + "0XV", "0M7", "5f8", "4cx", "4MT", "4X5", "UH", "02r", "1kk", "Xx", "61O", "5PE", "4nH", "7KJ", "vT", "c5", + "l4", "yU", "6Tj", "4aI", "4Oe", "6zF", "Wy", "00C", "1iZ", "ZI", "4W4", "4BU", "4ly", "5i9", "0m", "0WW", + "jg", "0IU", "46s", "533", "4I6", "5Lv", "0gy", "C", "3OK", "0jI", "4Qg", "6dD", "6Jh", "5oj", "r6", "gW", + "hV", "0Kd", "44B", "6Ei", "6kE", "5NG", "0eH", "Fz", "KJ", "0hx", "4SV", "4F7", "6HY", "49r", "0FT", "ef", + "60U", "ckl", "0zP", "Yb", "3F", "206", "4oR", "4z3", "6WA", "4bb", "0YL", "2lo", "TR", "A3", "4LN", "6ym", + "62d", "4CO", "N2", "2MB", "1w", "0VM", "4mc", "7Ha", "4u2", "54z", "8Re", "xO", "Vc", "01Y", "b0D", "aQN", + "647", "71w", "Ha", "0kS", "8Lg", "fM", "4k0", "5np", "47i", "6FB", "29d", "0HO", "P0", "EQ", "6hn", "5Ml", + "4RL", "6go", "JP", "0ib", "0GN", "26e", "6IC", "48h", "45X", "4d1", "iL", "8Cf", "0dR", "0q3", "hYt", "beO", + "4nD", "7KF", "2P", "c9", "1kg", "Xt", "61C", "5PI", "4MX", "4X9", "UD", "0vv", "0XZ", "2my", "5f4", "4ct", + "4lu", "5i5", "0a", "1Gz", "0yw", "ZE", "4W8", "4BY", "4Oi", "6zJ", "Wu", "00O", "l8", "yY", "6Tf", "4aE", + "6Jd", "5of", "62", "25B", "Iw", "0jE", "4Qk", "6dH", "6ix", "5Lz", "0gu", "O", "jk", "0IY", "4rw", "5w7", + "5x6", "5mW", "0FX", "ej", "KF", "0ht", "4SZ", "6fy", "6kI", "5NK", "0eD", "Fv", "hZ", "93", "44N", "6Ee", + "2BO", "03d", "4LB", "6ya", "6WM", "4bn", "1Ia", "zr", "3J", "0Tp", "bUm", "a4g", "5D2", "4Ar", "87L", "Yn", + "Vo", "01U", "4Ns", "5K3", "416", "54v", "1KP", "xC", "us", "0VA", "4mo", "6XL", "62h", "4CC", "0xm", "2MN", + "0fo", "2SL", "6hb", "bgr", "47e", "6FN", "kq", "0HC", "0Es", "fA", "aal", "bDn", "4Pq", "5U1", "Hm", "8bG", + "10w", "Gl", "5Z0", "5OQ", "45T", "anm", "1O2", "0Jr", "0GB", "dp", "6IO", "48d", "5Ba", "6gc", "3Ll", "0in", + "1kc", "Xp", "61G", "5PM", "bTs", "7KB", "2T", "0Un", "8QF", "39T", "5f0", "4cp", "797", "aRm", "1s2", "02z", + "0ys", "ZA", "63v", "766", "4lq", "5i1", "0e", "9Nf", "0Zo", "2oL", "6Tb", "4aA", "4Om", "6zN", "Wq", "00K", + "Is", "0jA", "4Qo", "6dL", "7ZA", "5ob", "66", "25F", "jo", "9Pd", "4rs", "5w3", "aCn", "bfl", "0gq", "K", + "KB", "0hp", "bim", "72T", "5x2", "49z", "327", "en", "3nn", "97", "44J", "6Ea", "6kM", "5NO", "11i", "Fr", + "6WI", "4bj", "0YD", "zv", "TZ", "0wh", "4LF", "6ye", "5D6", "4Av", "0zX", "Yj", "3N", "0Tt", "4oZ", "6Zy", + "412", "54r", "1KT", "xG", "Vk", "01Q", "4Nw", "5K7", "62l", "4CG", "0xi", "2MJ", "uw", "0VE", "4mk", "6XH", + "47a", "6FJ", "ku", "0HG", "P8", "EY", "6hf", "5Md", "4Pu", "5U5", "Hi", "8bC", "0Ew", "fE", "4k8", "5nx", + "45P", "4d9", "iD", "0Jv", "0dZ", "Gh", "5Z4", "5OU", "4RD", "6gg", "JX", "0ij", "0GF", "dt", "6IK", "5lI", + "4Op", "5J0", "Wl", "00V", "0Zr", "2oQ", "405", "55u", "4ll", "6YO", "0x", "0WB", "0yn", "2LM", "63k", "5Ra", + "4MA", "6xb", "2CL", "02g", "0XC", "39I", "6VN", "4cm", "bTn", "a5d", "2I", "0Us", "86O", "Xm", "5E1", "5PP", + "6kP", "5NR", "11t", "Fo", "hC", "0Kq", "44W", "aon", "6HL", "49g", "0FA", "es", "3Mo", "0hm", "4SC", "72I", + "6ia", "5Lc", "0gl", "V", "jr", "1Ya", "46f", "6GM", "hyV", "bEm", "0Dp", "gB", "In", "8cD", "4Qr", "5T2", + "1b", "0VX", "4mv", "5h6", "62q", "4CZ", "0xt", "2MW", "Vv", "01L", "4Nj", "7kh", "6Ue", "54o", "1KI", "xZ", + "3S", "0Ti", "4oG", "6Zd", "6tH", "4Ak", "0zE", "Yw", "TG", "0wu", "780", "6yx", "5g7", "4bw", "0YY", "zk", + "1Wz", "di", "5y5", "5lT", "4RY", "4G8", "JE", "0iw", "0dG", "Gu", "6jJ", "5OH", "45M", "6Df", "iY", "80", + "71", "fX", "6Kg", "5ne", "4Ph", "6eK", "Ht", "0kF", "0fv", "ED", "4H9", "5My", "4st", "5v4", "kh", "0HZ", + "0Zv", "yD", "401", "4aX", "4Ot", "5J4", "Wh", "00R", "O9", "ZX", "63o", "4BD", "4lh", "6YK", "tt", "0WF", + "0XG", "2md", "6VJ", "4ci", "4ME", "6xf", "UY", "02c", "1kz", "Xi", "5E5", "5PT", "4nY", "aqh", "2M", "0Uw", + "hG", "0Ku", "44S", "6Ex", "6kT", "5NV", "0eY", "Fk", "3Mk", "0hi", "4SG", "6fd", "6HH", "49c", "0FE", "ew", + "jv", "0ID", "46b", "6GI", "6ie", "5Lg", "0gh", "R", "Ij", "0jX", "4Qv", "5T6", "6Jy", "7O9", "0Dt", "gF", + "62u", "775", "0xp", "198", "1f", "9Oe", "4mr", "5h2", "6Ua", "54k", "1KM", "2nO", "Vr", "01H", "4Nn", "7kl", + "60D", "4Ao", "0zA", "Ys", "3W", "0Tm", "4oC", "7JA", "5g3", "4bs", "8PE", "zo", "TC", "03y", "784", "aSn", + "bhn", "73W", "JA", "0is", "334", "dm", "5y1", "48y", "45I", "6Db", "3om", "84", "0dC", "Gq", "6jN", "5OL", + "4Pl", "6eO", "Hp", "0kB", "75", "24E", "6Kc", "5na", "47x", "528", "kl", "8AF", "0fr", "1c2", "aBm", "bgo", + "4ld", "6YG", "0p", "0WJ", "O5", "ZT", "63c", "4BH", "4Ox", "5J8", "Wd", "0tV", "0Zz", "yH", "4t5", "4aT", + "4nU", "7KW", "2A", "1EZ", "1kv", "Xe", "5E9", "5PX", "4MI", "6xj", "UU", "02o", "0XK", "2mh", "6VF", "4ce", + "6HD", "49o", "0FI", "27b", "KW", "0he", "4SK", "6fh", "6kX", "5NZ", "0eU", "Fg", "hK", "0Ky", "4pW", "4e6", + "4j7", "5ow", "0Dx", "gJ", "If", "0jT", "4Qz", "6dY", "6ii", "5Lk", "Q7", "DV", "jz", "0IH", "46n", "6GE", + "3PN", "01D", "4Nb", "aQS", "6Um", "54g", "m3", "xR", "1j", "0VP", "59W", "a6G", "4V3", "4CR", "85l", "194", + "TO", "03u", "4LS", "4Y2", "a9F", "56V", "0YQ", "zc", "wS", "b2", "4oO", "6Zl", "60H", "4Ac", "0zM", "2On", + "0dO", "2Ql", "6jB", "aU1", "45E", "6Dn", "iQ", "88", "0GS", "da", "acL", "48u", "4RQ", "4G0", "JM", "94N", + "12W", "EL", "4H1", "5Mq", "47t", "524", "29y", "0HR", "79", "fP", "6Ko", "5nm", "aZ0", "6eC", "3NL", "0kN", + "O1", "ZP", "63g", "4BL", "58I", "6YC", "0t", "0WN", "8Sf", "yL", "409", "4aP", "b1G", "aPM", "0a3", "00Z", + "1kr", "Xa", "61V", "bzN", "4nQ", "7KS", "2E", "215", "0XO", "2ml", "6VB", "4ca", "4MM", "6xn", "UQ", "02k", + "KS", "0ha", "4SO", "6fl", "7Xa", "49k", "0FM", "27f", "hO", "8Be", "4pS", "4e2", "aAN", "bdL", "0eQ", "Fc", + "Ib", "0jP", "654", "70t", "4j3", "5os", "8Md", "gN", "28g", "0IL", "46j", "6GA", "6im", "5Lo", "Q3", "Z", + "6Ui", "54c", "m7", "xV", "Vz", "0uH", "4Nf", "7kd", "4V7", "4CV", "0xx", "190", "1n", "0VT", "4mz", "6XY", + "6WX", "56R", "0YU", "zg", "TK", "03q", "4LW", "4Y6", "60L", "4Ag", "0zI", "2Oj", "wW", "b6", "4oK", "6Zh", + "45A", "6Dj", "iU", "0Jg", "0dK", "Gy", "6jF", "5OD", "4RU", "4G4", "JI", "1yZ", "0GW", "de", "5y9", "48q", + "47p", "520", "kd", "0HV", "0fz", "EH", "4H5", "5Mu", "4Pd", "6eG", "Hx", "0kJ", "s5", "fT", "6Kk", "5ni", + "5Y1", "5LP", "13v", "e", "jA", "0Is", "46U", "aml", "6JN", "5oL", "0DC", "gq", "3Om", "0jo", "4QA", "6db", + "6kc", "5Na", "0en", "2PM", "hp", "0KB", "44d", "6EO", "abm", "49T", "0Fr", "1C2", "Kl", "8aF", "4Sp", "5V0", + "4Mr", "5H2", "Un", "02T", "0Xp", "2mS", "427", "57w", "4nn", "7Kl", "2z", "1Ea", "1kM", "2NO", "61i", "5Pc", + "4OC", "7jA", "2AN", "00e", "0ZA", "ys", "6TL", "4ao", "58v", "a7f", "0K", "0Wq", "84M", "Zo", "5G3", "4Bs", + "0EY", "fk", "6KT", "5nV", "bjh", "6ex", "HG", "0ku", "0fE", "Ew", "6hH", "5MJ", "47O", "6Fd", "29B", "0Hi", + "53", "dZ", "6Ie", "48N", "4Rj", "6gI", "Jv", "0iD", "0dt", "GF", "6jy", "7o9", "4qv", "5t6", "ij", "0JX", + "wh", "0TZ", "4ot", "5j4", "4T9", "4AX", "0zv", "YD", "Tt", "03N", "4Lh", "6yK", "6Wg", "4bD", "o9", "zX", + "1Q", "0Vk", "4mE", "6Xf", "62B", "4Ci", "0xG", "2Md", "VE", "0uw", "4NY", "aQh", "5e5", "5pT", "1Kz", "xi", + "jE", "0Iw", "46Q", "4g8", "5Y5", "5LT", "13r", "a", "IY", "0jk", "4QE", "6df", "6JJ", "5oH", "0DG", "gu", + "ht", "0KF", "4ph", "6EK", "6kg", "5Ne", "S9", "FX", "Kh", "0hZ", "4St", "5V4", "4h9", "49P", "0Fv", "eD", + "0Xt", "2mW", "423", "4cZ", "4Mv", "5H6", "Uj", "02P", "1kI", "XZ", "61m", "5Pg", "4nj", "7Kh", "vv", "0UD", + "0ZE", "yw", "6TH", "4ak", "4OG", "6zd", "2AJ", "00a", "0yY", "Zk", "5G7", "4Bw", "58r", "6Yx", "0O", "0Wu", + "bjl", "71U", "HC", "0kq", "316", "fo", "6KP", "5nR", "47K", "7VA", "29F", "0Hm", "0fA", "Es", "6hL", "5MN", + "4Rn", "6gM", "Jr", "1ya", "57", "26G", "6Ia", "48J", "45z", "5t2", "in", "8CD", "0dp", "GB", "hYV", "bem", + "60w", "757", "0zr", "2OQ", "3d", "9Mg", "4op", "5j0", "6Wc", "56i", "0Yn", "2lM", "Tp", "03J", "4Ll", "6yO", + "62F", "4Cm", "0xC", "dwS", "1U", "0Vo", "4mA", "6Xb", "5e1", "54X", "8RG", "xm", "VA", "0us", "b0f", "aQl", + "6JF", "5oD", "0DK", "gy", "IU", "0jg", "4QI", "6dj", "5Y9", "5LX", "0gW", "m", "jI", "1YZ", "4rU", "4g4", + "4h5", "5mu", "0Fz", "eH", "Kd", "0hV", "4Sx", "5V8", "6kk", "5Ni", "S5", "FT", "hx", "0KJ", "44l", "6EG", + "4nf", "7Kd", "2r", "0UH", "M7", "XV", "61a", "5Pk", "4Mz", "6xY", "Uf", "0vT", "0Xx", "39r", "4v7", "4cV", + "4lW", "4y6", "0C", "0Wy", "0yU", "Zg", "63P", "5RZ", "4OK", "6zh", "WW", "B6", "0ZI", "2oj", "6TD", "4ag", + "0fM", "2Sn", "7xa", "5MB", "47G", "6Fl", "kS", "0Ha", "0EQ", "fc", "aaN", "bDL", "4PS", "4E2", "HO", "8be", + "10U", "GN", "4J3", "5Os", "45v", "506", "ib", "0JP", "q3", "dR", "6Im", "48F", "4Rb", "6gA", "3LN", "0iL", + "2Bm", "03F", "aF0", "6yC", "6Wo", "4bL", "o1", "zP", "3h", "0TR", "bUO", "a4E", "4T1", "4AP", "87n", "YL", + "VM", "01w", "4NQ", "7kS", "hfu", "54T", "1Kr", "xa", "1Y", "0Vc", "4mM", "6Xn", "62J", "4Ca", "0xO", "2Ml", + "IQ", "0jc", "4QM", "6dn", "6JB", "a19", "0DO", "25d", "jM", "9PF", "46Y", "4g0", "aCL", "687", "0gS", "i", + "3MP", "0hR", "676", "72v", "4h1", "49X", "8Of", "eL", "3nL", "0KN", "44h", "6EC", "6ko", "5Nm", "S1", "FP", + "M3", "XR", "61e", "5Po", "4nb", "aqS", "2v", "0UL", "8Qd", "39v", "4v3", "4cR", "b3E", "aRO", "Ub", "02X", + "0yQ", "Zc", "63T", "bxL", "4lS", "4y2", "0G", "237", "0ZM", "2on", "7Da", "4ac", "4OO", "6zl", "WS", "B2", + "47C", "6Fh", "kW", "0He", "0fI", "2Sj", "6hD", "5MF", "4PW", "4E6", "HK", "0ky", "0EU", "fg", "6KX", "5nZ", + "45r", "502", "if", "0JT", "0dx", "GJ", "4J7", "5Ow", "4Rf", "6gE", "Jz", "0iH", "q7", "dV", "6Ii", "48B", + "6Wk", "4bH", "o5", "zT", "Tx", "03B", "4Ld", "6yG", "4T5", "4AT", "0zz", "YH", "3l", "0TV", "4ox", "5j8", + "5e9", "54P", "1Kv", "xe", "VI", "01s", "4NU", "7kW", "62N", "4Ce", "0xK", "2Mh", "uU", "0Vg", "4mI", "6Xj", + "4K0", "5Np", "11V", "FM", "ha", "0KS", "44u", "515", "6Hn", "49E", "48", "eQ", "3MM", "0hO", "4Sa", "6fB", + "6iC", "5LA", "0gN", "t", "jP", "0Ib", "46D", "6Go", "hyt", "bEO", "0DR", "0Q3", "IL", "8cf", "4QP", "4D1", + "4OR", "4Z3", "WN", "00t", "0ZP", "yb", "hgv", "55W", "4lN", "6Ym", "0Z", "a3", "0yL", "2Lo", "63I", "4Bb", + "4Mc", "7ha", "2Cn", "02E", "n2", "2mB", "6Vl", "4cO", "bTL", "a5F", "2k", "0UQ", "86m", "XO", "4U2", "5Pr", + "0Gy", "dK", "4i6", "5lv", "5BZ", "6gX", "Jg", "0iU", "R6", "GW", "6jh", "5Oj", "45o", "6DD", "3oK", "0JI", + "0EH", "fz", "6KE", "5nG", "4PJ", "6ei", "HV", "0kd", "0fT", "Ef", "6hY", "690", "4sV", "4f7", "kJ", "0Hx", + "uH", "0Vz", "4mT", "4x5", "5F8", "4Cx", "0xV", "0m7", "VT", "C5", "4NH", "7kJ", "6UG", "54M", "1Kk", "xx", + "3q", "0TK", "4oe", "6ZF", "60b", "4AI", "L4", "YU", "Te", "0wW", "4Ly", "5I9", "4w4", "4bU", "1IZ", "zI", + "he", "0KW", "44q", "511", "4K4", "5Nt", "11R", "FI", "Ky", "0hK", "4Se", "6fF", "6Hj", "49A", "p4", "eU", + "jT", "0If", "4rH", "6Gk", "6iG", "5LE", "0gJ", "p", "IH", "0jz", "4QT", "4D5", "5z8", "5oY", "0DV", "gd", + "0ZT", "yf", "6TY", "4az", "4OV", "4Z7", "WJ", "00p", "0yH", "Zz", "63M", "4Bf", "4lJ", "6Yi", "tV", "a7", + "n6", "2mF", "6Vh", "4cK", "4Mg", "6xD", "2Cj", "02A", "1kX", "XK", "4U6", "5Pv", "6N9", "7Ky", "2o", "0UU", + "665", "73u", "Jc", "0iQ", "8Ne", "dO", "4i2", "5lr", "45k", "7Ta", "3oO", "0JM", "R2", "GS", "6jl", "5On", + "4PN", "6em", "HR", "8bx", "0EL", "24g", "6KA", "5nC", "47Z", "4f3", "kN", "8Ad", "0fP", "Eb", "aBO", "694", + "62W", "byO", "0xR", "0m3", "1D", "224", "4mP", "4x1", "6UC", "54I", "1Ko", "2nm", "VP", "C1", "4NL", "7kN", + "60f", "4AM", "L0", "YQ", "3u", "0TO", "4oa", "6ZB", "438", "4bQ", "8Pg", "zM", "Ta", "0wS", "b2F", "aSL", + "6Hf", "49M", "40", "eY", "Ku", "0hG", "4Si", "6fJ", "4K8", "5Nx", "0ew", "FE", "hi", "8BC", "4pu", "5u5", + "5z4", "5oU", "0DZ", "gh", "ID", "0jv", "4QX", "4D9", "6iK", "5LI", "0gF", "Dt", "jX", "0Ij", "46L", "6Gg", + "4lF", "6Ye", "0R", "0Wh", "0yD", "Zv", "63A", "4Bj", "4OZ", "6zy", "WF", "0tt", "0ZX", "yj", "5d6", "4av", + "4nw", "5k7", "2c", "0UY", "1kT", "XG", "61p", "5Pz", "4Mk", "6xH", "Uw", "02M", "0Xi", "2mJ", "6Vd", "4cG", + "0dm", "2QN", "7zA", "5Ob", "45g", "6DL", "is", "0JA", "0Gq", "dC", "acn", "48W", "4Rs", "5W3", "Jo", "94l", + "12u", "En", "5X2", "5MS", "47V", "alo", "kB", "0Hp", "1Ua", "fr", "6KM", "5nO", "4PB", "6ea", "3Nn", "0kl", + "3Pl", "01f", "bts", "7kB", "6UO", "54E", "1Kc", "xp", "1H", "0Vr", "59u", "a6e", "5F0", "4Cp", "85N", "d3F", + "Tm", "03W", "4Lq", "5I1", "434", "56t", "0Ys", "zA", "3y", "0TC", "4om", "6ZN", "60j", "4AA", "0zo", "2OL", + "Kq", "0hC", "4Sm", "6fN", "6Hb", "49I", "44", "27D", "hm", "8BG", "44y", "519", "aAl", "bdn", "0es", "FA", + "1o2", "0jr", "bko", "70V", "5z0", "5oQ", "305", "gl", "28E", "0In", "46H", "6Gc", "6iO", "5LM", "0gB", "x", + "1ia", "Zr", "63E", "4Bn", "4lB", "6Ya", "0V", "0Wl", "8SD", "yn", "5d2", "4ar", "b1e", "aPo", "WB", "00x", + "1kP", "XC", "61t", "744", "4ns", "5k3", "2g", "9Ld", "0Xm", "2mN", "7FA", "4cC", "4Mo", "6xL", "Us", "02I", + "45c", "6DH", "iw", "0JE", "0di", "2QJ", "6jd", "5Of", "4Rw", "5W7", "Jk", "0iY", "0Gu", "dG", "6Ix", "48S", + "47R", "6Fy", "kF", "0Ht", "0fX", "Ej", "5X6", "5MW", "4PF", "6ee", "HZ", "0kh", "0ED", "fv", "6KI", "5nK", + "6UK", "54A", "1Kg", "xt", "VX", "C9", "4ND", "7kF", "5F4", "4Ct", "0xZ", "2My", "1L", "0Vv", "4mX", "4x9", + "430", "4bY", "0Yw", "zE", "Ti", "03S", "4Lu", "5I5", "60n", "4AE", "L8", "YY", "wu", "0TG", "4oi", "6ZJ"}; diff --git a/src/db.c b/src/db.c index fed77e8a63f..b4db7d87d8d 100644 --- a/src/db.c +++ b/src/db.c @@ -104,9 +104,8 @@ robj *lookupKey(serverDb *db, robj *key, int flags) { /* Update the access time for the ageing algorithm. * Don't do it if we have a saving child, as this will trigger * a copy on write madness. */ - if ((flags & LOOKUP_NOTOUCH) == 0 && - server.current_client && server.current_client->flag.no_touch && - server.executing_client && server.executing_client->cmd->proc != touchCommand) + if ((flags & LOOKUP_NOTOUCH) == 0 && server.current_client && server.current_client->flag.no_touch + && server.executing_client && server.executing_client->cmd->proc != touchCommand) flags |= LOOKUP_NOTOUCH; if (!hasActiveChildProcess() && !(flags & LOOKUP_NOTOUCH)) { /* Shared objects can't be stored in the database. */ @@ -249,9 +248,10 @@ int getKeySlot(sds key) { * Modules and scripts executed on the primary may get replicated as multi-execs that operate on multiple slots, * so we must always recompute the slot for commands coming from the primary or AOF. */ - if (server.current_client && server.current_client->slot >= 0 && server.current_client->flag.executing_command && - !mustObeyClient(server.current_client)) { - debugServerAssertWithInfo(server.current_client, NULL, + if (server.current_client && server.current_client->slot >= 0 && server.current_client->flag.executing_command + && !mustObeyClient(server.current_client)) { + debugServerAssertWithInfo(server.current_client, + NULL, (int)keyHashSlot(key, (int)sdslen(key)) == server.current_client->slot); return server.current_client->slot; } @@ -341,8 +341,8 @@ static void dbSetValue(serverDb *db, robj *key, robj **valref, int overwrite, vo old = *oldref; } - if ((old->refcount == 1 && old->encoding != OBJ_ENCODING_EMBSTR) && - (val->refcount == 1 && val->encoding != OBJ_ENCODING_EMBSTR)) { + if ((old->refcount == 1 && old->encoding != OBJ_ENCODING_EMBSTR) + && (val->refcount == 1 && val->encoding != OBJ_ENCODING_EMBSTR)) { /* Keep old object in the database. Just swap it's ptr, type and * encoding with the content of val. */ int tmp_type = old->type; @@ -452,7 +452,8 @@ robj *dbRandomKey(serverDb *db) { sds key = objectGetKey(valkey); robj *keyobj = createStringObject(key, sdslen(key)); if (objectIsExpired(valkey)) { - if (allvolatile && (server.primary_host || server.import_mode || isPausedActions(PAUSE_ACTION_EXPIRE)) && --maxtries == 0) { + if (allvolatile && (server.primary_host || server.import_mode || isPausedActions(PAUSE_ACTION_EXPIRE)) + && --maxtries == 0) { /* If the DB is composed only of keys with an expire set, * it could happen that all the keys are already logically * expired in the replica, so the function cannot stop because @@ -1115,7 +1116,12 @@ int parseScanCursorOrReply(client *c, sds buf, unsigned long long *cursor) { return C_OK; } -char *obj_type_name[OBJ_TYPE_MAX] = {"string", "list", "set", "zset", "hash", NULL, /* module type is special */ +char *obj_type_name[OBJ_TYPE_MAX] = {"string", + "list", + "set", + "zset", + "hash", + NULL, /* module type is special */ "stream"}; /* Helper function to get type from a string in scan commands */ @@ -1171,7 +1177,8 @@ int parseScanOptionsOrReply(client *c, robj *o, int start_idx, bool allow_slot, opts->pat = objectGetVal(c->argv[i + 1]); opts->patlen = sdslen(opts->pat); opts->use_pattern = !(opts->patlen == 1 && opts->pat[0] == '*'); - opts->match_slot = opts->use_pattern && server.cluster_enabled ? patternHashSlot(opts->pat, opts->patlen) : -1; + opts->match_slot = opts->use_pattern && server.cluster_enabled ? patternHashSlot(opts->pat, opts->patlen) + : -1; i += 2; } else if (!strcasecmp(opt, "type") && o == NULL && j >= 2) { /* TYPE filter applies to key names only, not to object fields. */ @@ -1222,7 +1229,11 @@ int parseScanOptionsOrReply(client *c, robj *o, int start_idx, bool allow_slot, * cluster_ctx is used during CLUSTERSCAN to scan a specific slot or range of * slots and to return the valid cursor to advance the scan. */ -void scanGenericCommandWithOptions(client *c, robj *o, unsigned long long cursor, const scanOptions *opts, const clusterScanCtx *cluster_ctx) { +void scanGenericCommandWithOptions(client *c, + robj *o, + unsigned long long cursor, + const scanOptions *opts, + const clusterScanCtx *cluster_ctx) { int slot = cluster_ctx ? cluster_ctx->slot : -1; int final_slot = cluster_ctx ? cluster_ctx->final_slot : -1; vector result; @@ -2361,8 +2372,8 @@ int getKeysUsingKeySpecs(struct serverCommand *cmd, robj **argv, int argc, int s if (spec->begin_search_type == KSPEC_BS_INDEX) { first = spec->bs.index.pos; } else if (spec->begin_search_type == KSPEC_BS_KEYWORD) { - int start_index = - spec->bs.keyword.startfrom > 0 ? spec->bs.keyword.startfrom : argc + spec->bs.keyword.startfrom; + int start_index = spec->bs.keyword.startfrom > 0 ? spec->bs.keyword.startfrom + : argc + spec->bs.keyword.startfrom; int end_index = spec->bs.keyword.startfrom > 0 ? argc - 1 : 1; for (i = start_index; i != end_index; i = start_index <= end_index ? i + 1 : i - 1) { if (i >= argc || i < 1) break; @@ -2808,7 +2819,10 @@ int sortGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult char *name; int skip; } skiplist[] = { - {"limit", 2}, {"get", 1}, {"by", 1}, {NULL, 0} /* End of elements. */ + {"limit", 2}, + {"get", 1}, + {"by", 1}, + {NULL, 0} /* End of elements. */ }; for (i = 2; i < argc; i++) { @@ -2982,8 +2996,8 @@ int setGetKeys(struct serverCommand *cmd, robj **argv, int argc, getKeysResult * for (int i = 3; i < argc; i++) { char *arg = objectGetVal(argv[i]); - if ((arg[0] == 'g' || arg[0] == 'G') && (arg[1] == 'e' || arg[1] == 'E') && (arg[2] == 't' || arg[2] == 'T') && - arg[3] == '\0') { + if ((arg[0] == 'g' || arg[0] == 'G') && (arg[1] == 'e' || arg[1] == 'E') && (arg[2] == 't' || arg[2] == 'T') + && arg[3] == '\0') { keys[0].flags = CMD_KEY_RW | CMD_KEY_ACCESS | CMD_KEY_UPDATE; return 1; } @@ -3046,8 +3060,7 @@ int *swapdbDbIdArgs(robj **argv, int argc, int *count) { if (argc < 3) return NULL; long long db1, db2; - if (getLongLongFromObject(argv[1], &db1) != C_OK || - getLongLongFromObject(argv[2], &db2) != C_OK) return NULL; + if (getLongLongFromObject(argv[1], &db1) != C_OK || getLongLongFromObject(argv[2], &db2) != C_OK) return NULL; if (db1 < 0 || db1 >= server.dbnum || db2 < 0 || db2 >= server.dbnum) return NULL; int *result = zmalloc(2 * sizeof(int)); diff --git a/src/debug.c b/src/debug.c index daa676a59d0..f6a1004aa12 100644 --- a/src/debug.c +++ b/src/debug.c @@ -524,7 +524,8 @@ void debugCommand(client *c) { "SLOTMIGRATION PREVENT-PAUSE <0|1>", " When set to 1, slot migrations will be prevented from pausing on the source node.", "SLOTMIGRATION PREVENT-FAILOVER <0|1>", - " When set to 1, slot migrations will be prevented from performing the slot-level failover on the target node.", + " When set to 1, slot migrations will be prevented from performing the slot-level failover on the " + "target node.", NULL}; addExtendedReplyHelp(c, help, clusterDebugCommandExtendedHelp()); } else if (!strcasecmp(objectGetVal(c->argv[1]), "segfault")) { @@ -535,7 +536,8 @@ void debugCommand(client *c) { *p = 'x'; } else if (!strcasecmp(objectGetVal(c->argv[1]), "panic")) { serverPanic("DEBUG PANIC called at Unix time %lld", (long long)time(NULL)); - } else if (!strcasecmp(objectGetVal(c->argv[1]), "restart") || !strcasecmp(objectGetVal(c->argv[1]), "crash-and-recover")) { + } else if (!strcasecmp(objectGetVal(c->argv[1]), "restart") + || !strcasecmp(objectGetVal(c->argv[1]), "crash-and-recover")) { long long delay = 0; if (c->argc >= 3) { if (getLongLongFromObjectOrReply(c, c->argv[2], &delay, NULL) != C_OK) return; @@ -573,8 +575,9 @@ void debugCommand(client *c) { } else if (!strcasecmp(opt, "NOSAVE")) { save = 0; } else { - addReplyError(c, "DEBUG RELOAD only supports the " - "MERGE, NOFLUSH and NOSAVE options."); + addReplyError(c, + "DEBUG RELOAD only supports the " + "MERGE, NOFLUSH and NOSAVE options."); return; } } @@ -724,8 +727,11 @@ void debugCommand(client *c) { addReplyStatusFormat(c, "key_sds_len:%lld key_sds_avail:%lld obj_alloc:%lld " "val_sds_len:%lld val_sds_avail:%lld val_alloc:%lld", - (long long)sdslen(key), (long long)sdsavail(key), (long long)obj_alloc, - (long long)sdslen(objectGetVal(val)), (long long)sdsavail(objectGetVal(val)), + (long long)sdslen(key), + (long long)sdsavail(key), + (long long)obj_alloc, + (long long)sdslen(objectGetVal(val)), + (long long)sdsavail(objectGetVal(val)), (long long)val_alloc); } } else if (!strcasecmp(objectGetVal(c->argv[1]), "listpack") && c->argc == 3) { @@ -876,8 +882,9 @@ void debugCommand(client *c) { } else if (!strcasecmp(name, "verbatim")) { addReplyVerbatim(c, "This is a verbatim\nstring", 25, "txt"); } else { - addReplyError(c, "Wrong protocol type name. Please use one of the following: " - "string|integer|double|bignum|null|array|set|map|attrib|push|verbatim|true|false"); + addReplyError(c, + "Wrong protocol type name. Please use one of the following: " + "string|integer|double|bignum|null|array|set|map|attrib|push|verbatim|true|false"); } } else if (!strcasecmp(objectGetVal(c->argv[1]), "sleep") && c->argc == 3) { double dtime = valkey_strtod_sds(objectGetVal(c->argv[2]), NULL); @@ -981,8 +988,9 @@ void debugCommand(client *c) { hashtableGetStats(buf, sizeof(buf), ht, full); addReplyVerbatim(c, buf, strlen(buf), "txt"); } else { - addReplyError(c, "The value stored at the specified key is not " - "represented using an hash table"); + addReplyError(c, + "The value stored at the specified key is not " + "represented using an hash table"); } } else if (!strcasecmp(objectGetVal(c->argv[1]), "change-repl-id") && c->argc == 2) { serverLog(LL_NOTICE, "Changing replication IDs after receiving DEBUG change-repl-id"); @@ -1010,14 +1018,16 @@ void debugCommand(client *c) { if (j == 0) bucket_info = sdscatprintf(bucket_info, "bucket 0"); else - bucket_info = - sdscatprintf(bucket_info, "bucket %10zu", (size_t)1 << (j - 1 + CLIENT_MEM_USAGE_BUCKET_MIN_LOG)); + bucket_info = sdscatprintf(bucket_info, + "bucket %10zu", + (size_t)1 << (j - 1 + CLIENT_MEM_USAGE_BUCKET_MIN_LOG)); if (j == CLIENT_MEM_USAGE_BUCKETS - 1) bucket_info = sdscatprintf(bucket_info, "+ : "); else bucket_info = sdscatprintf(bucket_info, " - %10zu: ", ((size_t)1 << (j + CLIENT_MEM_USAGE_BUCKET_MIN_LOG)) - 1); - bucket_info = sdscatprintf(bucket_info, "tot-mem: %10zu, clients: %lu\n", + bucket_info = sdscatprintf(bucket_info, + "tot-mem: %10zu, clients: %lu\n", server.client_mem_usage_buckets[j].mem_usage_sum, server.client_mem_usage_buckets[j].clients->len); } @@ -1120,7 +1130,10 @@ void _serverAssertPrintClientInfo(const client *c) { bugReportStart(); serverLog(LL_WARNING, "=== ASSERTION FAILED CLIENT CONTEXT ==="); - serverLog(LL_WARNING, "client->flags = %llu(0-63) %llu(64-127)", (unsigned long long)c->raw_flag1, (unsigned long long)c->raw_flag2); + serverLog(LL_WARNING, + "client->flags = %llu(0-63) %llu(64-127)", + (unsigned long long)c->raw_flag1, + (unsigned long long)c->raw_flag2); serverLog(LL_WARNING, "client->conn = %s", connGetInfo(c->conn, conninfo, sizeof(conninfo))); serverLog(LL_WARNING, "client->argc = %d", c->argc); for (j = 0; j < c->argc; j++) { @@ -1214,7 +1227,8 @@ __attribute__((noinline)) void _serverPanic(const char *file, int line, const ch int bugReportStart(void) { pthread_mutex_lock(&bug_report_start_mutex); if (bug_report_start == 0) { - serverLog(LL_WARNING | LL_RAW, "\n\n=== %s BUG REPORT START: Cut & paste starting from here ===\n", + serverLog(LL_WARNING | LL_RAW, + "\n\n=== %s BUG REPORT START: Cut & paste starting from here ===\n", server.extended_redis_compat ? "REDIS" : "VALKEY"); bug_report_start = 1; pthread_mutex_unlock(&bug_report_start_mutex); @@ -1360,16 +1374,26 @@ void logRegisters(ucontext_t *uc) { "R8 :%016lx R9 :%016lx\nR10:%016lx R11:%016lx\n" "R12:%016lx R13:%016lx\nR14:%016lx R15:%016lx\n" "RIP:%016lx EFL:%016lx\nCS :%016lx FS:%016lx GS:%016lx", - (unsigned long)uc->uc_mcontext->__ss.__rax, (unsigned long)uc->uc_mcontext->__ss.__rbx, - (unsigned long)uc->uc_mcontext->__ss.__rcx, (unsigned long)uc->uc_mcontext->__ss.__rdx, - (unsigned long)uc->uc_mcontext->__ss.__rdi, (unsigned long)uc->uc_mcontext->__ss.__rsi, - (unsigned long)uc->uc_mcontext->__ss.__rbp, (unsigned long)uc->uc_mcontext->__ss.__rsp, - (unsigned long)uc->uc_mcontext->__ss.__r8, (unsigned long)uc->uc_mcontext->__ss.__r9, - (unsigned long)uc->uc_mcontext->__ss.__r10, (unsigned long)uc->uc_mcontext->__ss.__r11, - (unsigned long)uc->uc_mcontext->__ss.__r12, (unsigned long)uc->uc_mcontext->__ss.__r13, - (unsigned long)uc->uc_mcontext->__ss.__r14, (unsigned long)uc->uc_mcontext->__ss.__r15, - (unsigned long)uc->uc_mcontext->__ss.__rip, (unsigned long)uc->uc_mcontext->__ss.__rflags, - (unsigned long)uc->uc_mcontext->__ss.__cs, (unsigned long)uc->uc_mcontext->__ss.__fs, + (unsigned long)uc->uc_mcontext->__ss.__rax, + (unsigned long)uc->uc_mcontext->__ss.__rbx, + (unsigned long)uc->uc_mcontext->__ss.__rcx, + (unsigned long)uc->uc_mcontext->__ss.__rdx, + (unsigned long)uc->uc_mcontext->__ss.__rdi, + (unsigned long)uc->uc_mcontext->__ss.__rsi, + (unsigned long)uc->uc_mcontext->__ss.__rbp, + (unsigned long)uc->uc_mcontext->__ss.__rsp, + (unsigned long)uc->uc_mcontext->__ss.__r8, + (unsigned long)uc->uc_mcontext->__ss.__r9, + (unsigned long)uc->uc_mcontext->__ss.__r10, + (unsigned long)uc->uc_mcontext->__ss.__r11, + (unsigned long)uc->uc_mcontext->__ss.__r12, + (unsigned long)uc->uc_mcontext->__ss.__r13, + (unsigned long)uc->uc_mcontext->__ss.__r14, + (unsigned long)uc->uc_mcontext->__ss.__r15, + (unsigned long)uc->uc_mcontext->__ss.__rip, + (unsigned long)uc->uc_mcontext->__ss.__rflags, + (unsigned long)uc->uc_mcontext->__ss.__cs, + (unsigned long)uc->uc_mcontext->__ss.__fs, (unsigned long)uc->uc_mcontext->__ss.__gs); logStackContent((void **)uc->uc_mcontext->__ss.__rsp); #elif defined(__i386__) @@ -1380,47 +1404,70 @@ void logRegisters(ucontext_t *uc) { "EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx\n" "SS:%08lx EFL:%08lx EIP:%08lx CS :%08lx\n" "DS:%08lx ES:%08lx FS :%08lx GS :%08lx", - (unsigned long)uc->uc_mcontext->__ss.__eax, (unsigned long)uc->uc_mcontext->__ss.__ebx, - (unsigned long)uc->uc_mcontext->__ss.__ecx, (unsigned long)uc->uc_mcontext->__ss.__edx, - (unsigned long)uc->uc_mcontext->__ss.__edi, (unsigned long)uc->uc_mcontext->__ss.__esi, - (unsigned long)uc->uc_mcontext->__ss.__ebp, (unsigned long)uc->uc_mcontext->__ss.__esp, - (unsigned long)uc->uc_mcontext->__ss.__ss, (unsigned long)uc->uc_mcontext->__ss.__eflags, - (unsigned long)uc->uc_mcontext->__ss.__eip, (unsigned long)uc->uc_mcontext->__ss.__cs, - (unsigned long)uc->uc_mcontext->__ss.__ds, (unsigned long)uc->uc_mcontext->__ss.__es, - (unsigned long)uc->uc_mcontext->__ss.__fs, (unsigned long)uc->uc_mcontext->__ss.__gs); + (unsigned long)uc->uc_mcontext->__ss.__eax, + (unsigned long)uc->uc_mcontext->__ss.__ebx, + (unsigned long)uc->uc_mcontext->__ss.__ecx, + (unsigned long)uc->uc_mcontext->__ss.__edx, + (unsigned long)uc->uc_mcontext->__ss.__edi, + (unsigned long)uc->uc_mcontext->__ss.__esi, + (unsigned long)uc->uc_mcontext->__ss.__ebp, + (unsigned long)uc->uc_mcontext->__ss.__esp, + (unsigned long)uc->uc_mcontext->__ss.__ss, + (unsigned long)uc->uc_mcontext->__ss.__eflags, + (unsigned long)uc->uc_mcontext->__ss.__eip, + (unsigned long)uc->uc_mcontext->__ss.__cs, + (unsigned long)uc->uc_mcontext->__ss.__ds, + (unsigned long)uc->uc_mcontext->__ss.__es, + (unsigned long)uc->uc_mcontext->__ss.__fs, + (unsigned long)uc->uc_mcontext->__ss.__gs); logStackContent((void **)uc->uc_mcontext->__ss.__esp); #elif defined(__arm64__) /* macOS ARM64 */ - serverLog( - LL_WARNING, - "\n" - "x0:%016lx x1:%016lx x2:%016lx x3:%016lx\n" - "x4:%016lx x5:%016lx x6:%016lx x7:%016lx\n" - "x8:%016lx x9:%016lx x10:%016lx x11:%016lx\n" - "x12:%016lx x13:%016lx x14:%016lx x15:%016lx\n" - "x16:%016lx x17:%016lx x18:%016lx x19:%016lx\n" - "x20:%016lx x21:%016lx x22:%016lx x23:%016lx\n" - "x24:%016lx x25:%016lx x26:%016lx x27:%016lx\n" - "x28:%016lx fp:%016lx lr:%016lx\n" - "sp:%016lx pc:%016lx cpsr:%08lx\n", - (unsigned long)uc->uc_mcontext->__ss.__x[0], (unsigned long)uc->uc_mcontext->__ss.__x[1], - (unsigned long)uc->uc_mcontext->__ss.__x[2], (unsigned long)uc->uc_mcontext->__ss.__x[3], - (unsigned long)uc->uc_mcontext->__ss.__x[4], (unsigned long)uc->uc_mcontext->__ss.__x[5], - (unsigned long)uc->uc_mcontext->__ss.__x[6], (unsigned long)uc->uc_mcontext->__ss.__x[7], - (unsigned long)uc->uc_mcontext->__ss.__x[8], (unsigned long)uc->uc_mcontext->__ss.__x[9], - (unsigned long)uc->uc_mcontext->__ss.__x[10], (unsigned long)uc->uc_mcontext->__ss.__x[11], - (unsigned long)uc->uc_mcontext->__ss.__x[12], (unsigned long)uc->uc_mcontext->__ss.__x[13], - (unsigned long)uc->uc_mcontext->__ss.__x[14], (unsigned long)uc->uc_mcontext->__ss.__x[15], - (unsigned long)uc->uc_mcontext->__ss.__x[16], (unsigned long)uc->uc_mcontext->__ss.__x[17], - (unsigned long)uc->uc_mcontext->__ss.__x[18], (unsigned long)uc->uc_mcontext->__ss.__x[19], - (unsigned long)uc->uc_mcontext->__ss.__x[20], (unsigned long)uc->uc_mcontext->__ss.__x[21], - (unsigned long)uc->uc_mcontext->__ss.__x[22], (unsigned long)uc->uc_mcontext->__ss.__x[23], - (unsigned long)uc->uc_mcontext->__ss.__x[24], (unsigned long)uc->uc_mcontext->__ss.__x[25], - (unsigned long)uc->uc_mcontext->__ss.__x[26], (unsigned long)uc->uc_mcontext->__ss.__x[27], - (unsigned long)uc->uc_mcontext->__ss.__x[28], (unsigned long)arm_thread_state64_get_fp(uc->uc_mcontext->__ss), - (unsigned long)arm_thread_state64_get_lr(uc->uc_mcontext->__ss), - (unsigned long)arm_thread_state64_get_sp(uc->uc_mcontext->__ss), - (unsigned long)arm_thread_state64_get_pc(uc->uc_mcontext->__ss), (unsigned long)uc->uc_mcontext->__ss.__cpsr); + serverLog(LL_WARNING, + "\n" + "x0:%016lx x1:%016lx x2:%016lx x3:%016lx\n" + "x4:%016lx x5:%016lx x6:%016lx x7:%016lx\n" + "x8:%016lx x9:%016lx x10:%016lx x11:%016lx\n" + "x12:%016lx x13:%016lx x14:%016lx x15:%016lx\n" + "x16:%016lx x17:%016lx x18:%016lx x19:%016lx\n" + "x20:%016lx x21:%016lx x22:%016lx x23:%016lx\n" + "x24:%016lx x25:%016lx x26:%016lx x27:%016lx\n" + "x28:%016lx fp:%016lx lr:%016lx\n" + "sp:%016lx pc:%016lx cpsr:%08lx\n", + (unsigned long)uc->uc_mcontext->__ss.__x[0], + (unsigned long)uc->uc_mcontext->__ss.__x[1], + (unsigned long)uc->uc_mcontext->__ss.__x[2], + (unsigned long)uc->uc_mcontext->__ss.__x[3], + (unsigned long)uc->uc_mcontext->__ss.__x[4], + (unsigned long)uc->uc_mcontext->__ss.__x[5], + (unsigned long)uc->uc_mcontext->__ss.__x[6], + (unsigned long)uc->uc_mcontext->__ss.__x[7], + (unsigned long)uc->uc_mcontext->__ss.__x[8], + (unsigned long)uc->uc_mcontext->__ss.__x[9], + (unsigned long)uc->uc_mcontext->__ss.__x[10], + (unsigned long)uc->uc_mcontext->__ss.__x[11], + (unsigned long)uc->uc_mcontext->__ss.__x[12], + (unsigned long)uc->uc_mcontext->__ss.__x[13], + (unsigned long)uc->uc_mcontext->__ss.__x[14], + (unsigned long)uc->uc_mcontext->__ss.__x[15], + (unsigned long)uc->uc_mcontext->__ss.__x[16], + (unsigned long)uc->uc_mcontext->__ss.__x[17], + (unsigned long)uc->uc_mcontext->__ss.__x[18], + (unsigned long)uc->uc_mcontext->__ss.__x[19], + (unsigned long)uc->uc_mcontext->__ss.__x[20], + (unsigned long)uc->uc_mcontext->__ss.__x[21], + (unsigned long)uc->uc_mcontext->__ss.__x[22], + (unsigned long)uc->uc_mcontext->__ss.__x[23], + (unsigned long)uc->uc_mcontext->__ss.__x[24], + (unsigned long)uc->uc_mcontext->__ss.__x[25], + (unsigned long)uc->uc_mcontext->__ss.__x[26], + (unsigned long)uc->uc_mcontext->__ss.__x[27], + (unsigned long)uc->uc_mcontext->__ss.__x[28], + (unsigned long)arm_thread_state64_get_fp(uc->uc_mcontext->__ss), + (unsigned long)arm_thread_state64_get_lr(uc->uc_mcontext->__ss), + (unsigned long)arm_thread_state64_get_sp(uc->uc_mcontext->__ss), + (unsigned long)arm_thread_state64_get_pc(uc->uc_mcontext->__ss), + (unsigned long)uc->uc_mcontext->__ss.__cpsr); logStackContent((void **)arm_thread_state64_get_sp(uc->uc_mcontext->__ss)); #else /* At the moment we do not implement this for PowerPC */ @@ -1436,14 +1483,22 @@ void logRegisters(ucontext_t *uc) { "EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx\n" "SS :%08lx EFL:%08lx EIP:%08lx CS:%08lx\n" "DS :%08lx ES :%08lx FS :%08lx GS:%08lx", - (unsigned long)uc->uc_mcontext.gregs[11], (unsigned long)uc->uc_mcontext.gregs[8], - (unsigned long)uc->uc_mcontext.gregs[10], (unsigned long)uc->uc_mcontext.gregs[9], - (unsigned long)uc->uc_mcontext.gregs[4], (unsigned long)uc->uc_mcontext.gregs[5], - (unsigned long)uc->uc_mcontext.gregs[6], (unsigned long)uc->uc_mcontext.gregs[7], - (unsigned long)uc->uc_mcontext.gregs[18], (unsigned long)uc->uc_mcontext.gregs[17], - (unsigned long)uc->uc_mcontext.gregs[14], (unsigned long)uc->uc_mcontext.gregs[15], - (unsigned long)uc->uc_mcontext.gregs[3], (unsigned long)uc->uc_mcontext.gregs[2], - (unsigned long)uc->uc_mcontext.gregs[1], (unsigned long)uc->uc_mcontext.gregs[0]); + (unsigned long)uc->uc_mcontext.gregs[11], + (unsigned long)uc->uc_mcontext.gregs[8], + (unsigned long)uc->uc_mcontext.gregs[10], + (unsigned long)uc->uc_mcontext.gregs[9], + (unsigned long)uc->uc_mcontext.gregs[4], + (unsigned long)uc->uc_mcontext.gregs[5], + (unsigned long)uc->uc_mcontext.gregs[6], + (unsigned long)uc->uc_mcontext.gregs[7], + (unsigned long)uc->uc_mcontext.gregs[18], + (unsigned long)uc->uc_mcontext.gregs[17], + (unsigned long)uc->uc_mcontext.gregs[14], + (unsigned long)uc->uc_mcontext.gregs[15], + (unsigned long)uc->uc_mcontext.gregs[3], + (unsigned long)uc->uc_mcontext.gregs[2], + (unsigned long)uc->uc_mcontext.gregs[1], + (unsigned long)uc->uc_mcontext.gregs[0]); logStackContent((void **)uc->uc_mcontext.gregs[7]); #elif defined(__X86_64__) || defined(__x86_64__) /* Linux AMD64 */ @@ -1454,15 +1509,24 @@ void logRegisters(ucontext_t *uc) { "R8 :%016lx R9 :%016lx\nR10:%016lx R11:%016lx\n" "R12:%016lx R13:%016lx\nR14:%016lx R15:%016lx\n" "RIP:%016lx EFL:%016lx\nCSGSFS:%016lx", - (unsigned long)uc->uc_mcontext.gregs[13], (unsigned long)uc->uc_mcontext.gregs[11], - (unsigned long)uc->uc_mcontext.gregs[14], (unsigned long)uc->uc_mcontext.gregs[12], - (unsigned long)uc->uc_mcontext.gregs[8], (unsigned long)uc->uc_mcontext.gregs[9], - (unsigned long)uc->uc_mcontext.gregs[10], (unsigned long)uc->uc_mcontext.gregs[15], - (unsigned long)uc->uc_mcontext.gregs[0], (unsigned long)uc->uc_mcontext.gregs[1], - (unsigned long)uc->uc_mcontext.gregs[2], (unsigned long)uc->uc_mcontext.gregs[3], - (unsigned long)uc->uc_mcontext.gregs[4], (unsigned long)uc->uc_mcontext.gregs[5], - (unsigned long)uc->uc_mcontext.gregs[6], (unsigned long)uc->uc_mcontext.gregs[7], - (unsigned long)uc->uc_mcontext.gregs[16], (unsigned long)uc->uc_mcontext.gregs[17], + (unsigned long)uc->uc_mcontext.gregs[13], + (unsigned long)uc->uc_mcontext.gregs[11], + (unsigned long)uc->uc_mcontext.gregs[14], + (unsigned long)uc->uc_mcontext.gregs[12], + (unsigned long)uc->uc_mcontext.gregs[8], + (unsigned long)uc->uc_mcontext.gregs[9], + (unsigned long)uc->uc_mcontext.gregs[10], + (unsigned long)uc->uc_mcontext.gregs[15], + (unsigned long)uc->uc_mcontext.gregs[0], + (unsigned long)uc->uc_mcontext.gregs[1], + (unsigned long)uc->uc_mcontext.gregs[2], + (unsigned long)uc->uc_mcontext.gregs[3], + (unsigned long)uc->uc_mcontext.gregs[4], + (unsigned long)uc->uc_mcontext.gregs[5], + (unsigned long)uc->uc_mcontext.gregs[6], + (unsigned long)uc->uc_mcontext.gregs[7], + (unsigned long)uc->uc_mcontext.gregs[16], + (unsigned long)uc->uc_mcontext.gregs[17], (unsigned long)uc->uc_mcontext.gregs[18]); logStackContent((void **)uc->uc_mcontext.gregs[15]); #elif defined(__riscv) /* Linux RISC-V */ @@ -1476,21 +1540,36 @@ void logRegisters(ucontext_t *uc) { "s6:%016lx s7:%016lx\ns8:%016lx s9:%016lx\n" "s10:%016lx s11:%016lx\nt3:%016lx t4:%016lx\n" "t5:%016lx t6:%016lx\n", - (unsigned long)uc->uc_mcontext.__gregs[1], (unsigned long)uc->uc_mcontext.__gregs[3], - (unsigned long)uc->uc_mcontext.__gregs[4], (unsigned long)uc->uc_mcontext.__gregs[5], - (unsigned long)uc->uc_mcontext.__gregs[6], (unsigned long)uc->uc_mcontext.__gregs[7], - (unsigned long)uc->uc_mcontext.__gregs[8], (unsigned long)uc->uc_mcontext.__gregs[9], - (unsigned long)uc->uc_mcontext.__gregs[10], (unsigned long)uc->uc_mcontext.__gregs[11], - (unsigned long)uc->uc_mcontext.__gregs[12], (unsigned long)uc->uc_mcontext.__gregs[13], - (unsigned long)uc->uc_mcontext.__gregs[14], (unsigned long)uc->uc_mcontext.__gregs[15], - (unsigned long)uc->uc_mcontext.__gregs[16], (unsigned long)uc->uc_mcontext.__gregs[17], - (unsigned long)uc->uc_mcontext.__gregs[18], (unsigned long)uc->uc_mcontext.__gregs[19], - (unsigned long)uc->uc_mcontext.__gregs[20], (unsigned long)uc->uc_mcontext.__gregs[21], - (unsigned long)uc->uc_mcontext.__gregs[22], (unsigned long)uc->uc_mcontext.__gregs[23], - (unsigned long)uc->uc_mcontext.__gregs[24], (unsigned long)uc->uc_mcontext.__gregs[25], - (unsigned long)uc->uc_mcontext.__gregs[26], (unsigned long)uc->uc_mcontext.__gregs[27], - (unsigned long)uc->uc_mcontext.__gregs[28], (unsigned long)uc->uc_mcontext.__gregs[29], - (unsigned long)uc->uc_mcontext.__gregs[30], (unsigned long)uc->uc_mcontext.__gregs[31]); + (unsigned long)uc->uc_mcontext.__gregs[1], + (unsigned long)uc->uc_mcontext.__gregs[3], + (unsigned long)uc->uc_mcontext.__gregs[4], + (unsigned long)uc->uc_mcontext.__gregs[5], + (unsigned long)uc->uc_mcontext.__gregs[6], + (unsigned long)uc->uc_mcontext.__gregs[7], + (unsigned long)uc->uc_mcontext.__gregs[8], + (unsigned long)uc->uc_mcontext.__gregs[9], + (unsigned long)uc->uc_mcontext.__gregs[10], + (unsigned long)uc->uc_mcontext.__gregs[11], + (unsigned long)uc->uc_mcontext.__gregs[12], + (unsigned long)uc->uc_mcontext.__gregs[13], + (unsigned long)uc->uc_mcontext.__gregs[14], + (unsigned long)uc->uc_mcontext.__gregs[15], + (unsigned long)uc->uc_mcontext.__gregs[16], + (unsigned long)uc->uc_mcontext.__gregs[17], + (unsigned long)uc->uc_mcontext.__gregs[18], + (unsigned long)uc->uc_mcontext.__gregs[19], + (unsigned long)uc->uc_mcontext.__gregs[20], + (unsigned long)uc->uc_mcontext.__gregs[21], + (unsigned long)uc->uc_mcontext.__gregs[22], + (unsigned long)uc->uc_mcontext.__gregs[23], + (unsigned long)uc->uc_mcontext.__gregs[24], + (unsigned long)uc->uc_mcontext.__gregs[25], + (unsigned long)uc->uc_mcontext.__gregs[26], + (unsigned long)uc->uc_mcontext.__gregs[27], + (unsigned long)uc->uc_mcontext.__gregs[28], + (unsigned long)uc->uc_mcontext.__gregs[29], + (unsigned long)uc->uc_mcontext.__gregs[30], + (unsigned long)uc->uc_mcontext.__gregs[31]); logStackContent((void **)uc->uc_mcontext.__gregs[REG_SP]); #elif defined(__aarch64__) /* Linux AArch64 */ serverLog(LL_WARNING, @@ -1500,14 +1579,22 @@ void logRegisters(ucontext_t *uc) { "X26:%016lx X27:%016lx\nX28:%016lx X29:%016lx\n" "X30:%016lx\n" "pc:%016lx sp:%016lx\npstate:%016lx fault_address:%016lx\n", - (unsigned long)uc->uc_mcontext.regs[18], (unsigned long)uc->uc_mcontext.regs[19], - (unsigned long)uc->uc_mcontext.regs[20], (unsigned long)uc->uc_mcontext.regs[21], - (unsigned long)uc->uc_mcontext.regs[22], (unsigned long)uc->uc_mcontext.regs[23], - (unsigned long)uc->uc_mcontext.regs[24], (unsigned long)uc->uc_mcontext.regs[25], - (unsigned long)uc->uc_mcontext.regs[26], (unsigned long)uc->uc_mcontext.regs[27], - (unsigned long)uc->uc_mcontext.regs[28], (unsigned long)uc->uc_mcontext.regs[29], - (unsigned long)uc->uc_mcontext.regs[30], (unsigned long)uc->uc_mcontext.pc, - (unsigned long)uc->uc_mcontext.sp, (unsigned long)uc->uc_mcontext.pstate, + (unsigned long)uc->uc_mcontext.regs[18], + (unsigned long)uc->uc_mcontext.regs[19], + (unsigned long)uc->uc_mcontext.regs[20], + (unsigned long)uc->uc_mcontext.regs[21], + (unsigned long)uc->uc_mcontext.regs[22], + (unsigned long)uc->uc_mcontext.regs[23], + (unsigned long)uc->uc_mcontext.regs[24], + (unsigned long)uc->uc_mcontext.regs[25], + (unsigned long)uc->uc_mcontext.regs[26], + (unsigned long)uc->uc_mcontext.regs[27], + (unsigned long)uc->uc_mcontext.regs[28], + (unsigned long)uc->uc_mcontext.regs[29], + (unsigned long)uc->uc_mcontext.regs[30], + (unsigned long)uc->uc_mcontext.pc, + (unsigned long)uc->uc_mcontext.sp, + (unsigned long)uc->uc_mcontext.pstate, (unsigned long)uc->uc_mcontext.fault_address); logStackContent((void **)uc->uc_mcontext.sp); #elif defined(__arm__) /* Linux ARM */ @@ -1518,15 +1605,24 @@ void logRegisters(ucontext_t *uc) { "R2 :%016lx R1 :%016lx\nR0 :%016lx EC :%016lx\n" "fp: %016lx ip:%016lx\n" "pc:%016lx sp:%016lx\ncpsr:%016lx fault_address:%016lx\n", - (unsigned long)uc->uc_mcontext.arm_r10, (unsigned long)uc->uc_mcontext.arm_r9, - (unsigned long)uc->uc_mcontext.arm_r8, (unsigned long)uc->uc_mcontext.arm_r7, - (unsigned long)uc->uc_mcontext.arm_r6, (unsigned long)uc->uc_mcontext.arm_r5, - (unsigned long)uc->uc_mcontext.arm_r4, (unsigned long)uc->uc_mcontext.arm_r3, - (unsigned long)uc->uc_mcontext.arm_r2, (unsigned long)uc->uc_mcontext.arm_r1, - (unsigned long)uc->uc_mcontext.arm_r0, (unsigned long)uc->uc_mcontext.error_code, - (unsigned long)uc->uc_mcontext.arm_fp, (unsigned long)uc->uc_mcontext.arm_ip, - (unsigned long)uc->uc_mcontext.arm_pc, (unsigned long)uc->uc_mcontext.arm_sp, - (unsigned long)uc->uc_mcontext.arm_cpsr, (unsigned long)uc->uc_mcontext.fault_address); + (unsigned long)uc->uc_mcontext.arm_r10, + (unsigned long)uc->uc_mcontext.arm_r9, + (unsigned long)uc->uc_mcontext.arm_r8, + (unsigned long)uc->uc_mcontext.arm_r7, + (unsigned long)uc->uc_mcontext.arm_r6, + (unsigned long)uc->uc_mcontext.arm_r5, + (unsigned long)uc->uc_mcontext.arm_r4, + (unsigned long)uc->uc_mcontext.arm_r3, + (unsigned long)uc->uc_mcontext.arm_r2, + (unsigned long)uc->uc_mcontext.arm_r1, + (unsigned long)uc->uc_mcontext.arm_r0, + (unsigned long)uc->uc_mcontext.error_code, + (unsigned long)uc->uc_mcontext.arm_fp, + (unsigned long)uc->uc_mcontext.arm_ip, + (unsigned long)uc->uc_mcontext.arm_pc, + (unsigned long)uc->uc_mcontext.arm_sp, + (unsigned long)uc->uc_mcontext.arm_cpsr, + (unsigned long)uc->uc_mcontext.fault_address); logStackContent((void **)uc->uc_mcontext.arm_sp); #else NOT_SUPPORTED(); @@ -1540,15 +1636,24 @@ void logRegisters(ucontext_t *uc) { "R8 :%016lx R9 :%016lx\nR10:%016lx R11:%016lx\n" "R12:%016lx R13:%016lx\nR14:%016lx R15:%016lx\n" "RIP:%016lx EFL:%016lx\nCSGSFS:%016lx", - (unsigned long)uc->uc_mcontext.mc_rax, (unsigned long)uc->uc_mcontext.mc_rbx, - (unsigned long)uc->uc_mcontext.mc_rcx, (unsigned long)uc->uc_mcontext.mc_rdx, - (unsigned long)uc->uc_mcontext.mc_rdi, (unsigned long)uc->uc_mcontext.mc_rsi, - (unsigned long)uc->uc_mcontext.mc_rbp, (unsigned long)uc->uc_mcontext.mc_rsp, - (unsigned long)uc->uc_mcontext.mc_r8, (unsigned long)uc->uc_mcontext.mc_r9, - (unsigned long)uc->uc_mcontext.mc_r10, (unsigned long)uc->uc_mcontext.mc_r11, - (unsigned long)uc->uc_mcontext.mc_r12, (unsigned long)uc->uc_mcontext.mc_r13, - (unsigned long)uc->uc_mcontext.mc_r14, (unsigned long)uc->uc_mcontext.mc_r15, - (unsigned long)uc->uc_mcontext.mc_rip, (unsigned long)uc->uc_mcontext.mc_rflags, + (unsigned long)uc->uc_mcontext.mc_rax, + (unsigned long)uc->uc_mcontext.mc_rbx, + (unsigned long)uc->uc_mcontext.mc_rcx, + (unsigned long)uc->uc_mcontext.mc_rdx, + (unsigned long)uc->uc_mcontext.mc_rdi, + (unsigned long)uc->uc_mcontext.mc_rsi, + (unsigned long)uc->uc_mcontext.mc_rbp, + (unsigned long)uc->uc_mcontext.mc_rsp, + (unsigned long)uc->uc_mcontext.mc_r8, + (unsigned long)uc->uc_mcontext.mc_r9, + (unsigned long)uc->uc_mcontext.mc_r10, + (unsigned long)uc->uc_mcontext.mc_r11, + (unsigned long)uc->uc_mcontext.mc_r12, + (unsigned long)uc->uc_mcontext.mc_r13, + (unsigned long)uc->uc_mcontext.mc_r14, + (unsigned long)uc->uc_mcontext.mc_r15, + (unsigned long)uc->uc_mcontext.mc_rip, + (unsigned long)uc->uc_mcontext.mc_rflags, (unsigned long)uc->uc_mcontext.mc_cs); logStackContent((void **)uc->uc_mcontext.mc_rsp); #elif defined(__i386__) @@ -1558,13 +1663,20 @@ void logRegisters(ucontext_t *uc) { "EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx\n" "SS :%08lx EFL:%08lx EIP:%08lx CS:%08lx\n" "DS :%08lx ES :%08lx FS :%08lx GS:%08lx", - (unsigned long)uc->uc_mcontext.mc_eax, (unsigned long)uc->uc_mcontext.mc_ebx, - (unsigned long)uc->uc_mcontext.mc_ebx, (unsigned long)uc->uc_mcontext.mc_edx, - (unsigned long)uc->uc_mcontext.mc_edi, (unsigned long)uc->uc_mcontext.mc_esi, - (unsigned long)uc->uc_mcontext.mc_ebp, (unsigned long)uc->uc_mcontext.mc_esp, - (unsigned long)uc->uc_mcontext.mc_ss, (unsigned long)uc->uc_mcontext.mc_eflags, - (unsigned long)uc->uc_mcontext.mc_eip, (unsigned long)uc->uc_mcontext.mc_cs, - (unsigned long)uc->uc_mcontext.mc_es, (unsigned long)uc->uc_mcontext.mc_fs, + (unsigned long)uc->uc_mcontext.mc_eax, + (unsigned long)uc->uc_mcontext.mc_ebx, + (unsigned long)uc->uc_mcontext.mc_ebx, + (unsigned long)uc->uc_mcontext.mc_edx, + (unsigned long)uc->uc_mcontext.mc_edi, + (unsigned long)uc->uc_mcontext.mc_esi, + (unsigned long)uc->uc_mcontext.mc_ebp, + (unsigned long)uc->uc_mcontext.mc_esp, + (unsigned long)uc->uc_mcontext.mc_ss, + (unsigned long)uc->uc_mcontext.mc_eflags, + (unsigned long)uc->uc_mcontext.mc_eip, + (unsigned long)uc->uc_mcontext.mc_cs, + (unsigned long)uc->uc_mcontext.mc_es, + (unsigned long)uc->uc_mcontext.mc_fs, (unsigned long)uc->uc_mcontext.mc_gs); logStackContent((void **)uc->uc_mcontext.mc_esp); #else @@ -1579,12 +1691,25 @@ void logRegisters(ucontext_t *uc) { "R8 :%016lx R9 :%016lx\nR10:%016lx R11:%016lx\n" "R12:%016lx R13:%016lx\nR14:%016lx R15:%016lx\n" "RIP:%016lx EFL:%016lx\nCSGSFS:%016lx", - (unsigned long)uc->sc_rax, (unsigned long)uc->sc_rbx, (unsigned long)uc->sc_rcx, - (unsigned long)uc->sc_rdx, (unsigned long)uc->sc_rdi, (unsigned long)uc->sc_rsi, - (unsigned long)uc->sc_rbp, (unsigned long)uc->sc_rsp, (unsigned long)uc->sc_r8, (unsigned long)uc->sc_r9, - (unsigned long)uc->sc_r10, (unsigned long)uc->sc_r11, (unsigned long)uc->sc_r12, - (unsigned long)uc->sc_r13, (unsigned long)uc->sc_r14, (unsigned long)uc->sc_r15, - (unsigned long)uc->sc_rip, (unsigned long)uc->sc_rflags, (unsigned long)uc->sc_cs); + (unsigned long)uc->sc_rax, + (unsigned long)uc->sc_rbx, + (unsigned long)uc->sc_rcx, + (unsigned long)uc->sc_rdx, + (unsigned long)uc->sc_rdi, + (unsigned long)uc->sc_rsi, + (unsigned long)uc->sc_rbp, + (unsigned long)uc->sc_rsp, + (unsigned long)uc->sc_r8, + (unsigned long)uc->sc_r9, + (unsigned long)uc->sc_r10, + (unsigned long)uc->sc_r11, + (unsigned long)uc->sc_r12, + (unsigned long)uc->sc_r13, + (unsigned long)uc->sc_r14, + (unsigned long)uc->sc_r15, + (unsigned long)uc->sc_rip, + (unsigned long)uc->sc_rflags, + (unsigned long)uc->sc_cs); logStackContent((void **)uc->sc_rsp); #elif defined(__i386__) serverLog(LL_WARNING, @@ -1593,11 +1718,21 @@ void logRegisters(ucontext_t *uc) { "EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx\n" "SS :%08lx EFL:%08lx EIP:%08lx CS:%08lx\n" "DS :%08lx ES :%08lx FS :%08lx GS:%08lx", - (unsigned long)uc->sc_eax, (unsigned long)uc->sc_ebx, (unsigned long)uc->sc_ebx, - (unsigned long)uc->sc_edx, (unsigned long)uc->sc_edi, (unsigned long)uc->sc_esi, - (unsigned long)uc->sc_ebp, (unsigned long)uc->sc_esp, (unsigned long)uc->sc_ss, - (unsigned long)uc->sc_eflags, (unsigned long)uc->sc_eip, (unsigned long)uc->sc_cs, - (unsigned long)uc->sc_es, (unsigned long)uc->sc_fs, (unsigned long)uc->sc_gs); + (unsigned long)uc->sc_eax, + (unsigned long)uc->sc_ebx, + (unsigned long)uc->sc_ebx, + (unsigned long)uc->sc_edx, + (unsigned long)uc->sc_edi, + (unsigned long)uc->sc_esi, + (unsigned long)uc->sc_ebp, + (unsigned long)uc->sc_esp, + (unsigned long)uc->sc_ss, + (unsigned long)uc->sc_eflags, + (unsigned long)uc->sc_eip, + (unsigned long)uc->sc_cs, + (unsigned long)uc->sc_es, + (unsigned long)uc->sc_fs, + (unsigned long)uc->sc_gs); logStackContent((void **)uc->sc_esp); #else NOT_SUPPORTED(); @@ -1611,15 +1746,24 @@ void logRegisters(ucontext_t *uc) { "R8 :%016lx R9 :%016lx\nR10:%016lx R11:%016lx\n" "R12:%016lx R13:%016lx\nR14:%016lx R15:%016lx\n" "RIP:%016lx EFL:%016lx\nCSGSFS:%016lx", - (unsigned long)uc->uc_mcontext.__gregs[_REG_RAX], (unsigned long)uc->uc_mcontext.__gregs[_REG_RBX], - (unsigned long)uc->uc_mcontext.__gregs[_REG_RCX], (unsigned long)uc->uc_mcontext.__gregs[_REG_RDX], - (unsigned long)uc->uc_mcontext.__gregs[_REG_RDI], (unsigned long)uc->uc_mcontext.__gregs[_REG_RSI], - (unsigned long)uc->uc_mcontext.__gregs[_REG_RBP], (unsigned long)uc->uc_mcontext.__gregs[_REG_RSP], - (unsigned long)uc->uc_mcontext.__gregs[_REG_R8], (unsigned long)uc->uc_mcontext.__gregs[_REG_R9], - (unsigned long)uc->uc_mcontext.__gregs[_REG_R10], (unsigned long)uc->uc_mcontext.__gregs[_REG_R11], - (unsigned long)uc->uc_mcontext.__gregs[_REG_R12], (unsigned long)uc->uc_mcontext.__gregs[_REG_R13], - (unsigned long)uc->uc_mcontext.__gregs[_REG_R14], (unsigned long)uc->uc_mcontext.__gregs[_REG_R15], - (unsigned long)uc->uc_mcontext.__gregs[_REG_RIP], (unsigned long)uc->uc_mcontext.__gregs[_REG_RFLAGS], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RAX], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RBX], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RCX], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RDX], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RDI], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RSI], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RBP], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RSP], + (unsigned long)uc->uc_mcontext.__gregs[_REG_R8], + (unsigned long)uc->uc_mcontext.__gregs[_REG_R9], + (unsigned long)uc->uc_mcontext.__gregs[_REG_R10], + (unsigned long)uc->uc_mcontext.__gregs[_REG_R11], + (unsigned long)uc->uc_mcontext.__gregs[_REG_R12], + (unsigned long)uc->uc_mcontext.__gregs[_REG_R13], + (unsigned long)uc->uc_mcontext.__gregs[_REG_R14], + (unsigned long)uc->uc_mcontext.__gregs[_REG_R15], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RIP], + (unsigned long)uc->uc_mcontext.__gregs[_REG_RFLAGS], (unsigned long)uc->uc_mcontext.__gregs[_REG_CS]); logStackContent((void **)uc->uc_mcontext.__gregs[_REG_RSP]); #elif defined(__i386__) @@ -1629,13 +1773,20 @@ void logRegisters(ucontext_t *uc) { "EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx\n" "SS :%08lx EFL:%08lx EIP:%08lx CS:%08lx\n" "DS :%08lx ES :%08lx FS :%08lx GS:%08lx", - (unsigned long)uc->uc_mcontext.__gregs[_REG_EAX], (unsigned long)uc->uc_mcontext.__gregs[_REG_EBX], - (unsigned long)uc->uc_mcontext.__gregs[_REG_EDX], (unsigned long)uc->uc_mcontext.__gregs[_REG_EDI], - (unsigned long)uc->uc_mcontext.__gregs[_REG_ESI], (unsigned long)uc->uc_mcontext.__gregs[_REG_EBP], - (unsigned long)uc->uc_mcontext.__gregs[_REG_ESP], (unsigned long)uc->uc_mcontext.__gregs[_REG_SS], - (unsigned long)uc->uc_mcontext.__gregs[_REG_EFLAGS], (unsigned long)uc->uc_mcontext.__gregs[_REG_EIP], - (unsigned long)uc->uc_mcontext.__gregs[_REG_CS], (unsigned long)uc->uc_mcontext.__gregs[_REG_ES], - (unsigned long)uc->uc_mcontext.__gregs[_REG_FS], (unsigned long)uc->uc_mcontext.__gregs[_REG_GS]); + (unsigned long)uc->uc_mcontext.__gregs[_REG_EAX], + (unsigned long)uc->uc_mcontext.__gregs[_REG_EBX], + (unsigned long)uc->uc_mcontext.__gregs[_REG_EDX], + (unsigned long)uc->uc_mcontext.__gregs[_REG_EDI], + (unsigned long)uc->uc_mcontext.__gregs[_REG_ESI], + (unsigned long)uc->uc_mcontext.__gregs[_REG_EBP], + (unsigned long)uc->uc_mcontext.__gregs[_REG_ESP], + (unsigned long)uc->uc_mcontext.__gregs[_REG_SS], + (unsigned long)uc->uc_mcontext.__gregs[_REG_EFLAGS], + (unsigned long)uc->uc_mcontext.__gregs[_REG_EIP], + (unsigned long)uc->uc_mcontext.__gregs[_REG_CS], + (unsigned long)uc->uc_mcontext.__gregs[_REG_ES], + (unsigned long)uc->uc_mcontext.__gregs[_REG_FS], + (unsigned long)uc->uc_mcontext.__gregs[_REG_GS]); #else NOT_SUPPORTED(); #endif @@ -1647,15 +1798,24 @@ void logRegisters(ucontext_t *uc) { "R8 :%016lx R9 :%016lx\nR10:%016lx R11:%016lx\n" "R12:%016lx R13:%016lx\nR14:%016lx R15:%016lx\n" "RIP:%016lx EFL:%016lx\nCSGSFS:%016lx", - (unsigned long)uc->uc_mcontext.mc_rax, (unsigned long)uc->uc_mcontext.mc_rbx, - (unsigned long)uc->uc_mcontext.mc_rcx, (unsigned long)uc->uc_mcontext.mc_rdx, - (unsigned long)uc->uc_mcontext.mc_rdi, (unsigned long)uc->uc_mcontext.mc_rsi, - (unsigned long)uc->uc_mcontext.mc_rbp, (unsigned long)uc->uc_mcontext.mc_rsp, - (unsigned long)uc->uc_mcontext.mc_r8, (unsigned long)uc->uc_mcontext.mc_r9, - (unsigned long)uc->uc_mcontext.mc_r10, (unsigned long)uc->uc_mcontext.mc_r11, - (unsigned long)uc->uc_mcontext.mc_r12, (unsigned long)uc->uc_mcontext.mc_r13, - (unsigned long)uc->uc_mcontext.mc_r14, (unsigned long)uc->uc_mcontext.mc_r15, - (unsigned long)uc->uc_mcontext.mc_rip, (unsigned long)uc->uc_mcontext.mc_rflags, + (unsigned long)uc->uc_mcontext.mc_rax, + (unsigned long)uc->uc_mcontext.mc_rbx, + (unsigned long)uc->uc_mcontext.mc_rcx, + (unsigned long)uc->uc_mcontext.mc_rdx, + (unsigned long)uc->uc_mcontext.mc_rdi, + (unsigned long)uc->uc_mcontext.mc_rsi, + (unsigned long)uc->uc_mcontext.mc_rbp, + (unsigned long)uc->uc_mcontext.mc_rsp, + (unsigned long)uc->uc_mcontext.mc_r8, + (unsigned long)uc->uc_mcontext.mc_r9, + (unsigned long)uc->uc_mcontext.mc_r10, + (unsigned long)uc->uc_mcontext.mc_r11, + (unsigned long)uc->uc_mcontext.mc_r12, + (unsigned long)uc->uc_mcontext.mc_r13, + (unsigned long)uc->uc_mcontext.mc_r14, + (unsigned long)uc->uc_mcontext.mc_r15, + (unsigned long)uc->uc_mcontext.mc_rip, + (unsigned long)uc->uc_mcontext.mc_rflags, (unsigned long)uc->uc_mcontext.mc_cs); logStackContent((void **)uc->uc_mcontext.mc_rsp); #elif defined(__sun) @@ -1667,15 +1827,24 @@ void logRegisters(ucontext_t *uc) { "R8 :%016lx R9 :%016lx\nR10:%016lx R11:%016lx\n" "R12:%016lx R13:%016lx\nR14:%016lx R15:%016lx\n" "RIP:%016lx EFL:%016lx\nCSGSFS:%016lx", - (unsigned long)uc->uc_mcontext.gregs[REG_RAX], (unsigned long)uc->uc_mcontext.gregs[REG_RBX], - (unsigned long)uc->uc_mcontext.gregs[REG_RCX], (unsigned long)uc->uc_mcontext.gregs[REG_RDX], - (unsigned long)uc->uc_mcontext.gregs[REG_RDI], (unsigned long)uc->uc_mcontext.gregs[REG_RSI], - (unsigned long)uc->uc_mcontext.gregs[REG_RBP], (unsigned long)uc->uc_mcontext.gregs[REG_RSP], - (unsigned long)uc->uc_mcontext.gregs[REG_R8], (unsigned long)uc->uc_mcontext.gregs[REG_R9], - (unsigned long)uc->uc_mcontext.gregs[REG_R10], (unsigned long)uc->uc_mcontext.gregs[REG_R11], - (unsigned long)uc->uc_mcontext.gregs[REG_R12], (unsigned long)uc->uc_mcontext.gregs[REG_R13], - (unsigned long)uc->uc_mcontext.gregs[REG_R14], (unsigned long)uc->uc_mcontext.gregs[REG_R15], - (unsigned long)uc->uc_mcontext.gregs[REG_RIP], (unsigned long)uc->uc_mcontext.gregs[REG_RFL], + (unsigned long)uc->uc_mcontext.gregs[REG_RAX], + (unsigned long)uc->uc_mcontext.gregs[REG_RBX], + (unsigned long)uc->uc_mcontext.gregs[REG_RCX], + (unsigned long)uc->uc_mcontext.gregs[REG_RDX], + (unsigned long)uc->uc_mcontext.gregs[REG_RDI], + (unsigned long)uc->uc_mcontext.gregs[REG_RSI], + (unsigned long)uc->uc_mcontext.gregs[REG_RBP], + (unsigned long)uc->uc_mcontext.gregs[REG_RSP], + (unsigned long)uc->uc_mcontext.gregs[REG_R8], + (unsigned long)uc->uc_mcontext.gregs[REG_R9], + (unsigned long)uc->uc_mcontext.gregs[REG_R10], + (unsigned long)uc->uc_mcontext.gregs[REG_R11], + (unsigned long)uc->uc_mcontext.gregs[REG_R12], + (unsigned long)uc->uc_mcontext.gregs[REG_R13], + (unsigned long)uc->uc_mcontext.gregs[REG_R14], + (unsigned long)uc->uc_mcontext.gregs[REG_R15], + (unsigned long)uc->uc_mcontext.gregs[REG_RIP], + (unsigned long)uc->uc_mcontext.gregs[REG_RFL], (unsigned long)uc->uc_mcontext.gregs[REG_CS]); logStackContent((void **)uc->uc_mcontext.gregs[REG_RSP]); #endif @@ -1744,17 +1913,21 @@ static int libbacktrace_full_cb(void *data, uintptr_t pc, const char *filename, if (function) { if (filename && lineno > 0) { - len = snprintf(buf, sizeof(buf), "#%d 0x%lx %s at %s:%d\n", - cb_data->count, (unsigned long)pc, function, filename, lineno); + len = snprintf(buf, + sizeof(buf), + "#%d 0x%lx %s at %s:%d\n", + cb_data->count, + (unsigned long)pc, + function, + filename, + lineno); } else { - len = snprintf(buf, sizeof(buf), "#%d 0x%lx %s\n", - cb_data->count, (unsigned long)pc, function); + len = snprintf(buf, sizeof(buf), "#%d 0x%lx %s\n", cb_data->count, (unsigned long)pc, function); } /* Mark that we found a real function name */ cb_data->found_symbols = 1; } else { - len = snprintf(buf, sizeof(buf), "#%d 0x%lx \n", - cb_data->count, (unsigned long)pc); + len = snprintf(buf, sizeof(buf), "#%d 0x%lx \n", cb_data->count, (unsigned long)pc); } if (len > 0 && write(cb_data->fd, buf, len) == -1) { /* Avoid warning. */ @@ -1769,13 +1942,11 @@ static void symbolizeWithLibbacktrace(void **trace, int trace_size, int fd, int if (pid == 0) { /* Child process - safe to use libbacktrace here */ - struct backtrace_state *state = backtrace_create_state( - NULL, 0, libbacktrace_error_cb, &fd); + struct backtrace_state *state = backtrace_create_state(NULL, 0, libbacktrace_error_cb, &fd); if (state) { backtrace_callback_data cb_data = {.fd = fd, .count = 0, .found_symbols = 0}; for (int i = uplevel; i < trace_size; i++) { - backtrace_pcinfo(state, (uintptr_t)trace[i], libbacktrace_full_cb, - libbacktrace_error_cb, &cb_data); + backtrace_pcinfo(state, (uintptr_t)trace[i], libbacktrace_full_cb, libbacktrace_error_cb, &cb_data); } /* If libbacktrace produced no frames or no useful function names, fall back to standard backtrace */ if (cb_data.count == 0 || !cb_data.found_symbols) { @@ -1873,7 +2044,10 @@ __attribute__((noinline)) static void writeStacktraces(int fd, int uplevel) { stacktrace_data curr_stacktrace_data = {{0}}; while (read(stacktrace_pipe[0], &curr_stacktrace_data, sizeof(curr_stacktrace_data)) > 0) { /* stacktrace header includes the tid and the thread's name */ - snprintf_async_signal_safe(buff, sizeof(buff), "\n%d %s", curr_stacktrace_data.tid, + snprintf_async_signal_safe(buff, + sizeof(buff), + "\n%d %s", + curr_stacktrace_data.tid, curr_stacktrace_data.thread_name); if (write(fd, buff, strlen(buff)) == -1) { /* Avoid warning. */ }; @@ -1897,14 +2071,18 @@ __attribute__((noinline)) static void writeStacktraces(int fd, int uplevel) { #ifdef USE_LIBBACKTRACE symbolizeWithLibbacktrace(curr_stacktrace_data.trace, curr_stacktrace_data.trace_size, fd, curr_uplevel); #else - backtrace_symbols_fd(curr_stacktrace_data.trace + curr_uplevel, curr_stacktrace_data.trace_size - curr_uplevel, + backtrace_symbols_fd(curr_stacktrace_data.trace + curr_uplevel, + curr_stacktrace_data.trace_size - curr_uplevel, fd); #endif ++collected; } - snprintf_async_signal_safe(buff, sizeof(buff), "\n%lu/%lu expected stacktraces.\n", (long unsigned)(collected), + snprintf_async_signal_safe(buff, + sizeof(buff), + "\n%lu/%lu expected stacktraces.\n", + (long unsigned)(collected), (long unsigned)len_tids); if (write(fd, buff, strlen(buff)) == -1) { /* Avoid warning. */ }; @@ -2115,8 +2293,11 @@ int memtest_test_linux_anonymous_maps(void) { start_vect[regions] = start_addr; size_vect[regions] = size; - snprintf(logbuf, sizeof(logbuf), "*** Preparing to test memory region %lx (%lu bytes)\n", - (unsigned long)start_vect[regions], (unsigned long)size_vect[regions]); + snprintf(logbuf, + sizeof(logbuf), + "*** Preparing to test memory region %lx (%lu bytes)\n", + (unsigned long)start_vect[regions], + (unsigned long)size_vect[regions]); if (write(fd, logbuf, strlen(logbuf)) == -1) { /* Nothing to do. */ } regions++; @@ -2172,8 +2353,9 @@ void doFastMemoryTest(void) { if (memtest_test_linux_anonymous_maps()) { serverLogRaw(LL_WARNING | LL_RAW, "!!! MEMORY ERROR DETECTED! Check your memory ASAP !!!\n"); } else { - serverLogRaw(LL_WARNING | LL_RAW, "Fast memory test PASSED, however your memory can still be broken. " - "Please run a memory test for several hours if possible.\n"); + serverLogRaw(LL_WARNING | LL_RAW, + "Fast memory test PASSED, however your memory can still be broken. " + "Please run a memory test for several hours if possible.\n"); } } #endif /* HAVE_PROC_MAPS */ @@ -2217,7 +2399,11 @@ void dumpCodeAroundEIP(void *eip) { "$ xxd -r -p /tmp/dump.hex /tmp/dump.bin\n" "$ objdump --adjust-vma=%p -D -b binary -m i386:x86-64 /tmp/dump.bin\n" "------\n", - info.dli_sname, info.dli_saddr, info.dli_fname, info.dli_fbase, info.dli_saddr); + info.dli_sname, + info.dli_saddr, + info.dli_fname, + info.dli_fbase, + info.dli_saddr); size_t len = (long)eip - (long)info.dli_saddr; unsigned long sz = sysconf(_SC_PAGESIZE); if (len < 1 << 13) { /* we don't have functions over 8k (verified) */ @@ -2555,8 +2741,11 @@ static int is_thread_ready_to_signal(const char *proc_pid_task_path, const char /* if we reached EOF, it means we haven't found SigBlk or/and SigIgn, something is wrong */ if (line == NULL) { ret = 0; - serverLogFromHandler(LL_WARNING, "tid:%s: failed to find SigBlk or/and SigIgn field(s) in %s/%s/status file", - tid, proc_pid_task_path, tid); + serverLogFromHandler(LL_WARNING, + "tid:%s: failed to find SigBlk or/and SigIgn field(s) in %s/%s/status file", + tid, + proc_pid_task_path, + tid); } return ret; } diff --git a/src/defrag.c b/src/defrag.c index 670f83bee73..5bd55771145 100644 --- a/src/defrag.c +++ b/src/defrag.c @@ -48,8 +48,10 @@ #ifdef HAVE_DEFRAG -typedef enum { DEFRAG_NOT_DONE = 0, - DEFRAG_DONE = 1 } doneStatus; +typedef enum { + DEFRAG_NOT_DONE = 0, + DEFRAG_DONE = 1 +} doneStatus; /* * Defragmentation is performed in stages. Each stage is serviced by a stage function @@ -277,9 +279,7 @@ static void activeDefragZsetNode(void *privdata, void *entry_ref) { * when scores are equal, we MUST compare elements lexicographically to maintain correct skip list ordering. * Otherwise we might miss locating the entry. */ zskiplistNode *next = x->level[i].forward; - while (next && - (next->score < score || - (next->score == score && sdscmp(zslGetNodeElement(next), ele) < 0))) { + while (next && (next->score < score || (next->score == score && sdscmp(zslGetNodeElement(next), ele) < 0))) { x = next; next = x->level[i].forward; } @@ -341,8 +341,12 @@ static void activeDefragSdsDict(dict *d, int val_type) { : val_type == DEFRAG_SDS_DICT_VAL_LUA_SCRIPT ? (dictDefragAllocFunction *)evalActiveDefragScript : NULL)}; do { - cursor = hashtableScanDefrag(d, cursor, activeDefragDictCallback, - &defragfns, activeDefragAlloc, HASHTABLE_SCAN_EMIT_REF); + cursor = hashtableScanDefrag(d, + cursor, + activeDefragDictCallback, + &defragfns, + activeDefragAlloc, + HASHTABLE_SCAN_EMIT_REF); } while (cursor != 0); } @@ -441,7 +445,12 @@ static void scanLaterZsetCallback(void *privdata, void *element_ref) { static void scanLaterZset(robj *ob, unsigned long *cursor) { serverAssert(ob->type == OBJ_ZSET && ob->encoding == OBJ_ENCODING_SKIPLIST); zset *zs = (zset *)objectGetVal(ob); - *cursor = hashtableScanDefrag(zs->ht, *cursor, scanLaterZsetCallback, zs->zsl, activeDefragAlloc, HASHTABLE_SCAN_EMIT_REF); + *cursor = hashtableScanDefrag(zs->ht, + *cursor, + scanLaterZsetCallback, + zs->zsl, + activeDefragAlloc, + HASHTABLE_SCAN_EMIT_REF); } /* Used as hashtable scan callback when all we need is to defrag the hashtable @@ -455,7 +464,12 @@ static void scanHashtableCallbackCountScanned(void *privdata, void *elemref) { static void scanLaterSet(robj *ob, unsigned long *cursor) { serverAssert(ob->type == OBJ_SET && ob->encoding == OBJ_ENCODING_HASHTABLE); hashtable *ht = objectGetVal(ob); - *cursor = hashtableScanDefrag(ht, *cursor, activeDefragSdsHashtableCallback, NULL, activeDefragAlloc, HASHTABLE_SCAN_EMIT_REF); + *cursor = hashtableScanDefrag(ht, + *cursor, + activeDefragSdsHashtableCallback, + NULL, + activeDefragAlloc, + HASHTABLE_SCAN_EMIT_REF); } static void scanLaterHash(robj *ob, unsigned long *cursor) { @@ -496,7 +510,12 @@ static void defragZsetSkiplist(robj *ob) { else { unsigned long cursor = 0; do { - cursor = hashtableScanDefrag(zs->ht, cursor, activeDefragZsetNode, zs->zsl, activeDefragAlloc, HASHTABLE_SCAN_EMIT_REF); + cursor = hashtableScanDefrag(zs->ht, + cursor, + activeDefragZsetNode, + zs->zsl, + activeDefragAlloc, + HASHTABLE_SCAN_EMIT_REF); } while (cursor != 0); } } @@ -529,7 +548,12 @@ static void defragSet(robj *ob) { } else { unsigned long cursor = 0; do { - cursor = hashtableScanDefrag(ht, cursor, activeDefragSdsHashtableCallback, NULL, activeDefragAlloc, HASHTABLE_SCAN_EMIT_REF); + cursor = hashtableScanDefrag(ht, + cursor, + activeDefragSdsHashtableCallback, + NULL, + activeDefragAlloc, + HASHTABLE_SCAN_EMIT_REF); } while (cursor != 0); } /* defrag the hashtable struct and tables */ @@ -805,8 +829,7 @@ static void defragPubsubScanCallback(void *privdata, void *elemref) { } /* Try to defrag the dictionary of clients that is stored as the value part. */ - if ((newclients = hashtableDefragTables(clients, activeDefragAlloc))) - *clients_ref = newclients; + if ((newclients = hashtableDefragTables(clients, activeDefragAlloc))) *clients_ref = newclients; server.stat_active_defrag_scanned++; } @@ -873,8 +896,8 @@ static doneStatus defragLaterStep(monotime endtime, void *privdata) { listDelNode(defrag_later, head); } - if (++iterations > 16 || server.stat_active_defrag_hits > prev_defragged || - server.stat_active_defrag_scanned - prev_scanned > 64) { + if (++iterations > 16 || server.stat_active_defrag_hits > prev_defragged + || server.stat_active_defrag_scanned - prev_scanned > 64) { if (getMonotonicUs() > endtime) break; iterations = 0; prev_defragged = server.stat_active_defrag_hits; @@ -921,7 +944,8 @@ static doneStatus defragStageKvstoreHelper(monotime endtime, } while (true) { - if (++iterations > 16 || server.stat_active_defrag_hits > prev_defragged || server.stat_active_defrag_scanned - prev_scanned > 64) { + if (++iterations > 16 || server.stat_active_defrag_hits > prev_defragged + || server.stat_active_defrag_scanned - prev_scanned > 64) { if (getMonotonicUs() >= endtime) break; iterations = 0; prev_defragged = server.stat_active_defrag_hits; @@ -946,8 +970,12 @@ static doneStatus defragStageKvstoreHelper(monotime endtime, // Whatever privdata's actual type, this function requires that it begins with kvstoreIterState. if (privdata) *(kvstoreIterState *)privdata = state; - state.cursor = kvstoreHashtableScanDefrag(kvs, state.slot, state.cursor, - scan_fn, privdata, activeDefragAlloc, + state.cursor = kvstoreHashtableScanDefrag(kvs, + state.slot, + state.cursor, + scan_fn, + privdata, + activeDefragAlloc, HASHTABLE_SCAN_EMIT_REF); } @@ -968,8 +996,7 @@ static doneStatus defragStageDbKeys(monotime endtime, void *target, void *privda } serverAssert(ctx.dbid == dbid); - return defragStageKvstoreHelper(endtime, db->keys, - dbKeysScanCallback, defragLaterStep, &ctx); + return defragStageKvstoreHelper(endtime, db->keys, dbKeysScanCallback, defragLaterStep, &ctx); } @@ -978,8 +1005,7 @@ static doneStatus defragStageExpiresKvstore(monotime endtime, void *target, void UNUSED(privdata); int dbid = (uintptr_t)target; serverDb *db = server.db[dbid]; - return defragStageKvstoreHelper(endtime, db->expires, - scanHashtableCallbackCountScanned, NULL, NULL); + return defragStageKvstoreHelper(endtime, db->expires, scanHashtableCallbackCountScanned, NULL, NULL); } // Target is a DBID @@ -987,8 +1013,11 @@ static doneStatus defragStageKeysWithvolaItemsKvstore(monotime endtime, void *ta UNUSED(privdata); int dbid = (uintptr_t)target; serverDb *db = server.db[dbid]; - return defragStageKvstoreHelper(endtime, db->keys_with_volatile_items, - scanHashtableCallbackCountScanned, NULL, NULL); + return defragStageKvstoreHelper(endtime, + db->keys_with_volatile_items, + scanHashtableCallbackCountScanned, + NULL, + NULL); } @@ -997,8 +1026,7 @@ static doneStatus defragStagePubsubKvstore(monotime endtime, void *target, void getClientChannelsFnWrapper *fnWrapper = privdata; defragPubSubCtx ctx; ctx.getPubSubChannels = fnWrapper->fn; - return defragStageKvstoreHelper(endtime, (kvstore *)target, - defragPubsubScanCallback, NULL, &ctx); + return defragStageKvstoreHelper(endtime, (kvstore *)target, defragPubsubScanCallback, NULL, &ctx); } @@ -1068,9 +1096,12 @@ static void endDefragCycle(bool normal_termination) { size_t frag_bytes; float frag_pct = getAllocatorFragmentation(&frag_bytes); - serverLog(LL_VERBOSE, "Active defrag done in %dms, reallocated=%d, frag=%.0f%%, frag_bytes=%zu", - (int)elapsedMs(defrag.start_cycle), (int)(server.stat_active_defrag_hits - defrag.start_defrag_hits), - frag_pct, frag_bytes); + serverLog(LL_VERBOSE, + "Active defrag done in %dms, reallocated=%d, frag=%.0f%%, frag_bytes=%zu", + (int)elapsedMs(defrag.start_cycle), + (int)(server.stat_active_defrag_hits - defrag.start_defrag_hits), + frag_pct, + frag_bytes); server.stat_total_active_defrag_time += elapsedUs(server.stat_last_active_defrag_time); server.stat_last_active_defrag_time = 0; @@ -1197,11 +1228,15 @@ static long long activeDefragTimeProc(struct aeEventLoop *eventLoop, long long i defrag.current_stage = listNodeValue(listFirst(defrag.remaining_stages)); listDelNode(defrag.remaining_stages, listFirst(defrag.remaining_stages)); // Initialize the stage with endtime==0 - doneStatus status = defrag.current_stage->stage_fn(0, defrag.current_stage->target, defrag.current_stage->privdata); + doneStatus status = defrag.current_stage->stage_fn(0, + defrag.current_stage->target, + defrag.current_stage->privdata); serverAssert(status == DEFRAG_NOT_DONE); // Initialization should always return DEFRAG_NOT_DONE } - doneStatus status = defrag.current_stage->stage_fn(endtime, defrag.current_stage->target, defrag.current_stage->privdata); + doneStatus status = defrag.current_stage->stage_fn(endtime, + defrag.current_stage->target, + defrag.current_stage->privdata); if (status == DEFRAG_DONE) { zfree(defrag.current_stage); defrag.current_stage = NULL; @@ -1292,14 +1327,16 @@ static void updateDefragCpuPercent(void) { size_t frag_bytes; float frag_pct = getAllocatorFragmentation(&frag_bytes); if (server.active_defrag_cpu_percent == 0) { - if (frag_pct < server.active_defrag_threshold_lower || - frag_bytes < server.active_defrag_ignore_bytes) return; + if (frag_pct < server.active_defrag_threshold_lower || frag_bytes < server.active_defrag_ignore_bytes) return; } /* Calculate the adaptive aggressiveness of the defrag based on the current * fragmentation and configurations. */ - int cpu_pct = INTERPOLATE(frag_pct, server.active_defrag_threshold_lower, server.active_defrag_threshold_upper, - server.active_defrag_cpu_min, server.active_defrag_cpu_max); + int cpu_pct = INTERPOLATE(frag_pct, + server.active_defrag_threshold_lower, + server.active_defrag_threshold_upper, + server.active_defrag_cpu_min, + server.active_defrag_cpu_max); cpu_pct = LIMIT(cpu_pct, server.active_defrag_cpu_min, server.active_defrag_cpu_max); /* Normally we allow increasing the aggressiveness during a scan, but don't @@ -1308,11 +1345,17 @@ static void updateDefragCpuPercent(void) { if (cpu_pct > server.active_defrag_cpu_percent || server.active_defrag_configuration_changed) { server.active_defrag_configuration_changed = 0; if (defragIsRunning()) { - serverLog(LL_VERBOSE, "Changing active defrag CPU, frag=%.0f%%, frag_bytes=%zu, cpu=%d%%", - frag_pct, frag_bytes, cpu_pct); + serverLog(LL_VERBOSE, + "Changing active defrag CPU, frag=%.0f%%, frag_bytes=%zu, cpu=%d%%", + frag_pct, + frag_bytes, + cpu_pct); } else { - serverLog(LL_VERBOSE, "Starting active defrag, frag=%.0f%%, frag_bytes=%zu, cpu=%d%%", - frag_pct, frag_bytes, cpu_pct); + serverLog(LL_VERBOSE, + "Starting active defrag, frag=%.0f%%, frag_bytes=%zu, cpu=%d%%", + frag_pct, + frag_bytes, + cpu_pct); } server.active_defrag_cpu_percent = cpu_pct; } diff --git a/src/endianconv.h b/src/endianconv.h index 4479f447b3f..2ffbbef5d3e 100644 --- a/src/endianconv.h +++ b/src/endianconv.h @@ -20,26 +20,18 @@ */ static inline uint16_t bswap16(uint16_t x) { - return ((x & 0xFF00U) >> 8) | - ((x & 0x00FFU) << 8); + return ((x & 0xFF00U) >> 8) | ((x & 0x00FFU) << 8); } static inline uint32_t bswap32(uint32_t x) { - return ((x & 0xFF000000U) >> 24) | - ((x & 0x00FF0000U) >> 8) | - ((x & 0x0000FF00U) << 8) | - ((x & 0x000000FFU) << 24); + return ((x & 0xFF000000U) >> 24) | ((x & 0x00FF0000U) >> 8) | ((x & 0x0000FF00U) << 8) | ((x & 0x000000FFU) << 24); } static inline uint64_t bswap64(uint64_t x) { - return ((x & 0xFF00000000000000ULL) >> 56) | - ((x & 0x00FF000000000000ULL) >> 40) | - ((x & 0x0000FF0000000000ULL) >> 24) | - ((x & 0x000000FF00000000ULL) >> 8) | - ((x & 0x00000000FF000000ULL) << 8) | - ((x & 0x0000000000FF0000ULL) << 24) | - ((x & 0x000000000000FF00ULL) << 40) | - ((x & 0x00000000000000FFULL) << 56); + return ((x & 0xFF00000000000000ULL) >> 56) | ((x & 0x00FF000000000000ULL) >> 40) + | ((x & 0x0000FF0000000000ULL) >> 24) | ((x & 0x000000FF00000000ULL) >> 8) + | ((x & 0x00000000FF000000ULL) << 8) | ((x & 0x0000000000FF0000ULL) << 24) + | ((x & 0x000000000000FF00ULL) << 40) | ((x & 0x00000000000000FFULL) << 56); } static inline void memrev16(void *p) { diff --git a/src/entry.c b/src/entry.c index d28996722c4..f96105cf3f5 100644 --- a/src/entry.c +++ b/src/entry.c @@ -309,7 +309,9 @@ static entry *entryConstruct(size_t alloc_size, size_t expiry_size, size_t embedded_value_sds_size, size_t embedded_field_sds_size) { - serverAssert((sds_value == NULL && stringref_value == NULL && embed_value) || (sds_value != NULL && stringref_value == NULL) || (sds_value == NULL && stringref_value != NULL && !embed_value)); + serverAssert((sds_value == NULL && stringref_value == NULL && embed_value) + || (sds_value != NULL && stringref_value == NULL) + || (sds_value == NULL && stringref_value != NULL && !embed_value)); size_t buf_size; /* allocate the buffer */ char *buf = zmalloc_usable(alloc_size, &buf_size); @@ -328,7 +330,11 @@ static entry *entryConstruct(size_t alloc_size, buf_size -= sizeof(void *); } else if (sds_value) { /* The value is embedded, the value data is written after the field data. */ - sdswrite(buf + embedded_field_sds_size, buf_size - embedded_field_sds_size, SDS_TYPE_8, sds_value, sdslen(sds_value)); + sdswrite(buf + embedded_field_sds_size, + buf_size - embedded_field_sds_size, + SDS_TYPE_8, + sds_value, + sdslen(sds_value)); sdsfree(sds_value); buf_size -= embedded_value_sds_size; } @@ -341,8 +347,10 @@ static entry *entryConstruct(size_t alloc_size, sdsSetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_EXPIRY, expiry_size > 0 ? 1 : 0); /* Check that the new entry was built correctly */ - debugServerAssert(sdsGetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_VALUE_PTR) == (embed_value ? 0 : 1)); - debugServerAssert(sdsGetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_EXPIRY) == (expiry_size > 0 ? 1 : 0)); + debugServerAssert(sdsGetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_VALUE_PTR) + == (embed_value ? 0 : 1)); + debugServerAssert(sdsGetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_EXPIRY) + == (expiry_size > 0 ? 1 : 0)); return new_entry; } @@ -352,8 +360,24 @@ entry *entryCreate(const_sds field, sds value, mstime_t expiry) { int embedded_field_sds_type; size_t expiry_size, embedded_value_sds_size, embedded_field_sds_size; size_t value_len = value ? sdslen(value) : SIZE_MAX; - size_t alloc_size = entryReqSize(sdslen(field), value_len, expiry, &embed_value, &embedded_field_sds_type, &embedded_field_sds_size, &expiry_size, &embedded_value_sds_size); - return entryConstruct(alloc_size, field, value, NULL, expiry, embed_value, embedded_field_sds_type, expiry_size, embedded_value_sds_size, embedded_field_sds_size); + size_t alloc_size = entryReqSize(sdslen(field), + value_len, + expiry, + &embed_value, + &embedded_field_sds_type, + &embedded_field_sds_size, + &expiry_size, + &embedded_value_sds_size); + return entryConstruct(alloc_size, + field, + value, + NULL, + expiry, + embed_value, + embedded_field_sds_type, + expiry_size, + embedded_value_sds_size, + embedded_field_sds_size); } /* Sets the entry's value to a string reference object. @@ -391,7 +415,16 @@ entry *entryUpdateAsStringRef(entry *e, const char *buf, size_t len, mstime_t ex size_t expiry_size = 0; if (expiry != EXPIRY_NONE) expiry_size = sizeof(expiry); - entry *new_entry = entryConstruct(alloc_size, field, NULL, value, expiry, false, SDS_TYPE_8, expiry_size, sizeof(value), field_size); + entry *new_entry = entryConstruct(alloc_size, + field, + NULL, + value, + expiry, + false, + SDS_TYPE_8, + expiry_size, + sizeof(value), + field_size); entryFree(e); sdsSetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_STRING_REF, 1); @@ -425,22 +458,31 @@ entry *entryUpdate(entry *e, sds value, mstime_t expiry) { bool embed_value = false; int embedded_field_sds_type; size_t expiry_size, embedded_value_size, embedded_field_size; - size_t required_entry_size = entryReqSize(sdslen(field), value_len, expiry, &embed_value, &embedded_field_sds_type, &embedded_field_size, &expiry_size, &embedded_value_size); + size_t required_entry_size = entryReqSize(sdslen(field), + value_len, + expiry, + &embed_value, + &embedded_field_sds_type, + &embedded_field_size, + &expiry_size, + &embedded_value_size); size_t current_embedded_allocation_size = entryHasEmbeddedValue(e) ? entryMemUsage(e) : 0; - bool expiry_add_remove = update_expiry && (curr_expiration_time == EXPIRY_NONE || expiry == EXPIRY_NONE); // In case we are toggling expiration - bool value_change_encoding = update_value && (embed_value != entryHasEmbeddedValue(e)); // In case we change the way value is embedded or not + // In case we are toggling expiration + bool expiry_add_remove = update_expiry && (curr_expiration_time == EXPIRY_NONE || expiry == EXPIRY_NONE); + // In case we change the way value is embedded or not + bool value_change_encoding = update_value && (embed_value != entryHasEmbeddedValue(e)); /* We will create a new entry in the following cases: * 1. In the case were we add or remove expiration. * 2. We change the way value is encoded * 3. in the case were we are NOT migrating from an embedded entry to an embedded entry with ~the same size. */ - bool create_new_entry = (expiry_add_remove) || (value_change_encoding) || - (update_value && entryHasEmbeddedValue(e) && - !(required_entry_size <= EMBED_VALUE_MAX_ALLOC_SIZE && - required_entry_size <= current_embedded_allocation_size && - required_entry_size >= current_embedded_allocation_size * 3 / 4)); + bool create_new_entry = (expiry_add_remove) || (value_change_encoding) + || (update_value && entryHasEmbeddedValue(e) + && !(required_entry_size <= EMBED_VALUE_MAX_ALLOC_SIZE + && required_entry_size <= current_embedded_allocation_size + && required_entry_size >= current_embedded_allocation_size * 3 / 4)); if (!create_new_entry) { /* In this case we are sure we do not have to allocate new entry, so expiry must already be set. */ @@ -480,12 +522,23 @@ entry *entryUpdate(entry *e, sds value, mstime_t expiry) { } } /* allocate the buffer for a new entry */ - new_entry = entryConstruct(required_entry_size, field, value, NULL, expiry, embed_value, embedded_field_sds_type, expiry_size, embedded_value_size, embedded_field_size); + new_entry = entryConstruct(required_entry_size, + field, + value, + NULL, + expiry, + embed_value, + embedded_field_sds_type, + expiry_size, + embedded_value_size, + embedded_field_size); entryFree(e); } /* Check that the new entry was built correctly */ - debugServerAssert(sdsGetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_VALUE_PTR) == (embed_value ? 0 : 1)); - debugServerAssert(sdsGetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_EXPIRY) == (expiry_size > 0 ? 1 : 0)); + debugServerAssert(sdsGetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_VALUE_PTR) + == (embed_value ? 0 : 1)); + debugServerAssert(sdsGetAuxBit(entryGetField(new_entry), FIELD_SDS_AUX_BIT_ENTRY_HAS_EXPIRY) + == (expiry_size > 0 ? 1 : 0)); serverAssert(new_entry); return new_entry; } diff --git a/src/eval.c b/src/eval.c index 8e2839ae8a3..416e683c7d2 100644 --- a/src/eval.c +++ b/src/eval.c @@ -234,11 +234,7 @@ static void evalCalcScriptHash(int evalsha, sds script, char *out_sha) { * The err arg is optional, can be used to get a detailed error string. * The out_shebang_len arg is optional, can be used to trim the shebang from the script. * Returns C_OK on success, and C_ERR on error. */ -int evalExtractShebangFlags(sds body, - char **out_engine, - uint64_t *out_flags, - ssize_t *out_shebang_len, - sds *err) { +int evalExtractShebangFlags(sds body, char **out_engine, uint64_t *out_flags, ssize_t *out_shebang_len, sds *err) { serverAssert(out_flags != NULL); ssize_t shebang_len = 0; @@ -316,7 +312,8 @@ uint64_t evalGetCommandFlags(client *c, uint64_t cmd_flags) { c->cur_script = dictFind(evalCtx.scripts, sha); if (!c->cur_script) { if (evalsha) return cmd_flags; - if (evalExtractShebangFlags(objectGetVal(c->argv[1]), NULL, &script_flags, NULL, NULL) == C_ERR) return cmd_flags; + if (evalExtractShebangFlags(objectGetVal(c->argv[1]), NULL, &script_flags, NULL, NULL) == C_ERR) + return cmd_flags; } else { evalScript *es = dictGetVal(c->cur_script); script_flags = es->flags; @@ -426,14 +423,13 @@ static int evalRegisterNewScript(client *c, robj *body, char **sha) { robj *_err = NULL; size_t num_compiled_functions = 0; - compiledFunction **functions = - scriptingEngineCallCompileCode(engine, - VMSE_EVAL, - (sds)objectGetVal(body) + shebang_len, - sdslen(objectGetVal(body)) - shebang_len, - 0, - &num_compiled_functions, - &_err); + compiledFunction **functions = scriptingEngineCallCompileCode(engine, + VMSE_EVAL, + (sds)objectGetVal(body) + shebang_len, + sdslen(objectGetVal(body)) - shebang_len, + 0, + &num_compiled_functions, + &_err); if (functions == NULL) { serverAssert(_err != NULL); if (c != NULL) { @@ -702,10 +698,8 @@ dict *evalScriptsDict(void) { } unsigned long evalScriptsMemory(void) { - return evalCtx.scripts_mem + - dictMemUsage(evalCtx.scripts) + - dictSize(evalCtx.scripts) * sizeof(evalScript) + - listLength(evalCtx.scripts_lru_list) * sizeof(listNode); + return evalCtx.scripts_mem + dictMemUsage(evalCtx.scripts) + dictSize(evalCtx.scripts) * sizeof(evalScript) + + listLength(evalCtx.scripts_lru_list) * sizeof(listNode); } /* Wrapper for EVAL / EVALSHA that enables debugging, and makes sure diff --git a/src/evict.c b/src/evict.c index ce602b25679..f5d92e9a3ad 100644 --- a/src/evict.c +++ b/src/evict.c @@ -219,8 +219,8 @@ size_t freeMemoryGetNotCountedMemory(void) { /* We use list structure to manage replication buffer blocks, so backlog * also occupies some extra memory, we can't know exact blocks numbers, * we only get approximate size according to per block size. */ - size_t extra_approx_size = - (server.repl_backlog_size / PROTO_REPLY_CHUNK_BYTES + 1) * (sizeof(replBufBlock) + sizeof(listNode)); + size_t extra_approx_size = (server.repl_backlog_size / PROTO_REPLY_CHUNK_BYTES + 1) + * (sizeof(replBufBlock) + sizeof(listNode)); size_t counted_mem = server.repl_backlog_size + extra_approx_size; if (server.repl_buffer_mem > counted_mem) { overhead += (server.repl_buffer_mem - counted_mem); @@ -444,8 +444,8 @@ int performEvictions(void) { serverDb *db; robj *valkey; - if (server.maxmemory_policy & (MAXMEMORY_FLAG_LRU | MAXMEMORY_FLAG_LFU) || - server.maxmemory_policy == MAXMEMORY_VOLATILE_TTL) { + if (server.maxmemory_policy & (MAXMEMORY_FLAG_LRU | MAXMEMORY_FLAG_LFU) + || server.maxmemory_policy == MAXMEMORY_VOLATILE_TTL) { struct evictionPoolEntry *pool = EvictionPoolLRU; while (bestkey == NULL) { unsigned long total_keys = 0; @@ -516,8 +516,8 @@ int performEvictions(void) { } /* volatile-random and allkeys-random policy */ - else if (server.maxmemory_policy == MAXMEMORY_ALLKEYS_RANDOM || - server.maxmemory_policy == MAXMEMORY_VOLATILE_RANDOM) { + else if (server.maxmemory_policy == MAXMEMORY_ALLKEYS_RANDOM + || server.maxmemory_policy == MAXMEMORY_VOLATILE_RANDOM) { /* When evicting a random key, we try to evict a key for * each DB, so we use the static 'next_db' variable to * incrementally visit all DBs. */ diff --git a/src/expire.c b/src/expire.c index 7a070a75884..d62e0e1322b 100644 --- a/src/expire.c +++ b/src/expire.c @@ -50,8 +50,22 @@ /* Constants table from pow(0.98, 1) to pow(0.98, 16). * Help calculating the db->avg_ttl. */ -static double avg_ttl_factor[16] = {0.98, 0.9604, 0.941192, 0.922368, 0.903921, 0.885842, 0.868126, 0.850763, - 0.833748, 0.817073, 0.800731, 0.784717, 0.769022, 0.753642, 0.738569, 0.723798}; +static double avg_ttl_factor[16] = {0.98, + 0.9604, + 0.941192, + 0.922368, + 0.903921, + 0.885842, + 0.868126, + 0.850763, + 0.833748, + 0.817073, + 0.800731, + 0.784717, + 0.769022, + 0.753642, + 0.738569, + 0.723798}; /* Helper function for the activeExpireCycle() function. * This function will try to expire the key-value entry 'val'. @@ -200,8 +214,8 @@ static ustime_t activeExpireCycleJob(enum activeExpiryType jobType, int cycleTyp if (timelimit_us <= 0) return 0; unsigned long config_cycle_acceptable_stale = ACTIVE_EXPIRE_CYCLE_ACCEPTABLE_STALE - activeExpireEffort(); - unsigned long keys_per_loop = - ACTIVE_EXPIRE_CYCLE_KEYS_PER_LOOP + ACTIVE_EXPIRE_CYCLE_KEYS_PER_LOOP / 4 * activeExpireEffort(); + unsigned long keys_per_loop = ACTIVE_EXPIRE_CYCLE_KEYS_PER_LOOP + + ACTIVE_EXPIRE_CYCLE_KEYS_PER_LOOP / 4 * activeExpireEffort(); /* This function has some global state in order to continue the work * incrementally across calls. */ @@ -288,8 +302,7 @@ static ustime_t activeExpireCycleJob(enum activeExpiryType jobType, int cycleTyp * So we just perform more clock checks after each iteration. */ time_check_mask = 0x0; break; - default: - serverPanic("Unknown active expiry job type %d.", jobType); + default: serverPanic("Unknown active expiry job type %d.", jobType); } } @@ -338,8 +351,7 @@ static ustime_t activeExpireCycleJob(enum activeExpiryType jobType, int cycleTyp while (data.sampled < num && checked_buckets < max_buckets) { unsigned long cursor = db->expiry[jobType].cursor; - cursor = kvstoreScan(kvs, cursor, -1, -1, scan_cb, - expireShouldSkipTableForSamplingCb, &data); + cursor = kvstoreScan(kvs, cursor, -1, -1, scan_cb, expireShouldSkipTableForSamplingCb, &data); if (!data.has_more_expired_entries) db->expiry[jobType].cursor = cursor; if (db->expiry[jobType].cursor == 0 && !data.has_more_expired_entries) { db_done = 1; @@ -363,8 +375,8 @@ static ustime_t activeExpireCycleJob(enum activeExpiryType jobType, int cycleTyp /* We can't block forever here even if there are many keys to * expire. So after a given amount of microseconds return to the * caller waiting for the other active expire cycle. */ - if ((iteration & 0xf) == 0 || - !repeat) { /* Update the average TTL stats every 16 iterations or about to exit. */ + if ((iteration & 0xf) == 0 + || !repeat) { /* Update the average TTL stats every 16 iterations or about to exit. */ /* Update the average TTL stats for this database, * because this may reach the time limit. */ if (data.ttl_samples && jobType == KEYS) { @@ -391,7 +403,9 @@ static ustime_t activeExpireCycleJob(enum activeExpiryType jobType, int cycleTyp * = avg_ttl + (db->avg_ttl - avg_ttl) * pow(0.98, update_avg_ttl_times) * Notice that update_avg_ttl_times is between 1 and 16, we use a constant table * to accelerate the calculation of pow(0.98, update_avg_ttl_times).*/ - db->expiry[jobType].avg_ttl = avg_ttl + (db->expiry[jobType].avg_ttl - avg_ttl) * avg_ttl_factor[update_avg_ttl_times - 1]; + db->expiry[jobType].avg_ttl = avg_ttl + + (db->expiry[jobType].avg_ttl - avg_ttl) + * avg_ttl_factor[update_avg_ttl_times - 1]; } update_avg_ttl_times = 0; data.ttl_sum = 0; @@ -467,7 +481,8 @@ ustime_t activeExpireCycle(int type) { * is 10. Also make sure not to run fast cycles back to back. */ ustime_t timelimit_us; if (type == ACTIVE_EXPIRE_CYCLE_FAST) { - ustime_t config_cycle_fast_duration = ACTIVE_EXPIRE_CYCLE_FAST_DURATION + ACTIVE_EXPIRE_CYCLE_FAST_DURATION / 4 * activeExpireEffort(); + ustime_t config_cycle_fast_duration = ACTIVE_EXPIRE_CYCLE_FAST_DURATION + + ACTIVE_EXPIRE_CYCLE_FAST_DURATION / 4 * activeExpireEffort(); /* Never repeat a fast cycle for the same period * as the fast cycle total duration itself. */ diff --git a/src/functions.c b/src/functions.c index f8b8bc39a23..d9d2ad6079c 100644 --- a/src/functions.c +++ b/src/functions.c @@ -122,8 +122,7 @@ dictType librariesDictType = { static functionsLibCtx *curr_functions_lib_ctx = NULL; static size_t functionMallocSize(functionInfo *fi) { - return zmalloc_size(fi) + - scriptingEngineCallGetFunctionMemoryOverhead(fi->li->engine, fi->compiled_function); + return zmalloc_size(fi) + scriptingEngineCallGetFunctionMemoryOverhead(fi->li->engine, fi->compiled_function); } static size_t libraryMallocSize(functionLibInfo *li) { @@ -244,8 +243,7 @@ functionsLibCtx *functionsLibCtxGetCurrent(void) { return curr_functions_lib_ctx; } -static void initializeFunctionsLibEngineStats(scriptingEngine *engine, - void *context) { +static void initializeFunctionsLibEngineStats(scriptingEngine *engine, void *context) { functionsLibCtx *lib_ctx = (functionsLibCtx *)context; functionsLibEngineStats *stats = zcalloc(sizeof(*stats)); dictAdd(lib_ctx->engines_stats, sdsdup(scriptingEngineGetName(engine)), stats); @@ -280,9 +278,7 @@ void functionsAddEngineStats(sds engine_name) { * the function will verify that the given name is following the naming format * and return an error if its not. */ -static int functionLibCreateFunction(compiledFunction *function, - functionLibInfo *li, - sds *err) { +static int functionLibCreateFunction(compiledFunction *function, functionLibInfo *li, sds *err) { serverAssert(function->name->type == OBJ_STRING); serverAssert(function->desc == NULL || function->desc->type == OBJ_STRING); @@ -327,8 +323,7 @@ static void libraryUnlink(functionsLibCtx *lib_ctx, functionLibInfo *li) { dictEntry *entry = NULL; while ((entry = dictNext(iter))) { functionInfo *fi = dictGetVal(entry); - int ret = dictDelete(lib_ctx->functions, - objectGetVal(fi->compiled_function->name)); + int ret = dictDelete(lib_ctx->functions, objectGetVal(fi->compiled_function->name)); serverAssert(ret == DICT_OK); lib_ctx->cache_memory -= functionMallocSize(fi); } @@ -339,8 +334,7 @@ static void libraryUnlink(functionsLibCtx *lib_ctx, functionLibInfo *li) { lib_ctx->cache_memory -= libraryMallocSize(li); /* update stats */ - functionsLibEngineStats *stats = dictFetchValue(lib_ctx->engines_stats, - scriptingEngineGetName(li->engine)); + functionsLibEngineStats *stats = dictFetchValue(lib_ctx->engines_stats, scriptingEngineGetName(li->engine)); serverAssert(stats); stats->n_lib--; stats->n_functions -= dictSize(li->functions); @@ -351,9 +345,7 @@ static void libraryLink(functionsLibCtx *lib_ctx, functionLibInfo *li) { dictEntry *entry = NULL; while ((entry = dictNext(iter))) { functionInfo *fi = dictGetVal(entry); - dictAdd(lib_ctx->functions, - sdsnew(objectGetVal(fi->compiled_function->name)), - fi); + dictAdd(lib_ctx->functions, sdsnew(objectGetVal(fi->compiled_function->name)), fi); lib_ctx->cache_memory += functionMallocSize(fi); } dictReleaseIterator(iter); @@ -374,8 +366,10 @@ static void libraryLink(functionsLibCtx *lib_ctx, functionLibInfo *li) { * Return C_OK on success and C_ERR if aborted. If C_ERR is returned, set a relevant * error message on the 'err' out parameter. * */ -static int -libraryJoin(functionsLibCtx *functions_lib_ctx_dst, functionsLibCtx *functions_lib_ctx_src, int replace, sds *err) { +static int libraryJoin(functionsLibCtx *functions_lib_ctx_dst, + functionsLibCtx *functions_lib_ctx_src, + int replace, + sds *err) { int ret = C_ERR; dictIterator *iter = NULL; /* Stores the libraries we need to replace in case a revert is required. @@ -408,11 +402,8 @@ libraryJoin(functionsLibCtx *functions_lib_ctx_dst, functionsLibCtx *functions_l iter = dictGetIterator(functions_lib_ctx_src->functions); while ((entry = dictNext(iter))) { functionInfo *fi = dictGetVal(entry); - if (dictFetchValue(functions_lib_ctx_dst->functions, - objectGetVal(fi->compiled_function->name))) { - *err = sdscatfmt(sdsempty(), - "Function %s already exists", - objectGetVal(fi->compiled_function->name)); + if (dictFetchValue(functions_lib_ctx_dst->functions, objectGetVal(fi->compiled_function->name))) { + *err = sdscatfmt(sdsempty(), "Function %s already exists", objectGetVal(fi->compiled_function->name)); goto done; } } @@ -456,8 +447,8 @@ static void replyEngineStats(scriptingEngine *engine, void *context) { client *c = (client *)context; addReplyBulkCString(c, scriptingEngineGetName(engine)); addReplyMapLen(c, 2); - functionsLibEngineStats *e_stats = - dictFetchValue(curr_functions_lib_ctx->engines_stats, scriptingEngineGetName(engine)); + functionsLibEngineStats *e_stats = dictFetchValue(curr_functions_lib_ctx->engines_stats, + scriptingEngineGetName(engine)); addReplyBulkCString(c, "libraries_count"); addReplyLongLong(c, e_stats ? e_stats->n_lib : 0); addReplyBulkCString(c, "functions_count"); @@ -686,7 +677,9 @@ static void fcallCommandGeneric(client *c, int ro) { c, objectGetVal(fi->compiled_function->name), fi->compiled_function->f_flags, - ro) != C_OK) return; + ro) + != C_OK) + return; scriptingEngineCallFunction(engine, &run_ctx, @@ -824,8 +817,8 @@ void functionRestoreCommand(client *c) { functionsLibCtxSwapWithCurrent(functions_lib_ctx, server.lazyfree_lazy_user_flush); functions_lib_ctx = NULL; /* avoid releasing the f_ctx in the end */ } else { - if (libraryJoin(curr_functions_lib_ctx, functions_lib_ctx, restore_replicy == restorePolicy_Replace, &err) != - C_OK) { + if (libraryJoin(curr_functions_lib_ctx, functions_lib_ctx, restore_replicy == restorePolicy_Replace, &err) + != C_OK) { goto load_error; } } @@ -901,7 +894,8 @@ void functionHelpCommand(client *c) { " * ASYNC: Asynchronously flush the libraries.", " * SYNC: Synchronously flush the libraries.", "DUMP", - " Return a serialized payload representing the current libraries, can be restored using FUNCTION RESTORE command", + " Return a serialized payload representing the current libraries, can be restored using FUNCTION RESTORE " + "command", "RESTORE [FLUSH|APPEND|REPLACE]", " Restore the libraries represented by the given payload, it is possible to give a restore policy to", " control how to handle existing libraries (default APPEND):", @@ -922,8 +916,8 @@ static int functionsVerifyName(sds name) { } for (size_t i = 0; i < sdslen(name); ++i) { char curr_char = name[i]; - if ((curr_char >= 'a' && curr_char <= 'z') || (curr_char >= 'A' && curr_char <= 'Z') || - (curr_char >= '0' && curr_char <= '9') || (curr_char == '_')) { + if ((curr_char >= 'a' && curr_char <= 'z') || (curr_char >= 'A' && curr_char <= 'Z') + || (curr_char >= '0' && curr_char <= '9') || (curr_char == '_')) { continue; } return C_ERR; @@ -1045,14 +1039,13 @@ sds functionsCreateWithLibraryCtx(sds code, int replace, sds *err, functionsLibC new_li = engineLibraryCreate(md.name, engine, code); size_t num_compiled_functions = 0; robj *compile_error = NULL; - compiledFunction **compiled_functions = - scriptingEngineCallCompileCode(engine, - VMSE_FUNCTION, - md.code, - sdslen(md.code), - timeout, - &num_compiled_functions, - &compile_error); + compiledFunction **compiled_functions = scriptingEngineCallCompileCode(engine, + VMSE_FUNCTION, + md.code, + sdslen(md.code), + timeout, + &num_compiled_functions, + &compile_error); if (compiled_functions == NULL) { serverAssert(num_compiled_functions == 0); serverAssert(compile_error != NULL); @@ -1066,10 +1059,7 @@ sds functionsCreateWithLibraryCtx(sds code, int replace, sds *err, functionsLibC for (size_t i = 0; i < num_compiled_functions; i++) { int ret = functionLibCreateFunction(compiled_functions[i], new_li, err); if (ret == C_ERR) { - freeCompiledFunctions(engine, - compiled_functions, - num_compiled_functions, - i); + freeCompiledFunctions(engine, compiled_functions, num_compiled_functions, i); goto error; } } @@ -1084,11 +1074,9 @@ sds functionsCreateWithLibraryCtx(sds code, int replace, sds *err, functionsLibC iter = dictGetIterator(new_li->functions); while ((entry = dictNext(iter))) { functionInfo *fi = dictGetVal(entry); - if (dictFetchValue(lib_ctx->functions, - objectGetVal(fi->compiled_function->name))) { + if (dictFetchValue(lib_ctx->functions, objectGetVal(fi->compiled_function->name))) { /* functions name collision, abort. */ - *err = sdscatfmt(sdsempty(), "Function %s already exists", - objectGetVal(fi->compiled_function->name)); + *err = sdscatfmt(sdsempty(), "Function %s already exists", objectGetVal(fi->compiled_function->name)); goto error; } } @@ -1145,7 +1133,8 @@ void functionLoadCommand(client *c) { if (mustObeyClient(c)) { timeout = 0; } - if (!(library_name = functionsCreateWithLibraryCtx(objectGetVal(code), replace, &err, curr_functions_lib_ctx, timeout))) { + if (!(library_name = + functionsCreateWithLibraryCtx(objectGetVal(code), replace, &err, curr_functions_lib_ctx, timeout))) { serverAssert(err != NULL); addReplyErrorSds(c, err); return; diff --git a/src/fuzzer_client.c b/src/fuzzer_client.c index 5e2a2adc853..16243843af7 100644 --- a/src/fuzzer_client.c +++ b/src/fuzzer_client.c @@ -111,8 +111,7 @@ static void logMessage(LogLevel level, const char *format, ...) { struct tm *tm = localtime(&now); /* Print timestamp prefix directly */ - fprintf(output, "[%02d:%02d:%02d] [%s] ", - tm->tm_hour, tm->tm_min, tm->tm_sec, level_strs[level]); + fprintf(output, "[%02d:%02d:%02d] [%s] ", tm->tm_hour, tm->tm_min, tm->tm_sec, level_strs[level]); /* Print the main message directly */ va_list args; @@ -178,8 +177,7 @@ static void printErrors(int tid, ErrorList *list) { logMessage(LOG_ERROR, "[Thread %d] Total errors: %d", tid, list->total_errors); if (list->total_errors > MAX_ERRORS) { - logMessage(LOG_ERROR, "[Thread %d] Showing last %lu errors:", - tid, listLength(list->errors)); + logMessage(LOG_ERROR, "[Thread %d] Showing last %lu errors:", tid, listLength(list->errors)); } listIter *iter = listGetIterator(list->errors, AL_START_HEAD); @@ -214,21 +212,11 @@ typedef enum { static void incrCounter(CounterType type) { switch (type) { - case COUNTER_COMMANDS_SENT: - atomic_fetch_add(&global_commands_sent, 1); - break; - case COUNTER_SUCCESS_REPLIES: - atomic_fetch_add(&global_success_replies, 1); - break; - case COUNTER_ERROR_REPLIES: - atomic_fetch_add(&global_err_replies, 1); - break; - case COUNTER_MALFORMED_REPLIES: - atomic_fetch_add(&global_malformed_replies, 1); - break; - case COUNTER_TOTAL_ERRORS: - atomic_fetch_add(&global_total_errors, 1); - break; + case COUNTER_COMMANDS_SENT: atomic_fetch_add(&global_commands_sent, 1); break; + case COUNTER_SUCCESS_REPLIES: atomic_fetch_add(&global_success_replies, 1); break; + case COUNTER_ERROR_REPLIES: atomic_fetch_add(&global_err_replies, 1); break; + case COUNTER_MALFORMED_REPLIES: atomic_fetch_add(&global_malformed_replies, 1); break; + case COUNTER_TOTAL_ERRORS: atomic_fetch_add(&global_total_errors, 1); break; } } @@ -252,7 +240,8 @@ static void *progressReporterThread(void *arg) { /* Report progress */ if (current_time - last_report_time >= 1) { printf("\rProgress: %d/%d commands (%.1f%%), %.1f rps", - current_commands, total_commands_num, + current_commands, + total_commands_num, total_commands_num > 0 ? (current_commands * 100.0) / total_commands_num : 0, commands_per_sec); fflush(stdout); @@ -312,9 +301,8 @@ static void cleanupErrorList(ErrorList *l) { } static int isServerDisconnected(valkeyContext *ctx) { - return (ctx->err == VALKEY_ERR_EOF || - (ctx->err == VALKEY_ERR_IO && - (errno == ECONNRESET || errno == EPIPE || errno == ENOTCONN))); + return (ctx->err == VALKEY_ERR_EOF + || (ctx->err == VALKEY_ERR_IO && (errno == ECONNRESET || errno == EPIPE || errno == ENOTCONN))); } /* Connect to a Valkey server with optional TLS support @@ -382,8 +370,12 @@ static valkeyContext *reconnectWithBackoff(const char *host, int port, cliSSLcon int attempts = 0; valkeyContext *ctx = NULL; - logMessage(LOG_DEBUG, "[Thread %d] Attempting to reconnect to %s:%d%s with backoff...", - thread_id, host, port, ssl_config ? " (TLS)" : ""); + logMessage(LOG_DEBUG, + "[Thread %d] Attempting to reconnect to %s:%d%s with backoff...", + thread_id, + host, + port, + ssl_config ? " (TLS)" : ""); while (attempts < RECONNECT_MAX_ATTEMPTS) { ctx = connectToServer(host, port, ssl_config); @@ -394,8 +386,11 @@ static valkeyContext *reconnectWithBackoff(const char *host, int port, cliSSLcon /* Exponential backoff */ int delay = RECONNECT_BASE_DELAY_MS * (1 << attempts); - logMessage(LOG_INFO, "[Thread %d] Reconnection attempt %d failed, retrying in %d ms...", - thread_id, attempts + 1, delay); + logMessage(LOG_INFO, + "[Thread %d] Reconnection attempt %d failed, retrying in %d ms...", + thread_id, + attempts + 1, + delay); usleep(delay * 1000); attempts++; } @@ -445,8 +440,10 @@ static void handleMalformedReply(valkeyContext *ctx, FuzzerCommand *cmd) { fprintf(stderr, "\nNo malformed reply data available in context\n"); } - logMessage(LOG_ERROR, "[Thread %d] ABORTING ALL THREADS due to malformed reply (pthread_id: %lu)", - thread_id, (unsigned long)pthread_self()); + logMessage(LOG_ERROR, + "[Thread %d] ABORTING ALL THREADS due to malformed reply (pthread_id: %lu)", + thread_id, + (unsigned long)pthread_self()); /* Set global abort flag to stop all threads */ global_abort_all_threads = 1; @@ -460,11 +457,16 @@ static void handleCommandTimeout(FuzzerCommand *cmd, time_t start_time) { time_t current_time = time(NULL); double elapsed_time = difftime(current_time, start_time); - logMessage(LOG_ERROR, "[Thread %d] TIMEOUT: Command timed out after %.1f seconds (max %d seconds) - Command: ", - thread_id, elapsed_time, COMMAND_TIMEOUT_SEC); + logMessage(LOG_ERROR, + "[Thread %d] TIMEOUT: Command timed out after %.1f seconds (max %d seconds) - Command: ", + thread_id, + elapsed_time, + COMMAND_TIMEOUT_SEC); logMessage(LOG_ERROR, "Command: %s", printCommand(cmd)); - logMessage(LOG_ERROR, "[Thread %d] ABORTING THREAD due to timeout (pthread_id: %lu)", - thread_id, (unsigned long)pthread_self()); + logMessage(LOG_ERROR, + "[Thread %d] ABORTING THREAD due to timeout (pthread_id: %lu)", + thread_id, + (unsigned long)pthread_self()); } /* Helper function to handle command errors and update counters */ @@ -483,8 +485,7 @@ static CommandResult handleCommandError(valkeyContext *ctx, FuzzerCommand *cmd, } else { sds cmd_str = formatCommandString(cmd); char error_msg[512]; - snprintf(error_msg, sizeof(error_msg), "Error getting reply: %s (errno: %d)", - ctx->errstr, errno); + snprintf(error_msg, sizeof(error_msg), "Error getting reply: %s (errno: %d)", ctx->errstr, errno); addError(thread_error_list, error_msg, cmd_str); incrCounter(COUNTER_TOTAL_ERRORS); sdsfree(cmd_str); @@ -507,17 +508,10 @@ static void logReplyDebug(const char *command, valkeyReply *reply) { logMessage(LOG_DEBUG, "%s: -> (empty)", command); } break; - case VALKEY_REPLY_ARRAY: - logMessage(LOG_DEBUG, "%s: -> (array of %zu elements)", command, reply->elements); - break; - case VALKEY_REPLY_INTEGER: - logMessage(LOG_DEBUG, "%s: -> %lld", command, reply->integer); - break; - case VALKEY_REPLY_NIL: - logMessage(LOG_DEBUG, "%s: -> (nil)", command); - break; - default: - logMessage(LOG_DEBUG, "%s: -> (unknown reply type)", command); + case VALKEY_REPLY_ARRAY: logMessage(LOG_DEBUG, "%s: -> (array of %zu elements)", command, reply->elements); break; + case VALKEY_REPLY_INTEGER: logMessage(LOG_DEBUG, "%s: -> %lld", command, reply->integer); break; + case VALKEY_REPLY_NIL: logMessage(LOG_DEBUG, "%s: -> (nil)", command); break; + default: logMessage(LOG_DEBUG, "%s: -> (unknown reply type)", command); } } @@ -651,8 +645,7 @@ static void printFinalStatistics(void) { logMessage(LOG_INFO, "Error replies: %d", final_errors); logMessage(LOG_INFO, "Malformed replies: %d", final_malformed); logMessage(LOG_INFO, "Total errors: %d", final_total_errors); - logMessage(LOG_INFO, "Success rate: %.2f%%", - final_commands > 0 ? (final_success * 100.0) / final_commands : 0); + logMessage(LOG_INFO, "Success rate: %.2f%%", final_commands > 0 ? (final_success * 100.0) / final_commands : 0); if (final_total_errors > 0 && current_log_level < LOG_DEBUG) { logMessage(LOG_INFO, "To see full error details, run with --fuzz-loglevel debug"); @@ -670,7 +663,10 @@ static int runClients(const char *host, int port, int commands_num, int clients_ } printf("Running fuzzer with %d clients, %d commands per client (%d total commands)%s\n", - clients_num, commands_per_client, commands_num, ssl_config ? " (TLS)" : ""); + clients_num, + commands_per_client, + commands_num, + ssl_config ? " (TLS)" : ""); /* Start progress reporting for all threads combined */ startProgressReporting(commands_num); @@ -717,8 +713,7 @@ static int runClients(const char *host, int port, int commands_num, int clients_ stopProgressReporting(); - logMessage(LOG_INFO, "All client threads completed. %d succeeded, %d failed.", - clients_num - failed, failed); + logMessage(LOG_INFO, "All client threads completed. %d succeeded, %d failed.", clients_num - failed, failed); free(threads); free(thread_data); @@ -728,7 +723,15 @@ static int runClients(const char *host, int port, int commands_num, int clients_ /* Run fuzzer clients with specified parameters * This function is called by valkey-benchmark when fuzz mode is enabled */ -int runFuzzerClients(const char *host, int port, int commands_num, int clients_num, int cluster_mode, int num_keys, cliSSLconfig *ssl_config, const char *log_level, int fuzz_flags) { +int runFuzzerClients(const char *host, + int port, + int commands_num, + int clients_num, + int cluster_mode, + int num_keys, + cliSSLconfig *ssl_config, + const char *log_level, + int fuzz_flags) { /* Set log level from parameter */ if (log_level) { if (strcmp(log_level, "none") == 0) { @@ -746,8 +749,7 @@ int runFuzzerClients(const char *host, int port, int commands_num, int clients_n } if (clients_num > MAX_CLIENTS_NUM) { - logMessage(LOG_ERROR, "Too many parallel clients requested (%d). Maximum is %d.", - clients_num, MAX_CLIENTS_NUM); + logMessage(LOG_ERROR, "Too many parallel clients requested (%d). Maximum is %d.", clients_num, MAX_CLIENTS_NUM); return 1; } diff --git a/src/fuzzer_command_generator.c b/src/fuzzer_command_generator.c index 05117fbbbe7..c8dfdd82371 100644 --- a/src/fuzzer_command_generator.c +++ b/src/fuzzer_command_generator.c @@ -126,36 +126,35 @@ static int mapFlagType(const sds flagStr) { static const struct { int flag; const char *name; - } flagNames[] = { - {CMD_WRITE, "write"}, - {CMD_READONLY, "readonly"}, - {CMD_DENYOOM, "denyoom"}, - {CMD_MODULE, "module"}, - {CMD_ADMIN, "admin"}, - {CMD_PUBSUB, "pubsub"}, - {CMD_NOSCRIPT, "noscript"}, - {CMD_BLOCKING, "blocking"}, - {CMD_LOADING, "loading"}, - {CMD_STALE, "stale"}, - {CMD_SKIP_MONITOR, "skip_monitor"}, - {CMD_SKIP_COMMANDLOG, "skip_commandlog"}, - {CMD_ASKING, "asking"}, - {CMD_FAST, "fast"}, - {CMD_NO_AUTH, "no_auth"}, - {CMD_MAY_REPLICATE, "may_replicate"}, - {CMD_SENTINEL, "sentinel"}, - {CMD_ONLY_SENTINEL, "only_sentinel"}, - {CMD_NO_MANDATORY_KEYS, "no_mandatory_keys"}, - {CMD_PROTECTED, "protected"}, - {CMD_MODULE_GETKEYS, "module_getkeys"}, - {CMD_MODULE_NO_CLUSTER, "module_no_cluster"}, - {CMD_NO_ASYNC_LOADING, "no_async_loading"}, - {CMD_NO_MULTI, "no_multi"}, - {CMD_MOVABLE_KEYS, "movablekeys"}, - {CMD_ALLOW_BUSY, "allow_busy"}, - {CMD_MODULE_GETCHANNELS, "module_getchannels"}, - {CMD_TOUCHES_ARBITRARY_KEYS, "touches_arbitrary_keys"}, - {0, NULL}}; + } flagNames[] = {{CMD_WRITE, "write"}, + {CMD_READONLY, "readonly"}, + {CMD_DENYOOM, "denyoom"}, + {CMD_MODULE, "module"}, + {CMD_ADMIN, "admin"}, + {CMD_PUBSUB, "pubsub"}, + {CMD_NOSCRIPT, "noscript"}, + {CMD_BLOCKING, "blocking"}, + {CMD_LOADING, "loading"}, + {CMD_STALE, "stale"}, + {CMD_SKIP_MONITOR, "skip_monitor"}, + {CMD_SKIP_COMMANDLOG, "skip_commandlog"}, + {CMD_ASKING, "asking"}, + {CMD_FAST, "fast"}, + {CMD_NO_AUTH, "no_auth"}, + {CMD_MAY_REPLICATE, "may_replicate"}, + {CMD_SENTINEL, "sentinel"}, + {CMD_ONLY_SENTINEL, "only_sentinel"}, + {CMD_NO_MANDATORY_KEYS, "no_mandatory_keys"}, + {CMD_PROTECTED, "protected"}, + {CMD_MODULE_GETKEYS, "module_getkeys"}, + {CMD_MODULE_NO_CLUSTER, "module_no_cluster"}, + {CMD_NO_ASYNC_LOADING, "no_async_loading"}, + {CMD_NO_MULTI, "no_multi"}, + {CMD_MOVABLE_KEYS, "movablekeys"}, + {CMD_ALLOW_BUSY, "allow_busy"}, + {CMD_MODULE_GETCHANNELS, "module_getchannels"}, + {CMD_TOUCHES_ARBITRARY_KEYS, "touches_arbitrary_keys"}, + {0, NULL}}; /* Compile-time check: Ensure we have entries for all flags up to bit 28. * If this fails, new CMD_* flags were added to server.h - update flagNames array above. */ @@ -178,17 +177,16 @@ static int mapArgumentType(const sds typeStr) { static const struct { const char *name; int type; - } typeMap[] = { - {"string", ARG_TYPE_STRING}, - {"integer", ARG_TYPE_INTEGER}, - {"double", ARG_TYPE_DOUBLE}, - {"key", ARG_TYPE_KEY}, - {"pattern", ARG_TYPE_PATTERN}, - {"unix-time", ARG_TYPE_UNIX_TIME}, - {"pure-token", ARG_TYPE_PURE_TOKEN}, - {"oneof", ARG_TYPE_ONEOF}, - {"block", ARG_TYPE_BLOCK}, - {NULL, 0}}; + } typeMap[] = {{"string", ARG_TYPE_STRING}, + {"integer", ARG_TYPE_INTEGER}, + {"double", ARG_TYPE_DOUBLE}, + {"key", ARG_TYPE_KEY}, + {"pattern", ARG_TYPE_PATTERN}, + {"unix-time", ARG_TYPE_UNIX_TIME}, + {"pure-token", ARG_TYPE_PURE_TOKEN}, + {"oneof", ARG_TYPE_ONEOF}, + {"block", ARG_TYPE_BLOCK}, + {NULL, 0}}; for (int i = 0; typeMap[i].name != NULL; i++) { if (!strcmp(typeStr, typeMap[i].name)) { @@ -204,20 +202,19 @@ static CommandGroupType mapGroupType(const sds groupStr) { static const struct { const char *name; CommandGroupType group; - } groupMap[] = { - {"string", CMD_GROUP_STRING}, - {"list", CMD_GROUP_LIST}, - {"set", CMD_GROUP_SET}, - {"hash", CMD_GROUP_HASH}, - {"sorted-set", CMD_GROUP_SORTED_SET}, - {"sorted_set", CMD_GROUP_SORTED_SET}, - {"stream", CMD_GROUP_STREAM}, - {"hyperloglog", CMD_GROUP_HYPERLOGLOG}, - {"geo", CMD_GROUP_GEO}, - {"bitmap", CMD_GROUP_BITMAP}, - {"pubsub", CMD_GROUP_PUBSUB}, - {"generic", CMD_GROUP_GENERIC}, - {NULL, CMD_GROUP_UNKNOWN}}; + } groupMap[] = {{"string", CMD_GROUP_STRING}, + {"list", CMD_GROUP_LIST}, + {"set", CMD_GROUP_SET}, + {"hash", CMD_GROUP_HASH}, + {"sorted-set", CMD_GROUP_SORTED_SET}, + {"sorted_set", CMD_GROUP_SORTED_SET}, + {"stream", CMD_GROUP_STREAM}, + {"hyperloglog", CMD_GROUP_HYPERLOGLOG}, + {"geo", CMD_GROUP_GEO}, + {"bitmap", CMD_GROUP_BITMAP}, + {"pubsub", CMD_GROUP_PUBSUB}, + {"generic", CMD_GROUP_GENERIC}, + {NULL, CMD_GROUP_UNKNOWN}}; if (!groupStr) return CMD_GROUP_UNKNOWN; @@ -319,22 +316,21 @@ dict *initConfigDict(void) { } static int isEnumConfig(const char *key) { - static const char *enumConfigs[] = { - "repl-diskless-load", - "loglevel", - "maxmemory-policy", - "appendfsync", - "oom-score-adj", - "acl-pubsub-default", - "sanitize-dump-payload", - "cluster-preferred-endpoint-type", - "propagation-error-behavior", - "shutdown-on-sigint", - "shutdown-on-sigterm", - "log-format", - "log-timestamp-format", - "rdb-version-check", - NULL}; + static const char *enumConfigs[] = {"repl-diskless-load", + "loglevel", + "maxmemory-policy", + "appendfsync", + "oom-score-adj", + "acl-pubsub-default", + "sanitize-dump-payload", + "cluster-preferred-endpoint-type", + "propagation-error-behavior", + "shutdown-on-sigint", + "shutdown-on-sigterm", + "log-format", + "log-timestamp-format", + "rdb-version-check", + NULL}; for (int i = 0; enumConfigs[i] != NULL; i++) { if (strcasecmp(key, enumConfigs[i]) == 0) { @@ -345,16 +341,15 @@ static int isEnumConfig(const char *key) { } static int isSpecialConfig(const char *key) { - static const char *specialConfigs[] = { - "dir", - "save", - "client-output-buffer-limit", - "oom-score-adj-values", - "notify-keyspace-events", - "bind", - "rdma-bind", - "latency-tracking-info-percentiles", - NULL}; + static const char *specialConfigs[] = {"dir", + "save", + "client-output-buffer-limit", + "oom-score-adj-values", + "notify-keyspace-events", + "bind", + "rdma-bind", + "latency-tracking-info-percentiles", + NULL}; for (int i = 0; specialConfigs[i] != NULL; i++) { if (strcasecmp(key, specialConfigs[i]) == 0) { @@ -383,19 +378,18 @@ ConfigValueType determineConfigValueType(const char *value) { /* Check if a config should be filtered out to keep the server testable */ static int shouldFilterConfig(const char *key) { - static const char *filteredConfigs[] = { - "port", - "cluster-port", - "requirepass", - "bind", - "rdma-bind", - "min-replicas-to-write", - "replicaof", - "dir", - "save", - "shutdown-on-sigint", - "shutdown-on-sigterm", - NULL}; + static const char *filteredConfigs[] = {"port", + "cluster-port", + "requirepass", + "bind", + "rdma-bind", + "min-replicas-to-write", + "replicaof", + "dir", + "save", + "shutdown-on-sigint", + "shutdown-on-sigterm", + NULL}; if (!key) return 0; @@ -432,9 +426,14 @@ void addConfigEntry(dict *configDict, const char *key, const char *value) { void generateRandomEnumValue(FuzzerCommand *cmd, ConfigEntry *entry, const char *config_name) { if (strcasecmp(config_name, "maxmemory-policy") == 0) { - static const char *policies[] = {"volatile-lru", "volatile-lfu", "volatile-random", - "volatile-ttl", "allkeys-lru", "allkeys-lfu", - "allkeys-random", "noeviction"}; + static const char *policies[] = {"volatile-lru", + "volatile-lfu", + "volatile-random", + "volatile-ttl", + "allkeys-lru", + "allkeys-lfu", + "allkeys-random", + "noeviction"}; appendArg(cmd, sdsnew(policies[rand() % 8])); } else if (strcasecmp(config_name, "loglevel") == 0) { static const char *levels[] = {"debug", "verbose", "notice", "warning", "nothing"}; @@ -485,8 +484,7 @@ void generateRandomSpecialValue(FuzzerCommand *cmd, ConfigEntry *entry, const ch long hard_limit = (1 + rand() % 10) * 1024 * 1024; /* 1MB to 10MB */ long soft_limit = hard_limit / 2; /* Half of hard limit */ int soft_seconds = 10 + rand() % 50; /* 10 to 60 seconds */ - appendArg(cmd, sdscatprintf(sdsempty(), "%s %ld %ld %d", - class, hard_limit, soft_limit, soft_seconds)); + appendArg(cmd, sdscatprintf(sdsempty(), "%s %ld %ld %d", class, hard_limit, soft_limit, soft_seconds)); } else if (strcasecmp(config_name, "notify-keyspace-events") == 0) { /* Generate valid keyspace notification configuration */ static const char *options[] = { @@ -524,9 +522,8 @@ void generateRandomSpecialValue(FuzzerCommand *cmd, ConfigEntry *entry, const ch } } appendArg(cmd, percentiles); - } else if (strcasecmp(config_name, "rdma-bind") == 0 || - strcasecmp(config_name, "bind") == 0 || - strcasecmp(config_name, "dir") == 0) { + } else if (strcasecmp(config_name, "rdma-bind") == 0 || strcasecmp(config_name, "bind") == 0 + || strcasecmp(config_name, "dir") == 0) { /* For these configs, use the current value as we don't want to change them */ appendArg(cmd, sdsnew(entry->value)); } else { @@ -566,12 +563,8 @@ void generateRandomConfigValue(FuzzerCommand *cmd, ConfigEntry *entry) { appendArg(cmd, sdscatprintf(sdsempty(), "%ld", min + rand() % (max - min + 1))); return; } - case CONFIG_TYPE_ENUM: - generateRandomEnumValue(cmd, entry, config_name); - return; - case CONFIG_TYPE_SPECIAL: - generateRandomSpecialValue(cmd, entry, config_name); - return; + case CONFIG_TYPE_ENUM: generateRandomEnumValue(cmd, entry, config_name); return; + case CONFIG_TYPE_SPECIAL: generateRandomSpecialValue(cmd, entry, config_name); return; case CONFIG_TYPE_STRING: default: /* For strings, generate a random string */ @@ -625,8 +618,8 @@ dict *parseConfigOutput(valkeyReply *reply) { for (size_t i = 0; i < reply->elements; i += 2) { if (i + 1 >= reply->elements) break; - if (reply->element[i]->type != VALKEY_REPLY_STRING || - reply->element[i + 1]->type != VALKEY_REPLY_STRING) continue; + if (reply->element[i]->type != VALKEY_REPLY_STRING || reply->element[i + 1]->type != VALKEY_REPLY_STRING) + continue; const char *key = reply->element[i]->str; const char *value = reply->element[i + 1]->str; @@ -645,11 +638,10 @@ static void processArgumentFlags(CommandArgument *cmdArg, valkeyReply *flags) { static const struct { const char *name; int flag; - } flagMap[] = { - {"optional", CMD_ARG_OPTIONAL}, - {"multiple", CMD_ARG_MULTIPLE}, - {"multiple_token", CMD_ARG_MULTIPLE_TOKEN}, - {NULL, 0}}; + } flagMap[] = {{"optional", CMD_ARG_OPTIONAL}, + {"multiple", CMD_ARG_MULTIPLE}, + {"multiple_token", CMD_ARG_MULTIPLE_TOKEN}, + {NULL, 0}}; for (size_t j = 0; j < flags->elements; j++) { char *flagStr = flags->element[j]->str; @@ -894,8 +886,15 @@ static void initializeCommandRegistry(valkeyReply *commandTable) { fuzz_ctx->commandRegistrySize = countTotalCommands(commandTable); fuzz_ctx->commandRegistry = zmalloc(sizeof(CommandEntry) * fuzz_ctx->commandRegistrySize); /* Commands allowed in subscribe mode */ - const char *allowedCommands[] = { - "SUBSCRIBE", "PSUBSCRIBE", "SSUBSCRIBE", "UNSUBSCRIBE", "PUNSUBSCRIBE", "SUNSUBSCRIBE", "PING", "QUIT", "RESET"}; + const char *allowedCommands[] = {"SUBSCRIBE", + "PSUBSCRIBE", + "SSUBSCRIBE", + "UNSUBSCRIBE", + "PUNSUBSCRIBE", + "SUNSUBSCRIBE", + "PING", + "QUIT", + "RESET"}; int numAllowedCommands = sizeof(allowedCommands) / sizeof(allowedCommands[0]); /* Allocate memory for the subscribe command registry */ fuzz_ctx->subscribeCommandRegistry = zmalloc(sizeof(CommandEntry) * numAllowedCommands); @@ -907,8 +906,8 @@ static void initializeCommandRegistry(valkeyReply *commandTable) { assert(commandTable->element[i]->type == VALKEY_REPLY_STRING); sds cmdName = commandTable->element[i]->str; - assert(commandTable->element[i + 1]->type == VALKEY_REPLY_MAP || - commandTable->element[i + 1]->type == VALKEY_REPLY_ARRAY); + assert(commandTable->element[i + 1]->type == VALKEY_REPLY_MAP + || commandTable->element[i + 1]->type == VALKEY_REPLY_ARRAY); valkeyReply *cmdSpecs = commandTable->element[i + 1]; next = initializeCommandEntry(cmdName, NULL, next, cmdSpecs); } @@ -970,30 +969,10 @@ static void freeCommandEntry(CommandEntry *command) { /* Check if a command should be filtered out from the command registry as they may make the server untestable */ static int shouldFilterCommand(const sds cmdName, int fuzz_flags) { static const char *filteredCommands[] = { - "SHUTDOWN", - "FLUSHDB", - "FLUSHALL", - "REPLICAOF", - "SLAVEOF", - "FAILOVER", - "CLUSTER REPLICATE", - "SCRIPT DEBUG", - "CLIENT PAUSE", - "SAVE", - "BGSAVE", - "BGREWRITEAOF", - "SYNC", - "PSYNC", - "MULTI", - "EXEC", - "EVAL", - "CLIENT REPLY", - "MONITOR", - "DEBUG", - "PFSELFTEST", - "CONFIG REWRITE", - "ACL LOAD", - NULL}; + "SHUTDOWN", "FLUSHDB", "FLUSHALL", "REPLICAOF", "SLAVEOF", "FAILOVER", "CLUSTER REPLICATE", + "SCRIPT DEBUG", "CLIENT PAUSE", "SAVE", "BGSAVE", "BGREWRITEAOF", "SYNC", "PSYNC", + "MULTI", "EXEC", "EVAL", "CLIENT REPLY", "MONITOR", "DEBUG", "PFSELFTEST", + "CONFIG REWRITE", "ACL LOAD", NULL}; if (!cmdName) return 0; @@ -1027,7 +1006,8 @@ static void removeInvalidCommands(int fuzz_flags) { /* First delete from subscribeCommandRegistry */ for (size_t j = 0; j < fuzz_ctx->subscribeCommandRegistrySize; j++) { if (strcasecmp(fuzz_ctx->subscribeCommandRegistry[j].fullname, cmd->fullname) == 0) { - fuzz_ctx->subscribeCommandRegistry[j] = fuzz_ctx->subscribeCommandRegistry[fuzz_ctx->subscribeCommandRegistrySize - 1]; + fuzz_ctx->subscribeCommandRegistry[j] = + fuzz_ctx->subscribeCommandRegistry[fuzz_ctx->subscribeCommandRegistrySize - 1]; fuzz_ctx->subscribeCommandRegistrySize--; break; } @@ -1067,24 +1047,21 @@ int initFuzzer(valkeyContext *ctx, int num_keys, int cluster_mode, int fuzz_flag /* Execute COMMAND DOCS to get command documentation */ commandDocs = valkeyCommand(ctx, "COMMAND DOCS"); if (!commandDocs || commandDocs->type == VALKEY_REPLY_ERROR) { - printf("Error: Failed to execute COMMAND DOCS. %s\n", - commandDocs ? commandDocs->str : "No reply received"); + printf("Error: Failed to execute COMMAND DOCS. %s\n", commandDocs ? commandDocs->str : "No reply received"); goto cleanup; } /* Execute COMMAND to get command flags */ commandInfo = valkeyCommand(ctx, "COMMAND"); if (!commandInfo || commandInfo->type == VALKEY_REPLY_ERROR) { - printf("Error: Failed to execute COMMAND. %s\n", - commandInfo ? commandInfo->str : "No reply received"); + printf("Error: Failed to execute COMMAND. %s\n", commandInfo ? commandInfo->str : "No reply received"); goto cleanup; } /* Execute CONFIG GET * to get configuration parameters */ configOutput = valkeyCommand(ctx, "CONFIG GET *"); if (!configOutput || configOutput->type == VALKEY_REPLY_ERROR) { - printf("Error: Failed to execute CONFIG GET *. %s\n", - configOutput ? configOutput->str : "No reply received"); + printf("Error: Failed to execute CONFIG GET *. %s\n", configOutput ? configOutput->str : "No reply received"); goto cleanup; } @@ -1150,45 +1127,24 @@ static void addKeysToCommand(FuzzerCommand *cmd, int numkeys, CommandArgument *a CommandGroupType groupType = arg->parent->group; switch (groupType) { - case CMD_GROUP_STRING: - keyPrefix = "string"; - break; - case CMD_GROUP_LIST: - keyPrefix = "list"; - break; - case CMD_GROUP_SET: - keyPrefix = "set"; - break; - case CMD_GROUP_HASH: - keyPrefix = "hash"; - break; - case CMD_GROUP_SORTED_SET: - keyPrefix = "zset"; - break; - case CMD_GROUP_STREAM: - keyPrefix = "stream"; - break; - case CMD_GROUP_HYPERLOGLOG: - keyPrefix = "hll"; - break; - case CMD_GROUP_GEO: - keyPrefix = "geo"; - break; - case CMD_GROUP_BITMAP: - keyPrefix = "bitmap"; - break; - case CMD_GROUP_PUBSUB: - keyPrefix = "channel"; - break; + case CMD_GROUP_STRING: keyPrefix = "string"; break; + case CMD_GROUP_LIST: keyPrefix = "list"; break; + case CMD_GROUP_SET: keyPrefix = "set"; break; + case CMD_GROUP_HASH: keyPrefix = "hash"; break; + case CMD_GROUP_SORTED_SET: keyPrefix = "zset"; break; + case CMD_GROUP_STREAM: keyPrefix = "stream"; break; + case CMD_GROUP_HYPERLOGLOG: keyPrefix = "hll"; break; + case CMD_GROUP_GEO: keyPrefix = "geo"; break; + case CMD_GROUP_BITMAP: keyPrefix = "bitmap"; break; + case CMD_GROUP_PUBSUB: keyPrefix = "channel"; break; case CMD_GROUP_GENERIC: { /* For generic commands, randomly select one of the key types */ - static const char *keyTypes[] = { - "string", "list", "set", "hash", "zset", "stream", "hll", "geo", "bitmap", "key"}; + static const char *keyTypes[] = + {"string", "list", "set", "hash", "zset", "stream", "hll", "geo", "bitmap", "key"}; int randomTypeIndex = rand() % (sizeof(keyTypes) / sizeof(keyTypes[0])); keyPrefix = keyTypes[randomTypeIndex]; } break; - default: - break; + default: break; } } @@ -1243,12 +1199,10 @@ static void generateLexRangeValue(FuzzerCommand *cmd, const char *argName) { appendArg(cmd, sdsnew("+")); } else if (choice < 6) { /* Inclusive range with a string value */ - appendArg(cmd, sdscatprintf(sdsempty(), "[%s%d", - strcmp(argName, "min") == 0 ? "a" : "z", rand() % 100)); + appendArg(cmd, sdscatprintf(sdsempty(), "[%s%d", strcmp(argName, "min") == 0 ? "a" : "z", rand() % 100)); } else { /* Exclusive range with a string value */ - appendArg(cmd, sdscatprintf(sdsempty(), "(%s%d", - strcmp(argName, "min") == 0 ? "a" : "z", rand() % 100)); + appendArg(cmd, sdscatprintf(sdsempty(), "(%s%d", strcmp(argName, "min") == 0 ? "a" : "z", rand() % 100)); } } @@ -1258,7 +1212,8 @@ static void generateAclRule(FuzzerCommand *cmd) { int rule_type = rand() % 10; switch (rule_type) { - case 0: /* User state rules */ + case 0: + /* User state rules */ appendArg(cmd, sdsnew(rand() % 2 ? "on" : "off")); break; case 1: /* Password rules */ @@ -1305,15 +1260,14 @@ static void generateAclRule(FuzzerCommand *cmd) { break; case 5: /* Specific command allow rules */ { - static const char *commands[] = {"get", "set", "del", "exists", "ping", - "info", "keys", "scan", "type", "ttl"}; + static const char *commands[] = {"get", "set", "del", "exists", "ping", "info", "keys", "scan", "type", "ttl"}; int cmd_idx = rand() % (sizeof(commands) / sizeof(commands[0])); appendArg(cmd, sdscatprintf(sdsempty(), "+%s", commands[cmd_idx])); } break; case 6: /* Specific command deny rules */ { - static const char *commands[] = {"flushdb", "flushall", "shutdown", "debug", - "config", "eval", "script", "client"}; + static const char *commands[] = + {"flushdb", "flushall", "shutdown", "debug", "config", "eval", "script", "client"}; int cmd_idx = rand() % (sizeof(commands) / sizeof(commands[0])); appendArg(cmd, sdscatprintf(sdsempty(), "-%s", commands[cmd_idx])); } break; @@ -1328,7 +1282,8 @@ static void generateAclRule(FuzzerCommand *cmd) { appendArg(cmd, sdscatprintf(sdsempty(), "&channel:%d:*", rand() % 5)); } } break; - case 8: /* Reset rules */ + case 8: + /* Reset rules */ appendArg(cmd, sdsnew("reset")); break; default: /* Simple combination rules */ @@ -1349,12 +1304,10 @@ static sds generateRandomAddress(void) { /* 50% chance to generate IPv4, 50% chance to generate hostname */ if (rand() % 2 == 0) { /* Generate IPv4 address */ - return sdscatprintf(sdsempty(), "192.168.%d.%d:%d", - rand() % 256, rand() % 256, port); + return sdscatprintf(sdsempty(), "192.168.%d.%d:%d", rand() % 256, rand() % 256, port); } else { /* Generate hostname */ - return sdscatprintf(sdsempty(), "host-%d.example.com:%d", - rand() % 10, port); + return sdscatprintf(sdsempty(), "host-%d.example.com:%d", rand() % 10, port); } } @@ -1423,15 +1376,12 @@ static void generateStringArgValue(FuzzerCommand *cmd, const char *argName, Comm appendArg(cmd, value); } else if (strcmp(argName, "serialized-value") == 0) { /* Generate a serialized value for restore command */ - static const char *serialized_values[] = { - /* String value value-534 with proper RDB format */ - "\x00\x09value-534\x0b\x00\xc9\x88\x82M\xfb{\x0e1", - /* Integer value 537 with proper RDB format */ - "\x00\xc1\x19\x02\x0b\x00\x03Uh3\xba\xdc\xde\xac"}; + static const char *serialized_values[] = {/* String value value-534 with proper RDB format */ + "\x00\x09value-534\x0b\x00\xc9\x88\x82M\xfb{\x0e1", + /* Integer value 537 with proper RDB format */ + "\x00\xc1\x19\x02\x0b\x00\x03Uh3\xba\xdc\xde\xac"}; appendArg(cmd, sdscatprintf(sdsempty(), "\"%s\"", serialized_values[rand() % 2])); - } else if (strcmp(argName, "member") == 0 || - strcmp(argName, "member1") == 0 || - strcmp(argName, "member2") == 0) { + } else if (strcmp(argName, "member") == 0 || strcmp(argName, "member1") == 0 || strcmp(argName, "member2") == 0) { appendArg(cmd, sdscatprintf(sdsempty(), "member:%d", rand() % 50)); } else if (strcmp(argName, "host") == 0) { appendArg(cmd, sdscatprintf(sdsempty(), "host-%d.example.com", rand() % 5)); @@ -1485,32 +1435,34 @@ static void generateStringArgValue(FuzzerCommand *cmd, const char *argName, Comm } else if (strcmp(argName, "function") == 0) { appendArg(cmd, sdscatprintf(sdsempty(), "myfunc%d", rand() % 5)); } else if (strcmp(argName, "function-code") == 0) { - appendArg(cmd, sdscatprintf(sdsempty(), "\"#!lua name=myfunc%d \nserver.register_function('test', function(keys, args) return args[1] end) \"", rand() % 5)); - } else if (strcmp(argName, "library-name") == 0 || strcmp(argName, "library-name-pattern") == 0 || - strcmp(argName, "lib-name") == 0 || strcmp(argName, "libname") == 0) { + appendArg(cmd, + sdscatprintf(sdsempty(), + "\"#!lua name=myfunc%d \nserver.register_function('test', function(keys, args) return " + "args[1] end) \"", + rand() % 5)); + } else if (strcmp(argName, "library-name") == 0 || strcmp(argName, "library-name-pattern") == 0 + || strcmp(argName, "lib-name") == 0 || strcmp(argName, "libname") == 0) { appendArg(cmd, sdscatprintf(sdsempty(), "lib%d", rand() % 5)); } else if (strcmp(argName, "libver") == 0 || strcmp(argName, "lib-ver") == 0) { appendArg(cmd, sdscatprintf(sdsempty(), "%d.%d.%d", rand() % 10, rand() % 10, rand() % 10)); - } else if (strcmp(argName, "node-id") == 0 || strcmp(argName, "nodename") == 0 || - strcmp(argName, "importing") == 0 || strcmp(argName, "migrating") == 0 || - strcmp(argName, "node") == 0) { - appendArg(cmd, sdscatprintf(sdsempty(), "%08x%08x%08x%08x%08x", - rand(), rand(), rand(), rand(), rand())); + } else if (strcmp(argName, "node-id") == 0 || strcmp(argName, "nodename") == 0 || strcmp(argName, "importing") == 0 + || strcmp(argName, "migrating") == 0 || strcmp(argName, "node") == 0) { + appendArg(cmd, sdscatprintf(sdsempty(), "%08x%08x%08x%08x%08x", rand(), rand(), rand(), rand(), rand())); } else if (strcmp(argName, "encoding") == 0) { /* For BITFIELD command, encoding should be i or u format */ static const char *signs[] = {"i", "u"}; static const int bits[] = {1, 2, 4, 8, 16, 32, 64}; - appendArg(cmd, sdscatprintf(sdsempty(), "%s%d", signs[rand() % 2], bits[rand() % (sizeof(bits) / sizeof(bits[0]))])); + appendArg(cmd, + sdscatprintf(sdsempty(), "%s%d", signs[rand() % 2], bits[rand() % (sizeof(bits) / sizeof(bits[0]))])); } else if (strcmp(argName, "old-format") == 0) { - appendArg(cmd, sdscatprintf(sdsempty(), "192.168.%d.%d:%d", rand() % 256, rand() % 256, 6379 + (rand() % 1000))); + appendArg(cmd, + sdscatprintf(sdsempty(), "192.168.%d.%d:%d", rand() % 256, rand() % 256, 6379 + (rand() % 1000))); } else if (strcmp(argName, "runid") == 0 || strcmp(argName, "replicationid") == 0) { - appendArg(cmd, sdscatprintf(sdsempty(), "%08x%08x%08x%08x%08x", - rand(), rand(), rand(), rand(), rand())); + appendArg(cmd, sdscatprintf(sdsempty(), "%08x%08x%08x%08x%08x", rand(), rand(), rand(), rand(), rand())); } else if (strcmp(argName, "sha1") == 0) { - appendArg(cmd, sdscatprintf(sdsempty(), "%08x%08x%08x%08x%08x", - rand(), rand(), rand(), rand(), rand())); - } else if (strcmp(argName, "last-id") == 0 || strcmp(argName, "lastid") == 0 || - strcmp(argName, "max-deleted-id") == 0) { + appendArg(cmd, sdscatprintf(sdsempty(), "%08x%08x%08x%08x%08x", rand(), rand(), rand(), rand(), rand())); + } else if (strcmp(argName, "last-id") == 0 || strcmp(argName, "lastid") == 0 + || strcmp(argName, "max-deleted-id") == 0) { appendArg(cmd, sdscatprintf(sdsempty(), "%d-%d", rand() % 1000, rand() % 1000)); } else if (strcmp(argName, "min-idle-time") == 0) { appendArg(cmd, sdscatprintf(sdsempty(), "%d", rand() % 10000)); @@ -1519,12 +1471,20 @@ static void generateStringArgValue(FuzzerCommand *cmd, const char *argName, Comm } else if (strcmp(argName, "primary-name") == 0) { appendArg(cmd, sdscatprintf(sdsempty(), "primary-%d", rand() % 5)); } else if (strcmp(argName, "category") == 0) { - static const char *categories[] = {"connection", "generic", "string", "list", "set", - "sorted_set", "hash", "pubsub", "transactions", "scripting"}; + static const char *categories[] = {"connection", + "generic", + "string", + "list", + "set", + "sorted_set", + "hash", + "pubsub", + "transactions", + "scripting"}; appendArg(cmd, sdsnew(categories[rand() % (sizeof(categories) / sizeof(categories[0]))])); } else if (strcmp(argName, "flags") == 0) { - static const char *client_flags[] = {"A", "b", "c", "d", "e", "i", "M", "N", - "O", "P", "r", "S", "u", "U", "x", "t", "T", "R", "B", "I"}; + static const char *client_flags[] = {"A", "b", "c", "d", "e", "i", "M", "N", "O", "P", + "r", "S", "u", "U", "x", "t", "T", "R", "B", "I"}; appendArg(cmd, sdsnew(client_flags[rand() % (sizeof(client_flags) / sizeof(client_flags[0]))])); } else if (strcmp(argName, "element") == 0) { appendArg(cmd, sdscatprintf(sdsempty(), "elem-%d", rand() % 30)); @@ -1689,10 +1649,10 @@ static CommandEntry *handlePubSubCommandSelection(void) { selectedCommand = &fuzz_ctx->subscribeCommandRegistry[randomIndex]; /* Check if this command puts the client in unsubscribe mode */ - if ((strcasecmp(selectedCommand->fullname, "UNSUBSCRIBE") == 0 && client_ctx->subscribe_type == 0) || - (strcasecmp(selectedCommand->fullname, "PUNSUBSCRIBE") == 0 && client_ctx->subscribe_type == 1) || - (strcasecmp(selectedCommand->fullname, "SUNSUBSCRIBE") == 0 && client_ctx->subscribe_type == 2) || - (strcasecmp(selectedCommand->fullname, "RESET") == 0)) { + if ((strcasecmp(selectedCommand->fullname, "UNSUBSCRIBE") == 0 && client_ctx->subscribe_type == 0) + || (strcasecmp(selectedCommand->fullname, "PUNSUBSCRIBE") == 0 && client_ctx->subscribe_type == 1) + || (strcasecmp(selectedCommand->fullname, "SUNSUBSCRIBE") == 0 && client_ctx->subscribe_type == 2) + || (strcasecmp(selectedCommand->fullname, "RESET") == 0)) { client_ctx->in_subscribe_mode = 0; client_ctx->subscribe_type = 0; } @@ -1740,7 +1700,8 @@ void generateSingleCmd(FuzzerCommand *cmd) { if (strstr(selectedCommand->fullname, " ")) { /* Add the command name */ sds commandName = sdsnewlen(selectedCommand->fullname, strcspn(selectedCommand->fullname, " ")); - sds subCommand = sdsnewlen(strchr(selectedCommand->fullname, ' ') + 1, strlen(selectedCommand->fullname) - strcspn(selectedCommand->fullname, " ")); + sds subCommand = sdsnewlen(strchr(selectedCommand->fullname, ' ') + 1, + strlen(selectedCommand->fullname) - strcspn(selectedCommand->fullname, " ")); appendArg(cmd, commandName); appendArg(cmd, subCommand); } else { @@ -1820,8 +1781,7 @@ static sds createCorruptedArg(void) { { int len = rand() % 16 + 10; sds arg = sdsnewlen(NULL, len); - for (int k = 0; k < len - 1; k++) - ((char *)arg)[k] = rand() % 256; + for (int k = 0; k < len - 1; k++) ((char *)arg)[k] = rand() % 256; return arg; } case 1: /* Random Long string */ @@ -1831,9 +1791,11 @@ static sds createCorruptedArg(void) { memset(arg, 'A' + (rand() % 26), len - 1); return arg; } - case 2: /* Empty string */ + case 2: + /* Empty string */ return sdsnew(""); - case 3: /* Special characters */ + case 3: + /* Special characters */ return sdsnew("\n\r\t\"\\'$%^&*(){}[]<>"); case 4: /* Invalid number */ default: { @@ -1861,8 +1823,7 @@ static void removeArgument(FuzzerCommand *cmd) { sdsfree(cmd->argv[idx]); /* Shift remaining arguments */ - for (int k = idx; k < cmd->argc - 1; k++) - cmd->argv[k] = cmd->argv[k + 1]; + for (int k = idx; k < cmd->argc - 1; k++) cmd->argv[k] = cmd->argv[k + 1]; cmd->argc--; } @@ -1872,21 +1833,20 @@ static void addRandomArgument(FuzzerCommand *cmd) { sds new_arg = NULL; switch (rand() % 3) { - case 0: /* Random string */ + case 0: + /* Random string */ new_arg = sdsnew("random_value"); break; - case 1: /* Random number */ + case 1: + /* Random number */ new_arg = sdsfromlonglong(rand() % 1000); break; - case 2: - new_arg = sdsnew("\n\r\t\"\\'$%^&*(){}[]<>"); - break; + case 2: new_arg = sdsnew("\n\r\t\"\\'$%^&*(){}[]<>"); break; } /* Insert at random position */ int pos = rand() % (cmd->argc + 1); - for (int k = cmd->argc; k > pos; k--) - cmd->argv[k] = cmd->argv[k - 1]; + for (int k = cmd->argc; k > pos; k--) cmd->argv[k] = cmd->argv[k - 1]; cmd->argv[pos] = new_arg; cmd->argc++; diff --git a/src/geo.c b/src/geo.c index 4f7d6f7db27..ea6c5d91df9 100644 --- a/src/geo.c +++ b/src/geo.c @@ -190,8 +190,8 @@ int extractDistanceOrReply(client *c, robj **argv, double *conversion, double *r * *conversions is populated with the coefficient to use in order to convert meters to the unit.*/ int extractBoxOrReply(client *c, robj **argv, double *conversion, double *width, double *height) { double h, w; - if ((getDoubleFromObjectOrReply(c, argv[0], &w, "need numeric width") != C_OK) || - (getDoubleFromObjectOrReply(c, argv[1], &h, "need numeric height") != C_OK)) { + if ((getDoubleFromObjectOrReply(c, argv[0], &w, "need numeric width") != C_OK) + || (getDoubleFromObjectOrReply(c, argv[1], &h, "need numeric height") != C_OK)) { return C_ERR; } @@ -241,16 +241,29 @@ int geoWithinShape(GeoShape *shape, double score, double *xy, double *distance) /* Note that geohashGetDistanceIfInRadiusWGS84() takes arguments in * reverse order: longitude first, latitude later. */ if (shape->type == CIRCULAR_TYPE) { - if (!geohashGetDistanceIfInRadiusWGS84(shape->xy[0], shape->xy[1], xy[0], xy[1], - shape->t.radius * shape->conversion, distance)) + if (!geohashGetDistanceIfInRadiusWGS84(shape->xy[0], + shape->xy[1], + xy[0], + xy[1], + shape->t.radius * shape->conversion, + distance)) return C_ERR; } else if (shape->type == RECTANGLE_TYPE) { if (!geohashGetDistanceIfInRectangle(shape->t.r.width * shape->conversion, - shape->t.r.height * shape->conversion, shape->xy[0], shape->xy[1], xy[0], - xy[1], distance)) + shape->t.r.height * shape->conversion, + shape->xy[0], + shape->xy[1], + xy[0], + xy[1], + distance)) return C_ERR; } else if (shape->type == POLYGON_TYPE) { - if (!geohashGetDistanceIfInPolygon(shape->xy[0], shape->xy[1], xy, shape->t.polygon.points, shape->t.polygon.num_vertices, distance)) { + if (!geohashGetDistanceIfInPolygon(shape->xy[0], + shape->xy[1], + xy, + shape->t.polygon.points, + shape->t.polygon.num_vertices, + distance)) { return C_ERR; } } @@ -415,8 +428,8 @@ int membersOfAllNeighbors(robj *zobj, const GeoHashRadius *n, GeoShape *shape, g * adjacent neighbors can be the same, leading to duplicated * elements. Skip every range which is the same as the one * processed previously. */ - if (last_processed && neighbors[i].bits == neighbors[last_processed].bits && - neighbors[i].step == neighbors[last_processed].step) { + if (last_processed && neighbors[i].bits == neighbors[last_processed].bits + && neighbors[i].step == neighbors[last_processed].step) { if (debugmsg) D("Skipping processing of %d, same as previous\n", i); continue; } @@ -607,19 +620,20 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) { return; } i++; - } else if (!strcasecmp(arg, "store") && (i + 1) < remaining && !(flags & RADIUS_NOSTORE) && - !(flags & GEOSEARCH)) { + } else if (!strcasecmp(arg, "store") && (i + 1) < remaining && !(flags & RADIUS_NOSTORE) + && !(flags & GEOSEARCH)) { storekey = c->argv[base_args + i + 1]; storedist = 0; i++; - } else if (!strcasecmp(arg, "storedist") && (i + 1) < remaining && !(flags & RADIUS_NOSTORE) && - !(flags & GEOSEARCH)) { + } else if (!strcasecmp(arg, "storedist") && (i + 1) < remaining && !(flags & RADIUS_NOSTORE) + && !(flags & GEOSEARCH)) { storekey = c->argv[base_args + i + 1]; storedist = 1; i++; } else if (!strcasecmp(arg, "storedist") && (flags & GEOSEARCH) && (flags & GEOSEARCHSTORE)) { storedist = 1; - } else if (!strcasecmp(arg, "frommember") && (i + 1) < remaining && flags & GEOSEARCH && !fromloc && !bypolygon) { + } else if (!strcasecmp(arg, "frommember") && (i + 1) < remaining && flags & GEOSEARCH && !fromloc + && !bypolygon) { /* No source key, proceed with argument parsing and return an error when done. */ if (zobj == NULL) { frommember = 1; @@ -633,33 +647,43 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) { } frommember = 1; i++; - } else if (!strcasecmp(arg, "fromlonlat") && (i + 2) < remaining && flags & GEOSEARCH && !frommember && !bypolygon) { + } else if (!strcasecmp(arg, "fromlonlat") && (i + 2) < remaining && flags & GEOSEARCH && !frommember + && !bypolygon) { if (extractLongLatOrReply(c, c->argv + base_args + i + 1, shape.xy) == C_ERR) { geoPolygonPointsFree(&shape); return; } fromloc = 1; i += 2; - } else if (!strcasecmp(arg, "byradius") && (i + 2) < remaining && flags & GEOSEARCH && !bybox && !bypolygon) { - if (extractDistanceOrReply(c, c->argv + base_args + i + 1, &shape.conversion, &shape.t.radius) != C_OK) { + } else if (!strcasecmp(arg, "byradius") && (i + 2) < remaining && flags & GEOSEARCH && !bybox + && !bypolygon) { + if (extractDistanceOrReply(c, c->argv + base_args + i + 1, &shape.conversion, &shape.t.radius) + != C_OK) { geoPolygonPointsFree(&shape); return; } shape.type = CIRCULAR_TYPE; byradius = 1; i += 2; - } else if (!strcasecmp(arg, "bybox") && (i + 3) < remaining && flags & GEOSEARCH && !byradius && !bypolygon) { - if (extractBoxOrReply(c, c->argv + base_args + i + 1, &shape.conversion, &shape.t.r.width, - &shape.t.r.height) != C_OK) { + } else if (!strcasecmp(arg, "bybox") && (i + 3) < remaining && flags & GEOSEARCH && !byradius + && !bypolygon) { + if (extractBoxOrReply(c, + c->argv + base_args + i + 1, + &shape.conversion, + &shape.t.r.width, + &shape.t.r.height) + != C_OK) { geoPolygonPointsFree(&shape); return; } shape.type = RECTANGLE_TYPE; bybox = 1; i += 3; - } else if (!strcasecmp(arg, "bypolygon") && (i + 2) < remaining && flags & GEOSEARCH && !byradius && !bybox && !frommember && !fromloc) { + } else if (!strcasecmp(arg, "bypolygon") && (i + 2) < remaining && flags & GEOSEARCH && !byradius && !bybox + && !frommember && !fromloc) { int num_vertices = 0; - if (getIntFromObjectOrReply(c, c->argv[base_args + i + 1], &num_vertices, "invalid number of vertices") != C_OK) { + if (getIntFromObjectOrReply(c, c->argv[base_args + i + 1], &num_vertices, "invalid number of vertices") + != C_OK) { geoPolygonPointsFree(&shape); return; } @@ -677,7 +701,8 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) { shape.type = POLYGON_TYPE; bypolygon = 1; for (int j = 0; j < num_vertices * 2; j += 2) { - if (extractLongLatOrReply(c, c->argv + base_args + i + 2 + j, shape.t.polygon.points[j / 2]) == C_ERR) { + if (extractLongLatOrReply(c, c->argv + base_args + i + 2 + j, shape.t.polygon.points[j / 2]) + == C_ERR) { geoPolygonPointsFree(&shape); return; } @@ -693,21 +718,25 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) { /* Trap options not compatible with STORE and STOREDIST. */ if (storekey && (withdist || withhash || withcoords)) { - addReplyErrorFormat(c, "%s is not compatible with WITHDIST, WITHHASH and WITHCOORD options", + addReplyErrorFormat(c, + "%s is not compatible with WITHDIST, WITHHASH and WITHCOORD options", flags & GEOSEARCHSTORE ? "GEOSEARCHSTORE" : "STORE option in GEORADIUS"); geoPolygonPointsFree(&shape); return; } if ((flags & GEOSEARCH) && !(frommember || fromloc) && !bypolygon) { - addReplyErrorFormat(c, "exactly one of FROMMEMBER or FROMLONLAT can be specified for %s", + addReplyErrorFormat(c, + "exactly one of FROMMEMBER or FROMLONLAT can be specified for %s", (char *)objectGetVal(c->argv[0])); geoPolygonPointsFree(&shape); return; } if ((flags & GEOSEARCH) && !(byradius || bybox || bypolygon)) { - addReplyErrorFormat(c, "exactly one of BYRADIUS, BYBOX and BYPOLYGON can be specified for %s", (char *)objectGetVal(c->argv[0])); + addReplyErrorFormat(c, + "exactly one of BYRADIUS, BYBOX and BYPOLYGON can be specified for %s", + (char *)objectGetVal(c->argv[0])); geoPolygonPointsFree(&shape); return; } @@ -849,7 +878,9 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) { if (returned_items) { zsetConvertToListpackIfNeeded(zobj, maxelelen, totelelen); setKey(c, c->db, storekey, &zobj, 0); - notifyKeyspaceEvent(NOTIFY_ZSET, flags & GEOSEARCH ? "geosearchstore" : "georadiusstore", storekey, + notifyKeyspaceEvent(NOTIFY_ZSET, + flags & GEOSEARCH ? "geosearchstore" : "georadiusstore", + storekey, c->db->id); server.dirty += returned_items; } else if (dbDelete(c->db, storekey)) { @@ -1009,7 +1040,8 @@ void geodistCommand(client *c) { /* Get the scores. We need both otherwise NULL is returned. */ double score1, score2, xyxy[4]; - if (zsetScore(zobj, objectGetVal(c->argv[2]), &score1) == C_ERR || zsetScore(zobj, objectGetVal(c->argv[3]), &score2) == C_ERR) { + if (zsetScore(zobj, objectGetVal(c->argv[2]), &score1) == C_ERR + || zsetScore(zobj, objectGetVal(c->argv[3]), &score2) == C_ERR) { addReplyNull(c); return; } diff --git a/src/geohash.c b/src/geohash.c index 138fd2759ab..f3e92ee1f20 100644 --- a/src/geohash.c +++ b/src/geohash.c @@ -50,8 +50,11 @@ * From: https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN */ static inline uint64_t interleave64(uint32_t xlo, uint32_t ylo) { - static const uint64_t B[] = {0x5555555555555555ULL, 0x3333333333333333ULL, 0x0F0F0F0F0F0F0F0FULL, - 0x00FF00FF00FF00FFULL, 0x0000FFFF0000FFFFULL}; + static const uint64_t B[] = {0x5555555555555555ULL, + 0x3333333333333333ULL, + 0x0F0F0F0F0F0F0F0FULL, + 0x00FF00FF00FF00FFULL, + 0x0000FFFF0000FFFFULL}; static const unsigned int S[] = {1, 2, 4, 8, 16}; uint64_t x = xlo; @@ -79,8 +82,12 @@ static inline uint64_t interleave64(uint32_t xlo, uint32_t ylo) { * derived from http://stackoverflow.com/questions/4909263 */ static inline uint64_t deinterleave64(uint64_t interleaved) { - static const uint64_t B[] = {0x5555555555555555ULL, 0x3333333333333333ULL, 0x0F0F0F0F0F0F0F0FULL, - 0x00FF00FF00FF00FFULL, 0x0000FFFF0000FFFFULL, 0x00000000FFFFFFFFULL}; + static const uint64_t B[] = {0x5555555555555555ULL, + 0x3333333333333333ULL, + 0x0F0F0F0F0F0F0F0FULL, + 0x00FF00FF00FF00FFULL, + 0x0000FFFF0000FFFFULL, + 0x00000000FFFFFFFFULL}; static const unsigned int S[] = {0, 1, 2, 4, 8, 16}; uint64_t x = interleaved; @@ -133,8 +140,8 @@ int geohashEncode(const GeoHashRange *long_range, hash->bits = 0; hash->step = step; - if (latitude < lat_range->min || latitude > lat_range->max || longitude < long_range->min || - longitude > long_range->max) { + if (latitude < lat_range->min || latitude > lat_range->max || longitude < long_range->min + || longitude > long_range->max) { return 0; } diff --git a/src/geohash_helper.c b/src/geohash_helper.c index b64799c0315..ad6df4a1fe6 100644 --- a/src/geohash_helper.c +++ b/src/geohash_helper.c @@ -195,7 +195,8 @@ GeoHashRadius geohashCalculateAreasByShapeWGS84(GeoShape *shape) { radius_meters = shape->t.radius; } else if (shape->type == RECTANGLE_TYPE) { /* For rectangles, calculate the diagonal as the radius. */ - radius_meters = sqrt((shape->t.r.width / 2) * (shape->t.r.width / 2) + (shape->t.r.height / 2) * (shape->t.r.height / 2)); + radius_meters = sqrt((shape->t.r.width / 2) * (shape->t.r.width / 2) + + (shape->t.r.height / 2) * (shape->t.r.height / 2)); } else if (shape->type == POLYGON_TYPE) { /* For polygons, use max distance from the centroid to the bounding box. */ double dist_top_left = geohashGetDistance(longitude, latitude, min_lon, max_lat); @@ -350,14 +351,20 @@ int geohashGetDistanceIfInRectangle(double width_m, * The algorithm is based on PNPOLY - Point Inclusion in Polygon Test by W. Randolph Franklin (WRF). * See: https://wrfranklin.org/Research/Short_Notes/pnpoly.html * Returns 1 if inside the polyon and returns 0 otherwise. */ -int geohashGetDistanceIfInPolygon(double centroidLon, double centroidLat, double *point, double (*vertices)[2], int num_vertices, double *distance) { +int geohashGetDistanceIfInPolygon(double centroidLon, + double centroidLat, + double *point, + double (*vertices)[2], + int num_vertices, + double *distance) { int i, j; int inside = 0; for (i = 0, j = num_vertices - 1; i < num_vertices; j = i++) { double *vertexA = vertices[i]; double *vertexB = vertices[j]; - if (((vertexA[1] > point[1]) != (vertexB[1] > point[1])) && - (point[0] < (vertexB[0] - vertexA[0]) * (point[1] - vertexA[1]) / (vertexB[1] - vertexA[1]) + vertexA[0])) { + if (((vertexA[1] > point[1]) != (vertexB[1] > point[1])) + && (point[0] + < (vertexB[0] - vertexA[0]) * (point[1] - vertexA[1]) / (vertexB[1] - vertexA[1]) + vertexA[0])) { inside = !inside; } } diff --git a/src/geohash_helper.h b/src/geohash_helper.h index c84e4d11c73..f81881d9f31 100644 --- a/src/geohash_helper.h +++ b/src/geohash_helper.h @@ -61,6 +61,11 @@ int geohashGetDistanceIfInRectangle(double width_m, double x2, double y2, double *distance); -int geohashGetDistanceIfInPolygon(double centroidLon, double centroidLat, double *point, double (*vertices)[2], int num_vertices, double *distance); +int geohashGetDistanceIfInPolygon(double centroidLon, + double centroidLat, + double *point, + double (*vertices)[2], + int num_vertices, + double *distance); #endif /* GEOHASH_HELPER_HPP_ */ diff --git a/src/hashtable.c b/src/hashtable.c index a349ae9c0ce..98c24de975b 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -333,8 +333,7 @@ struct iter { }; /* The opaque hashtableIterator is defined as a blob of bytes. */ -static_assert(sizeof(hashtableIterator) >= sizeof(iter), - "Opaque iterator size"); +static_assert(sizeof(hashtableIterator) >= sizeof(iter), "Opaque iterator size"); /* Position, used by some hashtable functions such as two-phase insert and delete. */ typedef struct { @@ -343,8 +342,7 @@ typedef struct { uint16_t table_index; } position; -static_assert(sizeof(hashtablePosition) >= sizeof(position), - "Opaque iterator size"); +static_assert(sizeof(hashtablePosition) >= sizeof(position), "Opaque iterator size"); /* State for incremental find. */ typedef struct { @@ -363,8 +361,7 @@ typedef struct { uint64_t hash; } incrementalFind; -static_assert(sizeof(hashtableIncrementalFindState) >= sizeof(incrementalFind), - "Opaque incremental find state size"); +static_assert(sizeof(hashtableIncrementalFindState) >= sizeof(incrementalFind), "Opaque incremental find state size"); /* Struct used for stats functions. */ struct hashtableStats { @@ -825,7 +822,13 @@ static bool expand(hashtable *ht, size_t size, int *malloc_failed) { * entry at that position matches the provided key. If a match is found, it * updates the position and table index pointers and returns 1. Otherwise, * it returns 0. */ -static inline int checkCandidateInBucket(hashtable *ht, bucket *b, int pos, const void *key, int table, int *pos_in_bucket, int *table_index) { +static inline int checkCandidateInBucket(hashtable *ht, + bucket *b, + int pos, + const void *key, + int table, + int *pos_in_bucket, + int *table_index) { /* It's a candidate. */ void *entry = b->entries[pos]; const void *elem_key = entryGetKey(ht, entry); @@ -844,7 +847,13 @@ static inline int checkCandidateInBucket(hashtable *ht, bucket *b, int pos, cons #if HAVE_X86_SIMD ATTRIBUTE_TARGET_SSE2 -static int findKeyInBucketSSE2(hashtable *ht, bucket *b, uint8_t h2, const void *key, int table, int *pos_in_bucket, int *table_index) { +static int findKeyInBucketSSE2(hashtable *ht, + bucket *b, + uint8_t h2, + const void *key, + int table, + int *pos_in_bucket, + int *table_index) { /* Get the bucket's presence mask - indicates which positions are filled. */ BUCKET_BITS_TYPE presence_mask = b->presence & ((1 << ENTRIES_PER_BUCKET) - 1); __m128i hash_vector = _mm_loadu_si128((__m128i *)b->hashes); @@ -879,7 +888,13 @@ static inline int popMatchBitmask(uint64_t *mask) { return pos; } -static int findKeyInBucketNeon(hashtable *ht, bucket *b, uint8_t h2, const void *key, int table, int *pos_in_bucket, int *table_index) { +static int findKeyInBucketNeon(hashtable *ht, + bucket *b, + uint8_t h2, + const void *key, + int table, + int *pos_in_bucket, + int *table_index) { const uint8x8_t hash_vector = vld1_u8(b->hashes); /* simple load */ const uint8x8_t h2_vector = vdup_n_u8(h2); /* duplicated into every byte */ const uint8x8_t equal_mask = vceq_u8(hash_vector, h2_vector); /* compare: 8 bits per item, 0xFF or 0x00 */ @@ -891,8 +906,7 @@ static int findKeyInBucketNeon(hashtable *ht, bucket *b, uint8_t h2, const void while (matches) { int pos = popMatchBitmask(&matches); - if ((b->presence & (1 << pos)) && - checkCandidateInBucket(ht, b, pos, key, table, pos_in_bucket, table_index)) + if ((b->presence & (1 << pos)) && checkCandidateInBucket(ht, b, pos, key, table, pos_in_bucket, table_index)) return 1; } return 0; /* No match */ @@ -931,8 +945,9 @@ static bucket *findBucket(hashtable *ht, uint64_t hash, const void *key, int *po #else /* Find candidate entries with presence flag set and matching h2 hash. */ for (int pos = 0; pos < numBucketPositions(b); pos++) { - if (isPositionFilled(b, pos) && b->hashes[pos] == h2 && - checkCandidateInBucket(ht, b, pos, key, table, pos_in_bucket, table_index)) return b; + if (isPositionFilled(b, pos) && b->hashes[pos] == h2 + && checkCandidateInBucket(ht, b, pos, key, table, pos_in_bucket, table_index)) + return b; } #endif b = getChildBucket(b); @@ -1966,10 +1981,8 @@ bool hashtableIncrementalFindStep(hashtableIncrementalFindState *state) { data->pos = 0; } return true; - case HASHTABLE_FOUND: - return false; - case HASHTABLE_NOT_FOUND: - return false; + case HASHTABLE_FOUND: return false; + case HASHTABLE_NOT_FOUND: return false; } assert(0); } @@ -2043,7 +2056,12 @@ size_t hashtableScan(hashtable *ht, size_t cursor, hashtableScanFunction fn, voi * purpose of defragmentation) and updating the pointer to the entry inside * the hash table. */ -size_t hashtableScanDefrag(hashtable *ht, size_t cursor, hashtableScanFunction fn, void *privdata, void *(*defragfn)(void *), int flags) { +size_t hashtableScanDefrag(hashtable *ht, + size_t cursor, + hashtableScanFunction fn, + void *privdata, + void *(*defragfn)(void *), + int flags) { if (hashtableSize(ht) == 0) return 0; /* Prevent entries from being moved around during the scan call, as a @@ -2244,8 +2262,7 @@ void hashtableCleanupIterator(hashtableIterator *iterator) { assert(iter->fingerprint == hashtableFingerprint(iter->hashtable)); } } - if (isSafe(iter)) - untrackSafeIterator(iter); + if (isSafe(iter)) untrackSafeIterator(iter); } /* Allocates and initializes an iterator. */ @@ -2308,8 +2325,8 @@ bool hashtableNext(hashtableIterator *iterator, void **elemptr) { * this iterator is the only reason for pausing rehashing, * we can do the compaction now when we're done with a * bucket chain, before we move on to the next index. */ - if (iter->hashtable->pause_rehash == 1 && - iter->hashtable->used[iter->table] < iter->last_seen_size) { + if (iter->hashtable->pause_rehash == 1 + && iter->hashtable->used[iter->table] < iter->last_seen_size) { compactBucketChain(iter->hashtable, iter->index, iter->table); } iter->last_seen_size = iter->hashtable->used[iter->table]; @@ -2339,7 +2356,8 @@ bool hashtableNext(hashtableIterator *iterator, void **elemptr) { /* No entry here. */ continue; } - if (!(iter->flags & HASHTABLE_ITER_SKIP_VALIDATION) && !validateElementIfNeeded(iter->hashtable, b->entries[iter->pos_in_bucket])) { + if (!(iter->flags & HASHTABLE_ITER_SKIP_VALIDATION) + && !validateElementIfNeeded(iter->hashtable, b->entries[iter->pos_in_bucket])) { continue; } /* Return the entry at this position. */ @@ -2477,20 +2495,21 @@ hashtableStats *hashtableGetStatsHt(hashtable *ht, int table_index, int full) { /* Generates human readable stats. */ size_t hashtableGetStatsMsg(char *buf, size_t bufsize, hashtableStats *stats, int full) { size_t l = 0; - l += snprintf(buf + l, bufsize - l, + l += snprintf(buf + l, + bufsize - l, "Hash table %d stats (%s):\n" " table size: %lu\n" " number of entries: %lu\n", stats->table_index, - (stats->table_index == 0) ? "main hash table" : "rehashing target", stats->size, + (stats->table_index == 0) ? "main hash table" : "rehashing target", + stats->size, stats->used); if (stats->table_index == 0) { - l += snprintf(buf + l, bufsize - l, - " rehashing index: %zd\n", - stats->rehash_index); + l += snprintf(buf + l, bufsize - l, " rehashing index: %zd\n", stats->rehash_index); } if (full) { - l += snprintf(buf + l, bufsize - l, + l += snprintf(buf + l, + bufsize - l, " top-level buckets: %lu\n" " child buckets: %lu\n" " max chain length: %lu\n" @@ -2503,7 +2522,11 @@ size_t hashtableGetStatsMsg(char *buf, size_t bufsize, hashtableStats *stats, in for (unsigned long i = 0; i < HASHTABLE_STATS_VECTLEN - 1; i++) { if (stats->clvector[i] == 0) continue; if (l >= bufsize) break; - l += snprintf(buf + l, bufsize - l, " %ld: %ld (%.02f%%)\n", i, stats->clvector[i], + l += snprintf(buf + l, + bufsize - l, + " %ld: %ld (%.02f%%)\n", + i, + stats->clvector[i], ((float)stats->clvector[i] / stats->toplevel_buckets) * 100); } } @@ -2538,8 +2561,11 @@ void hashtableGetStats(char *buf, size_t bufsize, hashtable *ht, int full) { void hashtableDump(hashtable *ht) { for (int table = 0; table <= 1; table++) { printf("Table %d, used %zu, exp %d, top-level buckets %zu, child buckets %zu\n", - table, ht->used[table], ht->bucket_exp[table], - numBuckets(ht->bucket_exp[table]), ht->child_buckets[table]); + table, + ht->used[table], + ht->bucket_exp[table], + numBuckets(ht->bucket_exp[table]), + ht->child_buckets[table]); for (size_t idx = 0; idx < numBuckets(ht->bucket_exp[table]); idx++) { bucket *b = &ht->tables[table][idx]; int level = 0; @@ -2547,7 +2573,9 @@ void hashtableDump(hashtable *ht) { printf(" Bucket %d:%zu level:%d\n", table, idx, level); for (int pos = 0; pos < ENTRIES_PER_BUCKET; pos++) { if (isPositionFilled(b, pos)) { - printf(" %d h2 %02x, key \"%s\"\n", pos, b->hashes[pos], + printf(" %d h2 %02x, key \"%s\"\n", + pos, + b->hashes[pos], (const char *)entryGetKey(ht, b->entries[pos])); } } @@ -2575,7 +2603,10 @@ void hashtableHistogram(hashtable *ht) { } size_t chains_left = size; printf("Bucket fill table=%d size=%zu children=%zu used=%zu:\n", - table, size, ht->child_buckets[table], ht->used[table]); + table, + size, + ht->child_buckets[table], + ht->used[table]); do { printf(" "); for (size_t idx = 0; idx < size; idx++) { diff --git a/src/hashtable.h b/src/hashtable.h index 8bbf5d8c05b..6c0e6141cea 100644 --- a/src/hashtable.h +++ b/src/hashtable.h @@ -160,7 +160,12 @@ bool hashtableIncrementalFindGetResult(hashtableIncrementalFindState *state, voi /* Iteration & scan */ size_t hashtableScan(hashtable *ht, size_t cursor, hashtableScanFunction fn, void *privdata); -size_t hashtableScanDefrag(hashtable *ht, size_t cursor, hashtableScanFunction fn, void *privdata, void *(*defragfn)(void *), int flags); +size_t hashtableScanDefrag(hashtable *ht, + size_t cursor, + hashtableScanFunction fn, + void *privdata, + void *(*defragfn)(void *), + int flags); void hashtableInitIterator(hashtableIterator *iter, hashtable *ht, uint8_t flags); void hashtableRetargetIterator(hashtableIterator *iterator, hashtable *ht); void hashtableCleanupIterator(hashtableIterator *iter); diff --git a/src/hyperloglog.c b/src/hyperloglog.c index 783212014d1..ba1f3bf0009 100644 --- a/src/hyperloglog.c +++ b/src/hyperloglog.c @@ -208,12 +208,12 @@ struct hllhdr { #define HLL_INVALIDATE_CACHE(hdr) (hdr)->card[7] |= (1 << 7) #define HLL_VALID_CACHE(hdr) (((hdr)->card[7] & (1 << 7)) == 0) -#define HLL_P 14 /* The greater is P, the smaller the error. */ -#define HLL_Q (64 - HLL_P) /* The number of bits of the hash value used for \ - determining the number of leading zeros. */ -#define HLL_REGISTERS (1 << HLL_P) /* With P=14, 16384 registers. */ -#define HLL_P_MASK (HLL_REGISTERS - 1) /* Mask to index register. */ -#define HLL_BITS 6 /* Enough to count up to 63 leading zeroes. */ +#define HLL_P 14 /* The greater is P, the smaller the error. */ +#define HLL_Q (64 - HLL_P) /* The number of bits of the hash value used for \ + determining the number of leading zeros. */ +#define HLL_REGISTERS (1 << HLL_P) /* With P=14, 16384 registers. */ +#define HLL_P_MASK (HLL_REGISTERS - 1) /* Mask to index register. */ +#define HLL_BITS 6 /* Enough to count up to 63 leading zeroes. */ #define HLL_REGISTER_MAX ((1 << HLL_BITS) - 1) #define HLL_HDR_SIZE sizeof(struct hllhdr) #define HLL_DENSE_SIZE (HLL_HDR_SIZE + ((HLL_REGISTERS * HLL_BITS + 7) / 8)) @@ -401,8 +401,8 @@ static int simd_enabled = 1; /* Macros to access the sparse representation. * The macros parameter is expected to be an uint8_t pointer. */ -#define HLL_SPARSE_XZERO_BIT 0x40 /* 01xxxxxx */ -#define HLL_SPARSE_VAL_BIT 0x80 /* 1vvvvvxx */ +#define HLL_SPARSE_XZERO_BIT 0x40 /* 01xxxxxx */ +#define HLL_SPARSE_VAL_BIT 0x80 /* 1vvvvvxx */ #define HLL_SPARSE_IS_ZERO(p) (((*(p)) & 0xc0) == 0) /* 00xxxxxx */ #define HLL_SPARSE_IS_XZERO(p) (((*(p)) & 0xc0) == HLL_SPARSE_XZERO_BIT) #define HLL_SPARSE_IS_VAL(p) ((*(p)) & HLL_SPARSE_VAL_BIT) @@ -1142,14 +1142,38 @@ void hllMergeDenseAVX2(uint8_t *reg_raw, const uint8_t *reg_dense) { * To: {AAA0|BBB0|CCC0|DDD0|EEE0|FFF0|GGG0|HHH0} */ const __m256i shuffle = _mm256_setr_epi8( // - 4, 5, 6, -1, // - 7, 8, 9, -1, // - 10, 11, 12, -1, // - 13, 14, 15, -1, // - 0, 1, 2, -1, // - 3, 4, 5, -1, // - 6, 7, 8, -1, // - 9, 10, 11, -1 // + 4, + 5, + 6, + -1, // + 7, + 8, + 9, + -1, // + 10, + 11, + 12, + -1, // + 13, + 14, + 15, + -1, // + 0, + 1, + 2, + -1, // + 3, + 4, + 5, + -1, // + 6, + 7, + 8, + -1, // + 9, + 10, + 11, + -1 // ); /* Merge the first 8 registers (6 bytes) normally @@ -1250,10 +1274,7 @@ void hllMergeDenseNEON(uint8_t *reg_raw, const uint8_t *reg_dense) { uint8_t *dense_ptr = (uint8_t *)reg_dense; uint8_t *raw_ptr = (uint8_t *)reg_raw; - uint8x16_t idx = {0, 1, 2, 0xFF, - 3, 4, 5, 0xFF, - 6, 7, 8, 0xFF, - 9, 10, 11, 0xFF}; + uint8x16_t idx = {0, 1, 2, 0xFF, 3, 4, 5, 0xFF, 6, 7, 8, 0xFF, 9, 10, 11, 0xFF}; // Bit masks for extracting specific bit ranges uint8x16_t mask1 = vreinterpretq_u8_u32(vdupq_n_u32(0x0000003f)); // Bits 0-5 @@ -1424,16 +1445,38 @@ void hllDenseCompressAVX2(uint8_t *reg_dense, const uint8_t *reg_raw) { * To: {AAAB|BBCC|CDDD|0000|EEEF|FFGG|GHHH|0000} */ const __m256i shuffle = _mm256_setr_epi8( // - 0, 1, 2, // - 4, 5, 6, // - 8, 9, 10, // - 12, 13, 14, // - -1, -1, -1, -1, // - 0, 1, 2, // - 4, 5, 6, // - 8, 9, 10, // - 12, 13, 14, // - -1, -1, -1, -1 // + 0, + 1, + 2, // + 4, + 5, + 6, // + 8, + 9, + 10, // + 12, + 13, + 14, // + -1, + -1, + -1, + -1, // + 0, + 1, + 2, // + 4, + 5, + 6, // + 8, + 9, + 10, // + 12, + 13, + 14, // + -1, + -1, + -1, + -1 // ); /* Raw to Dense: @@ -1522,6 +1565,7 @@ void hllDenseCompressNEON(uint8_t *reg_dense, const uint8_t *reg_raw) { * From: {AAA0|BBB0|CCC0|DDD0} * To: {AAAB|BBCC|CDDD|0000} */ + // clang-format off uint8x16_t idx = { 0, 1, 2, // Extract bytes from lane 0 4, 5, 6, // Extract bytes from lane 1 @@ -1529,6 +1573,7 @@ void hllDenseCompressNEON(uint8_t *reg_dense, const uint8_t *reg_raw) { 12, 13, 14, // Extract bytes from lane 3 0xFF, 0xFF, 0xFF, 0xFF // Zero out last 4 elements (padding) }; + // clang-format on // Bit masks for extracting first 6 bits from every byte within 32-bit lanes uint32x4_t mask1 = vdupq_n_u32(0x0000003F); // Extract bits 0-5 @@ -1655,8 +1700,9 @@ int isHLLObjectOrReply(client *c, robj *o) { return C_OK; invalid: - addReplyError(c, "-WRONGTYPE Key is not a valid " - "HyperLogLog string value."); + addReplyError(c, + "-WRONGTYPE Key is not a valid " + "HyperLogLog string value."); return C_ERR; } @@ -1902,7 +1948,10 @@ void pfselftestCommand(client *c) { HLL_DENSE_GET_REGISTER(val, hdr->registers, i); if (val != bytecounters[i]) { - addReplyErrorFormat(c, "TESTFAILED Register %d should be %d but is %d", i, (int)bytecounters[i], + addReplyErrorFormat(c, + "TESTFAILED Register %d should be %d but is %d", + i, + (int)bytecounters[i], (int)val); goto cleanup; } @@ -1959,8 +2008,10 @@ void pfselftestCommand(client *c) { if (abserr < 0) abserr = -abserr; if (abserr > (int64_t)maxerr) { - addReplyErrorFormat(c, "TESTFAILED Too big error. card:%llu abserr:%llu", - (unsigned long long)checkpoint, (unsigned long long)abserr); + addReplyErrorFormat(c, + "TESTFAILED Too big error. card:%llu abserr:%llu", + (unsigned long long)checkpoint, + (unsigned long long)abserr); goto cleanup; } checkpoint *= 10; diff --git a/src/io_threads.c b/src/io_threads.c index ca7d142fd9b..94ad540d6ff 100644 --- a/src/io_threads.c +++ b/src/io_threads.c @@ -175,8 +175,8 @@ void IOThreadsAfterSleep(int numevents) { float cpu_sys = (float)getInstantaneousMetric(STATS_METRIC_MAIN_THREAD_CPU_SYS) / 10000.0; float cpu_user = (float)getInstantaneousMetric(STATS_METRIC_MAIN_THREAD_CPU_USER) / 10000.0; /* Ignite IO threads if sys CPU > 30%, or if sys CPU > 5% and user CPU > 50% */ - should_ignite = (cpu_sys > IO_IGNITION_CPU_SYS) || - (cpu_sys > IO_IGNITION_CPU_SYS_LOW && cpu_user > IO_IGNITION_CPU_USER); + should_ignite = (cpu_sys > IO_IGNITION_CPU_SYS) + || (cpu_sys > IO_IGNITION_CPU_SYS_LOW && cpu_user > IO_IGNITION_CPU_USER); #else should_ignite = (numevents >= IO_IGNITION_EVENTS); #endif @@ -263,7 +263,8 @@ static void flushPendingIOResponses(int blocking) { /* Try to enqueue. If blocking is set, retry until success. */ do { pushed = mpscEnqueue(&io_shared_outbox, job, &io_thread_ticket); - if (pushed || !blocking || server.crashed) break; /* On server crash we kill the IO threads, no point in sending back jobs to the main-thread. */ + if (pushed || !blocking || server.crashed) + break; /* On server crash we kill the IO threads, no point in sending back jobs to the main-thread. */ atomic_thread_fence(memory_order_acquire); } while (true); @@ -325,14 +326,9 @@ static void *IOThreadMain(void *myid) { untagJob(batch_jobs[i], &data, &type); switch (type) { - case JOB_REQ_FREE_ARGV: - IOThreadFreeArgv((robj **)data); - break; - case JOB_REQ_POLL: - IOThreadPoll((aeEventLoop *)data); - break; - default: - serverPanic("Invalid SPSC job type: %d", type); + case JOB_REQ_FREE_ARGV: IOThreadFreeArgv((robj **)data); break; + case JOB_REQ_POLL: IOThreadPoll((aeEventLoop *)data); break; + default: serverPanic("Invalid SPSC job type: %d", type); } } processed += batch_count; @@ -349,23 +345,12 @@ static void *IOThreadMain(void *myid) { untagJob(tagged_job, &data, &type); switch (type) { - case JOB_REQ_READ_CLIENT: - ioThreadReadQueryFromClient((client *)data); - break; - case JOB_REQ_WRITE_CLIENT: - ioThreadWriteToClient((client *)data); - break; - case JOB_REQ_FREE_OBJ: - decrRefCount(data); - break; - case JOB_REQ_ACCEPT: - ioThreadAccept((client *)data); - break; - case JOB_REQ_POLL: - IOThreadPoll((aeEventLoop *)data); - break; - default: - serverPanic("Invalid SPMC job type: %d", type); + case JOB_REQ_READ_CLIENT: ioThreadReadQueryFromClient((client *)data); break; + case JOB_REQ_WRITE_CLIENT: ioThreadWriteToClient((client *)data); break; + case JOB_REQ_FREE_OBJ: decrRefCount(data); break; + case JOB_REQ_ACCEPT: ioThreadAccept((client *)data); break; + case JOB_REQ_POLL: IOThreadPoll((aeEventLoop *)data); break; + default: serverPanic("Invalid SPMC job type: %d", type); } processed++; } diff --git a/src/kvstore.c b/src/kvstore.c index 846b58705eb..ec10584f821 100644 --- a/src/kvstore.c +++ b/src/kvstore.c @@ -52,6 +52,7 @@ static hashtable *kvstoreIteratorNextHashtable(kvstoreIterator *kvs_it); +// clang-format off struct _kvstore { int flags; hashtableType *dtype; @@ -71,6 +72,7 @@ struct _kvstore { hashtable *importing; /* The set of hashtable indexes that are being imported */ unsigned long long importing_key_count; /* Total number of importing keys in this kvstore. */ }; +// clang-format on /* Structure for kvstore iterator that allows iterating across multiple hashtables. */ struct _kvstoreIterator { @@ -211,8 +213,8 @@ static hashtable *createHashtableIfNeeded(kvstore *kvs, int didx) { * and Scan, we won't delete the hashtable. We will check whether it needs * to be deleted when we're releasing the iterator. */ static void freeHashtableIfNeeded(kvstore *kvs, int didx) { - if (!(kvs->flags & KVSTORE_FREE_EMPTY_HASHTABLES) || !kvstoreGetHashtable(kvs, didx) || kvstoreHashtableSize(kvs, didx) != 0 || - kvstoreHashtableIsRehashingPaused(kvs, didx)) + if (!(kvs->flags & KVSTORE_FREE_EMPTY_HASHTABLES) || !kvstoreGetHashtable(kvs, didx) + || kvstoreHashtableSize(kvs, didx) != 0 || kvstoreHashtableIsRehashingPaused(kvs, didx)) return; hashtableRelease(kvs->hashtables[didx]); kvs->hashtables[didx] = NULL; @@ -304,7 +306,9 @@ kvstore *kvstoreCreate(hashtableType *type, int num_hashtables_bits, int flags) kvs->hashtables = zcalloc(sizeof(hashtable *) * kvs->num_hashtables); kvs->importing = hashtableCreate(&intHashtableType); kvs->rehashing = listCreate(); - kvs->hashtable_size_index = kvs->num_hashtables > 1 ? zcalloc(sizeof(unsigned long long) * (kvs->num_hashtables + 1)) : NULL; + kvs->hashtable_size_index = kvs->num_hashtables > 1 + ? zcalloc(sizeof(unsigned long long) * (kvs->num_hashtables + 1)) + : NULL; if (!(kvs->flags & KVSTORE_ALLOCATE_HASHTABLES_ON_DEMAND)) { for (int i = 0; i < kvs->num_hashtables; i++) createHashtableIfNeeded(kvs, i); } @@ -331,7 +335,8 @@ void kvstoreEmpty(kvstore *kvs, void(callback)(hashtable *)) { kvs->non_empty_hashtables = 0; kvs->resize_cursor = 0; kvs->bucket_count = 0; - if (kvs->hashtable_size_index) memset(kvs->hashtable_size_index, 0, sizeof(unsigned long long) * (kvs->num_hashtables + 1)); + if (kvs->hashtable_size_index) + memset(kvs->hashtable_size_index, 0, sizeof(unsigned long long) * (kvs->num_hashtables + 1)); kvs->overhead_hashtable_rehashing = 0; } @@ -897,7 +902,11 @@ bool kvstoreHashtableAdd(kvstore *kvs, int didx, void *entry) { return ret; } -bool kvstoreHashtableFindPositionForInsert(kvstore *kvs, int didx, void *key, hashtablePosition *position, void **existing) { +bool kvstoreHashtableFindPositionForInsert(kvstore *kvs, + int didx, + void *key, + hashtablePosition *position, + void **existing) { hashtable *ht = createHashtableIfNeeded(kvs, didx); return hashtableFindPositionForInsert(ht, key, position, existing); } diff --git a/src/kvstore.h b/src/kvstore.h index c47ffbb9158..3fde4daf26e 100644 --- a/src/kvstore.h +++ b/src/kvstore.h @@ -87,7 +87,11 @@ bool kvstoreHashtableFind(kvstore *kvs, int didx, void *key, void **found); void **kvstoreHashtableFindRef(kvstore *kvs, int didx, const void *key); bool kvstoreHashtableAdd(kvstore *kvs, int didx, void *entry); -bool kvstoreHashtableFindPositionForInsert(kvstore *kvs, int didx, void *key, hashtablePosition *position, void **existing); +bool kvstoreHashtableFindPositionForInsert(kvstore *kvs, + int didx, + void *key, + hashtablePosition *position, + void **existing); void kvstoreHashtableInsertAtPosition(kvstore *kvs, int didx, void *entry, void *position); void **kvstoreHashtableTwoPhasePopFindRef(kvstore *kvs, int didx, const void *key, void *position); diff --git a/src/latency.c b/src/latency.c index f71094c3949..30a64742465 100644 --- a/src/latency.c +++ b/src/latency.c @@ -217,9 +217,9 @@ sds createLatencyReport(void) { /* Return ASAP if the latency engine is disabled and it looks like it * was never enabled so far. */ if (dictSize(server.latency_events) == 0 && server.latency_monitor_threshold == 0) { - report = sdscat( - report, "I'm sorry, Dave, I can't do that. Latency monitoring is disabled in this Valkey instance. You may " - "use \"CONFIG SET latency-monitor-threshold .\" in order to enable it.\n"); + report = sdscat(report, + "I'm sorry, Dave, I can't do that. Latency monitoring is disabled in this Valkey instance. You " + "may use \"CONFIG SET latency-monitor-threshold .\" in order to enable it.\n"); return report; } @@ -245,8 +245,13 @@ sds createLatencyReport(void) { report = sdscatprintf(report, "%d. %s: %d latency spikes (average %lums, mean deviation %lums, period %.2f sec). Worst " "all time event %lums.", - eventnum, event, ls.samples, (unsigned long)ls.avg, (unsigned long)ls.mad, - (double)ls.period / ls.samples, (unsigned long)ts->max); + eventnum, + event, + ls.samples, + (unsigned long)ls.avg, + (unsigned long)ls.mad, + (double)ls.period / ls.samples, + (unsigned long)ts->max); /* Fork */ if (!strcasecmp(event, "fork")) { @@ -269,7 +274,8 @@ sds createLatencyReport(void) { /* Potentially commands. */ if (!strcasecmp(event, "command")) { - if (server.commandlog[COMMANDLOG_TYPE_SLOW].threshold < 0 || server.commandlog[COMMANDLOG_TYPE_SLOW].max_len == 0) { + if (server.commandlog[COMMANDLOG_TYPE_SLOW].threshold < 0 + || server.commandlog[COMMANDLOG_TYPE_SLOW].max_len == 0) { advise_slowlog_enabled = 1; advices++; } else if (server.commandlog[COMMANDLOG_TYPE_SLOW].threshold / 1000 > server.latency_monitor_threshold) { @@ -358,21 +364,24 @@ sds createLatencyReport(void) { } if (eventnum == 0 && advices == 0) { - report = sdscat(report, "No latency spike was observed during the lifetime of this Valkey instance, not " - "in the slightest bit.\n"); + report = sdscat(report, + "No latency spike was observed during the lifetime of this Valkey instance, not " + "in the slightest bit.\n"); } else if (eventnum > 0 && advices == 0) { - report = sdscat(report, "\nThere are latency events logged that are not easy to fix. Please get some " - "help from Valkey community, providing this report in your help request.\n"); + report = sdscat(report, + "\nThere are latency events logged that are not easy to fix. Please get some " + "help from Valkey community, providing this report in your help request.\n"); } else { /* Add all the suggestions accumulated so far. */ /* Better VM. */ report = sdscat(report, "\nHere is some advice for you:\n\n"); if (advise_better_vm) { - report = sdscat(report, "- If you are using a virtual machine, consider upgrading it with a faster one " - "using a hypervisior that provides less latency during fork() calls. Xen is known " - "to have poor fork() performance. Even in the context of the same VM provider, " - "certain kinds of instances can execute fork faster than others.\n"); + report = sdscat(report, + "- If you are using a virtual machine, consider upgrading it with a faster one " + "using a hypervisior that provides less latency during fork() calls. Xen is known " + "to have poor fork() performance. Even in the context of the same VM provider, " + "certain kinds of instances can execute fork faster than others.\n"); } /* Slow log. */ @@ -386,11 +395,11 @@ sds createLatencyReport(void) { } if (advise_slowlog_tuning) { - report = sdscatprintf( - report, - "- Your current Slow Log configuration only logs events that are slower than your configured latency " - "monitor threshold. Please use 'CONFIG SET slowlog-log-slower-than %llu'.\n", - (unsigned long long)server.latency_monitor_threshold * 1000); + report = sdscatprintf(report, + "- Your current Slow Log configuration only logs events that are slower than your " + "configured latency " + "monitor threshold. Please use 'CONFIG SET slowlog-log-slower-than %llu'.\n", + (unsigned long long)server.latency_monitor_threshold * 1000); } if (advise_slowlog_inspect) { @@ -429,66 +438,72 @@ sds createLatencyReport(void) { } if (advise_data_writeback) { - report = - sdscat(report, "- Mounting ext3/4 filesystems with data=writeback can provide a performance boost " - "compared to data=ordered, however this mode of operation provides less guarantees, and " - "sometimes it can happen that after a hard crash the AOF file will have a half-written " - "command at the end and will require to be repaired before Valkey restarts.\n"); + report = sdscat(report, + "- Mounting ext3/4 filesystems with data=writeback can provide a performance boost " + "compared to data=ordered, however this mode of operation provides less guarantees, and " + "sometimes it can happen that after a hard crash the AOF file will have a half-written " + "command at the end and will require to be repaired before Valkey restarts.\n"); } if (advise_disk_contention) { - report = sdscat(report, "- Try to lower the disk contention. This is often caused by other disk intensive " - "processes running in the same computer (including other Valkey instances).\n"); + report = sdscat(report, + "- Try to lower the disk contention. This is often caused by other disk intensive " + "processes running in the same computer (including other Valkey instances).\n"); } if (advise_no_appendfsync) { - report = sdscat(report, "- Assuming from the point of view of data safety this is viable in your " - "environment, you could try to enable the 'no-appendfsync-on-rewrite' option, so " - "that fsync will not be performed while there is a child rewriting the AOF file or " - "producing an RDB file (the moment where there is high disk contention).\n"); + report = sdscat(report, + "- Assuming from the point of view of data safety this is viable in your " + "environment, you could try to enable the 'no-appendfsync-on-rewrite' option, so " + "that fsync will not be performed while there is a child rewriting the AOF file or " + "producing an RDB file (the moment where there is high disk contention).\n"); } if (advise_relax_fsync_policy && server.aof_fsync == AOF_FSYNC_ALWAYS) { - report = sdscat(report, "- Your fsync policy is set to 'always'. It is very hard to get good performances " - "with such a setup, if possible try to relax the fsync policy to 'onesec'.\n"); + report = sdscat(report, + "- Your fsync policy is set to 'always'. It is very hard to get good performances " + "with such a setup, if possible try to relax the fsync policy to 'onesec'.\n"); } if (advise_write_load_info) { - report = sdscat( - report, "- Latency during the AOF atomic rename operation or when the final difference is flushed to " - "the AOF file at the end of the rewrite, sometimes is caused by very high write load, causing " - "the AOF buffer to get very large. If possible try to send less commands to accomplish the " - "same work, or use Lua scripts to group multiple operations into a single EVALSHA call.\n"); + report = sdscat(report, + "- Latency during the AOF atomic rename operation or when the final difference is flushed " + "to the AOF file at the end of the rewrite, sometimes is caused by very high write load, " + "causing the AOF buffer to get very large. If possible try to send less commands to " + "accomplish the same work, or use Lua scripts to group multiple operations into a single " + "EVALSHA call.\n"); } if (advise_hz && server.hz < 100) { - report = sdscat(report, "- In order to make the Valkey keys expiring process more incremental, try to set " - "the 'hz' configuration parameter to 100 using 'CONFIG SET hz 100'.\n"); + report = sdscat(report, + "- In order to make the Valkey keys expiring process more incremental, try to set " + "the 'hz' configuration parameter to 100 using 'CONFIG SET hz 100'.\n"); } if (advise_large_objects) { - report = - sdscat(report, "- Deleting, expiring or evicting (because of maxmemory policy) large objects is a " - "blocking operation. If you have very large objects that are often deleted, expired, or " - "evicted, try to fragment those objects into multiple smaller objects.\n"); + report = sdscat(report, + "- Deleting, expiring or evicting (because of maxmemory policy) large objects is a " + "blocking operation. If you have very large objects that are often deleted, expired, or " + "evicted, try to fragment those objects into multiple smaller objects.\n"); } if (advise_mass_eviction) { - report = sdscat(report, "- Sudden changes to the 'maxmemory' setting via 'CONFIG SET', or allocation of " - "large objects via sets or sorted sets intersections, STORE option of SORT, Valkey " - "Cluster large keys migrations (RESTORE command), may create sudden memory " - "pressure forcing the server to block trying to evict keys. \n"); + report = sdscat(report, + "- Sudden changes to the 'maxmemory' setting via 'CONFIG SET', or allocation of " + "large objects via sets or sorted sets intersections, STORE option of SORT, Valkey " + "Cluster large keys migrations (RESTORE command), may create sudden memory " + "pressure forcing the server to block trying to evict keys. \n"); } if (advise_disable_thp) { - report = - sdscat(report, "- I detected a non zero amount of anonymous huge pages used by your process. This " - "creates very serious latency events in different conditions, especially when " - "Valkey is persisting on disk. To disable THP support use the command 'echo never > " - "/sys/kernel/mm/transparent_hugepage/enabled', make sure to also add it into " - "/etc/rc.local so that the command will be executed again after a reboot. Note " - "that even if you have already disabled THP, you still need to restart the Valkey " - "process to get rid of the huge pages already created.\n"); + report = sdscat(report, + "- I detected a non zero amount of anonymous huge pages used by your process. This " + "creates very serious latency events in different conditions, especially when " + "Valkey is persisting on disk. To disable THP support use the command 'echo never > " + "/sys/kernel/mm/transparent_hugepage/enabled', make sure to also add it into " + "/etc/rc.local so that the command will be executed again after a reboot. Note " + "that even if you have already disabled THP, you still need to restart the Valkey " + "process to get rid of the huge pages already created.\n"); } } @@ -660,8 +675,12 @@ sds latencyCommandGenSparkeline(char *event, struct latencyTimeSeries *ts) { sparklineSequenceAddSample(seq, ts->samples[i].latency, buf); } - graph = sdscatprintf(graph, "%s - high %lu ms, low %lu ms (all time high %lu ms)\n", event, (unsigned long)max, - (unsigned long)min, (unsigned long)ts->max); + graph = sdscatprintf(graph, + "%s - high %lu ms, low %lu ms (all time high %lu ms)\n", + event, + (unsigned long)max, + (unsigned long)min, + (unsigned long)ts->max); for (j = 0; j < LATENCY_GRAPH_COLS; j++) graph = sdscatlen(graph, "-", 1); graph = sdscatlen(graph, "\n", 1); graph = sparklineRender(graph, seq, LATENCY_GRAPH_COLS, 4, SPARKLINE_FILL); @@ -747,7 +766,8 @@ void latencyCommand(client *c) { " Reset latency data of one or more classes.", " (default: reset all data for all event classes)", "HISTOGRAM [COMMAND ...]", - " Return a cumulative distribution of latencies in the format of a histogram for the specified command names.", + " Return a cumulative distribution of latencies in the format of a histogram for the specified command " + "names.", " If no commands are specified then all histograms are replied.", NULL, }; diff --git a/src/latency.h b/src/latency.h index a1e327bbba7..60507dda776 100644 --- a/src/latency.h +++ b/src/latency.h @@ -106,8 +106,8 @@ typedef enum { EL_DURATION_TYPE_EL = 0, // cumulative time duration metric of the whole eventloop EL_DURATION_TYPE_CMD, // cumulative time duration metric of executing commands EL_DURATION_TYPE_AOF, // cumulative time duration metric of flushing AOF in eventloop - EL_DURATION_TYPE_CRON, // cumulative time duration metric of cron (serverCron and beforeSleep, but excluding IO and - // AOF) + EL_DURATION_TYPE_CRON, // cumulative time duration metric of cron (serverCron and beforeSleep, + // but excluding IO and AOF) EL_DURATION_TYPE_NUM } DurationType; diff --git a/src/lazyfree.c b/src/lazyfree.c index ef338958635..b5ec8cce189 100644 --- a/src/lazyfree.c +++ b/src/lazyfree.c @@ -260,7 +260,8 @@ void freeEvalScriptsAsync(dict *scripts, list *scripts_lru_list, list *engine_ca /* Free functions ctx, if the functions ctx contains enough functions, free it in async way. */ void freeFunctionsAsync(functionsLibCtx *functions_lib_ctx, list *engine_callbacks) { if (functionsLibCtxFunctionsLen(functions_lib_ctx) > LAZYFREE_THRESHOLD) { - atomic_fetch_add_explicit(&lazyfree_objects, functionsLibCtxFunctionsLen(functions_lib_ctx), + atomic_fetch_add_explicit(&lazyfree_objects, + functionsLibCtxFunctionsLen(functions_lib_ctx), memory_order_relaxed); bioCreateLazyFreeJob(lazyFreeFunctionsCtx, 2, functions_lib_ctx, engine_callbacks); } else { diff --git a/src/listpack.c b/src/listpack.c index 37d3db618ba..fe99f00e61e 100644 --- a/src/listpack.c +++ b/src/listpack.c @@ -501,8 +501,10 @@ unsigned long lpLength(unsigned char *lp) { * * Similarly, there is no error returned since the listpack normally can be * assumed to be valid, so that would be a very high API cost. */ -static inline unsigned char * -lpGetWithSize(unsigned char *p, int64_t *count, unsigned char *intbuf, uint64_t *entry_size) { +static inline unsigned char *lpGetWithSize(unsigned char *p, + int64_t *count, + unsigned char *intbuf, + uint64_t *entry_size) { int64_t val; uint64_t uval, negstart, negmax; @@ -537,8 +539,8 @@ lpGetWithSize(unsigned char *p, int64_t *count, unsigned char *intbuf, uint64_t negmax = UINT32_MAX; if (entry_size) *entry_size = LP_ENCODING_32BIT_INT_ENTRY_SIZE; } else if (LP_ENCODING_IS_64BIT_INT(p[0])) { - uval = (uint64_t)p[1] | (uint64_t)p[2] << 8 | (uint64_t)p[3] << 16 | (uint64_t)p[4] << 24 | - (uint64_t)p[5] << 32 | (uint64_t)p[6] << 40 | (uint64_t)p[7] << 48 | (uint64_t)p[8] << 56; + uval = (uint64_t)p[1] | (uint64_t)p[2] << 8 | (uint64_t)p[3] << 16 | (uint64_t)p[4] << 24 | (uint64_t)p[5] << 32 + | (uint64_t)p[6] << 40 | (uint64_t)p[7] << 48 | (uint64_t)p[8] << 56; negstart = (uint64_t)1 << 63; negmax = UINT64_MAX; if (entry_size) *entry_size = LP_ENCODING_64BIT_INT_ENTRY_SIZE; @@ -851,8 +853,12 @@ unsigned char *lpInsert(unsigned char *lp, } /* This is just a wrapper for lpInsert() to directly use a string. */ -unsigned char * -lpInsertString(unsigned char *lp, unsigned char *s, uint32_t slen, unsigned char *p, int where, unsigned char **newp) { +unsigned char *lpInsertString(unsigned char *lp, + unsigned char *s, + uint32_t slen, + unsigned char *p, + int where, + unsigned char **newp) { return lpInsert(lp, s, NULL, slen, p, where, newp); } @@ -1496,8 +1502,11 @@ unsigned int lpRandomPairsUnique(unsigned char *lp, unsigned int count, listpack * i++; * } */ -unsigned char * -lpNextRandom(unsigned char *lp, unsigned char *p, unsigned int *index, unsigned int remaining, int even_only) { +unsigned char *lpNextRandom(unsigned char *lp, + unsigned char *p, + unsigned int *index, + unsigned int remaining, + int even_only) { /* To only iterate once, every time we try to pick a member, the probability * we pick it is the quotient of the count left we want to pick and the * count still we haven't visited. This way, we could make every member be @@ -1550,7 +1559,12 @@ void lpRepr(unsigned char *lp) { "\thdrlen: %3u,\n" "\tbacklen: %2lu,\n" "\tpayload: %1u\n", - (long unsigned)p, index, (unsigned long)(p - lp), encoded_size + back_len, encoded_size_bytes, back_len, + (long unsigned)p, + index, + (unsigned long)(p - lp), + encoded_size + back_len, + encoded_size_bytes, + back_len, encoded_size - encoded_size_bytes); printf("\tbytes: "); for (unsigned int i = 0; i < (encoded_size + back_len); i++) { diff --git a/src/listpack.h b/src/listpack.h index b1437972610..fb8a1d5aecd 100644 --- a/src/listpack.h +++ b/src/listpack.h @@ -58,8 +58,12 @@ unsigned char *lpNew(size_t capacity); void lpFree(unsigned char *lp); void lpFreeVoid(void *lp); unsigned char *lpShrinkToFit(unsigned char *lp); -unsigned char * -lpInsertString(unsigned char *lp, unsigned char *s, uint32_t slen, unsigned char *p, int where, unsigned char **newp); +unsigned char *lpInsertString(unsigned char *lp, + unsigned char *s, + uint32_t slen, + unsigned char *p, + int where, + unsigned char **newp); unsigned char *lpInsertInteger(unsigned char *lp, long long lval, unsigned char *p, int where, unsigned char **newp); unsigned char *lpPrepend(unsigned char *lp, unsigned char *s, uint32_t slen); unsigned char *lpPrependInteger(unsigned char *lp, long long lval); @@ -93,8 +97,11 @@ void lpRandomPair(unsigned char *lp, unsigned long total_count, listpackEntry *k void lpRandomPairs(unsigned char *lp, unsigned int count, listpackEntry *keys, listpackEntry *vals); unsigned int lpRandomPairsUnique(unsigned char *lp, unsigned int count, listpackEntry *keys, listpackEntry *vals); void lpRandomEntries(unsigned char *lp, unsigned int count, listpackEntry *entries); -unsigned char * -lpNextRandom(unsigned char *lp, unsigned char *p, unsigned int *index, unsigned int remaining, int even_only); +unsigned char *lpNextRandom(unsigned char *lp, + unsigned char *p, + unsigned int *index, + unsigned int remaining, + int even_only); int lpSafeToAdd(unsigned char *lp, size_t add); void lpRepr(unsigned char *lp); diff --git a/src/logreqres.c b/src/logreqres.c index 40b30e1b67b..21c2d8dfa31 100644 --- a/src/logreqres.c +++ b/src/logreqres.c @@ -184,10 +184,10 @@ size_t reqresAppendRequest(client *c) { /* Ignore commands that have streaming non-standard response */ sds cmd = objectGetVal(argv[0]); - if (!strcasecmp(cmd, "debug") || /* because of DEBUG SEGFAULT */ - !strcasecmp(cmd, "sync") || !strcasecmp(cmd, "psync") || !strcasecmp(cmd, "monitor") || - !strcasecmp(cmd, "subscribe") || !strcasecmp(cmd, "unsubscribe") || !strcasecmp(cmd, "ssubscribe") || - !strcasecmp(cmd, "sunsubscribe") || !strcasecmp(cmd, "psubscribe") || !strcasecmp(cmd, "punsubscribe")) { + if (!strcasecmp(cmd, "debug") /* because of DEBUG SEGFAULT */ + || !strcasecmp(cmd, "sync") || !strcasecmp(cmd, "psync") || !strcasecmp(cmd, "monitor") + || !strcasecmp(cmd, "subscribe") || !strcasecmp(cmd, "unsubscribe") || !strcasecmp(cmd, "ssubscribe") + || !strcasecmp(cmd, "sunsubscribe") || !strcasecmp(cmd, "psubscribe") || !strcasecmp(cmd, "punsubscribe")) { return 0; } @@ -255,7 +255,8 @@ size_t reqresAppendResponse(client *c) { if (i == c->reqres.offset.last_node.index) { /* Write the potentially incomplete node, which had data from * before the current command started */ - written = reqresAppendBuffer(c, o->buf + c->reqres.offset.last_node.used, + written = reqresAppendBuffer(c, + o->buf + c->reqres.offset.last_node.used, o->used - c->reqres.offset.last_node.used); } else { /* New node */ diff --git a/src/lolwut5.c b/src/lolwut5.c index deb7d0e78bc..83abd7cde4a 100644 --- a/src/lolwut5.c +++ b/src/lolwut5.c @@ -161,7 +161,9 @@ void lolwut5Command(client *c) { /* Generate some computer art and reply. */ lwCanvas *canvas = lwDrawSchotter(cols, squares_per_row, squares_per_col); sds rendered = renderCanvas(canvas); - rendered = sdscatprintf(rendered, "\nGeorg Nees - schotter, plotter on paper, 1968. %s ver. ", server.extended_redis_compat ? "Redis" : "Valkey"); + rendered = sdscatprintf(rendered, + "\nGeorg Nees - schotter, plotter on paper, 1968. %s ver. ", + server.extended_redis_compat ? "Redis" : "Valkey"); rendered = sdscat(rendered, server.extended_redis_compat ? REDIS_VERSION : VALKEY_VERSION); rendered = sdscatlen(rendered, "\n", 1); addReplyVerbatim(c, rendered, sdslen(rendered), "txt"); diff --git a/src/lolwut6.c b/src/lolwut6.c index d26886b9a0b..907c489591b 100644 --- a/src/lolwut6.c +++ b/src/lolwut6.c @@ -180,8 +180,9 @@ void lolwut6Command(client *c) { lwCanvas *canvas = lwCreateCanvas(cols, rows, 3); generateSkyline(canvas); sds rendered = renderCanvas(canvas); - rendered = sdscatprintf(rendered, "\nDedicated to the 8 bit game developers of past and present.\n" - "Original 8 bit image from Plaguemon by hikikomori. %s ver. ", + rendered = sdscatprintf(rendered, + "\nDedicated to the 8 bit game developers of past and present.\n" + "Original 8 bit image from Plaguemon by hikikomori. %s ver. ", server.extended_redis_compat ? "Redis" : "Valkey"); rendered = sdscat(rendered, server.extended_redis_compat ? REDIS_VERSION : VALKEY_VERSION); rendered = sdscatlen(rendered, "\n", 1); diff --git a/src/lolwut9.c b/src/lolwut9.c index 7adaf044945..292773d5f44 100644 --- a/src/lolwut9.c +++ b/src/lolwut9.c @@ -77,8 +77,11 @@ void lolwut9Command(client *c) { } output_array[i * (cols + 1) + cols] = '\n'; } - output_array = sdscatprintf(output_array, "Ascii representation of Julia set with constant %.2f + %.2fi\n", julia_r, julia_i); - output_array = sdscatprintf(output_array, "Don't forget to have fun! %s ver. ", server.extended_redis_compat ? "Redis" : "Valkey"); + output_array = + sdscatprintf(output_array, "Ascii representation of Julia set with constant %.2f + %.2fi\n", julia_r, julia_i); + output_array = sdscatprintf(output_array, + "Don't forget to have fun! %s ver. ", + server.extended_redis_compat ? "Redis" : "Valkey"); output_array = sdscat(output_array, server.extended_redis_compat ? REDIS_VERSION : VALKEY_VERSION); output_array = sdscatlen(output_array, "\n", 1); addReplyVerbatim(c, output_array, sdslen(output_array), "txt"); diff --git a/src/memtest.c b/src/memtest.c index 99843ba0deb..c477746ff94 100644 --- a/src/memtest.c +++ b/src/memtest.c @@ -182,8 +182,8 @@ void memtest_fill_value(unsigned long *l, size_t bytes, unsigned long v1, unsign #ifdef MEMTEST_32BIT *l1 = *l2 = ((unsigned long)v) | (((unsigned long)v) << 16); #else - *l1 = *l2 = ((unsigned long)v) | (((unsigned long)v) << 16) | (((unsigned long)v) << 32) | - (((unsigned long)v) << 48); + *l1 = *l2 = ((unsigned long)v) | (((unsigned long)v) << 16) | (((unsigned long)v) << 32) + | (((unsigned long)v) << 48); #endif l1 += step; l2 += step; diff --git a/src/module.c b/src/module.c index 4342144016d..67a4463cd6d 100644 --- a/src/module.c +++ b/src/module.c @@ -193,12 +193,10 @@ typedef struct ValkeyModuleCtx ValkeyModuleCtx; #define VALKEYMODULE_CTX_BLOCKED_TIMEOUT (1 << 3) #define VALKEYMODULE_CTX_THREAD_SAFE (1 << 4) #define VALKEYMODULE_CTX_BLOCKED_DISCONNECTED (1 << 5) -#define VALKEYMODULE_CTX_TEMP_CLIENT (1 << 6) /* Return client object to the pool \ - when the context is destroyed */ -#define VALKEYMODULE_CTX_NEW_CLIENT (1 << 7) /* Free client object when the \ - context is destroyed */ +#define VALKEYMODULE_CTX_TEMP_CLIENT (1 << 6) /* Return client object to the pool when the context is destroyed */ +#define VALKEYMODULE_CTX_NEW_CLIENT (1 << 7) /* Free client object when the context is destroyed */ #define VALKEYMODULE_CTX_CHANNELS_POS_REQUEST (1 << 8) -#define VALKEYMODULE_CTX_COMMAND (1 << 9) /* Context created to serve a command from call() or AOF (which calls cmd->proc directly) */ +#define VALKEYMODULE_CTX_COMMAND (1 << 9) /* Context created to serve a command from call() or AOF (which calls cmd->proc directly) */ #define VALKEYMODULE_CTX_KEYSPACE_NOTIFICATION (1 << 10) /* Context created a keyspace notification event */ #define VALKEYMODULE_CTX_SCRIPT_EXECUTION (1 << 11) /* Context created to serve a scripting engine execution */ @@ -260,7 +258,7 @@ typedef struct ValkeyModuleCommand ValkeyModuleCommand; #define VALKEYMODULE_REPLYFLAG_NONE 0 #define VALKEYMODULE_REPLYFLAG_TOPARSE (1 << 0) /* Protocol must be parsed. */ -#define VALKEYMODULE_REPLYFLAG_NESTED (1 << 1) /* Nested reply object. No proto \ +#define VALKEYMODULE_REPLYFLAG_NESTED (1 << 1) /* Nested reply object. No proto \ or struct free. */ /* Reply of VM_Call() function. The function is filled in a lazy @@ -693,8 +691,7 @@ void moduleEnqueueLoadModule(sds path, sds *argv, int argc) { listAddNodeTail(server.loadmodule_queue, loadmod); } -sds moduleLoadQueueEntryToLoadmoduleOptionStr(ValkeyModule *module, - const char *config_option_str) { +sds moduleLoadQueueEntryToLoadmoduleOptionStr(ValkeyModule *module, const char *config_option_str) { sds line; line = sdsnew(config_option_str); @@ -1413,8 +1410,14 @@ int VM_CreateCommand(ValkeyModuleCtx *ctx, if (lookupCommandByCString(name) != NULL) return VALKEYMODULE_ERR; sds declared_name = sdsnew(name); - ValkeyModuleCommand *cp = moduleCreateCommandProxy(ctx->module, declared_name, sdsdup(declared_name), cmdfunc, - flags, firstkey, lastkey, keystep); + ValkeyModuleCommand *cp = moduleCreateCommandProxy(ctx->module, + declared_name, + sdsdup(declared_name), + cmdfunc, + flags, + firstkey, + lastkey, + keystep); cp->serverCmd->arity = cmdfunc ? -1 : -2; /* Default value, can be changed later via dedicated API */ /* Drain IO queue before modifying commands dictionary to prevent concurrent access while modifying it. */ drainIOThreadsQueue(); @@ -1576,13 +1579,15 @@ static ValkeyModuleCommandHistoryEntry *moduleCmdHistoryEntryAt(const ValkeyModu off_t offset = index * version->sizeof_historyentry; return (ValkeyModuleCommandHistoryEntry *)((char *)(entries) + offset); } -static ValkeyModuleCommandKeySpec * -moduleCmdKeySpecAt(const ValkeyModuleCommandInfoVersion *version, ValkeyModuleCommandKeySpec *keyspecs, int index) { +static ValkeyModuleCommandKeySpec *moduleCmdKeySpecAt(const ValkeyModuleCommandInfoVersion *version, + ValkeyModuleCommandKeySpec *keyspecs, + int index) { off_t offset = index * version->sizeof_keyspec; return (ValkeyModuleCommandKeySpec *)((char *)(keyspecs) + offset); } -static ValkeyModuleCommandArg * -moduleCmdArgAt(const ValkeyModuleCommandInfoVersion *version, const ValkeyModuleCommandArg *args, int index) { +static ValkeyModuleCommandArg *moduleCmdArgAt(const ValkeyModuleCommandInfoVersion *version, + const ValkeyModuleCommandArg *args, + int index) { off_t offset = index * version->sizeof_arg; return (ValkeyModuleCommandArg *)((char *)(args) + offset); } @@ -2008,11 +2013,11 @@ int VM_SetCommandInfo(ValkeyModuleCommand *command, const ValkeyModuleCommandInf /* Check if any info has already been set. Overwriting info involves freeing * the old info, which is not implemented. */ - if (cmd->summary || cmd->complexity || cmd->since || cmd->history || cmd->tips || cmd->args || - !(cmd->key_specs_num == 0 || - /* Allow key spec populated from legacy (first,last,step) to exist. */ - (cmd->key_specs_num == 1 && cmd->key_specs[0].begin_search_type == KSPEC_BS_INDEX && - cmd->key_specs[0].find_keys_type == KSPEC_FK_RANGE))) { + if (cmd->summary || cmd->complexity || cmd->since || cmd->history || cmd->tips || cmd->args + || !(cmd->key_specs_num == 0 || + /* Allow key spec populated from legacy (first,last,step) to exist. */ + (cmd->key_specs_num == 1 && cmd->key_specs[0].begin_search_type == KSPEC_BS_INDEX + && cmd->key_specs[0].find_keys_type == KSPEC_FK_RANGE))) { errno = EEXIST; return VALKEYMODULE_ERR; } @@ -2164,10 +2169,10 @@ static int moduleValidateCommandInfo(const ValkeyModuleCommandInfo *info) { /* Flags. Exactly one flag in a group is set if and only if the * masked bits is a power of two. */ - uint64_t key_flags = - VALKEYMODULE_CMD_KEY_RO | VALKEYMODULE_CMD_KEY_RW | VALKEYMODULE_CMD_KEY_OW | VALKEYMODULE_CMD_KEY_RM; - uint64_t write_flags = - VALKEYMODULE_CMD_KEY_INSERT | VALKEYMODULE_CMD_KEY_DELETE | VALKEYMODULE_CMD_KEY_UPDATE; + uint64_t key_flags = VALKEYMODULE_CMD_KEY_RO | VALKEYMODULE_CMD_KEY_RW | VALKEYMODULE_CMD_KEY_OW + | VALKEYMODULE_CMD_KEY_RM; + uint64_t write_flags = VALKEYMODULE_CMD_KEY_INSERT | VALKEYMODULE_CMD_KEY_DELETE + | VALKEYMODULE_CMD_KEY_UPDATE; if (!isPowerOfTwo(spec->flags & key_flags)) { serverLog(LL_WARNING, "Invalid command info: key_specs[%zd].flags: " @@ -2199,7 +2204,8 @@ static int moduleValidateCommandInfo(const ValkeyModuleCommandInfo *info) { serverLog(LL_WARNING, "Invalid command info: key_specs[%zd].begin_search_type: " "Invalid value %d", - j, spec->begin_search_type); + j, + spec->begin_search_type); return 0; } @@ -2213,7 +2219,8 @@ static int moduleValidateCommandInfo(const ValkeyModuleCommandInfo *info) { serverLog(LL_WARNING, "Invalid command info: key_specs[%zd].find_keys_type: " "Invalid value %d", - j, spec->find_keys_type); + j, + spec->find_keys_type); return 0; } } @@ -3082,9 +3089,10 @@ int VM_StringCompare(const ValkeyModuleString *a, const ValkeyModuleString *b) { * the string is unshared, otherwise NULL is returned. */ static ValkeyModuleString *moduleAssertUnsharedString(ValkeyModuleString *str) { if (str->refcount != 1) { - serverLog(LL_WARNING, "Module attempted to use an in-place string modify operation " - "with a string referenced multiple times. Please check the code " - "for API usage correctness."); + serverLog(LL_WARNING, + "Module attempted to use an in-place string modify operation " + "with a string referenced multiple times. Please check the code " + "for API usage correctness."); return NULL; } if (str->encoding == OBJ_ENCODING_EMBSTR) { @@ -3276,17 +3284,14 @@ int VM_ReplyWithErrorFormat(ValkeyModuleCtx *ctx, const char *fmt, ...) { * * The function always returns VALKEYMODULE_OK. */ -int VM_ReplyWithCustomErrorFormat(ValkeyModuleCtx *ctx, - int update_error_stats, - const char *fmt, - ...) { +int VM_ReplyWithCustomErrorFormat(ValkeyModuleCtx *ctx, int update_error_stats, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - int ret = moduleReplyErrorFormatInternal( - ctx, - ERR_REPLY_FLAG_CUSTOM | (update_error_stats ? 0 : ERR_REPLY_FLAG_NO_STATS_UPDATE), - fmt, - ap); + int ret = moduleReplyErrorFormatInternal(ctx, + ERR_REPLY_FLAG_CUSTOM + | (update_error_stats ? 0 : ERR_REPLY_FLAG_NO_STATS_UPDATE), + fmt, + ap); va_end(ap); return ret; } @@ -3742,8 +3747,7 @@ int VM_Replicate(ValkeyModuleCtx *ctx, const char *cmdname, const char *fmt, ... va_list ap; int slot = -1; - bool skip_validation = ctx->module && - (ctx->module->options & VALKEYMODULE_OPTIONS_SKIP_COMMAND_VALIDATION); + bool skip_validation = ctx->module && (ctx->module->options & VALKEYMODULE_OPTIONS_SKIP_COMMAND_VALIDATION); bool slot_export_in_progress = clusterIsAnySlotExporting(); if (!skip_validation || slot_export_in_progress) { cmd = lookupCommandByCString((char *)cmdname); @@ -3797,7 +3801,11 @@ int VM_Replicate(ValkeyModuleCtx *ctx, const char *cmdname, const char *fmt, ... * * The function always returns VALKEYMODULE_OK. */ int VM_ReplicateVerbatim(ValkeyModuleCtx *ctx) { - alsoPropagate(ctx->client->db->id, ctx->client->argv, ctx->client->argc, PROPAGATE_AOF | PROPAGATE_REPL, ctx->client->slot); + alsoPropagate(ctx->client->db->id, + ctx->client->argv, + ctx->client->argc, + PROPAGATE_AOF | PROPAGATE_REPL, + ctx->client->slot); server.dirty++; return VALKEYMODULE_OK; } @@ -3975,10 +3983,8 @@ int modulePopulateReplicationInfoStructure(void *ri, int structver) { * } */ int VM_GetClientInfoById(void *ci, uint64_t id) { - client *client = - (server.executing_client && server.executing_client->id == id) - ? server.executing_client - : lookupClientByID(id); + client *client = (server.executing_client && server.executing_client->id == id) ? server.executing_client + : lookupClientByID(id); if (client == NULL) return VALKEYMODULE_ERR; if (ci == NULL) return VALKEYMODULE_OK; @@ -4868,12 +4874,12 @@ int VM_ListInsert(ValkeyModuleKey *key, long index, ValkeyModuleString *value) { } else if (key != NULL && key->value == NULL && (index == 0 || index == -1)) { /* Insert in empty key => push. */ return VM_ListPush(key, VALKEYMODULE_LIST_TAIL, value); - } else if (key != NULL && key->value != NULL && key->value->type == OBJ_LIST && - (index == (long)listTypeLength(key->value) || index == -1)) { + } else if (key != NULL && key->value != NULL && key->value->type == OBJ_LIST + && (index == (long)listTypeLength(key->value) || index == -1)) { /* Insert after the last element => push tail. */ return VM_ListPush(key, VALKEYMODULE_LIST_TAIL, value); - } else if (key != NULL && key->value != NULL && key->value->type == OBJ_LIST && - (index == 0 || index == -(long)listTypeLength(key->value) - 1)) { + } else if (key != NULL && key->value != NULL && key->value->type == OBJ_LIST + && (index == 0 || index == -(long)listTypeLength(key->value) - 1)) { /* Insert before the first element => push head. */ return VM_ListPush(key, VALKEYMODULE_LIST_HEAD, value); } @@ -5125,7 +5131,8 @@ int zsetInitScoreRange(ValkeyModuleKey *key, double min, double max, int minex, zrs->maxex = maxex; if (key->value->encoding == OBJ_ENCODING_LISTPACK) { - key->u.zset.current = first ? zzlFirstInRange(objectGetVal(key->value), zrs) : zzlLastInRange(objectGetVal(key->value), zrs); + key->u.zset.current = first ? zzlFirstInRange(objectGetVal(key->value), zrs) + : zzlLastInRange(objectGetVal(key->value), zrs); } else if (key->value->encoding == OBJ_ENCODING_SKIPLIST) { zset *zs = objectGetVal(key->value); zskiplist *zsl = zs->zsl; @@ -5187,8 +5194,8 @@ int zsetInitLexRange(ValkeyModuleKey *key, ValkeyModuleString *min, ValkeyModule key->u.zset.type = VALKEYMODULE_ZSET_RANGE_LEX; if (key->value->encoding == OBJ_ENCODING_LISTPACK) { - key->u.zset.current = - first ? zzlFirstInLexRange(objectGetVal(key->value), zlrs) : zzlLastInLexRange(objectGetVal(key->value), zlrs); + key->u.zset.current = first ? zzlFirstInLexRange(objectGetVal(key->value), zlrs) + : zzlLastInLexRange(objectGetVal(key->value), zlrs); } else if (key->value->encoding == OBJ_ENCODING_SKIPLIST) { zset *zs = objectGetVal(key->value); zskiplist *zsl = zs->zsl; @@ -5471,8 +5478,10 @@ int VM_HashHasStringRef(ValkeyModuleKey *key, ValkeyModuleString *field) { */ int VM_HashSet(ValkeyModuleKey *key, int flags, ...) { va_list ap; - if (!key || (flags & ~(VALKEYMODULE_HASH_NX | VALKEYMODULE_HASH_XX | VALKEYMODULE_HASH_CFIELDS | - VALKEYMODULE_HASH_COUNT_ALL))) { + if (!key + || (flags + & ~(VALKEYMODULE_HASH_NX | VALKEYMODULE_HASH_XX | VALKEYMODULE_HASH_CFIELDS + | VALKEYMODULE_HASH_COUNT_ALL))) { errno = EINVAL; return 0; } else if (key->value && key->value->type != OBJ_HASH) { @@ -6257,7 +6266,7 @@ int VM_CallReplyPromiseAbort(ValkeyModuleCallReply *reply, void **private_data) ValkeyModuleAsyncRMCallPromise *promise = callReplyGetPrivateData(reply); serverAssert(!promise->from_call_argv); if (!promise->c) - return VALKEYMODULE_ERR; /* Promise can not be aborted, either already aborted or already finished. */ + return VALKEYMODULE_ERR; /* Promise can not be aborted, either already aborted or already finished. */ if (!(promise->c->flag.blocked)) return VALKEYMODULE_ERR; /* Client is not blocked anymore, can not abort it. */ /* Client is still blocked, remove it from any blocking state and release it. */ @@ -6657,7 +6666,8 @@ static void moduleCallCommandHelper(ValkeyModuleCtx *ctx, client *c, robj **argv if (!user) { errno = ENOTSUP; if (error_as_call_replies) { - reply_error_msg = sdsnew("cannot run as user, no user directly attached to context or context's client"); + reply_error_msg = sdsnew("cannot run as user, no user directly attached to context or context's " + "client"); } goto cleanup; } @@ -6703,7 +6713,9 @@ static void moduleCallCommandHelper(ValkeyModuleCtx *ctx, client *c, robj **argv if (!is_running_script || !server.script_disable_deny_script) { errno = ESPIPE; if (error_as_call_replies) { - reply_error_msg = sdscatfmt(sdsempty(), "command '%S' is not allowed on script mode", c->cmd->fullname); + reply_error_msg = sdscatfmt(sdsempty(), + "command '%S' is not allowed on script mode", + c->cmd->fullname); } goto cleanup; } @@ -6774,7 +6786,8 @@ static void moduleCallCommandHelper(ValkeyModuleCtx *ctx, client *c, robj **argv acl_retval = ACLCheckAllUserCommandPerm(user, c->cmd, c->argv, c->argc, dbid, &acl_errpos); if (acl_retval != ACL_OK) { int context = scriptIsRunning() ? ACL_LOG_CTX_SCRIPT : ACL_LOG_CTX_MODULE; - sds object = (acl_retval == ACL_DENIED_CMD) ? sdsdup(c->cmd->fullname) : sdsdup(objectGetVal(c->argv[acl_errpos])); + sds object = (acl_retval == ACL_DENIED_CMD) ? sdsdup(c->cmd->fullname) + : sdsdup(objectGetVal(c->argv[acl_errpos])); addACLLogEntry(ctx->client, acl_retval, context, -1, c->user->name, object); if (error_as_call_replies) { /* verbosity should be same as processCommand() in server.c */ @@ -6801,13 +6814,15 @@ static void moduleCallCommandHelper(ValkeyModuleCtx *ctx, client *c, robj **argv if (error_code == CLUSTER_REDIR_DOWN_RO_STATE) { if (error_as_call_replies) { reply_error_msg = sdscatfmt(sdsempty(), - "Can not execute a write command '%S' while the cluster is down and readonly", + "Can not execute a write command '%S' while the cluster is down and " + "readonly", c->cmd->fullname); } errno = EROFS; } else if (error_code == CLUSTER_REDIR_DOWN_STATE) { if (error_as_call_replies) { - reply_error_msg = sdscatfmt(sdsempty(), "Can not execute a command '%S' while the cluster is down", + reply_error_msg = sdscatfmt(sdsempty(), + "Can not execute a command '%S' while the cluster is down", c->cmd->fullname); } errno = ENETDOWN; @@ -6835,8 +6850,8 @@ static void moduleCallCommandHelper(ValkeyModuleCtx *ctx, client *c, robj **argv /* If the script already made a modification to the dataset, we can't * fail it on unpredictable error state. */ - if ((is_running_script && !scriptIsWriteDirty() && cmd_flags & CMD_WRITE) || - (!is_running_script && cmd_flags & CMD_WRITE)) { + if ((is_running_script && !scriptIsWriteDirty() && cmd_flags & CMD_WRITE) + || (!is_running_script && cmd_flags & CMD_WRITE)) { /* on script mode, if a command is a write command, * We will not run it if we encounter disk error * or we do not have enough replicas */ @@ -6873,8 +6888,8 @@ static void moduleCallCommandHelper(ValkeyModuleCtx *ctx, client *c, robj **argv } } - if (server.primary_host && server.repl_state != REPL_STATE_CONNECTED && server.repl_serve_stale_data == 0 && - !(cmd_flags & CMD_STALE)) { + if (server.primary_host && server.repl_state != REPL_STATE_CONNECTED && server.repl_serve_stale_data == 0 + && !(cmd_flags & CMD_STALE)) { errno = ESPIPE; if (error_as_call_replies) { if (is_running_script) { @@ -7206,8 +7221,8 @@ moduleType *moduleTypeLookupModuleByNameInternal(const char *name, int ignore_ca listRewind(module->types, &li); while ((ln = listNext(&li))) { moduleType *mt = ln->value; - if ((!ignore_case && memcmp(name, mt->name, sizeof(mt->name)) == 0) || - (ignore_case && !strcasecmp(name, mt->name))) { + if ((!ignore_case && memcmp(name, mt->name, sizeof(mt->name)) == 0) + || (ignore_case && !strcasecmp(name, mt->name))) { dictReleaseIterator(di); return mt; } @@ -7581,7 +7596,9 @@ void moduleRDBLoadError(ValkeyModuleIO *io) { "Read performed by module '%s' about type '%s' " "after reading '%llu' bytes of a value " "for key named: '%s'.", - io->type->module->name, io->type->name, (unsigned long long)io->bytes, + io->type->module->name, + io->type->name, + (unsigned long long)io->bytes, io->key ? (server.hide_user_data_from_log ? "*redacted*" : (char *)objectGetVal(io->key)) : "(null)"); } @@ -7628,9 +7645,10 @@ int moduleVerifyAllAllowAtomicSlotMigrationOrReply(client *c) { while ((de = dictNext(di)) != NULL) { struct ValkeyModule *module = dictGetVal(de); if (!(module->options & VALKEYMODULE_OPTIONS_HANDLE_ATOMIC_SLOT_MIGRATION)) { - addReplyErrorFormat(c, "The module %s does not support atomic slot migrations. " - "Please ensure all modules have declared support for " - "atomic slot migration and try again", + addReplyErrorFormat(c, + "The module %s does not support atomic slot migrations. " + "Please ensure all modules have declared support for " + "atomic slot migration and try again", module->name); dictReleaseIterator(di); return C_ERR; @@ -8081,7 +8099,8 @@ void VM_EmitAOF(ValkeyModuleIO *io, const char *cmdname, const char *fmt, ...) { serverLog(LL_WARNING, "Fatal: AOF method for module data type '%s' tried to " "emit unknown command '%s'", - io->type->name, cmdname); + io->type->name, + cmdname); io->error = 1; errno = EINVAL; return; @@ -8096,7 +8115,8 @@ void VM_EmitAOF(ValkeyModuleIO *io, const char *cmdname, const char *fmt, ...) { serverLog(LL_WARNING, "Fatal: AOF method for module data type '%s' tried to " "call ValkeyModule_EmitAOF() with wrong format specifiers '%s'", - io->type->name, fmt); + io->type->name, + fmt); io->error = 1; errno = EINVAL; return; @@ -8394,8 +8414,9 @@ ValkeyModuleBlockedClient *moduleBlockClient(ValkeyModuleCtx *ctx, if (islua || ismulti) { c->bstate->module_blocked_handle = NULL; - addReplyError(c, islua ? "Blocking module command called from Lua script" - : "Blocking module command called from transaction"); + addReplyError(c, + islua ? "Blocking module command called from Lua script" + : "Blocking module command called from transaction"); } else if (ctx->flags & VALKEYMODULE_CTX_BLOCKED_REPLY) { c->bstate->module_blocked_handle = NULL; addReplyError(c, "Blocking module command called from a Reply callback context"); @@ -8605,24 +8626,17 @@ int checkModuleAuthentication(client *c, robj *username, robj *password, robj ** } const char *module_name = auth_ctx ? auth_ctx->module->name : NULL; - moduleFireAuthenticationEvent(c->id, - objectGetVal(username), - module_name, - auth_result == AUTH_OK); + moduleFireAuthenticationEvent(c->id, objectGetVal(username), module_name, auth_result == AUTH_OK); return auth_result; } -void moduleFireAuthenticationEvent(uint64_t client_id, - const char *username, - const char *module_name, - int is_granted) { +void moduleFireAuthenticationEvent(uint64_t client_id, const char *username, const char *module_name, int is_granted) { ValkeyModuleAuthenticationInfo info = VALKEYMODULE_AUTHENTICATIONINFO_INITIALIZER_V1; info.client_id = client_id; info.username = username; info.module_name = module_name; - info.result = is_granted ? VALKEYMODULE_AUTH_RESULT_GRANTED - : VALKEYMODULE_AUTH_RESULT_DENIED; + info.result = is_granted ? VALKEYMODULE_AUTH_RESULT_GRANTED : VALKEYMODULE_AUTH_RESULT_DENIED; moduleFireServerEvent(VALKEYMODULE_EVENT_AUTHENTICATION_ATTEMPT, 0, &info); } @@ -8815,8 +8829,16 @@ ValkeyModuleBlockedClient *VM_BlockClientOnKeys(ValkeyModuleCtx *ctx, ValkeyModuleString **keys, int numkeys, void *privdata) { - return moduleBlockClient(ctx, reply_callback, NULL, timeout_callback, free_privdata, timeout_ms, keys, numkeys, - privdata, 0); + return moduleBlockClient(ctx, + reply_callback, + NULL, + timeout_callback, + free_privdata, + timeout_ms, + keys, + numkeys, + privdata, + 0); } /* Same as ValkeyModule_BlockClientOnKeys, but can take VALKEYMODULE_BLOCK_* flags @@ -8837,8 +8859,16 @@ ValkeyModuleBlockedClient *VM_BlockClientOnKeysWithFlags(ValkeyModuleCtx *ctx, int numkeys, void *privdata, int flags) { - return moduleBlockClient(ctx, reply_callback, NULL, timeout_callback, free_privdata, timeout_ms, keys, numkeys, - privdata, flags); + return moduleBlockClient(ctx, + reply_callback, + NULL, + timeout_callback, + free_privdata, + timeout_ms, + keys, + numkeys, + privdata, + flags); } /* This function is used in order to potentially unblock a client blocked @@ -9109,7 +9139,9 @@ void moduleBlockedClientTimedOut(client *c, int from_module) { moduleFreeContext(&ctx); if (!from_module) { - updateStatsOnUnblock(c, bc->background_duration, 0, + updateStatsOnUnblock(c, + bc->background_duration, + 0, ((server.stat_total_error_replies != prev_error_replies) ? ERROR_COMMAND_FAILED : 0)); } @@ -9498,8 +9530,9 @@ void moduleNotifyKeyspaceEvent(int type, const char *event, robj *key, int dbid) ValkeyModuleKeyspaceSubscriber *sub = ln->value; /* Only notify subscribers on events matching the registration, * and avoid subscribers triggering themselves */ - if ((sub->event_mask & type) && - (sub->active == 0 || (sub->module->options & VALKEYMODULE_OPTIONS_ALLOW_NESTED_KEYSPACE_NOTIFICATIONS))) { + if ((sub->event_mask & type) + && (sub->active == 0 + || (sub->module->options & VALKEYMODULE_OPTIONS_ALLOW_NESTED_KEYSPACE_NOTIFICATIONS))) { ValkeyModuleCtx ctx; if (server.executing_client == NULL) { moduleCreateContext(&ctx, sub->module, VALKEYMODULE_CTX_TEMP_CLIENT); @@ -10474,8 +10507,8 @@ int VM_ACLCheckCommandPermissions(ValkeyModuleUser *user, ValkeyModuleString **a * * EACCESS: The user does not have permission to access the key. */ int VM_ACLCheckKeyPermissions(ValkeyModuleUser *user, ValkeyModuleString *key, int flags) { - const int allow_mask = (VALKEYMODULE_CMD_KEY_ACCESS | VALKEYMODULE_CMD_KEY_INSERT | VALKEYMODULE_CMD_KEY_DELETE | - VALKEYMODULE_CMD_KEY_UPDATE); + const int allow_mask = (VALKEYMODULE_CMD_KEY_ACCESS | VALKEYMODULE_CMD_KEY_INSERT | VALKEYMODULE_CMD_KEY_DELETE + | VALKEYMODULE_CMD_KEY_UPDATE); if ((flags & allow_mask) != flags) { errno = EINVAL; @@ -10502,8 +10535,8 @@ int VM_ACLCheckKeyPermissions(ValkeyModuleUser *user, ValkeyModuleString *key, i * * EACCESS: The user does not have permission to access the pubsub channel. */ int VM_ACLCheckChannelPermissions(ValkeyModuleUser *user, ValkeyModuleString *ch, int flags) { - const int allow_mask = (VALKEYMODULE_CMD_CHANNEL_PUBLISH | VALKEYMODULE_CMD_CHANNEL_SUBSCRIBE | - VALKEYMODULE_CMD_CHANNEL_UNSUBSCRIBE | VALKEYMODULE_CMD_CHANNEL_PATTERN); + const int allow_mask = (VALKEYMODULE_CMD_CHANNEL_PUBLISH | VALKEYMODULE_CMD_CHANNEL_SUBSCRIBE + | VALKEYMODULE_CMD_CHANNEL_UNSUBSCRIBE | VALKEYMODULE_CMD_CHANNEL_PATTERN); if ((flags & allow_mask) != flags) { errno = EINVAL; @@ -10614,7 +10647,12 @@ int VM_ACLAddLogEntryByUserName(ValkeyModuleCtx *ctx, ValkeyModuleACLLogEntryReason reason) { int acl_reason = moduleGetACLLogEntryReason(reason); if (!acl_reason) return VALKEYMODULE_ERR; - addACLLogEntry(ctx->client, acl_reason, ACL_LOG_CTX_MODULE, -1, objectGetVal(username), sdsdup(objectGetVal(object))); + addACLLogEntry(ctx->client, + acl_reason, + ACL_LOG_CTX_MODULE, + -1, + objectGetVal(username), + sdsdup(objectGetVal(object))); return VALKEYMODULE_OK; } @@ -11047,8 +11085,8 @@ int VM_InfoAddSection(ValkeyModuleInfoCtx *ctx, const char *name) { * 2) the module name was requested (emit all) * 3) this specific section was requested. */ if (ctx->requested_sections) { - if ((!full_name || !dictFind(ctx->requested_sections, full_name)) && - (!dictFind(ctx->requested_sections, ctx->module->name))) { + if ((!full_name || !dictFind(ctx->requested_sections, full_name)) + && (!dictFind(ctx->requested_sections, ctx->module->name))) { sdsfree(full_name); ctx->in_section = 0; return VALKEYMODULE_ERR; @@ -11069,9 +11107,10 @@ int VM_InfoBeginDictField(ValkeyModuleInfoCtx *ctx, const char *name) { /* Implicitly end dicts, instead of returning an error which is likely un checked. */ if (ctx->in_dict_field) VM_InfoEndDictField(ctx); char *tmpmodname, *tmpname; - ctx->info = - sdscatfmt(ctx->info, "%s_%s:", getSafeInfoString(ctx->module->name, strlen(ctx->module->name), &tmpmodname), - getSafeInfoString(name, strlen(name), &tmpname)); + ctx->info = sdscatfmt(ctx->info, + "%s_%s:", + getSafeInfoString(ctx->module->name, strlen(ctx->module->name), &tmpmodname), + getSafeInfoString(name, strlen(name), &tmpname)); if (tmpmodname != NULL) zfree(tmpmodname); if (tmpname != NULL) zfree(tmpname); ctx->in_dict_field = 1; @@ -11781,8 +11820,8 @@ void moduleFireCommandACLRejectedEvent(client *c, uint64_t subevent, int errpos) char int_key_buf[LONG_STR_SIZE]; const char *rejection_context = NULL; - if ((subevent == VALKEYMODULE_ACL_LOG_KEY || subevent == VALKEYMODULE_ACL_LOG_CHANNEL) && - errpos >= 0 && errpos < c->argc) { + if ((subevent == VALKEYMODULE_ACL_LOG_KEY || subevent == VALKEYMODULE_ACL_LOG_CHANNEL) && errpos >= 0 + && errpos < c->argc) { robj *key_obj = c->argv[errpos]; if (key_obj->encoding == OBJ_ENCODING_INT) { ll2string(int_key_buf, sizeof(int_key_buf), (long)objectGetVal(key_obj)); @@ -12118,12 +12157,12 @@ int VM_ScanKey(ValkeyModuleKey *key, ValkeyModuleScanCursor *cursor, ValkeyModul long long vll; while (p) { vstr = lpGetValue(p, &vlen, &vll); - robj *field = - (vstr != NULL) ? createStringObject((char *)vstr, vlen) : createStringObjectFromLongLongWithSds(vll); + robj *field = (vstr != NULL) ? createStringObject((char *)vstr, vlen) + : createStringObjectFromLongLongWithSds(vll); p = lpNext(objectGetVal(o), p); vstr = lpGetValue(p, &vlen, &vll); - robj *value = - (vstr != NULL) ? createStringObject((char *)vstr, vlen) : createStringObjectFromLongLongWithSds(vll); + robj *value = (vstr != NULL) ? createStringObject((char *)vstr, vlen) + : createStringObjectFromLongLongWithSds(vll); fn(key, field, value, privdata); p = lpNext(objectGetVal(o), p); decrRefCount(field); @@ -12221,7 +12260,10 @@ int VM_KillForkChild(int child_pid) { } void ModuleForkDoneHandler(int exitcode, int bysignal) { - serverLog(LL_NOTICE, "Module fork exited pid: %ld, retcode: %d, bysignal: %d", (long)server.child_pid, exitcode, + serverLog(LL_NOTICE, + "Module fork exited pid: %ld, retcode: %d, bysignal: %d", + (long)server.child_pid, + exitcode, bysignal); if (moduleForkInfo.done_handler) { moduleForkInfo.done_handler(exitcode, bysignal, moduleForkInfo.done_handler_user_data); @@ -12760,8 +12802,7 @@ int VM_IsSubEventSupported(ValkeyModuleEvent event, int64_t subevent) { case VALKEYMODULE_EVENT_EVENTLOOP: return subevent < _VALKEYMODULE_SUBEVENT_EVENTLOOP_NEXT; case VALKEYMODULE_EVENT_CONFIG: return subevent < _VALKEYMODULE_SUBEVENT_CONFIG_NEXT; case VALKEYMODULE_EVENT_KEY: return subevent < _VALKEYMODULE_SUBEVENT_KEY_NEXT; - case VALKEYMODULE_EVENT_COMMAND_RESULT_REJECTED: - return subevent == 0; + case VALKEYMODULE_EVENT_COMMAND_RESULT_REJECTED: return subevent == 0; case VALKEYMODULE_EVENT_COMMAND_RESULT_ACL_REJECTED: return subevent < 5; /* ValkeyModuleACLLogEntryReason has 5 values (0-4) */ default: break; @@ -12853,10 +12894,10 @@ void moduleFireServerEvent(uint64_t eid, int subid, void *data) { moduledata = data; } else if (eid == VALKEYMODULE_EVENT_ATOMIC_SLOT_MIGRATION) { moduledata = data; - } else if (eid == VALKEYMODULE_EVENT_COMMAND_RESULT_SUCCESS || - eid == VALKEYMODULE_EVENT_COMMAND_RESULT_FAILURE || - eid == VALKEYMODULE_EVENT_COMMAND_RESULT_REJECTED || - eid == VALKEYMODULE_EVENT_COMMAND_RESULT_ACL_REJECTED) { + } else if (eid == VALKEYMODULE_EVENT_COMMAND_RESULT_SUCCESS + || eid == VALKEYMODULE_EVENT_COMMAND_RESULT_FAILURE + || eid == VALKEYMODULE_EVENT_COMMAND_RESULT_REJECTED + || eid == VALKEYMODULE_EVENT_COMMAND_RESULT_ACL_REJECTED) { moduledata = data; } @@ -12906,9 +12947,10 @@ void processModuleLoadingProgressEvent(int is_aof) { int progress = -1; if (server.loading_total_bytes) progress = (server.loading_loaded_bytes << 10) / server.loading_total_bytes; ValkeyModuleLoadingProgressV1 fi = {VALKEYMODULE_LOADING_PROGRESS_VERSION, server.hz, progress}; - moduleFireServerEvent( - VALKEYMODULE_EVENT_LOADING_PROGRESS, - is_aof ? VALKEYMODULE_SUBEVENT_LOADING_PROGRESS_AOF : VALKEYMODULE_SUBEVENT_LOADING_PROGRESS_RDB, &fi); + moduleFireServerEvent(VALKEYMODULE_EVENT_LOADING_PROGRESS, + is_aof ? VALKEYMODULE_SUBEVENT_LOADING_PROGRESS_AOF + : VALKEYMODULE_SUBEVENT_LOADING_PROGRESS_RDB, + &fi); /* decide when the next event should fire. */ next_event = now + 1000000 / server.hz; } @@ -13338,16 +13380,20 @@ static int moduleInitPostOnLoadResolved(ModuleLoadFunc onload, moduleCreateContext(&ctx, NULL, VALKEYMODULE_CTX_TEMP_CLIENT); /* We pass NULL since we don't have a module yet. */ if (onload((void *)&ctx, module_argv, module_argc) == VALKEYMODULE_ERR) { if (ctx.module) { - serverLog(LL_WARNING, "%sModule %s initialization failed. Module not loaded.", - is_static ? "Static " : "", display_name); + serverLog(LL_WARNING, + "%sModule %s initialization failed. Module not loaded.", + is_static ? "Static " : "", + display_name); moduleUnregisterCleanup(ctx.module); moduleRemoveCateogires(ctx.module); moduleFreeModuleStructure(ctx.module); } else { /* If there is no ctx.module, this means that our ValkeyModule_Init call failed, * and currently init will only fail on busy name. */ - serverLog(LL_WARNING, "%sModule %s initialization failed. Module name is busy.", - is_static ? "Static " : "", display_name); + serverLog(LL_WARNING, + "%sModule %s initialization failed. Module name is busy.", + is_static ? "Static " : "", + display_name); } moduleFreeContext(&ctx); if (handle) { @@ -13428,7 +13474,8 @@ int moduleLoad(const char *path, void **module_argv, int module_argc, int is_loa } int dlopen_flags = RTLD_NOW | RTLD_LOCAL; -#if (defined(__GLIBC__) || defined(__FreeBSD__)) && !defined(VALKEY_ADDRESS_SANITIZER) && !defined(VALKEY_THREAD_SANITIZER) && __has_include() +#if (defined(__GLIBC__) || defined(__FreeBSD__)) && !defined(VALKEY_ADDRESS_SANITIZER) \ + && !defined(VALKEY_THREAD_SANITIZER) && __has_include() /* RTLD_DEEPBIND, which is required for loading modules that contains the * same symbols, does not work with ASAN or TSAN. Therefore, we exclude * RTLD_DEEPBIND when doing test builds with sanitizers. @@ -13495,8 +13542,10 @@ static int moduleLoadStaticSymbol(void **out, void **handle, const char *symbol_ if (error == NULL) error = "Unknown error"; serverLog(LL_WARNING, - "Failed to load static module: %s. Could not load method: %s. %s", module_name, - symbol_full_name, error); + "Failed to load static module: %s. Could not load method: %s. %s", + module_name, + symbol_full_name, + error); dlclose(*handle); return C_ERR; } @@ -13528,8 +13577,7 @@ int moduleLoadStatic(const char *module_name, void **module_argv, int module_arg if (moduleLoadStaticSymbol((void **)&onload, &handle, "ValkeyModule_OnLoad", module_name) != C_OK) { return C_ERR; } - return moduleInitPostOnLoadResolved(onload, handle, module_name, module_argv, module_argc, - is_loadex, 1); + return moduleInitPostOnLoadResolved(onload, handle, module_name, module_argv, module_argc, is_loadex, 1); } static int moduleUnloadInternal(struct ValkeyModule *module, const char **errmsg) { @@ -13566,7 +13614,8 @@ static int moduleUnloadInternal(struct ValkeyModule *module, const char **errmsg /* Give module a chance to clean up. */ ModuleUnLoadFunc onunload = NULL; if (module->is_static_module == 1) { - if (moduleLoadStaticSymbol((void **)&onunload, &module->handle, "ValkeyModule_OnUnload", module->name) != C_OK) { + if (moduleLoadStaticSymbol((void **)&onunload, &module->handle, "ValkeyModule_OnUnload", module->name) + != C_OK) { serverLog(LL_WARNING, "Module %s OnUnload failed. Unload canceled.", module->name); errno = ECANCELED; return C_ERR; @@ -13755,7 +13804,13 @@ sds genModulesInfoString(sds info) { info = sdscatfmt(info, "module:name=%S,ver=%i,api=%i,filters=%i," "usedby=%S,using=%S,options=%S\r\n", - name, module->ver, module->apiver, (int)listLength(module->filters), usedby, using, options); + name, + module->ver, + module->apiver, + (int)listLength(module->filters), + usedby, + using, + options); sdsfree(usedby); sdsfree(using); sdsfree(options); @@ -13776,9 +13831,10 @@ int isModuleConfigNameRegistered(ValkeyModule *module, const char *name) { /* Assert that the flags passed into the VM_RegisterConfig Suite are valid */ int moduleVerifyConfigFlags(unsigned int flags, configType type) { - if ((flags & ~(VALKEYMODULE_CONFIG_DEFAULT | VALKEYMODULE_CONFIG_IMMUTABLE | VALKEYMODULE_CONFIG_SENSITIVE | - VALKEYMODULE_CONFIG_HIDDEN | VALKEYMODULE_CONFIG_PROTECTED | VALKEYMODULE_CONFIG_DENY_LOADING | - VALKEYMODULE_CONFIG_BITFLAGS | VALKEYMODULE_CONFIG_MEMORY | VALKEYMODULE_CONFIG_UNSIGNED))) { + if ((flags + & ~(VALKEYMODULE_CONFIG_DEFAULT | VALKEYMODULE_CONFIG_IMMUTABLE | VALKEYMODULE_CONFIG_SENSITIVE + | VALKEYMODULE_CONFIG_HIDDEN | VALKEYMODULE_CONFIG_PROTECTED | VALKEYMODULE_CONFIG_DENY_LOADING + | VALKEYMODULE_CONFIG_BITFLAGS | VALKEYMODULE_CONFIG_MEMORY | VALKEYMODULE_CONFIG_UNSIGNED))) { serverLogRaw(LL_WARNING, "Invalid flag(s) for configuration"); return VALKEYMODULE_ERR; } @@ -13802,8 +13858,8 @@ int moduleVerifyResourceName(const char *name) { for (size_t i = 0; name[i] != '\0'; i++) { char curr_char = name[i]; - if ((curr_char >= 'a' && curr_char <= 'z') || (curr_char >= 'A' && curr_char <= 'Z') || - (curr_char >= '0' && curr_char <= '9') || (curr_char == '_') || (curr_char == '-')) { + if ((curr_char >= 'a' && curr_char <= 'z') || (curr_char >= 'A' && curr_char <= 'Z') + || (curr_char >= '0' && curr_char <= '9') || (curr_char == '_') || (curr_char == '-')) { continue; } serverLog(LL_WARNING, "Invalid character %c in Module resource name %s.", curr_char, name); @@ -13897,7 +13953,9 @@ int loadModuleConfigs(ValkeyModule *module) { dictEntry *config_argument = dictFind(server.module_configs_queue, config_name); if (config_argument) { if (!performModuleConfigSetFromName(dictGetKey(config_argument), dictGetVal(config_argument), &err)) { - serverLog(LL_WARNING, "Issue during loading of configuration %s : %s", (sds)dictGetKey(config_argument), + serverLog(LL_WARNING, + "Issue during loading of configuration %s : %s", + (sds)dictGetKey(config_argument), err); sdsfree(config_name); dictEmpty(server.module_configs_queue, NULL); @@ -13905,8 +13963,10 @@ int loadModuleConfigs(ValkeyModule *module) { } } else { if (!performModuleConfigSetDefaultFromName(config_name, &err)) { - serverLog(LL_WARNING, "Issue attempting to set default value of configuration %s : %s", - module_config->name, err); + serverLog(LL_WARNING, + "Issue attempting to set default value of configuration %s : %s", + module_config->name, + err); sdsfree(config_name); dictEmpty(server.module_configs_queue, NULL); return VALKEYMODULE_ERR; @@ -13964,8 +14024,10 @@ int moduleConfigApplyConfig(list *module_configs, const char **err, const char * * -------------------------------------------------------------------------- */ /* Create a module config object. */ -ModuleConfig * -createModuleConfig(const char *name, ValkeyModuleConfigApplyFunc apply_fn, void *privdata, ValkeyModule *module) { +ModuleConfig *createModuleConfig(const char *name, + ValkeyModuleConfigApplyFunc apply_fn, + void *privdata, + ValkeyModule *module) { ModuleConfig *new_config = zmalloc(sizeof(ModuleConfig)); new_config->name = sdsnew(name); new_config->apply_fn = apply_fn; @@ -14434,18 +14496,16 @@ int VM_RegisterScriptingEngine(ValkeyModuleCtx *module_ctx, serverLog(LL_DEBUG, "Registering a new scripting engine: %s", engine_name); if (engine_methods->version > VALKEYMODULE_SCRIPTING_ENGINE_ABI_VERSION) { - serverLog(LL_WARNING, "The engine implementation version is greater " - "than what this server supports. Server ABI " - "Version: %lu, Engine ABI version: %lu", + serverLog(LL_WARNING, + "The engine implementation version is greater " + "than what this server supports. Server ABI " + "Version: %lu, Engine ABI version: %lu", VALKEYMODULE_SCRIPTING_ENGINE_ABI_VERSION, (unsigned long)engine_methods->version); return VALKEYMODULE_ERR; } - if (scriptingEngineManagerRegister(engine_name, - module_ctx->module, - engine_ctx, - engine_methods) != C_OK) { + if (scriptingEngineManagerRegister(engine_name, module_ctx->module, engine_ctx, engine_methods) != C_OK) { return VALKEYMODULE_ERR; } @@ -14475,8 +14535,8 @@ int VM_UnregisterScriptingEngine(ValkeyModuleCtx *ctx, const char *engine_name) * It will return VMSE_STATE_KILLED if the function was already killed either by * a `SCRIPT KILL`, or `FUNCTION KILL`. */ -ValkeyModuleScriptingEngineExecutionState VM_GetFunctionExecutionState( - ValkeyModuleScriptingEngineServerRuntimeCtx *server_ctx) { +ValkeyModuleScriptingEngineExecutionState VM_GetFunctionExecutionState(ValkeyModuleScriptingEngineServerRuntimeCtx + *server_ctx) { int ret = scriptInterrupt(server_ctx); serverAssert(ret == SCRIPT_CONTINUE || ret == SCRIPT_KILL); return ret == SCRIPT_CONTINUE ? VMSE_STATE_EXECUTING : VMSE_STATE_KILLED; @@ -14533,8 +14593,7 @@ void VM_ScriptingEngineDebuggerFlushLogs(void) { * `ValkeyModule_ScriptingEngineDebuggerFlushLogs` allows to implement an * interactive debugging session for scripts executed by the scripting engine. */ -void VM_ScriptingEngineDebuggerProcessCommands(int *client_disconnected, - ValkeyModuleString **err) { +void VM_ScriptingEngineDebuggerProcessCommands(int *client_disconnected, ValkeyModuleString **err) { scriptingEngineDebuggerProcessCommands(client_disconnected, err); } @@ -14583,8 +14642,8 @@ void moduleCommand(client *c) { } /* If this is a loadex command we want to populate server.module_configs_queue with * sds NAME VALUE pairs. We also want to increment argv to just after ARGS, if supplied. */ - if (parseLoadexArguments((ValkeyModuleString ***)&argv, &argc) == VALKEYMODULE_OK && - moduleLoad(objectGetVal(c->argv[2]), (void **)argv, argc, 1) == C_OK) + if (parseLoadexArguments((ValkeyModuleString ***)&argv, &argc) == VALKEYMODULE_OK + && moduleLoad(objectGetVal(c->argv[2]), (void **)argv, argc, 1) == C_OK) addReply(c, shared.ok); else { dictEmpty(server.module_configs_queue, NULL); @@ -15061,7 +15120,8 @@ int VM_GetDbIdFromDefragCtx(ValkeyModuleDefragCtx *ctx) { * Otherwise it returns `VALKEYMODULE_OK`. */ int VM_ACLCheckKeyPrefixPermissions(ValkeyModuleUser *user, const char *key, size_t len, unsigned int flags) { - const int allow_mask = (VALKEYMODULE_CMD_KEY_ACCESS | VALKEYMODULE_CMD_KEY_INSERT | VALKEYMODULE_CMD_KEY_DELETE | VALKEYMODULE_CMD_KEY_UPDATE); + const int allow_mask = (VALKEYMODULE_CMD_KEY_ACCESS | VALKEYMODULE_CMD_KEY_INSERT | VALKEYMODULE_CMD_KEY_DELETE + | VALKEYMODULE_CMD_KEY_UPDATE); if (user == NULL) { errno = EINVAL; diff --git a/src/module.h b/src/module.h index f6ec2c4ebb8..d9961ffe8af 100644 --- a/src/module.h +++ b/src/module.h @@ -141,11 +141,7 @@ typedef struct ValkeyModuleIO { /* Macro to initialize an IO context. Note that the 'ver' field is populated * inside rdb.c according to the version of the value to load. */ -static inline void moduleInitIOContext(ValkeyModuleIO *iovar, - moduleType *mtype, - rio *rioptr, - robj *keyptr, - int db) { +static inline void moduleInitIOContext(ValkeyModuleIO *iovar, moduleType *mtype, rio *rioptr, robj *keyptr, int db) { iovar->rio = rioptr; iovar->type = mtype; iovar->bytes = 0; @@ -175,8 +171,7 @@ static inline void moduleInitDigestContext(ValkeyModuleDigest *mdvar) { } void moduleEnqueueLoadModule(sds path, sds *argv, int argc); -sds moduleLoadQueueEntryToLoadmoduleOptionStr(ValkeyModule *module, - const char *config_option_str); +sds moduleLoadQueueEntryToLoadmoduleOptionStr(ValkeyModule *module, const char *config_option_str); ValkeyModuleCtx *moduleAllocateContext(void); void moduleScriptingEngineInitContext(ValkeyModuleCtx *out_ctx, ValkeyModule *module, diff --git a/src/modules/helloacl.c b/src/modules/helloacl.c index 6659b98f8c5..1cecafdc56f 100644 --- a/src/modules/helloacl.c +++ b/src/modules/helloacl.c @@ -165,16 +165,16 @@ int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int arg if (ValkeyModule_CreateCommand(ctx, "helloacl.reset", ResetCommand_ValkeyCommand, "", 0, 0, 0) == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "helloacl.revoke", RevokeCommand_ValkeyCommand, "", 0, 0, 0) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "helloacl.revoke", RevokeCommand_ValkeyCommand, "", 0, 0, 0) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "helloacl.authglobal", AuthGlobalCommand_ValkeyCommand, "no-auth", 0, 0, 0) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "helloacl.authglobal", AuthGlobalCommand_ValkeyCommand, "no-auth", 0, 0, 0) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "helloacl.authasync", AuthAsyncCommand_ValkeyCommand, "no-auth", 0, 0, 0) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "helloacl.authasync", AuthAsyncCommand_ValkeyCommand, "no-auth", 0, 0, 0) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; global = ValkeyModule_CreateModuleUser("global"); diff --git a/src/modules/hellocluster.c b/src/modules/hellocluster.c index b5c96ed256f..0b7d5f1df5a 100644 --- a/src/modules/hellocluster.c +++ b/src/modules/hellocluster.c @@ -77,8 +77,14 @@ void PingReceiver(ValkeyModuleCtx *ctx, uint8_t type, const unsigned char *payload, uint32_t len) { - ValkeyModule_Log(ctx, "notice", "PING (type %d) RECEIVED from %.*s: '%.*s'", type, VALKEYMODULE_NODE_ID_LEN, - sender_id, (int)len, payload); + ValkeyModule_Log(ctx, + "notice", + "PING (type %d) RECEIVED from %.*s: '%.*s'", + type, + VALKEYMODULE_NODE_ID_LEN, + sender_id, + (int)len, + payload); ValkeyModule_SendClusterMessage(ctx, NULL, MSGTYPE_PONG, "Ohi!", 4); ValkeyModuleCallReply *reply = ValkeyModule_Call(ctx, "INCR", "c", "pings_received"); ValkeyModule_FreeCallReply(reply); @@ -90,8 +96,14 @@ void PongReceiver(ValkeyModuleCtx *ctx, uint8_t type, const unsigned char *payload, uint32_t len) { - ValkeyModule_Log(ctx, "notice", "PONG (type %d) RECEIVED from %.*s: '%.*s'", type, VALKEYMODULE_NODE_ID_LEN, - sender_id, (int)len, payload); + ValkeyModule_Log(ctx, + "notice", + "PONG (type %d) RECEIVED from %.*s: '%.*s'", + type, + VALKEYMODULE_NODE_ID_LEN, + sender_id, + (int)len, + payload); } /* This function must be present on each module. It is used in order to @@ -102,12 +114,12 @@ int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int arg if (ValkeyModule_Init(ctx, "hellocluster", 1, VALKEYMODULE_APIVER_1) == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hellocluster.pingall", PingallCommand_ValkeyCommand, "readonly", 0, 0, 0) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hellocluster.pingall", PingallCommand_ValkeyCommand, "readonly", 0, 0, 0) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hellocluster.list", ListCommand_ValkeyCommand, "readonly", 0, 0, 0) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hellocluster.list", ListCommand_ValkeyCommand, "readonly", 0, 0, 0) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; /* Disable Cluster sharding and redirections. This way every node diff --git a/src/modules/hellohook.c b/src/modules/hellohook.c index f318859890f..28dbe18dd04 100644 --- a/src/modules/hellohook.c +++ b/src/modules/hellohook.c @@ -44,7 +44,9 @@ void clientChangeCallback(ValkeyModuleCtx *ctx, ValkeyModuleEvent e, uint64_t su ValkeyModuleClientInfo *ci = data; printf("Client %s event for client #%llu %s:%d\n", (sub == VALKEYMODULE_SUBEVENT_CLIENT_CHANGE_CONNECTED) ? "connection" : "disconnection", - (unsigned long long)ci->id, ci->addr, ci->port); + (unsigned long long)ci->id, + ci->addr, + ci->port); } void flushdbCallback(ValkeyModuleCtx *ctx, ValkeyModuleEvent e, uint64_t sub, void *data) { @@ -77,7 +79,10 @@ void authenticationAttemptCallback(ValkeyModuleCtx *ctx, ValkeyModuleEvent e, ui ValkeyModuleAuthenticationInfo *ai = data; printf("Authentication attempt for client #%llu with username=%s module=%s success=%d\n", - (unsigned long long)ai->client_id, ai->username, ai->module_name, ai->result == VALKEYMODULE_AUTH_RESULT_GRANTED); + (unsigned long long)ai->client_id, + ai->username, + ai->module_name, + ai->result == VALKEYMODULE_AUTH_RESULT_GRANTED); } /* This function must be present on each module. It is used in order to diff --git a/src/modules/hellotimer.c b/src/modules/hellotimer.c index 3d6258c76ae..7d909cf8701 100644 --- a/src/modules/hellotimer.c +++ b/src/modules/hellotimer.c @@ -66,8 +66,8 @@ int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int arg if (ValkeyModule_Init(ctx, "hellotimer", 1, VALKEYMODULE_APIVER_1) == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hellotimer.timer", TimerCommand_ValkeyCommand, "readonly", 0, 0, 0) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hellotimer.timer", TimerCommand_ValkeyCommand, "readonly", 0, 0, 0) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; return VALKEYMODULE_OK; diff --git a/src/modules/hellotype.c b/src/modules/hellotype.c index 53dc75c8648..56f812c906c 100644 --- a/src/modules/hellotype.c +++ b/src/modules/hellotype.c @@ -145,8 +145,8 @@ int HelloTypeRange_ValkeyCommand(ValkeyModuleCtx *ctx, ValkeyModuleString **argv } long long first, count; - if (ValkeyModule_StringToLongLong(argv[2], &first) != VALKEYMODULE_OK || - ValkeyModule_StringToLongLong(argv[3], &count) != VALKEYMODULE_OK || first < 0 || count < 0) { + if (ValkeyModule_StringToLongLong(argv[2], &first) != VALKEYMODULE_OK + || ValkeyModule_StringToLongLong(argv[3], &count) != VALKEYMODULE_OK || first < 0 || count < 0) { return ValkeyModule_ReplyWithError(ctx, "ERR invalid first or count parameters"); } @@ -241,7 +241,13 @@ int HelloTypeBRange_ValkeyCommand(ValkeyModuleCtx *ctx, ValkeyModuleString **arg /* Otherwise let's block on the key. */ void *privdata = ValkeyModule_Alloc(100); - ValkeyModule_BlockClientOnKeys(ctx, HelloBlock_Reply, HelloBlock_Timeout, HelloBlock_FreeData, timeout, argv + 1, 1, + ValkeyModule_BlockClientOnKeys(ctx, + HelloBlock_Reply, + HelloBlock_Timeout, + HelloBlock_FreeData, + timeout, + argv + 1, + 1, privdata); return VALKEYMODULE_OK; } @@ -322,20 +328,20 @@ int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int arg HelloType = ValkeyModule_CreateDataType(ctx, "hellotype", 0, &tm); if (HelloType == NULL) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hellotype.insert", HelloTypeInsert_ValkeyCommand, "write deny-oom", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hellotype.insert", HelloTypeInsert_ValkeyCommand, "write deny-oom", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hellotype.range", HelloTypeRange_ValkeyCommand, "readonly", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hellotype.range", HelloTypeRange_ValkeyCommand, "readonly", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hellotype.len", HelloTypeLen_ValkeyCommand, "readonly", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hellotype.len", HelloTypeLen_ValkeyCommand, "readonly", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hellotype.brange", HelloTypeBRange_ValkeyCommand, "readonly", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hellotype.brange", HelloTypeBRange_ValkeyCommand, "readonly", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; return VALKEYMODULE_OK; diff --git a/src/modules/helloworld.c b/src/modules/helloworld.c index 83f36615ad6..ddb5a43f0d5 100644 --- a/src/modules/helloworld.c +++ b/src/modules/helloworld.c @@ -133,10 +133,10 @@ int HelloListSplice_ValkeyCommand(ValkeyModuleCtx *ctx, ValkeyModuleString **arg ValkeyModuleKey *dstkey = ValkeyModule_OpenKey(ctx, argv[2], VALKEYMODULE_READ | VALKEYMODULE_WRITE); /* Src and dst key must be empty or lists. */ - if ((ValkeyModule_KeyType(srckey) != VALKEYMODULE_KEYTYPE_LIST && - ValkeyModule_KeyType(srckey) != VALKEYMODULE_KEYTYPE_EMPTY) || - (ValkeyModule_KeyType(dstkey) != VALKEYMODULE_KEYTYPE_LIST && - ValkeyModule_KeyType(dstkey) != VALKEYMODULE_KEYTYPE_EMPTY)) { + if ((ValkeyModule_KeyType(srckey) != VALKEYMODULE_KEYTYPE_LIST + && ValkeyModule_KeyType(srckey) != VALKEYMODULE_KEYTYPE_EMPTY) + || (ValkeyModule_KeyType(dstkey) != VALKEYMODULE_KEYTYPE_LIST + && ValkeyModule_KeyType(dstkey) != VALKEYMODULE_KEYTYPE_EMPTY)) { ValkeyModule_CloseKey(srckey); ValkeyModule_CloseKey(dstkey); return ValkeyModule_ReplyWithError(ctx, VALKEYMODULE_ERRORMSG_WRONGTYPE); @@ -176,10 +176,10 @@ int HelloListSpliceAuto_ValkeyCommand(ValkeyModuleCtx *ctx, ValkeyModuleString * ValkeyModuleKey *dstkey = ValkeyModule_OpenKey(ctx, argv[2], VALKEYMODULE_READ | VALKEYMODULE_WRITE); /* Src and dst key must be empty or lists. */ - if ((ValkeyModule_KeyType(srckey) != VALKEYMODULE_KEYTYPE_LIST && - ValkeyModule_KeyType(srckey) != VALKEYMODULE_KEYTYPE_EMPTY) || - (ValkeyModule_KeyType(dstkey) != VALKEYMODULE_KEYTYPE_LIST && - ValkeyModule_KeyType(dstkey) != VALKEYMODULE_KEYTYPE_EMPTY)) { + if ((ValkeyModule_KeyType(srckey) != VALKEYMODULE_KEYTYPE_LIST + && ValkeyModule_KeyType(srckey) != VALKEYMODULE_KEYTYPE_EMPTY) + || (ValkeyModule_KeyType(dstkey) != VALKEYMODULE_KEYTYPE_LIST + && ValkeyModule_KeyType(dstkey) != VALKEYMODULE_KEYTYPE_EMPTY)) { return ValkeyModule_ReplyWithError(ctx, VALKEYMODULE_ERRORMSG_WRONGTYPE); } @@ -355,8 +355,8 @@ int HelloZsumRange_ValkeyCommand(ValkeyModuleCtx *ctx, ValkeyModuleString **argv double score_start, score_end; if (argc != 4) return ValkeyModule_WrongArity(ctx); - if (ValkeyModule_StringToDouble(argv[2], &score_start) != VALKEYMODULE_OK || - ValkeyModule_StringToDouble(argv[3], &score_end) != VALKEYMODULE_OK) { + if (ValkeyModule_StringToDouble(argv[2], &score_start) != VALKEYMODULE_OK + || ValkeyModule_StringToDouble(argv[3], &score_end) != VALKEYMODULE_OK) { return ValkeyModule_ReplyWithError(ctx, "ERR invalid range"); } @@ -520,36 +520,42 @@ int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int arg printf("Module loaded with ARGV[%d] = %s\n", j, s); } - if (ValkeyModule_CreateCommand(ctx, "hello.simple", HelloSimple_ValkeyCommand, "readonly", 0, 0, 0) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.simple", HelloSimple_ValkeyCommand, "readonly", 0, 0, 0) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.push.native", HelloPushNative_ValkeyCommand, "write deny-oom", 1, 1, - 1) == VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.push.native", HelloPushNative_ValkeyCommand, "write deny-oom", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.push.call", HelloPushCall_ValkeyCommand, "write deny-oom", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.push.call", HelloPushCall_ValkeyCommand, "write deny-oom", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.push.call2", HelloPushCall2_ValkeyCommand, "write deny-oom", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.push.call2", HelloPushCall2_ValkeyCommand, "write deny-oom", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.list.sum.len", HelloListSumLen_ValkeyCommand, "readonly", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.list.sum.len", HelloListSumLen_ValkeyCommand, "readonly", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.list.splice", HelloListSplice_ValkeyCommand, "write deny-oom", 1, 2, - 1) == VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.list.splice", HelloListSplice_ValkeyCommand, "write deny-oom", 1, 2, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.list.splice.auto", HelloListSpliceAuto_ValkeyCommand, "write deny-oom", - 1, 2, 1) == VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, + "hello.list.splice.auto", + HelloListSpliceAuto_ValkeyCommand, + "write deny-oom", + 1, + 2, + 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.rand.array", HelloRandArray_ValkeyCommand, "readonly", 0, 0, 0) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.rand.array", HelloRandArray_ValkeyCommand, "readonly", 0, 0, 0) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; if (ValkeyModule_CreateCommand(ctx, "hello.repl1", HelloRepl1_ValkeyCommand, "write", 0, 0, 0) == VALKEYMODULE_ERR) @@ -558,24 +564,24 @@ int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int arg if (ValkeyModule_CreateCommand(ctx, "hello.repl2", HelloRepl2_ValkeyCommand, "write", 1, 1, 1) == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.toggle.case", HelloToggleCase_ValkeyCommand, "write", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.toggle.case", HelloToggleCase_ValkeyCommand, "write", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.more.expire", HelloMoreExpire_ValkeyCommand, "write", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.more.expire", HelloMoreExpire_ValkeyCommand, "write", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.zsumrange", HelloZsumRange_ValkeyCommand, "readonly", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.zsumrange", HelloZsumRange_ValkeyCommand, "readonly", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.lexrange", HelloLexRange_ValkeyCommand, "readonly", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.lexrange", HelloLexRange_ValkeyCommand, "readonly", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; - if (ValkeyModule_CreateCommand(ctx, "hello.hcopy", HelloHCopy_ValkeyCommand, "write deny-oom", 1, 1, 1) == - VALKEYMODULE_ERR) + if (ValkeyModule_CreateCommand(ctx, "hello.hcopy", HelloHCopy_ValkeyCommand, "write deny-oom", 1, 1, 1) + == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; if (ValkeyModule_CreateCommand(ctx, "hello.leftpad", HelloLeftPad_ValkeyCommand, "", 1, 1, 1) == VALKEYMODULE_ERR) diff --git a/src/modules/lua/debug_lua.c b/src/modules/lua/debug_lua.c index d03a9226329..d37295b567a 100644 --- a/src/modules/lua/debug_lua.c +++ b/src/modules/lua/debug_lua.c @@ -452,7 +452,9 @@ static void ldbEval(lua_State *lua, ValkeyModuleString **argv, int argc) { } } - ValkeyModuleString *expr = ValkeyModule_CreateStringPrintf(NULL, "return %s", ValkeyModule_StringPtrLen(code, NULL)); + ValkeyModuleString *expr = ValkeyModule_CreateStringPrintf(NULL, + "return %s", + ValkeyModule_StringPtrLen(code, NULL)); size_t code_len; const char *code_str = ValkeyModule_StringPtrLen(code, &code_len); @@ -666,24 +668,117 @@ void ldbGenerateDebuggerCommandsArray(lua_State *lua, if (commands_array_cache == NULL) { ValkeyModuleScriptingEngineDebuggerCommand commands_array[] = { - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("step", 1, NULL, 0, "Run current line and stop again.", 0, stepCommandHandler), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("next", 1, NULL, 0, "Alias for step.", 0, stepCommandHandler), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("continue", 1, NULL, 0, "Run till next breakpoint.", 0, continueCommandHandler), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("list", 1, list_params, 2, "List source code around a specific line. If no line is specified the list is printed around the current line. [ctx] specifies how many lines to show before/after [line].", 0, listCommandHandler), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("whole", 1, NULL, 0, "List all source code. Alias for 'list 1 1000000'.", 0, wholeCommandHandler), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("print", 1, print_params, 1, "Show the value of the specified variable [var]. Can also show global vars KEYS and ARGV. If no [var] is specidied, shows the value of all local variables.", 0, printCommandHandler, lua), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("break", 1, break_params, 1, "Add/Remove a breakpoint to the specified line. If no [line] is specified, it shows all breakpoints. When line = 0, it removes all breakpoints.", 0, breakCommandHandler), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("trace", 1, NULL, 0, "Show a backtrace.", 0, traceCommandHandler, lua), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("eval", 1, eval_params, 1, "Execute some Lua code (in a different callframe).", 0, evalCommandHandler, lua), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("valkey", 1, valkey_params, 1, "Execute a command.", 0, valkeyCommandHandler, lua), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("redis", 1, valkey_params, 1, NULL, 1, valkeyCommandHandler, lua), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX(SERVER_API_NAME, 0, valkey_params, 1, NULL, 1, valkeyCommandHandler, lua), - VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("abort", 1, NULL, 0, "Stop the execution of the script. In sync mode dataset changes will be retained.", 0, abortCommandHandler, lua), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("step", + 1, + NULL, + 0, + "Run current line and stop again.", + 0, + stepCommandHandler), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("next", + 1, + NULL, + 0, + "Alias for step.", + 0, + stepCommandHandler), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("continue", + 1, + NULL, + 0, + "Run till next breakpoint.", + 0, + continueCommandHandler), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND( + "list", + 1, + list_params, + 2, + "List source code around a specific line. If no line is specified the list is printed around the " + "current line. [ctx] specifies how many lines to show before/after [line].", + 0, + listCommandHandler), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("whole", + 1, + NULL, + 0, + "List all source code. Alias for 'list 1 1000000'.", + 0, + wholeCommandHandler), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX( + "print", + 1, + print_params, + 1, + "Show the value of the specified variable [var]. Can also show global vars KEYS and ARGV. If no [var] " + "is specidied, shows the value of all local variables.", + 0, + printCommandHandler, + lua), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND("break", + 1, + break_params, + 1, + "Add/Remove a breakpoint to the specified line. If no " + "[line] is specified, it shows all breakpoints. " + "When line = 0, it removes all breakpoints.", + 0, + breakCommandHandler), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("trace", + 1, + NULL, + 0, + "Show a backtrace.", + 0, + traceCommandHandler, + lua), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("eval", + 1, + eval_params, + 1, + "Execute some Lua code (in a different callframe).", + 0, + evalCommandHandler, + lua), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("valkey", + 1, + valkey_params, + 1, + "Execute a command.", + 0, + valkeyCommandHandler, + lua), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("redis", + 1, + valkey_params, + 1, + NULL, + 1, + valkeyCommandHandler, + lua), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX(SERVER_API_NAME, + 0, + valkey_params, + 1, + NULL, + 1, + valkeyCommandHandler, + lua), + VALKEYMODULE_SCRIPTING_ENGINE_DEBUGGER_COMMAND_WITH_CTX("abort", + 1, + NULL, + 0, + "Stop the execution of the script. In sync mode " + "dataset changes will be retained.", + 0, + abortCommandHandler, + lua), }; commands_array_len = sizeof(commands_array) / sizeof(ValkeyModuleScriptingEngineDebuggerCommand); - commands_array_cache = ValkeyModule_Calloc(commands_array_len, sizeof(ValkeyModuleScriptingEngineDebuggerCommand)); + commands_array_cache = ValkeyModule_Calloc(commands_array_len, + sizeof(ValkeyModuleScriptingEngineDebuggerCommand)); memcpy(commands_array_cache, &commands_array, sizeof(commands_array)); } diff --git a/src/modules/lua/engine_lua.c b/src/modules/lua/engine_lua.c index da960790694..4557e5a4831 100644 --- a/src/modules/lua/engine_lua.c +++ b/src/modules/lua/engine_lua.c @@ -170,8 +170,7 @@ static void get_version_info(ValkeyModuleCtx *ctx, ValkeyModule_FreeServerInfo(ctx, info); } -static void initializeLuaState(luaEngineCtx *lua_engine_ctx, - ValkeyModuleScriptingEngineSubsystemType type) { +static void initializeLuaState(luaEngineCtx *lua_engine_ctx, ValkeyModuleScriptingEngineSubsystemType type) { lua_State *lua = lua_open(); if (type == VMSE_EVAL) { @@ -253,9 +252,10 @@ static ValkeyModuleScriptingEngineCompiledFunction **luaEngineCompileCode(Valkey if (type == VMSE_EVAL) { lua_State *lua = lua_engine_ctx->eval_lua; - if (luaL_loadbuffer( - lua, code, code_len, "@user_script")) { - *err = ValkeyModule_CreateStringPrintf(module_ctx, "Error compiling script (new function): %s", lua_tostring(lua, -1)); + if (luaL_loadbuffer(lua, code, code_len, "@user_script")) { + *err = ValkeyModule_CreateStringPrintf(module_ctx, + "Error compiling script (new function): %s", + lua_tostring(lua, -1)); lua_pop(lua, 1); return functions; } @@ -270,21 +270,15 @@ static ValkeyModuleScriptingEngineCompiledFunction **luaEngineCompileCode(Valkey }; ValkeyModuleScriptingEngineCompiledFunction *func = ValkeyModule_Alloc(sizeof(*func)); - *func = (ValkeyModuleScriptingEngineCompiledFunction){ - .name = NULL, - .function = script, - .desc = NULL, - .f_flags = 0}; + *func = + (ValkeyModuleScriptingEngineCompiledFunction){.name = NULL, .function = script, .desc = NULL, .f_flags = 0}; *out_num_compiled_functions = 1; functions = ValkeyModule_Calloc(1, sizeof(ValkeyModuleScriptingEngineCompiledFunction *)); *functions = func; } else { - functions = luaFunctionLibraryCreate(lua_engine_ctx->function_lua, - code, - timeout, - out_num_compiled_functions, - err); + functions = + luaFunctionLibraryCreate(lua_engine_ctx->function_lua, code, timeout, out_num_compiled_functions, err); } return functions; @@ -354,8 +348,8 @@ static int isLuaInsecureAPIEnabled(ValkeyModuleCtx *module_ctx) { ValkeyModule_FreeCallReply(reply); return 0; } - ValkeyModule_Assert(ValkeyModule_CallReplyType(reply) == VALKEYMODULE_REPLY_ARRAY && - ValkeyModule_CallReplyLength(reply) == 2); + ValkeyModule_Assert(ValkeyModule_CallReplyType(reply) == VALKEYMODULE_REPLY_ARRAY + && ValkeyModule_CallReplyLength(reply) == 2); ValkeyModuleCallReply *val = ValkeyModule_CallReplyArrayElement(reply, 1); ValkeyModule_Assert(ValkeyModule_CallReplyType(val) == VALKEYMODULE_REPLY_STRING); const char *val_str = ValkeyModule_CallReplyStringPtr(val, NULL); @@ -395,10 +389,10 @@ static ValkeyModuleScriptingEngineCallableLazyEnvReset *luaEngineResetEnv(Valkey static size_t luaEngineFunctionMemoryOverhead(ValkeyModuleCtx *module_ctx, ValkeyModuleScriptingEngineCompiledFunction *compiled_function) { VALKEYMODULE_NOT_USED(module_ctx); - return ValkeyModule_MallocSize(compiled_function->function) + - (compiled_function->name ? ValkeyModule_MallocSize(compiled_function->name) : 0) + - (compiled_function->desc ? ValkeyModule_MallocSize(compiled_function->desc) : 0) + - ValkeyModule_MallocSize(compiled_function); + return ValkeyModule_MallocSize(compiled_function->function) + + (compiled_function->name ? ValkeyModule_MallocSize(compiled_function->name) : 0) + + (compiled_function->desc ? ValkeyModule_MallocSize(compiled_function->desc) : 0) + + ValkeyModule_MallocSize(compiled_function); } static void luaEngineFreeFunction(ValkeyModuleCtx *module_ctx, @@ -431,11 +425,12 @@ static void luaEngineFreeFunction(ValkeyModuleCtx *module_ctx, ValkeyModule_Free(compiled_function); } -static ValkeyModuleScriptingEngineDebuggerEnableRet luaEngineDebuggerEnable(ValkeyModuleCtx *module_ctx, - ValkeyModuleScriptingEngineCtx *engine_ctx, - ValkeyModuleScriptingEngineSubsystemType type, - const ValkeyModuleScriptingEngineDebuggerCommand **commands, - size_t *commands_len) { +static ValkeyModuleScriptingEngineDebuggerEnableRet luaEngineDebuggerEnable( + ValkeyModuleCtx *module_ctx, + ValkeyModuleScriptingEngineCtx *engine_ctx, + ValkeyModuleScriptingEngineSubsystemType type, + const ValkeyModuleScriptingEngineDebuggerCommand **commands, + size_t *commands_len) { VALKEYMODULE_NOT_USED(module_ctx); if (type != VMSE_EVAL) { @@ -445,9 +440,7 @@ static ValkeyModuleScriptingEngineDebuggerEnableRet luaEngineDebuggerEnable(Valk ldbEnable(); luaEngineCtx *lua_engine_ctx = engine_ctx; - ldbGenerateDebuggerCommandsArray(lua_engine_ctx->eval_lua, - commands, - commands_len); + ldbGenerateDebuggerCommandsArray(lua_engine_ctx->eval_lua, commands, commands_len); return VMSE_DEBUG_ENABLED; } @@ -493,9 +486,7 @@ static struct luaEngineCtx *engine_ctx = NULL; #define LUA_MODULE_VISIBILITY #endif -LUA_MODULE_VISIBILITY int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, - ValkeyModuleString **argv, - int argc) { +LUA_MODULE_VISIBILITY int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc) { VALKEYMODULE_NOT_USED(argv); VALKEYMODULE_NOT_USED(argc); @@ -503,8 +494,9 @@ LUA_MODULE_VISIBILITY int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, return VALKEYMODULE_ERR; } - ValkeyModule_SetModuleOptions(ctx, VALKEYMODULE_OPTIONS_HANDLE_REPL_ASYNC_LOAD | - VALKEYMODULE_OPTIONS_HANDLE_ATOMIC_SLOT_MIGRATION); + ValkeyModule_SetModuleOptions(ctx, + VALKEYMODULE_OPTIONS_HANDLE_REPL_ASYNC_LOAD + | VALKEYMODULE_OPTIONS_HANDLE_ATOMIC_SLOT_MIGRATION); engine_ctx = createEngineContext(ctx); @@ -529,10 +521,7 @@ LUA_MODULE_VISIBILITY int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, .debugger_end = luaEngineDebuggerEnd, }; - int result = ValkeyModule_RegisterScriptingEngine(ctx, - LUA_ENGINE_NAME, - engine_ctx, - &methods); + int result = ValkeyModule_RegisterScriptingEngine(ctx, LUA_ENGINE_NAME, engine_ctx, &methods); if (result == VALKEYMODULE_ERR) { ValkeyModule_Log(ctx, "warning", "Failed to register LUA scripting engine"); @@ -561,9 +550,7 @@ LUA_MODULE_VISIBILITY int ValkeyModule_OnUnload(ValkeyModuleCtx *ctx) { #if STATIC_LUA /* Unique entry points (Load and Unload) used by the Lua module when linked statically */ -int ValkeyModule_OnLoad_lua(ValkeyModuleCtx *ctx, - ValkeyModuleString **argv, - int argc) { +int ValkeyModule_OnLoad_lua(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc) { return ValkeyModule_OnLoad(ctx, argv, argc); } diff --git a/src/modules/lua/function_lua.c b/src/modules/lua/function_lua.c index 95283644a45..063d87e09b7 100644 --- a/src/modules/lua/function_lua.c +++ b/src/modules/lua/function_lua.c @@ -100,8 +100,7 @@ static void luaEngineLoadHook(lua_State *lua, lua_Debug *ar) { } } -static void freeCompiledFunc(lua_State *lua, - ValkeyModuleScriptingEngineCompiledFunction *compiled_func) { +static void freeCompiledFunc(lua_State *lua, ValkeyModuleScriptingEngineCompiledFunction *compiled_func) { ValkeyModule_FreeString(NULL, compiled_func->name); if (compiled_func->desc) { ValkeyModule_FreeString(NULL, compiled_func->desc); @@ -171,9 +170,8 @@ ValkeyModuleScriptingEngineCompiledFunction **luaFunctionLibraryCreate(lua_State goto done; } - compiled_functions = - ValkeyModule_Calloc(list_length(load_ctx.functions), - sizeof(ValkeyModuleScriptingEngineCompiledFunction *)); + compiled_functions = ValkeyModule_Calloc(list_length(load_ctx.functions), + sizeof(ValkeyModuleScriptingEngineCompiledFunction *)); ListIter *iter = list_get_iter(load_ctx.functions); void *val = NULL; *out_num_compiled_functions = 0; @@ -282,8 +280,7 @@ static ValkeyModuleString *luaGetStringObject(lua_State *lua, int index) { return ValkeyModule_CreateString(NULL, str, len); } -static int luaRegisterFunctionReadNamedArgs(lua_State *lua, - ValkeyModuleScriptingEngineCompiledFunction *func) { +static int luaRegisterFunctionReadNamedArgs(lua_State *lua, ValkeyModuleScriptingEngineCompiledFunction *func) { char *err = NULL; ValkeyModuleString *name = NULL; ValkeyModuleString *desc = NULL; @@ -353,11 +350,7 @@ static int luaRegisterFunctionReadNamedArgs(lua_State *lua, goto error; } - luaRegisterFunctionArgsInitialize(func, - name, - desc, - script, - flags); + luaRegisterFunctionArgsInitialize(func, name, desc, script, flags); return C_OK; @@ -372,8 +365,7 @@ static int luaRegisterFunctionReadNamedArgs(lua_State *lua, return C_ERR; } -static int luaRegisterFunctionReadPositionalArgs(lua_State *lua, - ValkeyModuleScriptingEngineCompiledFunction *func) { +static int luaRegisterFunctionReadPositionalArgs(lua_State *lua, ValkeyModuleScriptingEngineCompiledFunction *func) { char *err = NULL; ValkeyModuleString *name = NULL; luaFunction *script = NULL; @@ -404,8 +396,7 @@ static int luaRegisterFunctionReadPositionalArgs(lua_State *lua, return C_ERR; } -static int luaRegisterFunctionReadArgs(lua_State *lua, - ValkeyModuleScriptingEngineCompiledFunction *func) { +static int luaRegisterFunctionReadArgs(lua_State *lua, ValkeyModuleScriptingEngineCompiledFunction *func) { int argc = lua_gettop(lua); if (argc < 1 || argc > 2) { luaPushError(lua, "wrong number of arguments to server.register_function"); diff --git a/src/modules/lua/script_lua.c b/src/modules/lua/script_lua.c index 91f762be847..4a65b5c5562 100644 --- a/src/modules/lua/script_lua.c +++ b/src/modules/lua/script_lua.c @@ -46,7 +46,12 @@ #include /* Forward declarations of module API functions not publicly exposed */ -extern int VM_CallArgv(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc, int flags, const ValkeyModuleReplyHandlers *resp_handlers, void *reply_ctx); +extern int VM_CallArgv(ValkeyModuleCtx *ctx, + ValkeyModuleString **argv, + int argc, + int flags, + const ValkeyModuleReplyHandlers *resp_handlers, + void *reply_ctx); extern int VM_ReplyRaw(ValkeyModuleCtx *ctx, const char *proto, size_t proto_len); #define ValkeyModule_CallArgv VM_CallArgv #define ValkeyModule_ReplyRaw VM_ReplyRaw @@ -99,31 +104,10 @@ static char *server_api_allow_list[] = { /* Lua builtins */ static char *lua_builtins_allow_list[] = { - "xpcall", - "tostring", - "setmetatable", - "next", - "assert", - "tonumber", - "rawequal", - "collectgarbage", - "getmetatable", - "rawset", - "pcall", - "coroutine", - "type", - "_G", - "select", - "unpack", - "gcinfo", - "pairs", - "rawget", - "loadstring", - "ipairs", - "_VERSION", - "load", - "error", - NULL, + "xpcall", "tostring", "setmetatable", "next", "assert", "tonumber", "rawequal", + "collectgarbage", "getmetatable", "rawset", "pcall", "coroutine", "type", "_G", + "select", "unpack", "gcinfo", "pairs", "rawget", "loadstring", "ipairs", + "_VERSION", "load", "error", NULL, }; /* Lua builtins which are deprecated for sandboxing concerns */ @@ -365,9 +349,7 @@ static void luaReplyToServerReply(ValkeyModuleCtx *ctx, int resp_version, lua_St } switch (t) { - case LUA_TSTRING: - ValkeyModule_ReplyWithStringBuffer(ctx, lua_tostring(lua, -1), lua_strlen(lua, -1)); - break; + case LUA_TSTRING: ValkeyModule_ReplyWithStringBuffer(ctx, lua_tostring(lua, -1), lua_strlen(lua, -1)); break; case LUA_TBOOLEAN: if (resp_version == 2) { int b = lua_toboolean(lua, -1); @@ -1182,11 +1164,9 @@ static int luaServerGenericCommand(lua_State *lua, int raise_error) { ValkeyModule_Free(cmdlog); } - int flags = VALKEYMODULE_CALL_ARGV_SCRIPT_MODE | - VALKEYMODULE_CALL_ARGV_REPLICATE | - VALKEYMODULE_CALL_ARGV_ERRORS_AS_REPLIES | - VALKEYMODULE_CALL_ARGV_RESPECT_DENY_OOM | - VALKEYMODULE_CALL_ARGV_REPLY_EXACT; + int flags = VALKEYMODULE_CALL_ARGV_SCRIPT_MODE | VALKEYMODULE_CALL_ARGV_REPLICATE + | VALKEYMODULE_CALL_ARGV_ERRORS_AS_REPLIES | VALKEYMODULE_CALL_ARGV_RESPECT_DENY_OOM + | VALKEYMODULE_CALL_ARGV_REPLY_EXACT; if (!(rctx->replication_flags & PROPAGATE_AOF)) { flags |= VALKEYMODULE_CALL_ARGV_NO_AOF; @@ -1531,7 +1511,9 @@ static int luaProtectedTableError(lua_State *lua) { luaFuncCallCtx *rctx = luaGetFromRegistry(lua, REGISTRY_RUN_CTX_NAME); int argc = lua_gettop(lua); if (argc != 2) { - ValkeyModule_Log(rctx->module_ctx, "warning", "malicious code trying to call luaProtectedTableError with wrong arguments"); + ValkeyModule_Log(rctx->module_ctx, + "warning", + "malicious code trying to call luaProtectedTableError with wrong arguments"); luaL_error(lua, "Wrong number of arguments to luaProtectedTableError"); } if (!lua_isstring(lua, -1) && !lua_isnumber(lua, -1)) { @@ -1560,7 +1542,9 @@ static int luaNewIndexAllowList(lua_State *lua) { luaFuncCallCtx *rctx = luaGetFromRegistry(lua, REGISTRY_RUN_CTX_NAME); int argc = lua_gettop(lua); if (argc != 3) { - ValkeyModule_Log(rctx->module_ctx, "warning", "malicious code trying to call luaNewIndexAllowList with wrong arguments"); + ValkeyModule_Log(rctx->module_ctx, + "warning", + "malicious code trying to call luaNewIndexAllowList with wrong arguments"); luaL_error(lua, "Wrong number of arguments to luaNewIndexAllowList"); } if (!lua_istable(lua, -3)) { @@ -1608,9 +1592,10 @@ static int luaNewIndexAllowList(lua_State *lua) { } } if (!*c && !deprecated) { - ValkeyModule_Log(rctx->module_ctx, "warning", - "A key '%s' was added to Lua globals which is neither on the globals allow list nor listed on the " - "deny list.", + ValkeyModule_Log(rctx->module_ctx, + "warning", + "A key '%s' was added to Lua globals which is neither on the globals allow list " + "nor listed on the deny list.", variable_name); } } else { @@ -1664,14 +1649,8 @@ void luaSetTableProtectionRecursively(lua_State *lua) { /* Set the readonly flag on the metatable of basic types (string, nil etc.) */ void luaSetTableProtectionForBasicTypes(lua_State *lua) { - static const int types[] = { - LUA_TSTRING, - LUA_TNUMBER, - LUA_TBOOLEAN, - LUA_TNIL, - LUA_TFUNCTION, - LUA_TTHREAD, - LUA_TLIGHTUSERDATA}; + static const int types[] = + {LUA_TSTRING, LUA_TNUMBER, LUA_TBOOLEAN, LUA_TNIL, LUA_TFUNCTION, LUA_TTHREAD, LUA_TLIGHTUSERDATA}; for (size_t i = 0; i < sizeof(types) / sizeof(types[0]); i++) { /* Push a dummy value of the type to get its metatable */ @@ -1886,8 +1865,7 @@ static void luaCreateArray(lua_State *lua, ValkeyModuleString **elev, int elec) static int server_math_random(lua_State *L) { /* the `%' avoids the (rare) case of r==1, and is needed also because on some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ - lua_Number r = (lua_Number)(serverLrand48() % SERVER_LRAND48_MAX) / - (lua_Number)SERVER_LRAND48_MAX; + lua_Number r = (lua_Number)(serverLrand48() % SERVER_LRAND48_MAX) / (lua_Number)SERVER_LRAND48_MAX; switch (lua_gettop(L)) { /* check number of arguments */ case 0: { /* no arguments */ lua_pushnumber(L, r); /* Number between 0 and 1 */ @@ -2025,7 +2003,8 @@ void luaLdbLineHook(lua_State *lua, lua_Debug *ar) { reason = "timeout reached, infinite loop?"; ldbSetStepMode(0); ldbSetBreakpointOnNextLine(0); - ValkeyModuleString *msg = ValkeyModule_CreateStringPrintf(NULL, "* Stopped at %d, stop reason = %s", ldbGetCurrentLine(), reason); + ValkeyModuleString *msg = + ValkeyModule_CreateStringPrintf(NULL, "* Stopped at %d, stop reason = %s", ldbGetCurrentLine(), reason); ldbLog(msg); ldbLogSourceLine(ldbGetCurrentLine()); ldbSendLogs(); @@ -2138,19 +2117,14 @@ void luaCallFunction(ValkeyModuleCtx *ctx, errorInfo err_info = {0}; luaExtractErrorInformation(lua, &err_info); if (err_info.line && err_info.source) { - ValkeyModule_ReplyWithCustomErrorFormat( - ctx, - !err_info.ignore_err_stats_update, - "%s script: on %s:%s.", - err_info.msg, - err_info.source, - err_info.line); + ValkeyModule_ReplyWithCustomErrorFormat(ctx, + !err_info.ignore_err_stats_update, + "%s script: on %s:%s.", + err_info.msg, + err_info.source, + err_info.line); } else { - ValkeyModule_ReplyWithCustomErrorFormat( - ctx, - !err_info.ignore_err_stats_update, - "%s", - err_info.msg); + ValkeyModule_ReplyWithCustomErrorFormat(ctx, !err_info.ignore_err_stats_update, "%s", err_info.msg); } luaErrorInformationDiscard(&err_info); } diff --git a/src/monotonic.c b/src/monotonic.c index 2d9a580750d..c7d43eb8187 100644 --- a/src/monotonic.c +++ b/src/monotonic.c @@ -143,7 +143,9 @@ static void monotonicInit_aarch64(void) { return; } - snprintf(monotonic_info_string, sizeof(monotonic_info_string), "ARM CNTVCT @ %ld ticks/us", + snprintf(monotonic_info_string, + sizeof(monotonic_info_string), + "ARM CNTVCT @ %ld ticks/us", mono_ticksPerMicrosecond); getMonotonicUs = getMonotonicUs_aarch64; } diff --git a/src/networking.c b/src/networking.c index a4bcd261a20..6eb70b7f416 100644 --- a/src/networking.c +++ b/src/networking.c @@ -222,7 +222,9 @@ void linkClient(client *c) { static void clientSetDefaultAuth(client *c) { /* If the default user does not require authentication, the user is * directly authenticated. */ - clientSetUser(c, DefaultUser, (DefaultUser->flags & USER_FLAG_NOPASS) && !(DefaultUser->flags & USER_FLAG_DISABLED)); + clientSetUser(c, + DefaultUser, + (DefaultUser->flags & USER_FLAG_NOPASS) && !(DefaultUser->flags & USER_FLAG_DISABLED)); } /* Attach the user u to this client. @@ -232,8 +234,7 @@ static void clientSetDefaultAuth(client *c) { void clientSetUser(client *c, user *u, int authenticated) { c->user = u; c->flag.authenticated = authenticated; - if (authenticated) - c->flag.ever_authenticated = authenticated; + if (authenticated) c->flag.ever_authenticated = authenticated; } static int clientEverAuthenticated(client *c) { @@ -243,14 +244,15 @@ static int clientEverAuthenticated(client *c) { int authRequired(client *c) { /* Check if the user is authenticated. This check is skipped in case * the default user is flagged as "nopass" and is active. */ - int auth_required = (!(DefaultUser->flags & USER_FLAG_NOPASS) || (DefaultUser->flags & USER_FLAG_DISABLED)) && - !c->flag.authenticated; + int auth_required = (!(DefaultUser->flags & USER_FLAG_NOPASS) || (DefaultUser->flags & USER_FLAG_DISABLED)) + && !c->flag.authenticated; return auth_required; } static inline int isReplicaReadyForReplData(client *replica) { - return (replica->repl_data->repl_state == REPLICA_STATE_ONLINE || replica->repl_data->repl_state == REPLICA_STATE_BG_RDB_LOAD) && - !(replica->flag.close_asap); + return (replica->repl_data->repl_state == REPLICA_STATE_ONLINE + || replica->repl_data->repl_state == REPLICA_STATE_BG_RDB_LOAD) + && !(replica->flag.close_asap); } /* Decides if copy avoidance is preferred according to client type, number of I/O threads, object size @@ -276,10 +278,12 @@ static int isCopyAvoidPreferred(client *c, robj *obj) { /* Main thread only. No I/O threads */ if (server.io_threads_num == 1) { /* Copy avoidance is preferred starting certain string size */ - return server.min_string_size_copy_avoid && sdslen(objectGetVal(obj)) >= (size_t)server.min_string_size_copy_avoid; + return server.min_string_size_copy_avoid + && sdslen(objectGetVal(obj)) >= (size_t)server.min_string_size_copy_avoid; } /* Main thread + I/O threads */ - return server.min_string_size_copy_avoid_threaded && sdslen(objectGetVal(obj)) >= (size_t)server.min_string_size_copy_avoid_threaded; + return server.min_string_size_copy_avoid_threaded + && sdslen(objectGetVal(obj)) >= (size_t)server.min_string_size_copy_avoid_threaded; } client *createClient(connection *conn) { @@ -406,11 +410,10 @@ void putClientInPendingWriteQueue(client *c) { /* Schedule the client to write the output buffers to the socket only * if not already done and, for replicas, if the replica can actually receive * writes at this stage. */ - if (!c->flag.pending_write && - (!c->repl_data || - c->repl_data->repl_state == REPL_STATE_NONE || - (isReplicaReadyForReplData(c) && !c->repl_data->repl_start_cmd_stream_on_ack)) && - clusterSlotMigrationShouldInstallWriteHandler(c)) { + if (!c->flag.pending_write + && (!c->repl_data || c->repl_data->repl_state == REPL_STATE_NONE + || (isReplicaReadyForReplData(c) && !c->repl_data->repl_start_cmd_stream_on_ack)) + && clusterSlotMigrationShouldInstallWriteHandler(c)) { /* Here instead of installing the write handler, we just flag the * client and put it into a list of clients that have something * to write to the socket. This way before re-entering the event @@ -558,9 +561,9 @@ static size_t upsertPayloadHeader(char *buf, if (!clusterSlotStatsEnabled(slot)) slot = -1; /* Try to add payload to last chunk if possible */ - if (*last_header != NULL && (*last_header)->payload_type == type && (*last_header)->slot == slot && - (*last_header)->track_bytes == track_bytes && - !atomic_load_explicit(&(*last_header)->tracked_for_cob, memory_order_acquire)) { + if (*last_header != NULL && (*last_header)->payload_type == type && (*last_header)->slot == slot + && (*last_header)->track_bytes == track_bytes + && !atomic_load_explicit(&(*last_header)->tracked_for_cob, memory_order_acquire)) { (*last_header)->payload_len += allowed_len; return allowed_len; } @@ -604,7 +607,14 @@ static size_t _addReplyPayloadToBuffer(client *c, const void *payload, size_t le size_t reply_len = min(available, len); if (c->flag.buf_encoded) { int track_bytes = (server.commandlog[COMMANDLOG_TYPE_LARGE_REPLY].threshold != -1); - reply_len = upsertPayloadHeader(c->buf, &c->bufpos, &c->last_header, payload_type, len, c->slot, track_bytes, available); + reply_len = upsertPayloadHeader(c->buf, + &c->bufpos, + &c->last_header, + payload_type, + len, + c->slot, + track_bytes, + available); } if (!reply_len) return 0; @@ -655,7 +665,14 @@ static void _addReplyPayloadToList(client *c, list *reply_list, const char *payl if (tail->flag.buf_encoded) { int track_bytes = (server.commandlog[COMMANDLOG_TYPE_LARGE_REPLY].threshold != -1); - copy = upsertPayloadHeader(tail->buf, &tail->used, &tail->last_header, payload_type, len, c->slot, track_bytes, avail); + copy = upsertPayloadHeader(tail->buf, + &tail->used, + &tail->last_header, + payload_type, + len, + c->slot, + track_bytes, + avail); } else if (encoded) { /* If encoded buffer is required but tail is unencoded then pretend nothing can be added to it * and, as consequence, cause addition of a new tail */ @@ -684,7 +701,14 @@ static void _addReplyPayloadToList(client *c, list *reply_list, const char *payl tail->last_header = NULL; if (tail->flag.buf_encoded) { int track_bytes = (server.commandlog[COMMANDLOG_TYPE_LARGE_REPLY].threshold != -1); - upsertPayloadHeader(tail->buf, &tail->used, &tail->last_header, payload_type, len, c->slot, track_bytes, tail->size); + upsertPayloadHeader(tail->buf, + &tail->used, + &tail->last_header, + payload_type, + len, + c->slot, + track_bytes, + tail->size); } memcpy(tail->buf + tail->used, payload, len); tail->used += len; @@ -711,8 +735,8 @@ static void _addBulkStrRefToToList(client *c, const void *payload, size_t len) { * depending on how many arguments it got), and has no reply. */ int cmdHasPushAsReply(struct serverCommand *cmd) { if (!cmd) return 0; - return cmd->proc == subscribeCommand || cmd->proc == unsubscribeCommand || cmd->proc == psubscribeCommand || - cmd->proc == punsubscribeCommand || cmd->proc == ssubscribeCommand || cmd->proc == sunsubscribeCommand; + return cmd->proc == subscribeCommand || cmd->proc == unsubscribeCommand || cmd->proc == psubscribeCommand + || cmd->proc == punsubscribeCommand || cmd->proc == ssubscribeCommand || cmd->proc == sunsubscribeCommand; } void _addReplyToBufferOrList(client *c, const char *s, size_t len) { @@ -724,7 +748,8 @@ void _addReplyToBufferOrList(client *c, const char *s, size_t len) { * not for responses, so we should normally never get here on a replica client. */ if (getClientType(c) == CLIENT_TYPE_REPLICA) { sds cmdname = c->lastcmd ? c->lastcmd->fullname : NULL; - logInvalidUseAndFreeClientAsync(c, "Replica generated a reply to command '%s'", + logInvalidUseAndFreeClientAsync(c, + "Replica generated a reply to command '%s'", cmdname ? cmdname : ""); return; } @@ -740,8 +765,8 @@ void _addReplyToBufferOrList(client *c, const char *s, size_t len) { * the SUBSCRIBE command family, which (currently) have a push message instead of a proper reply. * The check for executing_client also avoids affecting push messages that are part of eviction. * Check CLIENT_PUSHING first to avoid race conditions, as it's absent in module's fake client. */ - int defer_push_message = c->flag.pushing && c == server.current_client && server.executing_client && - !cmdHasPushAsReply(server.executing_client->cmd); + int defer_push_message = c->flag.pushing && c == server.current_client && server.executing_client + && !cmdHasPushAsReply(server.executing_client->cmd); if (defer_push_message == 0 && isDeferredReplyEnabled(c)) { _addReplyProtoToList(c, c->deferred_reply, s, len); return; @@ -879,8 +904,8 @@ void afterErrorReply(client *c, const char *s, size_t len, int flags) { } /* After the errors RAX reaches its limit, instead of tracking * custom errors (e.g. LUA), we track the error under `errorstat_ERRORSTATS_OVERFLOW` */ - if (flags & ERR_REPLY_FLAG_CUSTOM && raxSize(server.errors) >= ERRORSTATS_LIMIT && - !raxFind(server.errors, (unsigned char *)err_prefix, prefix_len, NULL)) { + if (flags & ERR_REPLY_FLAG_CUSTOM && raxSize(server.errors) >= ERRORSTATS_LIMIT + && !raxFind(server.errors, (unsigned char *)err_prefix, prefix_len, NULL)) { err_prefix = ERRORSTATS_OVERFLOW_ERR; prefix_len = strlen(ERRORSTATS_OVERFLOW_ERR); } @@ -901,7 +926,8 @@ void afterErrorReply(client *c, const char *s, size_t len, int flags) { * the commands sent by the primary. However it is useful to log such events since * they are rare and may hint at errors in a script or a bug in the server. */ int ctype = getClientType(c); - if (ctype == CLIENT_TYPE_PRIMARY || ctype == CLIENT_TYPE_REPLICA || c->id == CLIENT_ID_AOF || ctype == CLIENT_TYPE_SLOT_IMPORT || ctype == CLIENT_TYPE_SLOT_EXPORT) { + if (ctype == CLIENT_TYPE_PRIMARY || ctype == CLIENT_TYPE_REPLICA || c->id == CLIENT_ID_AOF + || ctype == CLIENT_TYPE_SLOT_IMPORT || ctype == CLIENT_TYPE_SLOT_EXPORT) { char *to, *from; if (c->id == CLIENT_ID_AOF) { @@ -929,7 +955,11 @@ void afterErrorReply(client *c, const char *s, size_t len, int flags) { "== CRITICAL == This %s is sending an error " "to its %s: '%.*s' after processing the command " "'%s'", - from, to, (int)len, s, cmdname ? cmdname : ""); + from, + to, + (int)len, + s, + cmdname ? cmdname : ""); if (ctype == CLIENT_TYPE_PRIMARY && server.repl_backlog && server.repl_backlog->histlen > 0) { showLatestBacklog(); } @@ -939,15 +969,17 @@ void afterErrorReply(client *c, const char *s, size_t len, int flags) { * are currently two checked cases: * * If this command was from our primary and we are not a writable replica. * * We are reading from an AOF file. */ - int panic_in_replicas = (ctype == CLIENT_TYPE_PRIMARY && server.repl_replica_ro) && - (server.propagation_error_behavior == PROPAGATION_ERR_BEHAVIOR_PANIC || - server.propagation_error_behavior == PROPAGATION_ERR_BEHAVIOR_PANIC_ON_REPLICAS); - int panic_in_aof = - c->id == CLIENT_ID_AOF && server.propagation_error_behavior == PROPAGATION_ERR_BEHAVIOR_PANIC; + int panic_in_replicas = (ctype == CLIENT_TYPE_PRIMARY && server.repl_replica_ro) + && (server.propagation_error_behavior == PROPAGATION_ERR_BEHAVIOR_PANIC + || server.propagation_error_behavior == PROPAGATION_ERR_BEHAVIOR_PANIC_ON_REPLICAS); + int panic_in_aof = c->id == CLIENT_ID_AOF + && server.propagation_error_behavior == PROPAGATION_ERR_BEHAVIOR_PANIC; if (panic_in_replicas || panic_in_aof) { serverPanic("This %s panicked sending an error to its %s" " after processing the command '%s'", - from, to, cmdname ? cmdname : ""); + from, + to, + cmdname ? cmdname : ""); } if (ctype == CLIENT_TYPE_SLOT_IMPORT || ctype == CLIENT_TYPE_SLOT_EXPORT) { clusterHandleSlotMigrationErrorResponse(c->slot_migration_job); @@ -1091,8 +1123,8 @@ void trimReplyUnusedTailSpace(client *c) { * allocation), otherwise there's a high chance realloc will NOP. * Also, to avoid large memmove which happens as part of realloc, we only do * that if the used part is small. */ - if (tail->size - tail->used > tail->size / 4 && tail->used < PROTO_REPLY_CHUNK_BYTES && - c->io_write_state != CLIENT_PENDING_IO && !tail->flag.buf_encoded) { + if (tail->size - tail->used > tail->size / 4 && tail->used < PROTO_REPLY_CHUNK_BYTES + && c->io_write_state != CLIENT_PENDING_IO && !tail->flag.buf_encoded) { size_t usable_size; size_t old_size = tail->size; tail = zrealloc_usable(tail, tail->used + sizeof(clientReplyBlock), &usable_size); @@ -1118,7 +1150,8 @@ void *addReplyDeferredLen(client *c) { * not for responses, so we should normally never get here on a replica client. */ if (getClientType(c) == CLIENT_TYPE_REPLICA) { sds cmdname = c->lastcmd ? c->lastcmd->fullname : NULL; - logInvalidUseAndFreeClientAsync(c, "Replica generated a reply to command '%s'", + logInvalidUseAndFreeClientAsync(c, + "Replica generated a reply to command '%s'", cmdname ? cmdname : ""); return NULL; } @@ -1164,8 +1197,8 @@ void setDeferredReply(client *c, void *node, const char *s, size_t length) { * - It has enough room already allocated * - And not too large (avoid large memmove) * - And the client is not in a pending I/O state */ - if (ln->prev != NULL && (prev = listNodeValue(ln->prev)) && prev->size > prev->used && - c->io_write_state != CLIENT_PENDING_IO && !prev->flag.buf_encoded) { + if (ln->prev != NULL && (prev = listNodeValue(ln->prev)) && prev->size > prev->used + && c->io_write_state != CLIENT_PENDING_IO && !prev->flag.buf_encoded) { size_t len_to_copy = prev->size - prev->used; if (len_to_copy > length) len_to_copy = length; memcpy(prev->buf + prev->used, s, len_to_copy); @@ -1179,8 +1212,9 @@ void setDeferredReply(client *c, void *node, const char *s, size_t length) { s += len_to_copy; } - if (ln->next != NULL && (next = listNodeValue(ln->next)) && next->size - next->used >= length && - next->used < PROTO_REPLY_CHUNK_BYTES * 4 && c->io_write_state != CLIENT_PENDING_IO && !next->flag.buf_encoded) { + if (ln->next != NULL && (next = listNodeValue(ln->next)) && next->size - next->used >= length + && next->used < PROTO_REPLY_CHUNK_BYTES * 4 && c->io_write_state != CLIENT_PENDING_IO + && !next->flag.buf_encoded) { memmove(next->buf + length, next->buf, next->used); memcpy(next->buf, s, length); c->net_output_bytes_curr_cmd += length; @@ -1633,8 +1667,10 @@ void addReplyHelp(client *c, const char **help) { void addReplySubcommandSyntaxError(client *c) { sds cmd = sdsnew((char *)objectGetVal(c->argv[0])); sdstoupper(cmd); - addReplyErrorFormat(c, "unknown subcommand or wrong number of arguments for '%.128s'. Try %s HELP.", - (char *)objectGetVal(c->argv[1]), cmd); + addReplyErrorFormat(c, + "unknown subcommand or wrong number of arguments for '%.128s'. Try %s HELP.", + (char *)objectGetVal(c->argv[1]), + cmd); sdsfree(cmd); } @@ -1776,8 +1812,11 @@ void clientAcceptHandler(connection *conn) { client *c = connGetPrivateData(conn); if (connGetState(conn) != CONN_STATE_CONNECTED) { - serverLog(LL_WARNING, "Error accepting a client connection: %s (addr=%s laddr=%s)", connGetLastError(conn), - getClientPeerId(c), getClientSockname(c)); + serverLog(LL_WARNING, + "Error accepting a client connection: %s (addr=%s laddr=%s)", + connGetLastError(conn), + getClientPeerId(c), + getClientSockname(c)); freeClientAsync(c); return; } @@ -1822,7 +1861,8 @@ void clientAcceptHandler(connection *conn) { if (u) { clientSetUser(c, u, 1); moduleNotifyUserChanged(c); - serverLog(LL_VERBOSE, "TLS: Auto-authenticated client as %s", + serverLog(LL_VERBOSE, + "TLS: Auto-authenticated client as %s", server.hide_user_data_from_log ? "*redacted*" : u->name); } else if (cert_username) { addACLLogEntry(c, ACL_INVALID_TLS_CERT_AUTH, ACL_LOG_CTX_TOPLEVEL, 0, cert_username, NULL); @@ -1843,8 +1883,11 @@ void acceptCommonHandler(connection *conn, struct ClientFlags flags, char *ip) { connFormatAddr(conn, laddr, sizeof(laddr), 0); if (connGetState(conn) != CONN_STATE_ACCEPTING) { - serverLog(LL_VERBOSE, "Accepted client connection in error state: %s (addr=%s laddr=%s)", - connGetLastError(conn), addr, laddr); + serverLog(LL_VERBOSE, + "Accepted client connection in error state: %s (addr=%s laddr=%s)", + connGetLastError(conn), + addr, + laddr); connClose(conn); return; } @@ -1875,8 +1918,11 @@ void acceptCommonHandler(connection *conn, struct ClientFlags flags, char *ip) { /* Create connection and client */ if ((c = createClient(conn)) == NULL) { - serverLog(LL_WARNING, "Error registering fd event for the new client connection: %s (addr=%s laddr=%s)", - connGetLastError(conn), addr, laddr); + serverLog(LL_WARNING, + "Error registering fd event for the new client connection: %s (addr=%s laddr=%s)", + connGetLastError(conn), + addr, + laddr); connClose(conn); /* May be already closed, just ignore errors */ return; } @@ -1894,8 +1940,11 @@ void acceptCommonHandler(connection *conn, struct ClientFlags flags, char *ip) { */ if (connAccept(conn, clientAcceptHandler) == C_ERR) { if (connGetState(conn) == CONN_STATE_ERROR) - serverLog(LL_WARNING, "Error accepting a client connection: %s (addr=%s laddr=%s)", connGetLastError(conn), - getClientPeerId(c), getClientSockname(c)); + serverLog(LL_WARNING, + "Error accepting a client connection: %s (addr=%s laddr=%s)", + connGetLastError(conn), + getClientPeerId(c), + getClientSockname(c)); freeClient(connGetPrivateData(conn)); return; } @@ -1986,8 +2035,8 @@ void unlinkClient(client *c) { * always check if this was the target. The state of the migration isn't relevant since the * snapshot child may take some time to die, during which the migration will continue past * the snapshot state. */ - if (c->repl_data && server.rdb_pipe_conns && - ((c->flag.replica && c->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END))) { + if (c->repl_data && server.rdb_pipe_conns + && ((c->flag.replica && c->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END))) { int i; int still_alive = 0; for (i = 0; i < server.rdb_pipe_numconns; i++) { @@ -2367,15 +2416,20 @@ int freeClientsInAsyncFreeQueue(void) { if (!c->repl_data->rdb_client_disconnect_time) { if (c->conn) connSetReadHandler(c->conn, NULL); c->repl_data->rdb_client_disconnect_time = server.unixtime; - dualChannelServerLog(LL_VERBOSE, "Postpone RDB client id=%llu (%s) free for %d seconds", - (unsigned long long)c->id, replicationGetReplicaName(c), server.wait_before_rdb_client_free); + dualChannelServerLog(LL_VERBOSE, + "Postpone RDB client id=%llu (%s) free for %d seconds", + (unsigned long long)c->id, + replicationGetReplicaName(c), + server.wait_before_rdb_client_free); } - if (server.unixtime - c->repl_data->rdb_client_disconnect_time <= server.wait_before_rdb_client_free) continue; - dualChannelServerLog( - LL_NOTICE, - "Replica main channel failed to establish PSYNC within the grace period (%ld seconds). " - "Freeing RDB client %llu.", - (long int)(server.unixtime - c->repl_data->rdb_client_disconnect_time), (unsigned long long)c->id); + if (server.unixtime - c->repl_data->rdb_client_disconnect_time <= server.wait_before_rdb_client_free) + continue; + dualChannelServerLog(LL_NOTICE, + "Replica main channel failed to establish PSYNC within the grace period (%ld " + "seconds). " + "Freeing RDB client %llu.", + (long int)(server.unixtime - c->repl_data->rdb_client_disconnect_time), + (unsigned long long)c->id); c->flag.protected_rdb_channel = 0; } @@ -2554,7 +2608,12 @@ typedef struct bufWriteMetadata { process stopped due encountered limit */ } bufWriteMetadata; -static void initReplyIOV(client *c, int iovsize, struct iovec *iov_arr, char (*prefixes)[], char *crlf, replyIOV *reply) { +static void initReplyIOV(client *c, + int iovsize, + struct iovec *iov_arr, + char (*prefixes)[], + char *crlf, + replyIOV *reply) { reply->iovcnt = 0; reply->iovsize = iovsize; reply->limit_reached = 0; @@ -2839,7 +2898,9 @@ int _writeToClient(client *c) { ssize_t tot_written = 0; while (tot_written < bytes_to_write) { - int nwritten = connWrite(c->conn, c->buf + c->io_last_written.data_len + tot_written, bytes_to_write - tot_written); + int nwritten = connWrite(c->conn, + c->buf + c->io_last_written.data_len + tot_written, + bytes_to_write - tot_written); if (nwritten <= 0) { c->write_flags |= WRITE_FLAGS_WRITE_ERROR; tot_written = tot_written > 0 ? tot_written : nwritten; @@ -2876,8 +2937,11 @@ static void trackBufReferences(char *buf, size_t bufpos, client *c) { if (header->payload_type == BULK_STR_REF) { uint8_t expected = 0; - if (atomic_compare_exchange_strong_explicit(&header->tracked_for_cob, &expected, 1, - memory_order_acq_rel, memory_order_acquire)) { + if (atomic_compare_exchange_strong_explicit(&header->tracked_for_cob, + &expected, + 1, + memory_order_acq_rel, + memory_order_acquire)) { /* We claimed tracking rights */ bulkStrRef *str_ref = (bulkStrRef *)ptr; size_t len = header->payload_len; @@ -3081,7 +3145,9 @@ void sendReplyToClient(connection *conn) { void handleQbLimitReached(client *c) { sds ci = catClientInfoString(sdsempty(), c, server.hide_user_data_from_log), bytes = sdsempty(); bytes = sdscatrepr(bytes, c->querybuf, 64); - serverLog(LL_WARNING, "Closing client that reached max query buffer length: %s (qbuf initial bytes: %s)", ci, + serverLog(LL_WARNING, + "Closing client that reached max query buffer length: %s (qbuf initial bytes: %s)", + ci, bytes); sdsfree(ci); sdsfree(bytes); @@ -3174,12 +3240,14 @@ void handleParseError(client *c) { setProtocolError("invalid CRLF in request", c); } else if (flags & READ_FLAGS_ERROR_UNEXPECTED_INLINE_FROM_REPLICATED_CLIENT) { if (getClientType(c) == CLIENT_TYPE_SLOT_IMPORT) { - serverLog(LL_WARNING, "WARNING: Receiving inline protocol from slot import, import stream corruption? Closing the " - "slot import connection."); + serverLog(LL_WARNING, + "WARNING: Receiving inline protocol from slot import, import stream corruption? Closing the " + "slot import connection."); setProtocolError("Import using the inline protocol. Desync?", c); } else { - serverLog(LL_WARNING, "WARNING: Receiving inline protocol from primary, primary stream corruption? Closing the " - "primary connection and discarding the cached primary."); + serverLog(LL_WARNING, + "WARNING: Receiving inline protocol from primary, primary stream corruption? Closing the " + "primary connection and discarding the cached primary."); setProtocolError("Master using the inline protocol. Desync?", c); } } else { @@ -3188,12 +3256,13 @@ void handleParseError(client *c) { } int isParsingError(client *c) { - return c->read_flags & (READ_FLAGS_ERROR_BIG_INLINE_REQUEST | READ_FLAGS_ERROR_BIG_MULTIBULK | - READ_FLAGS_ERROR_INVALID_MULTIBULK_LEN | READ_FLAGS_ERROR_UNAUTHENTICATED_MULTIBULK_LEN | - READ_FLAGS_ERROR_UNAUTHENTICATED_BULK_LEN | READ_FLAGS_ERROR_MBULK_INVALID_BULK_LEN | - READ_FLAGS_ERROR_BIG_BULK_COUNT | READ_FLAGS_ERROR_MBULK_UNEXPECTED_CHARACTER | - READ_FLAGS_ERROR_UNEXPECTED_INLINE_FROM_REPLICATED_CLIENT | READ_FLAGS_ERROR_UNBALANCED_QUOTES | - READ_FLAGS_ERROR_INVALID_CRLF); + return c->read_flags + & (READ_FLAGS_ERROR_BIG_INLINE_REQUEST | READ_FLAGS_ERROR_BIG_MULTIBULK + | READ_FLAGS_ERROR_INVALID_MULTIBULK_LEN | READ_FLAGS_ERROR_UNAUTHENTICATED_MULTIBULK_LEN + | READ_FLAGS_ERROR_UNAUTHENTICATED_BULK_LEN | READ_FLAGS_ERROR_MBULK_INVALID_BULK_LEN + | READ_FLAGS_ERROR_BIG_BULK_COUNT | READ_FLAGS_ERROR_MBULK_UNEXPECTED_CHARACTER + | READ_FLAGS_ERROR_UNEXPECTED_INLINE_FROM_REPLICATED_CLIENT | READ_FLAGS_ERROR_UNBALANCED_QUOTES + | READ_FLAGS_ERROR_INVALID_CRLF); } /* This function is called after the query-buffer was parsed. @@ -3526,9 +3595,14 @@ static void setProtocolError(const char *errstr, client *c) { if (c->querybuf && sdslen(c->querybuf) - c->qb_pos < PROTO_DUMP_LEN) { snprintf(buf, sizeof(buf), "'%s'", c->querybuf + c->qb_pos); } else if (c->querybuf) { - snprintf(buf, sizeof(buf), "'%.*s' (... more %zu bytes ...) '%.*s'", - PROTO_DUMP_LEN / 2, c->querybuf + c->qb_pos, sdslen(c->querybuf) - c->qb_pos - PROTO_DUMP_LEN, - PROTO_DUMP_LEN / 2, c->querybuf + sdslen(c->querybuf) - PROTO_DUMP_LEN / 2); + snprintf(buf, + sizeof(buf), + "'%.*s' (... more %zu bytes ...) '%.*s'", + PROTO_DUMP_LEN / 2, + c->querybuf + c->qb_pos, + sdslen(c->querybuf) - c->qb_pos - PROTO_DUMP_LEN, + PROTO_DUMP_LEN / 2, + c->querybuf + sdslen(c->querybuf) - PROTO_DUMP_LEN / 2); } /* Remove non printable chars. */ @@ -3555,8 +3629,7 @@ static void setProtocolError(const char *errstr, client *c) { * command is in RESP format, so the first byte in the command is found * to be '*'. Otherwise for inline commands parseInlineBuffer() is called. */ void parseMultibulkBuffer(client *c) { - int flag = parseMultibulk(c, &c->argc, &c->argv, &c->argv_len, - &c->argv_len_sum, &c->net_input_bytes_curr_cmd); + int flag = parseMultibulk(c, &c->argc, &c->argv, &c->argv_len, &c->argv_len_sum, &c->net_input_bytes_curr_cmd); c->read_flags |= flag; if (c->read_flags & READ_FLAGS_AUTH_REQUIRED) { @@ -3575,9 +3648,7 @@ void parseMultibulkBuffer(client *c) { /* Try parsing pipelined commands. */ cmdQueue *queue = &c->cmd_queue; serverAssert(queue->len == 0); - while ((flag & READ_FLAGS_PARSING_COMPLETED) && - sdslen(c->querybuf) > c->qb_pos && - c->querybuf[c->qb_pos] == '*') { + while ((flag & READ_FLAGS_PARSING_COMPLETED) && sdslen(c->querybuf) > c->qb_pos && c->querybuf[c->qb_pos] == '*') { c->reqtype = PROTO_REQ_MULTIBULK; /* Push a new parser state to the command queue */ if (queue->len == queue->cap) { @@ -3592,8 +3663,7 @@ void parseMultibulkBuffer(client *c) { } parsedCommand *p = &queue->cmds[queue->len++]; memset(p, 0, sizeof(*p)); - flag = parseMultibulk(c, &p->argc, &p->argv, &p->argv_len, - &p->argv_len_sum, &p->input_bytes); + flag = parseMultibulk(c, &p->argc, &p->argv, &p->argv_len, &p->argv_len_sum, &p->input_bytes); p->read_flags = flag; p->slot = -1; } @@ -3780,22 +3850,21 @@ static int parseMultibulk(client *c, } else { /* Check if we have space in argv, grow if needed */ if (*argc >= *argv_len) { - *argv_len = min(*argv_len < INT_MAX / 2 ? (*argv_len) * 2 : INT_MAX, - *argc + c->multibulklen); + *argv_len = min(*argv_len < INT_MAX / 2 ? (*argv_len) * 2 : INT_MAX, *argc + c->multibulklen); *argv = zrealloc(*argv, sizeof(robj *) * (*argv_len)); } /* Check that what follows argv is a real \r\n */ - if (unlikely(c->querybuf[c->qb_pos + c->bulklen] != '\r' || - c->querybuf[c->qb_pos + c->bulklen + 1] != '\n')) { + if (unlikely(c->querybuf[c->qb_pos + c->bulklen] != '\r' + || c->querybuf[c->qb_pos + c->bulklen + 1] != '\n')) { return READ_FLAGS_ERROR_INVALID_CRLF; } /* Optimization: if a non-replicated client's buffer contains JUST our bulk element * instead of creating a new object by *copying* the sds we * just use the current sds string. */ - if (!is_replicated && c->qb_pos == 0 && c->bulklen >= PROTO_MBULK_BIG_ARG && - sdslen(c->querybuf) == (size_t)(c->bulklen + 2)) { + if (!is_replicated && c->qb_pos == 0 && c->bulklen >= PROTO_MBULK_BIG_ARG + && sdslen(c->querybuf) == (size_t)(c->bulklen + 2)) { (*argv)[(*argc)++] = createObject(OBJ_STRING, c->querybuf); *argv_len_sum += c->bulklen; sdsIncrLen(c->querybuf, -2); /* remove CRLF */ @@ -3958,8 +4027,7 @@ void parseInputBuffer(client *c) { /* Free unused memory in a client's queue of parsed commands. */ void trimCommandQueue(client *c) { - if (c->flag.close_asap) return; /* Prevent concurrent access with - freeClientAsync(). */ + if (c->flag.close_asap) return; /* Prevent concurrent access with freeClientAsync(). */ cmdQueue *queue = &c->cmd_queue; if (queue->cmds != NULL) { if (queue->len == 0) { @@ -4092,14 +4160,11 @@ static void prefetchCommandQueueKeys(client *c) { /* If the command is valid, add keys to incremental find batch. */ if (c->parsed_cmd != NULL && !(c->read_flags & READ_FLAGS_BAD_ARITY)) { - num_keys = addKeysToIncrFindBatch(c, c->parsed_cmd, c->argv, c->argc, - key_incr_states, num_keys, max_keys); + num_keys = addKeysToIncrFindBatch(c, c->parsed_cmd, c->argv, c->argc, key_incr_states, num_keys, max_keys); } else { /* Command is already found to be incomplete, non-existing, etc. */ - debugServerAssert(!(c->read_flags & READ_FLAGS_PARSING_COMPLETED) || - c->argc == 0 || - (c->read_flags & READ_FLAGS_COMMAND_NOT_FOUND) || - (c->read_flags & READ_FLAGS_BAD_ARITY)); + debugServerAssert(!(c->read_flags & READ_FLAGS_PARSING_COMPLETED) || c->argc == 0 + || (c->read_flags & READ_FLAGS_COMMAND_NOT_FOUND) || (c->read_flags & READ_FLAGS_BAD_ARITY)); } cmdQueue *queue = &c->cmd_queue; @@ -4109,14 +4174,12 @@ static void prefetchCommandQueueKeys(client *c) { p->read_flags |= READ_FLAGS_PREFETCHED; if (p->cmd == NULL || p->read_flags & READ_FLAGS_BAD_ARITY) { /* Command is already found to be incomplete, non-existing, etc. */ - debugServerAssert(!(p->read_flags & READ_FLAGS_PARSING_COMPLETED) || - p->argc == 0 || - (p->read_flags & READ_FLAGS_COMMAND_NOT_FOUND) || - (p->read_flags & READ_FLAGS_BAD_ARITY)); + debugServerAssert(!(p->read_flags & READ_FLAGS_PARSING_COMPLETED) || p->argc == 0 + || (p->read_flags & READ_FLAGS_COMMAND_NOT_FOUND) + || (p->read_flags & READ_FLAGS_BAD_ARITY)); continue; } - num_keys = addKeysToIncrFindBatch(c, p->cmd, p->argv, p->argc, - key_incr_states, num_keys, max_keys); + num_keys = addKeysToIncrFindBatch(c, p->cmd, p->argv, p->argc, key_incr_states, num_keys, max_keys); } if (num_keys <= 1) return; /* No point to prefetch a single key */ @@ -4145,8 +4208,7 @@ static void prefetchCommandQueueKeys(client *c) { int processInputBuffer(client *c) { /* Parse the query buffer and/or execute already parsed commands. */ - while ((c->querybuf && c->qb_pos < sdslen(c->querybuf)) || - c->cmd_queue.off < c->cmd_queue.len) { + while ((c->querybuf && c->qb_pos < sdslen(c->querybuf)) || c->cmd_queue.off < c->cmd_queue.len) { if (!canParseCommand(c)) { break; } @@ -4272,8 +4334,8 @@ static bool readToQueryBuf(client *c) { * * For unauthenticated clients, the query buffer cannot exceed 1MB at most. */ size_t qb_memory = sdslen(c->querybuf) + (c->mstate ? c->mstate->argv_len_sums : 0); - if (qb_memory > server.client_max_querybuf_len || - (qb_memory > 1024 * 1024 && (c->read_flags & READ_FLAGS_AUTH_REQUIRED))) { + if (qb_memory > server.client_max_querybuf_len + || (qb_memory > 1024 * 1024 && (c->read_flags & READ_FLAGS_AUTH_REQUIRED))) { c->read_flags |= READ_FLAGS_QB_LIMIT_REACHED; } } @@ -4296,10 +4358,7 @@ void readQueryFromClient(connection *conn) { if (processInputBuffer(c) == C_ERR) return; trimCommandQueue(c); } - repeat = (c->flag.primary && - !c->flag.close_asap && - ++iter < REPL_MAX_READS_PER_IO_EVENT && - full_read); + repeat = (c->flag.primary && !c->flag.close_asap && ++iter < REPL_MAX_READS_PER_IO_EVENT && full_read); beforeNextClient(c); } while (repeat); } @@ -4420,44 +4479,79 @@ sds catClientInfoString(sds s, client *client, int hide_user_data) { replBufBlock *cur = listNodeValue(client->repl_data->ref_repl_buf_node); used_blocks_of_repl_buf = last->id - cur->id + 1; } - sds ret = sdscatfmt( - s, - FMTARGS( - "id=%U", (unsigned long long)client->id, - " addr=%s", getClientPeerId(client), - " laddr=%s", getClientSockname(client), - " %s", connGetInfo(client->conn, conninfo, sizeof(conninfo)), - " name=%s", hide_user_data ? "*redacted*" : (client->name ? (char *)objectGetVal(client->name) : ""), - " age=%I", (long long)(commandTimeSnapshot() / 1000 - client->ctime), - " idle=%I", (long long)(server.unixtime - client->last_interaction), - " flags=%s", flags, - " capa=%s", capa, - " db=%i", client->db->id, - " sub=%i", client->pubsub_data ? (int)hashtableSize(client->pubsub_data->pubsub_channels) : 0, - " psub=%i", client->pubsub_data ? (int)hashtableSize(client->pubsub_data->pubsub_patterns) : 0, - " ssub=%i", client->pubsub_data ? (int)hashtableSize(client->pubsub_data->pubsubshard_channels) : 0, - " multi=%i", client->mstate ? client->mstate->count : -1, - " watch=%i", client->mstate ? (int)listLength(&client->mstate->watched_keys) : 0, - " qbuf=%U", client->querybuf ? (unsigned long long)sdslen(client->querybuf) : 0, - " qbuf-free=%U", client->querybuf ? (unsigned long long)sdsavail(client->querybuf) : 0, - " argv-mem=%U", (unsigned long long)client->argv_len_sum, - " multi-mem=%U", client->mstate ? (unsigned long long)client->mstate->argv_len_sums : 0, - " rbs=%U", (unsigned long long)client->buf_usable_size, - " rbp=%U", (unsigned long long)client->buf_peak, - " obl=%U", (unsigned long long)client->bufpos, - " oll=%U", (unsigned long long)listLength(client->reply) + used_blocks_of_repl_buf, - " omem=%U", (unsigned long long)obufmem, /* should not include client->buf since we want to see 0 for static clients. */ - " tot-mem=%U", (unsigned long long)total_mem, - " events=%s", events, - " cmd=%s", client->lastcmd ? client->lastcmd->fullname : "NULL", - " user=%s", hide_user_data ? "*redacted*" : (client->user ? client->user->name : "(superuser)"), - " redir=%I", (client->flag.tracking) ? (long long)client->pubsub_data->client_tracking_redirection : -1, - " resp=%i", client->resp, - " lib-name=%s", client->lib_name ? (char *)objectGetVal(client->lib_name) : "", - " lib-ver=%s", client->lib_ver ? (char *)objectGetVal(client->lib_ver) : "", - " tot-net-in=%U", client->net_input_bytes, - " tot-net-out=%U", client->net_output_bytes, - " tot-cmds=%U", client->commands_processed)); + sds ret = + sdscatfmt(s, + FMTARGS("id=%U", + (unsigned long long)client->id, + " addr=%s", + getClientPeerId(client), + " laddr=%s", + getClientSockname(client), + " %s", + connGetInfo(client->conn, conninfo, sizeof(conninfo)), + " name=%s", + hide_user_data ? "*redacted*" : (client->name ? (char *)objectGetVal(client->name) : ""), + " age=%I", + (long long)(commandTimeSnapshot() / 1000 - client->ctime), + " idle=%I", + (long long)(server.unixtime - client->last_interaction), + " flags=%s", + flags, + " capa=%s", + capa, + " db=%i", + client->db->id, + " sub=%i", + client->pubsub_data ? (int)hashtableSize(client->pubsub_data->pubsub_channels) : 0, + " psub=%i", + client->pubsub_data ? (int)hashtableSize(client->pubsub_data->pubsub_patterns) : 0, + " ssub=%i", + client->pubsub_data ? (int)hashtableSize(client->pubsub_data->pubsubshard_channels) : 0, + " multi=%i", + client->mstate ? client->mstate->count : -1, + " watch=%i", + client->mstate ? (int)listLength(&client->mstate->watched_keys) : 0, + " qbuf=%U", + client->querybuf ? (unsigned long long)sdslen(client->querybuf) : 0, + " qbuf-free=%U", + client->querybuf ? (unsigned long long)sdsavail(client->querybuf) : 0, + " argv-mem=%U", + (unsigned long long)client->argv_len_sum, + " multi-mem=%U", + client->mstate ? (unsigned long long)client->mstate->argv_len_sums : 0, + " rbs=%U", + (unsigned long long)client->buf_usable_size, + " rbp=%U", + (unsigned long long)client->buf_peak, + " obl=%U", + (unsigned long long)client->bufpos, + " oll=%U", + (unsigned long long)listLength(client->reply) + used_blocks_of_repl_buf, + " omem=%U", + /* should not include client->buf since we want to see 0 for static clients. */ + (unsigned long long)obufmem, + " tot-mem=%U", + (unsigned long long)total_mem, + " events=%s", + events, + " cmd=%s", + client->lastcmd ? client->lastcmd->fullname : "NULL", + " user=%s", + hide_user_data ? "*redacted*" : (client->user ? client->user->name : "(superuser)"), + " redir=%I", + (client->flag.tracking) ? (long long)client->pubsub_data->client_tracking_redirection : -1, + " resp=%i", + client->resp, + " lib-name=%s", + client->lib_name ? (char *)objectGetVal(client->lib_name) : "", + " lib-ver=%s", + client->lib_ver ? (char *)objectGetVal(client->lib_ver) : "", + " tot-net-in=%U", + client->net_input_bytes, + " tot-net-out=%U", + client->net_output_bytes, + " tot-cmds=%U", + client->commands_processed)); return ret; } @@ -4470,17 +4564,24 @@ sds catClientInfoShortString(sds s, client *client, int hide_user_data) { if (!server.crashed) waitForClientIO(client); char conninfo[CONN_INFO_LEN]; - sds ret = sdscatfmt( - s, - FMTARGS( - "id=%U", (unsigned long long)client->id, - " addr=%s", getClientPeerId(client), - " laddr=%s", getClientSockname(client), - " %s", connGetInfo(client->conn, conninfo, sizeof(conninfo)), - " name=%s", hide_user_data ? "*redacted*" : (client->name ? (char *)objectGetVal(client->name) : ""), - " user=%s", hide_user_data ? "*redacted*" : (client->user ? client->user->name : "(superuser)"), - " lib-name=%s", client->lib_name ? (char *)objectGetVal(client->lib_name) : "", - " lib-ver=%s", client->lib_ver ? (char *)objectGetVal(client->lib_ver) : "")); + sds ret = sdscatfmt(s, + FMTARGS("id=%U", + (unsigned long long)client->id, + " addr=%s", + getClientPeerId(client), + " laddr=%s", + getClientSockname(client), + " %s", + connGetInfo(client->conn, conninfo, sizeof(conninfo)), + " name=%s", + hide_user_data ? "*redacted*" + : (client->name ? (char *)objectGetVal(client->name) : ""), + " user=%s", + hide_user_data ? "*redacted*" : (client->user ? client->user->name : "(superuser)"), + " lib-name=%s", + client->lib_name ? (char *)objectGetVal(client->lib_name) : "", + " lib-ver=%s", + client->lib_ver ? (char *)objectGetVal(client->lib_ver) : "")); return ret; } @@ -4686,8 +4787,8 @@ static int parseClientFiltersOrReply(client *c, int index, clientFilter *filter) } else if (!strcasecmp(objectGetVal(c->argv[index]), "maxage") && moreargs) { long long maxage; - if (getLongLongFromObjectOrReply(c, c->argv[index + 1], &maxage, - "maxage is not an integer or out of range") != C_OK) + if (getLongLongFromObjectOrReply(c, c->argv[index + 1], &maxage, "maxage is not an integer or out of range") + != C_OK) return C_ERR; if (maxage <= 0) { addReplyError(c, "maxage should be greater than 0"); @@ -4730,7 +4831,8 @@ static int parseClientFiltersOrReply(client *c, int index, clientFilter *filter) } index += 2; } else if (!strcasecmp(objectGetVal(c->argv[index]), "not-user") && moreargs) { - filter->not_user = ACLGetUserByName(objectGetVal(c->argv[index + 1]), sdslen(objectGetVal(c->argv[index + 1]))); + filter->not_user = ACLGetUserByName(objectGetVal(c->argv[index + 1]), + sdslen(objectGetVal(c->argv[index + 1]))); if (filter->not_user == NULL) { addReplyErrorFormat(c, "No such user '%s'", (char *)objectGetVal(c->argv[index + 1])); return C_ERR; @@ -4749,8 +4851,11 @@ static int parseClientFiltersOrReply(client *c, int index, clientFilter *filter) } else if (!strcasecmp(objectGetVal(c->argv[index]), "idle") && moreargs) { long long idle_time; - if (getLongLongFromObjectOrReply(c, c->argv[index + 1], &idle_time, - "idle is not an integer or out of range") != C_OK) + if (getLongLongFromObjectOrReply(c, + c->argv[index + 1], + &idle_time, + "idle is not an integer or out of range") + != C_OK) return C_ERR; if (idle_time <= 0) { addReplyError(c, "idle should be greater than 0"); @@ -4821,8 +4926,7 @@ static int parseClientFiltersOrReply(client *c, int index, clientFilter *filter) index += 2; } else if (!strcasecmp(objectGetVal(c->argv[index]), "db") && moreargs) { int db_id; - if (getIntFromObjectOrReply(c, c->argv[index + 1], &db_id, - "DB is not an integer or out of range") != C_OK) + if (getIntFromObjectOrReply(c, c->argv[index + 1], &db_id, "DB is not an integer or out of range") != C_OK) return C_ERR; if (db_id < 0 || db_id >= server.dbnum) { addReplyErrorFormat(c, "DB number should be between 0 and %d", server.dbnum - 1); @@ -4832,8 +4936,8 @@ static int parseClientFiltersOrReply(client *c, int index, clientFilter *filter) index += 2; } else if (!strcasecmp(objectGetVal(c->argv[index]), "not-db") && moreargs) { int not_db_id; - if (getIntFromObjectOrReply(c, c->argv[index + 1], ¬_db_id, - "NOT-DB is not an integer or out of range") != C_OK) + if (getIntFromObjectOrReply(c, c->argv[index + 1], ¬_db_id, "NOT-DB is not an integer or out of range") + != C_OK) return C_ERR; if (not_db_id < 0 || not_db_id >= server.dbnum) { addReplyErrorFormat(c, "NOT-DB number should be between 0 and %d", server.dbnum - 1); @@ -4892,8 +4996,7 @@ static int validateClientCapaFilter(sds capa) { case 'r': /* Valid capability, do nothing. */ break; - default: - return C_ERR; + default: return C_ERR; } } return C_OK; @@ -4926,8 +5029,7 @@ static int validateClientFlagFilter(sds flag_filter) { case 'N': /* Valid flag, do nothing. */ break; - default: - return C_ERR; + default: return C_ERR; } } return C_OK; @@ -4942,16 +5044,25 @@ static int clientMatchesFilter(client *client, clientFilter *client_filter) { if (client_filter->ids && !intsetFind(client_filter->ids, client->id)) return 0; if (client_filter->user && client->user != client_filter->user) return 0; if (client_filter->skipme && client == server.current_client) return 0; - if (client_filter->max_age != 0 && (long long)(commandTimeSnapshot() / 1000 - client->ctime) < client_filter->max_age) return 0; - if (client_filter->idle != 0 && (long long)(commandTimeSnapshot() / 1000 - client->last_interaction) < client_filter->idle) return 0; + if (client_filter->max_age != 0 + && (long long)(commandTimeSnapshot() / 1000 - client->ctime) < client_filter->max_age) + return 0; + if (client_filter->idle != 0 + && (long long)(commandTimeSnapshot() / 1000 - client->last_interaction) < client_filter->idle) + return 0; if (client_filter->flags && clientMatchesFlagFilter(client, client_filter->flags) == 0) return 0; if (client_filter->name) { - if (!client->name || !objectGetVal(client->name) || strcmp(objectGetVal(client->name), client_filter->name) != 0) { + if (!client->name || !objectGetVal(client->name) + || strcmp(objectGetVal(client->name), client_filter->name) != 0) { return 0; } } - if (client_filter->lib_name && (!client->lib_name || compareStringObjects(client->lib_name, client_filter->lib_name) != 0)) return 0; - if (client_filter->lib_ver && (!client->lib_ver || compareStringObjects(client->lib_ver, client_filter->lib_ver) != 0)) return 0; + if (client_filter->lib_name + && (!client->lib_name || compareStringObjects(client->lib_name, client_filter->lib_name) != 0)) + return 0; + if (client_filter->lib_ver + && (!client->lib_ver || compareStringObjects(client->lib_ver, client_filter->lib_ver) != 0)) + return 0; if (client_filter->db_number != -1 && client->db->id != client_filter->db_number) return 0; if (client_filter->capa && clientMatchesCapaFilter(client, client_filter->capa) == 0) return 0; if (client_filter->ip && clientMatchesIpFilter(client, client_filter->ip) == 0) return 0; @@ -4964,12 +5075,17 @@ static int clientMatchesFilter(client *client, clientFilter *client_filter) { if (client_filter->not_user && client->user == client_filter->not_user) return 0; if (client_filter->not_flags && clientMatchesFlagFilter(client, client_filter->not_flags) != 0) return 0; if (client_filter->not_name) { - if (client->name && objectGetVal(client->name) && strcmp(objectGetVal(client->name), client_filter->not_name) == 0) { + if (client->name && objectGetVal(client->name) + && strcmp(objectGetVal(client->name), client_filter->not_name) == 0) { return 0; } } - if (client_filter->not_lib_name && (client->lib_name && compareStringObjects(client->lib_name, client_filter->not_lib_name) == 0)) return 0; - if (client_filter->not_lib_ver && (client->lib_ver && compareStringObjects(client->lib_ver, client_filter->not_lib_ver) == 0)) return 0; + if (client_filter->not_lib_name + && (client->lib_name && compareStringObjects(client->lib_name, client_filter->not_lib_name) == 0)) + return 0; + if (client_filter->not_lib_ver + && (client->lib_ver && compareStringObjects(client->lib_ver, client_filter->not_lib_ver) == 0)) + return 0; if (client_filter->not_db_number != -1 && client->db->id == client_filter->not_db_number) return 0; if (client_filter->not_capa && clientMatchesCapaFilter(client, client_filter->not_capa) != 0) return 0; if (client_filter->not_ip && clientMatchesIpFilter(client, client_filter->not_ip) != 0) return 0; @@ -5084,14 +5200,11 @@ static int clientMatchesFlagFilter(client *c, sds flag_filter) { if (!c->slot_migration_job || isImportSlotMigrationJob(c->slot_migration_job)) return 0; break; case 'N': /* Check for no flags */ - if (c->flag.replica || c->flag.primary || c->flag.pubsub || - c->flag.multi || c->flag.blocked || c->flag.tracking || - c->flag.tracking_broken_redir || c->flag.tracking_bcast || - c->flag.dirty_cas || c->flag.close_after_reply || - c->flag.unblocked || c->flag.close_asap || - c->flag.unix_socket || c->flag.readonly || - c->flag.no_evict || c->flag.no_touch || - c->flag.import_source || c->slot_migration_job) { + if (c->flag.replica || c->flag.primary || c->flag.pubsub || c->flag.multi || c->flag.blocked + || c->flag.tracking || c->flag.tracking_broken_redir || c->flag.tracking_bcast || c->flag.dirty_cas + || c->flag.close_after_reply || c->flag.unblocked || c->flag.close_asap || c->flag.unix_socket + || c->flag.readonly || c->flag.no_evict || c->flag.no_touch || c->flag.import_source + || c->slot_migration_job) { return 0; } break; @@ -5445,8 +5558,7 @@ void clientUnblockCommand(client *c) { void clientSetNameCommand(client *c) { /* CLIENT SETNAME */ - if (clientSetNameOrReply(c, c->argv[2]) == C_OK) - addReply(c, shared.ok); + if (clientSetNameOrReply(c, c->argv[2]) == C_OK) addReply(c, shared.ok); } void clientGetNameCommand(client *c) { @@ -5497,8 +5609,9 @@ void clientTrackingCommand(client *c) { if (!strcasecmp(objectGetVal(c->argv[j]), "redirect") && moreargs) { j++; if (redir != 0) { - addReplyError(c, "A client can only redirect to a single " - "other client"); + addReplyError(c, + "A client can only redirect to a single " + "other client"); zfree(prefix); return; } @@ -5511,8 +5624,9 @@ void clientTrackingCommand(client *c) { * right now, even if it is possible that it gets disconnected * later. Still a valid sanity check. */ if (lookupClientByID(redir) == NULL) { - addReplyError(c, "The client ID you want redirect to " - "does not exist"); + addReplyError(c, + "The client ID you want redirect to " + "does not exist"); zfree(prefix); return; } @@ -5549,9 +5663,10 @@ void clientTrackingCommand(client *c) { int oldbcast = !!c->flag.tracking_bcast; int newbcast = !!(options.tracking_bcast); if (oldbcast != newbcast) { - addReplyError(c, "You can't switch BCAST mode on/off before disabling " - "tracking for this client, and then re-enabling it with " - "a different mode."); + addReplyError(c, + "You can't switch BCAST mode on/off before disabling " + "tracking for this client, and then re-enabling it with " + "a different mode."); zfree(prefix); return; } @@ -5569,11 +5684,12 @@ void clientTrackingCommand(client *c) { return; } - if ((options.tracking_optin && c->flag.tracking_optout) || - (options.tracking_optout && c->flag.tracking_optin)) { - addReplyError(c, "You can't switch OPTIN/OPTOUT mode before disabling " - "tracking for this client, and then re-enabling it with " - "a different mode."); + if ((options.tracking_optin && c->flag.tracking_optout) + || (options.tracking_optout && c->flag.tracking_optin)) { + addReplyError(c, + "You can't switch OPTIN/OPTOUT mode before disabling " + "tracking for this client, and then re-enabling it with " + "a different mode."); zfree(prefix); return; } @@ -5599,9 +5715,10 @@ void clientTrackingCommand(client *c) { void clientCachingCommand(client *c) { if (!c->flag.tracking) { - addReplyError(c, "CLIENT CACHING can be called only when the " - "client is in tracking mode with OPTIN or " - "OPTOUT mode enabled"); + addReplyError(c, + "CLIENT CACHING can be called only when the " + "client is in tracking mode with OPTIN or " + "OPTOUT mode enabled"); return; } @@ -5751,8 +5868,11 @@ void helloCommand(client *c) { int next_arg = 1; if (c->argc >= 2) { - if (getLongLongFromObjectOrReply(c, c->argv[next_arg++], &ver, - "Protocol version is not an integer or out of range") != C_OK) { + if (getLongLongFromObjectOrReply(c, + c->argv[next_arg++], + &ver, + "Protocol version is not an integer or out of range") + != C_OK) { return; } @@ -5804,10 +5924,11 @@ void helloCommand(client *c) { /* At this point we need to be authenticated to continue. */ if (!c->flag.authenticated) { - addReplyError(c, "-NOAUTH HELLO must be called with the client already " - "authenticated, otherwise the HELLO AUTH " - "option can be used to authenticate the client and " - "select the RESP protocol version at the same time"); + addReplyError(c, + "-NOAUTH HELLO must be called with the client already " + "authenticated, otherwise the HELLO AUTH " + "option can be used to authenticate the client and " + "select the RESP protocol version at the same time"); return; } @@ -5873,13 +5994,17 @@ void securityWarningCommand(client *c) { "Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: " "commands to %s. This is likely due to an attacker attempting to use Cross " "Protocol Scripting to compromise your %s instance. Connection aborted.", - SERVER_TITLE, SERVER_TITLE); + SERVER_TITLE, + SERVER_TITLE); } else { serverLog(LL_WARNING, "Possible SECURITY ATTACK detected. It looks like somebody is sending POST or Host: commands to " "%s. This is likely due to an attacker attempting to use Cross Protocol Scripting to " "compromise your %s instance. Connection from %s:%d aborted.", - SERVER_TITLE, SERVER_TITLE, ip, port); + SERVER_TITLE, + SERVER_TITLE, + ip, + port); } logged_time = now; } @@ -6042,8 +6167,7 @@ size_t getClientOutputBufferMemoryUsage(client *c) { size_t list_item_size = sizeof(listNode) + sizeof(clientReplyBlock); size_t usage = c->reply_bytes + (list_item_size * listLength(c->reply)); if (isDeferredReplyEnabled(c)) { - usage += c->deferred_reply_bytes + - (list_item_size * listLength(c->deferred_reply)); + usage += c->deferred_reply_bytes + (list_item_size * listLength(c->deferred_reply)); } usage += atomic_load_explicit(&c->io_tracked_reply_len, memory_order_relaxed); @@ -6118,8 +6242,7 @@ int checkClientOutputBufferLimits(client *c) { /* For unauthenticated clients which were also never authenticated before the output buffer is limited to prevent * them from abusing it by not reading the replies */ - if (used_mem > REPLY_BUFFER_SIZE_UNAUTHENTICATED_CLIENT && authRequired(c) && !clientEverAuthenticated(c)) - return 1; + if (used_mem > REPLY_BUFFER_SIZE_UNAUTHENTICATED_CLIENT && authRequired(c) && !clientEverAuthenticated(c)) return 1; class = getClientType(c); /* For the purpose of output buffer limiting, primaries are handled @@ -6186,8 +6309,8 @@ int closeClientOnOutputBufferLimitReached(client *c, int async) { /* Note that c->reply_bytes is irrelevant for replica clients * (they use the global repl buffers). */ size_t tracked_len = atomic_load_explicit(&c->io_tracked_reply_len, memory_order_relaxed); - if ((c->reply_bytes == 0 && tracked_len == 0 && getClientType(c) != CLIENT_TYPE_REPLICA) || - (c->flag.close_asap && !(c->flag.protected_rdb_channel))) + if ((c->reply_bytes == 0 && tracked_len == 0 && getClientType(c) != CLIENT_TYPE_REPLICA) + || (c->flag.close_asap && !(c->flag.protected_rdb_channel))) return 0; if (checkClientOutputBufferLimits(c)) { sds client = catClientInfoString(sdsempty(), c, server.hide_user_data_from_log); @@ -6196,7 +6319,8 @@ int closeClientOnOutputBufferLimitReached(client *c, int async) { if (async || c->flag.protected_rdb_channel) { c->flag.protected_rdb_channel = 0; freeClientAsync(c); - serverLog(LL_WARNING, "Client %s scheduled to be closed ASAP for overcoming of output buffer limits.", + serverLog(LL_WARNING, + "Client %s scheduled to be closed ASAP for overcoming of output buffer limits.", client); } else { freeClient(c); @@ -6236,8 +6360,8 @@ void flushReplicasOutputBuffers(void) { * * 3. Obviously if the replica is not ONLINE. */ - if (isReplicaReadyForReplData(replica) && !(replica->flag.close_asap) && can_receive_writes && - !replica->repl_data->repl_start_cmd_stream_on_ack && clientHasPendingReplies(replica)) { + if (isReplicaReadyForReplData(replica) && !(replica->flag.close_asap) && can_receive_writes + && !replica->repl_data->repl_start_cmd_stream_on_ack && clientHasPendingReplies(replica)) { writeToClient(replica); } } @@ -6245,18 +6369,12 @@ void flushReplicasOutputBuffers(void) { char *getPausedReason(pause_purpose purpose) { switch (purpose) { - case PAUSE_BY_CLIENT_COMMAND: - return "client_pause"; - case PAUSE_DURING_SHUTDOWN: - return "shutdown_in_progress"; - case PAUSE_DURING_FAILOVER: - return "failover_in_progress"; - case PAUSE_DURING_SLOT_MIGRATION: - return "slot_migration_in_progress"; - case NUM_PAUSE_PURPOSES: - return "none"; - default: - return "Unknown pause reason"; + case PAUSE_BY_CLIENT_COMMAND: return "client_pause"; + case PAUSE_DURING_SHUTDOWN: return "shutdown_in_progress"; + case PAUSE_DURING_FAILOVER: return "failover_in_progress"; + case PAUSE_DURING_SLOT_MIGRATION: return "slot_migration_in_progress"; + case NUM_PAUSE_PURPOSES: return "none"; + default: return "Unknown pause reason"; } } @@ -6417,8 +6535,9 @@ void processEventsWhileBlocked(void) { ProcessingEventsWhileBlocked++; while (iterations--) { long long startval = server.events_processed_while_blocked; - long long ae_events = - aeProcessEvents(server.el, AE_FILE_EVENTS | AE_DONT_WAIT | AE_CALL_BEFORE_SLEEP | AE_CALL_AFTER_SLEEP); + long long ae_events = aeProcessEvents(server.el, + AE_FILE_EVENTS | AE_DONT_WAIT | AE_CALL_BEFORE_SLEEP + | AE_CALL_AFTER_SLEEP); /* Note that server.events_processed_while_blocked will also get * incremented by callbacks called by the event loop handlers. */ server.events_processed_while_blocked += ae_events; @@ -6504,8 +6623,8 @@ size_t getClientEvictionLimit(void) { /* Handle percentage of maxmemory*/ if (server.maxmemory_clients < 0 && server.maxmemory > 0) { - unsigned long long maxmemory_clients_bytes = - (unsigned long long)((double)server.maxmemory * -(double)server.maxmemory_clients / 100); + unsigned long long maxmemory_clients_bytes = (unsigned long long)((double)server.maxmemory + * -(double)server.maxmemory_clients / 100); if (maxmemory_clients_bytes <= SIZE_MAX) maxmemory_clients_actual = maxmemory_clients_bytes; } else if (server.maxmemory_clients > 0) maxmemory_clients_actual = server.maxmemory_clients; @@ -6531,10 +6650,9 @@ void evictClients(void) { /* Variable to track memory of clients marked for close but not yet freed */ size_t pending_freed = 0; - while (server.stat_clients_type_memory[CLIENT_TYPE_NORMAL] + - server.stat_clients_type_memory[CLIENT_TYPE_PUBSUB] - - pending_freed > - client_eviction_limit) { + while (server.stat_clients_type_memory[CLIENT_TYPE_NORMAL] + server.stat_clients_type_memory[CLIENT_TYPE_PUBSUB] + - pending_freed + > client_eviction_limit) { listNode *ln = listNext(&bucket_iter); if (ln) { client *c = ln->value; @@ -6646,7 +6764,13 @@ void testOnlyBackupAndUpdateClientArgv(client *c, int new_argc, robj **new_argv) backupAndUpdateClientArgv(c, new_argc, new_argv); } -size_t testOnlyUpsertPayloadHeader(char *buf, size_t *bufpos, payloadHeader **last_header, uint8_t type, size_t len, int slot, size_t available) { +size_t testOnlyUpsertPayloadHeader(char *buf, + size_t *bufpos, + payloadHeader **last_header, + uint8_t type, + size_t len, + int slot, + size_t available) { return upsertPayloadHeader(buf, bufpos, last_header, type, len, slot, 0, available); } @@ -6674,7 +6798,12 @@ void testOnlyAddBulkStrRefToBufferOrList(client *c, robj *obj) { _addBulkStrRefToBufferOrList(c, obj); } -void testOnlyInitReplyIOV(client *c, int iovsize, struct iovec *iov_arr, char (*prefixes)[BULK_STR_LEN_PREFIX_MAX_SIZE], char *crlf, replyIOV *reply) { +void testOnlyInitReplyIOV(client *c, + int iovsize, + struct iovec *iov_arr, + char (*prefixes)[BULK_STR_LEN_PREFIX_MAX_SIZE], + char *crlf, + replyIOV *reply) { initReplyIOV(c, iovsize, iov_arr, prefixes, crlf, reply); } diff --git a/src/notify.c b/src/notify.c index d48c515b9da..9995e26c79f 100644 --- a/src/notify.c +++ b/src/notify.c @@ -108,6 +108,7 @@ void notifyKeyspaceEvent(int type, char *event, robj *key, int dbid) { int len = -1; char buf[24]; client *c = server.executing_client; + // clang-format off debugServerAssert(moduleNotifyKeyspaceSubscribersCnt() == 0 || (type & (NOTIFY_GENERIC | NOTIFY_STRING | NOTIFY_LIST | NOTIFY_SET | NOTIFY_HASH | NOTIFY_ZSET | NOTIFY_STREAM)) == 0 || c == NULL || @@ -117,6 +118,7 @@ void notifyKeyspaceEvent(int type, char *event, robj *key, int dbid) { c->flag.keyspace_notified == 1 || c->id == UINT64_MAX || // AOF client getClientType(c) != CLIENT_TYPE_NORMAL); + // clang-format on /* If any modules are interested in events, notify the module system now. * This bypasses the notifications configuration, but the module engine * will only call event subscribers if the event type matches the types diff --git a/src/object.c b/src/object.c index fe2e76fa6fb..f1f87f91555 100644 --- a/src/object.c +++ b/src/object.c @@ -57,8 +57,7 @@ static robj *createUnembeddedObjectWithKeyAndExpire(int type, void *val, const_sds key, long long expire) { /* Calculate sizes */ int has_embkey = key != NULL; - int has_expire = (expire != EXPIRY_NONE || - (has_embkey && sdslen(key) >= KEY_SIZE_TO_INCLUDE_EXPIRE_THRESHOLD)); + int has_expire = (expire != EXPIRY_NONE || (has_embkey && sdslen(key) >= KEY_SIZE_TO_INCLUDE_EXPIRE_THRESHOLD)); size_t key_sds_len = has_embkey ? sdslen(key) : 0; char key_sds_type = has_embkey ? sdsReqType(key_sds_len) : 0; size_t key_sds_size = has_embkey ? sdsReqSize(key_sds_len, key_sds_type) : 0; @@ -853,8 +852,8 @@ void trimStringObjectIfNeeded(robj *o, int trim_small_values) { * 2. When utilizing the argument caching mechanism in Lua. * 3. When calling from RM_TrimStringAllocation (trim_small_values is true). */ size_t len = sdslen(o->val_ptr); - if (len >= PROTO_MBULK_BIG_ARG || trim_small_values || - (server.executing_client && server.executing_client->flag.script && len < LUA_CMD_OBJCACHE_MAX_LEN)) { + if (len >= PROTO_MBULK_BIG_ARG || trim_small_values + || (server.executing_client && server.executing_client->flag.script && len < LUA_CMD_OBJCACHE_MAX_LEN)) { if (sdsavail(o->val_ptr) > len / 10) { o->val_ptr = sdsRemoveFreeSpace(o->val_ptr, 0); } @@ -1005,9 +1004,8 @@ int equalStringObjects(robj *a, robj *b) { /* If both strings are integer encoded just check if the stored * long is the same. */ return objectGetVal(a) == objectGetVal(b); - } else if (a->encoding != OBJ_ENCODING_INT && - b->encoding != OBJ_ENCODING_INT && - sdslen(objectGetVal(a)) != sdslen(objectGetVal(b))) { + } else if (a->encoding != OBJ_ENCODING_INT && b->encoding != OBJ_ENCODING_INT + && sdslen(objectGetVal(a)) != sdslen(objectGetVal(b))) { return 0; } else { return compareStringObjects(a, b) == 0; @@ -1377,9 +1375,9 @@ struct serverMemOverhead *getMemoryOverheadData(void) { mh->peak_allocated = server.stat_peak_memory; mh->total_frag = (float)server.cron_malloc_stats.process_rss / server.cron_malloc_stats.zmalloc_used; mh->total_frag_bytes = server.cron_malloc_stats.process_rss - server.cron_malloc_stats.zmalloc_used; - mh->allocator_frag = - (float)server.cron_malloc_stats.allocator_frag_smallbins_bytes / server.cron_malloc_stats.allocator_allocated + - 1; + mh->allocator_frag = (float)server.cron_malloc_stats.allocator_frag_smallbins_bytes + / server.cron_malloc_stats.allocator_allocated + + 1; mh->allocator_frag_bytes = server.cron_malloc_stats.allocator_frag_smallbins_bytes; mh->allocator_rss = (float)server.cron_malloc_stats.allocator_resident / server.cron_malloc_stats.allocator_active; mh->allocator_rss_bytes = server.cron_malloc_stats.allocator_resident - server.cron_malloc_stats.allocator_active; @@ -1401,8 +1399,8 @@ struct serverMemOverhead *getMemoryOverheadData(void) { } if (server.repl_backlog) { /* The approximate memory of rax tree for indexed blocks. */ - mh->repl_backlog += server.repl_backlog->blocks_index->numnodes * sizeof(raxNode) + - raxSize(server.repl_backlog->blocks_index) * sizeof(void *); + mh->repl_backlog += server.repl_backlog->blocks_index->numnodes * sizeof(raxNode) + + raxSize(server.repl_backlog->blocks_index) * sizeof(void *); } mh->replicas_repl_buffer = server.pending_repl_data.mem; mem_total += mh->repl_backlog; @@ -1412,9 +1410,9 @@ struct serverMemOverhead *getMemoryOverheadData(void) { /* Computing the memory used by the clients would be O(N) if done * here online. We use our values computed incrementally by * updateClientMemoryUsage(). */ - mh->clients_normal = server.stat_clients_type_memory[CLIENT_TYPE_PRIMARY] + - server.stat_clients_type_memory[CLIENT_TYPE_PUBSUB] + - server.stat_clients_type_memory[CLIENT_TYPE_NORMAL]; + mh->clients_normal = server.stat_clients_type_memory[CLIENT_TYPE_PRIMARY] + + server.stat_clients_type_memory[CLIENT_TYPE_PUBSUB] + + server.stat_clients_type_memory[CLIENT_TYPE_NORMAL]; mem_total += mh->clients_normal; mh->cluster_slot_import = server.stat_clients_type_memory[CLIENT_TYPE_SLOT_IMPORT]; @@ -1593,23 +1591,26 @@ sds getMemoryDoctorReport(void) { } if (high_alloc_frag) { s = sdscatprintf( - s, " * High allocator fragmentation: This instance has an allocator external fragmentation greater " - "than 1.1. This problem is usually due either to a large peak memory (check if there is a peak " - "memory entry above in the report) or may result from a workload that causes the allocator to " - "fragment memory a lot. You can try enabling 'activedefrag' config option.\n\n"); + s, + " * High allocator fragmentation: This instance has an allocator external fragmentation greater " + "than 1.1. This problem is usually due either to a large peak memory (check if there is a peak " + "memory entry above in the report) or may result from a workload that causes the allocator to " + "fragment memory a lot. You can try enabling 'activedefrag' config option.\n\n"); } if (high_alloc_rss) { s = sdscatprintf( - s, " * High allocator RSS overhead: This instance has an RSS memory overhead is greater than 1.1 (this " - "means that the Resident Set Size of the allocator is much larger than the sum what the allocator " - "actually holds). This problem is usually due to a large peak memory (check if there is a peak " - "memory entry above in the report), you can try the MEMORY PURGE command to reclaim it.\n\n"); + s, + " * High allocator RSS overhead: This instance has an RSS memory overhead is greater than 1.1 (this " + "means that the Resident Set Size of the allocator is much larger than the sum what the allocator " + "actually holds). This problem is usually due to a large peak memory (check if there is a peak " + "memory entry above in the report), you can try the MEMORY PURGE command to reclaim it.\n\n"); } if (high_proc_rss) { s = sdscatprintf( - s, " * High process RSS overhead: This instance has non-allocator RSS memory overhead is greater than " - "1.1 (this means that the Resident Set Size of the Valkey process is much larger than the RSS the " - "allocator holds). This problem may be due to Lua scripts or Modules.\n\n"); + s, + " * High process RSS overhead: This instance has non-allocator RSS memory overhead is greater than " + "1.1 (this means that the Resident Set Size of the Valkey process is much larger than the RSS the " + "allocator holds). This problem may be due to Lua scripts or Modules.\n\n"); } if (big_replica_buf) { s = sdscat(s, @@ -1621,19 +1622,21 @@ sds getMemoryDoctorReport(void) { "delays and the CLIENT LIST command to check the output buffers of each replica.\n\n"); } if (big_client_buf) { - s = sdscat(s, " * Big client buffers: The clients output buffers in this instance are greater than 200K " - "per client (on average). This may result from different causes, like Pub/Sub clients " - "subscribed to channels bot not receiving data fast enough, so that data piles on the Valkey " - "instance output buffer, or clients sending commands with large replies or very large " - "sequences of commands in the same pipeline. Please use the CLIENT LIST command in order to " - "investigate the issue if it causes problems in your instance, or to understand better why " - "certain clients are using a big amount of memory.\n\n"); + s = sdscat(s, + " * Big client buffers: The clients output buffers in this instance are greater than 200K " + "per client (on average). This may result from different causes, like Pub/Sub clients " + "subscribed to channels bot not receiving data fast enough, so that data piles on the Valkey " + "instance output buffer, or clients sending commands with large replies or very large " + "sequences of commands in the same pipeline. Please use the CLIENT LIST command in order to " + "investigate the issue if it causes problems in your instance, or to understand better why " + "certain clients are using a big amount of memory.\n\n"); } if (many_scripts) { - s = sdscat(s, " * Many scripts: There seem to be many cached scripts in this instance (more than 1000). " - "This may be because scripts are generated and `EVAL`ed, instead of being parameterized " - "(with KEYS and ARGV), `SCRIPT LOAD`ed and `EVALSHA`ed. Unless `SCRIPT FLUSH` is called " - "periodically, the scripts' caches may end up consuming most of your memory.\n\n"); + s = sdscat(s, + " * Many scripts: There seem to be many cached scripts in this instance (more than 1000). " + "This may be because scripts are generated and `EVAL`ed, instead of being parameterized " + "(with KEYS and ARGV), `SCRIPT LOAD`ed and `EVALSHA`ed. Unless `SCRIPT FLUSH` is called " + "periodically, the scripts' caches may end up consuming most of your memory.\n\n"); } s = sdscat(s, "I'm here to keep you safe, Sam. I want to help you.\n"); } @@ -1722,8 +1725,9 @@ void objectCommand(client *c) { } else if (!strcasecmp(objectGetVal(c->argv[1]), "idletime") && c->argc == 3) { if ((o = objectCommandLookupOrReply(c, c->argv[2], shared.null[c->resp])) == NULL) return; if (server.maxmemory_policy & MAXMEMORY_FLAG_LFU) { - addReplyError(c, "An LFU maxmemory policy is selected, idle time not tracked. Please note that when " - "switching between policies at runtime LRU and LFU data will take some time to adjust."); + addReplyError(c, + "An LFU maxmemory policy is selected, idle time not tracked. Please note that when " + "switching between policies at runtime LRU and LFU data will take some time to adjust."); return; } addReplyLongLong(c, lru_getIdleSecs(o->lru)); diff --git a/src/pubsub.c b/src/pubsub.c index ca45855b35d..af13beb25bb 100644 --- a/src/pubsub.c +++ b/src/pubsub.c @@ -369,7 +369,9 @@ int pubsubUnsubscribeChannel(client *c, robj *channel, int notify, pubsubtype ty void pubsubShardUnsubscribeAllChannelsInSlot(unsigned int slot) { if (!kvstoreHashtableSize(server.pubsubshard_channels, slot)) return; - kvstoreHashtableIterator *kvs_di = kvstoreGetHashtableIterator(server.pubsubshard_channels, slot, HASHTABLE_ITER_SAFE); + kvstoreHashtableIterator *kvs_di = kvstoreGetHashtableIterator(server.pubsubshard_channels, + slot, + HASHTABLE_ITER_SAFE); void *element; while (kvstoreHashtableIteratorNext(kvs_di, &element)) { hashtable *clients = element; @@ -542,8 +544,11 @@ int pubsubPublishMessageInternal(robj *channel, robj *message, pubsubtype type) while ((de = dictNext(di)) != NULL) { robj *pattern = dictGetKey(de); hashtable *clients = dictGetVal(de); - if (!stringmatchlen((char *)objectGetVal(pattern), sdslen(objectGetVal(pattern)), - (char *)objectGetVal(channel), sdslen(objectGetVal(channel)), 0)) + if (!stringmatchlen((char *)objectGetVal(pattern), + sdslen(objectGetVal(pattern)), + (char *)objectGetVal(channel), + sdslen(objectGetVal(channel)), + 0)) continue; hashtableIterator iter; @@ -791,6 +796,6 @@ size_t pubsubMemOverhead(client *c) { } int pubsubTotalSubscriptions(void) { - return dictSize(server.pubsub_patterns) + kvstoreSize(server.pubsub_channels) + - kvstoreSize(server.pubsubshard_channels); + return dictSize(server.pubsub_patterns) + kvstoreSize(server.pubsub_channels) + + kvstoreSize(server.pubsubshard_channels); } diff --git a/src/queues.c b/src/queues.c index d2146d5d9a9..e1fd61a83c5 100644 --- a/src/queues.c +++ b/src/queues.c @@ -176,7 +176,9 @@ inline void *spmcDequeue(spmcQueue *q) { if (diff == 0) { /* Slot has data. Attempt to claim via CAS on head. */ - if (atomic_compare_exchange_weak_explicit(&q->head, &head, head + 1, + if (atomic_compare_exchange_weak_explicit(&q->head, + &head, + head + 1, memory_order_relaxed, memory_order_relaxed)) { data = cell->data; diff --git a/src/quicklist.c b/src/quicklist.c index 67ffe4e17bf..a79f722f165 100644 --- a/src/quicklist.c +++ b/src/quicklist.c @@ -224,8 +224,8 @@ static int __quicklistCompressNode(quicklistNode *node) { quicklistLZF *lzf = zmalloc(sizeof(*lzf) + node->sz); /* Cancel if compression fails or doesn't compress small enough */ - if (((lzf->sz = lzf_compress(node->entry, node->sz, lzf->compressed, node->sz)) == 0) || - lzf->sz + MIN_COMPRESS_IMPROVE >= node->sz) { + if (((lzf->sz = lzf_compress(node->entry, node->sz, lzf->compressed, node->sz)) == 0) + || lzf->sz + MIN_COMPRESS_IMPROVE >= node->sz) { /* lzf_compress aborts/rejects compression if value not compressible. */ zfree(lzf); return 0; @@ -533,8 +533,11 @@ static quicklistNode *__quicklistCreateNode(int container, void *value, size_t s return new_node; } -static void -__quicklistInsertPlainNode(quicklist *quicklist, quicklistNode *old_node, void *value, size_t sz, int after) { +static void __quicklistInsertPlainNode(quicklist *quicklist, + quicklistNode *old_node, + void *value, + size_t sz, + int after) { quicklistNode *new_node = __quicklistCreateNode(QUICKLIST_NODE_CONTAINER_PLAIN, value, sz); __quicklistInsertNode(quicklist, old_node, new_node, after); quicklist->count++; @@ -729,8 +732,8 @@ void quicklistReplaceEntry(quicklistIter *iter, quicklistEntry *entry, void *dat quicklistNode *node = entry->node; unsigned char *newentry; - if (likely(!QL_NODE_IS_PLAIN(entry->node) && !isLargeElement(sz, quicklist->fill) && - (newentry = lpReplace(entry->node->entry, &entry->zi, data, sz)) != NULL)) { + if (likely(!QL_NODE_IS_PLAIN(entry->node) && !isLargeElement(sz, quicklist->fill) + && (newentry = lpReplace(entry->node->entry, &entry->zi, data, sz)) != NULL)) { entry->node->entry = newentry; quicklistNodeUpdateSz(entry->node); /* quicklistNext() and quicklistGetIteratorEntryAtIdx() provide an uncompressed node */ @@ -758,7 +761,8 @@ void quicklistReplaceEntry(quicklistIter *iter, quicklistEntry *entry, void *dat * If the original node was split, insert the split node after the new node. */ new_node = __quicklistCreateNode(isLargeElement(sz, quicklist->fill) ? QUICKLIST_NODE_CONTAINER_PLAIN : QUICKLIST_NODE_CONTAINER_PACKED, - data, sz); + data, + sz); __quicklistInsertNode(quicklist, node, new_node, 1); if (split_node) __quicklistInsertNode(quicklist, new_node, split_node, 1); quicklist->count++; @@ -1152,7 +1156,11 @@ int quicklistDelRange(quicklist *quicklist, const long start, const long count) D("[%ld]: asking to del: %ld because offset: %d; (ENTIRE NODE: %d), " "node count: %u", - extent, del, offset, delete_entire_node, node->count); + extent, + del, + offset, + delete_entire_node, + node->count); if (delete_entire_node || QL_NODE_IS_PLAIN(node)) { __quicklistDelNode(quicklist, node); @@ -1241,7 +1249,11 @@ quicklistIter *quicklistGetIteratorAtIdx(quicklist *quicklist, const int directi /* Fix accum so it looks like we seeked in the other direction. */ if (seek_forward != forward) accum = quicklist->count - n->count - accum; - D("Found node: %p at accum %llu, idx %llu, sub+ %llu, sub- %llu", (void *)n, accum, index, index - accum, + D("Found node: %p at accum %llu, idx %llu, sub+ %llu, sub- %llu", + (void *)n, + accum, + index, + index - accum, (-index) - 1 + accum); quicklistIter *iter = quicklistGetIterator(quicklist, direction); @@ -1591,7 +1603,10 @@ void quicklistRepr(unsigned char *ql, int full) { printf("{quicklist node(%d)\n", i++); printf("{container : %s, encoding: %s, size: %zu, count: %d, recompress: %d, attempted_compress: %d}\n", QL_NODE_IS_PLAIN(node) ? "PLAIN" : "PACKED", - (node->encoding == QUICKLIST_NODE_ENCODING_RAW) ? "RAW" : "LZF", node->sz, node->count, node->recompress, + (node->encoding == QUICKLIST_NODE_ENCODING_RAW) ? "RAW" : "LZF", + node->sz, + node->count, + node->recompress, node->attempted_compress); if (full) { diff --git a/src/rax.c b/src/rax.c index 75862842cd2..482a90c60e4 100644 --- a/src/rax.c +++ b/src/rax.c @@ -440,8 +440,13 @@ raxNode *raxCompressNode(raxNode *n, unsigned char *s, size_t len, raxNode **chi * means that the current node represents the key (that is, none of the * compressed node characters are needed to represent the key, just all * its parents nodes). */ -static inline size_t -raxLowWalk(rax *rax, unsigned char *s, size_t len, raxNode **stopnode, raxNode ***plink, int *splitpos, raxStack *ts) { +static inline size_t raxLowWalk(rax *rax, + unsigned char *s, + size_t len, + raxNode **stopnode, + raxNode ***plink, + int *splitpos, + raxStack *ts) { raxNode *h = rax->head; raxNode **parentlink = &rax->head; @@ -1041,7 +1046,10 @@ int raxRemove(rax *rax, unsigned char *s, size_t len, void **old) { raxNode *child = NULL; while (h != rax->head) { child = h; - debugf("Freeing child %p [%.*s] key:%d\n", (void *)child, (int)child->size, (char *)child->data, + debugf("Freeing child %p [%.*s] key:%d\n", + (void *)child, + (int)child->size, + (char *)child->data, child->iskey); rax->alloc_size -= rax_ptr_alloc_size(child); rax_free(child); diff --git a/src/rax.h b/src/rax.h index 2d0c940698a..98b81b5c093 100644 --- a/src/rax.h +++ b/src/rax.h @@ -167,12 +167,12 @@ typedef int (*raxNodeCallback)(raxNode **noderef); /* Radix tree iterator state is encapsulated into this data structure. */ #define RAX_ITER_STATIC_LEN 128 -#define RAX_ITER_JUST_SEEKED (1 << 0) /* Iterator was just seeked. Return current \ - element for the first iteration and \ - clear the flag. */ -#define RAX_ITER_EOF (1 << 1) /* End of iteration reached. */ -#define RAX_ITER_SAFE (1 << 2) /* Safe iterator, allows operations while \ - iterating. But it is slower. */ +#define RAX_ITER_JUST_SEEKED (1 << 0) /* Iterator was just seeked. Return current \ + * element for the first iteration and \ + * clear the flag. */ +#define RAX_ITER_EOF (1 << 1) /* End of iteration reached. */ +#define RAX_ITER_SAFE (1 << 2) /* Safe iterator, allows operations while \ + * iterating. But it is slower. */ typedef struct raxIterator { int flags; rax *rt; /* Radix tree we are iterating. */ diff --git a/src/rdb.c b/src/rdb.c index 054f5944446..f927ae1b6d2 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -101,8 +101,11 @@ void rdbReportError(int corruption_error, int linenum, char *reason, ...) { char msg[1024]; int len; - len = snprintf(msg, sizeof(msg), "Internal error in RDB reading offset %llu, function at rdb.c:%d -> ", - (unsigned long long)server.loading_loaded_bytes, linenum); + len = snprintf(msg, + sizeof(msg), + "Internal error in RDB reading offset %llu, function at rdb.c:%d -> ", + (unsigned long long)server.loading_loaded_bytes, + linenum); va_start(ap, reason); vsnprintf(msg + len, sizeof(msg) - len, reason, ap); va_end(ap); @@ -132,7 +135,8 @@ void rdbReportError(int corruption_error, int linenum, char *reason, ...) { /* In diskless loading, in case of a short read (not a corrupt * file), log and proceed (don't exit). */ serverLog(LL_WARNING, - "%s. Failure loading rdb format from socket, assuming connection error, resuming operation.", msg); + "%s. Failure loading rdb format from socket, assuming connection error, resuming operation.", + msg); return; } serverLog(LL_WARNING, "Terminating server after rdb file reading failure."); @@ -454,7 +458,8 @@ void *rdbLoadLzfStringObject(rio *rdb, int flags, size_t *lenptr) { if ((clen = rdbLoadLen(rdb, NULL)) == RDB_LENERR) return NULL; if ((len = rdbLoadLen(rdb, NULL)) == RDB_LENERR) return NULL; if ((c = ztrymalloc(clen)) == NULL) { - serverLog(isRestoreContext() ? LL_VERBOSE : LL_WARNING, "rdbLoadLzfStringObject failed allocating %llu bytes", + serverLog(isRestoreContext() ? LL_VERBOSE : LL_WARNING, + "rdbLoadLzfStringObject failed allocating %llu bytes", (unsigned long long)clen); goto err; } @@ -466,7 +471,8 @@ void *rdbLoadLzfStringObject(rio *rdb, int flags, size_t *lenptr) { val = sdstrynewlen(SDS_NOINIT, len); } if (!val) { - serverLog(isRestoreContext() ? LL_VERBOSE : LL_WARNING, "rdbLoadLzfStringObject failed allocating %llu bytes", + serverLog(isRestoreContext() ? LL_VERBOSE : LL_WARNING, + "rdbLoadLzfStringObject failed allocating %llu bytes", (unsigned long long)len); goto err; } @@ -596,7 +602,8 @@ void *rdbGenericLoadStringObject(rio *rdb, int flags, size_t *lenptr) { void *buf = plain ? ztrymalloc(len) : sdstrynewlen(SDS_NOINIT, len); if (!buf) { serverLog(isRestoreContext() ? LL_VERBOSE : LL_WARNING, - "rdbGenericLoadStringObject failed allocating %llu bytes", len); + "rdbGenericLoadStringObject failed allocating %llu bytes", + len); return NULL; } if (lenptr) *lenptr = len; @@ -612,7 +619,8 @@ void *rdbGenericLoadStringObject(rio *rdb, int flags, size_t *lenptr) { robj *o = tryCreateStringObject(SDS_NOINIT, len); if (!o) { serverLog(isRestoreContext() ? LL_VERBOSE : LL_WARNING, - "rdbGenericLoadStringObject failed allocating %llu bytes", len); + "rdbGenericLoadStringObject failed allocating %llu bytes", + len); return NULL; } if (len && rioRead(rdb, objectGetVal(o), len) == 0) { @@ -1218,8 +1226,11 @@ int rdbSaveKeyValuePair(rio *rdb, robj *key, robj *val, long long expiretime, in /* Save type, key, value */ int rdbtype = rdbGetObjectType(val, rdbver); if (rdbtype == -1) { - serverLog(LL_WARNING, "Can't store key '%s' (db %d) in RDB version %d", - (char *)objectGetVal(key), dbid, rdbver); + serverLog(LL_WARNING, + "Can't store key '%s' (db %d) in RDB version %d", + (char *)objectGetVal(key), + dbid, + rdbver); return -1; } if (rdbSaveType(rdb, rdbtype) == -1) return -1; @@ -1410,7 +1421,9 @@ ssize_t rdbSaveDb(rio *rdb, int dbid, int rdbflags, int rdbver, long *key_counte if ((res = rdbSaveLen(rdb, expires_size)) < 0) goto werr; written += res; - kvs_it = kvstoreIteratorInit(db->keys, HASHTABLE_ITER_SAFE | HASHTABLE_ITER_PREFETCH_VALUES | HASHTABLE_ITER_INCLUDE_IMPORTING); + kvs_it = kvstoreIteratorInit(db->keys, + HASHTABLE_ITER_SAFE | HASHTABLE_ITER_PREFETCH_VALUES + | HASHTABLE_ITER_INCLUDE_IMPORTING); int last_slot = -1; /* Iterate this DB writing every entry */ void *next; @@ -1419,7 +1432,9 @@ ssize_t rdbSaveDb(rio *rdb, int dbid, int rdbflags, int rdbver, long *key_counte int curr_slot = kvstoreIteratorGetCurrentHashtableIndex(kvs_it); /* Save slot info. */ if (server.cluster_enabled && curr_slot != last_slot) { - sds slot_info = sdscatprintf(sdsempty(), "%i,%lu,%lu,%lu", curr_slot, + sds slot_info = sdscatprintf(sdsempty(), + "%i,%lu,%lu,%lu", + curr_slot, kvstoreHashtableSize(db->keys, curr_slot), kvstoreHashtableSize(db->expires, curr_slot), kvstoreHashtableSize(db->keys_with_volatile_items, curr_slot)); @@ -1563,7 +1578,9 @@ static int rdbSaveInternal(int req, const char *filename, rdbSaveInfo *rsi, int serverLog(LL_WARNING, "Failed opening the temp RDB file %s (in server root dir %s) " "for saving: %s", - filename, cwdp ? cwdp : "unknown", str_err); + filename, + cwdp ? cwdp : "unknown", + str_err); errno = saved_errno; return C_ERR; } @@ -1647,7 +1664,10 @@ int rdbSave(int req, char *filename, rdbSaveInfo *rsi, int rdbflags) { serverLog(LL_WARNING, "Error moving temp DB file %s on the final " "destination %s (in server root dir %s): %s", - tmpfile, filename, cwdp ? cwdp : "unknown", str_err); + tmpfile, + filename, + cwdp ? cwdp : "unknown", + str_err); unlink(tmpfile); stopSaving(0); return C_ERR; @@ -2013,8 +2033,8 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd sdsfree(sdsele); return NULL; } - } else if (setTypeSize(o) < server.set_max_listpack_entries && - maxelelen <= server.set_max_listpack_value && lpSafeToAdd(NULL, sumelelen)) { + } else if (setTypeSize(o) < server.set_max_listpack_entries + && maxelelen <= server.set_max_listpack_value && lpSafeToAdd(NULL, sumelelen)) { /* We checked if it's safe to add one large element instead * of many small ones. It's OK since lpSafeToAdd doesn't * care about individual elements, only the total size. */ @@ -2030,8 +2050,8 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd /* This will also be called when the set was just converted * to a listpack encoded set. */ if (o->encoding == OBJ_ENCODING_LISTPACK) { - if (setTypeSize(o) < server.set_max_listpack_entries && elelen <= server.set_max_listpack_value && - lpSafeToAdd(objectGetVal(o), elelen)) { + if (setTypeSize(o) < server.set_max_listpack_entries && elelen <= server.set_max_listpack_value + && lpSafeToAdd(objectGetVal(o), elelen)) { unsigned char *p = lpFirst(objectGetVal(o)); if (p && lpFind(objectGetVal(o), p, (unsigned char *)sdsele, elelen, 0)) { rdbReportCorruptRDB("Duplicate set members detected"); @@ -2126,8 +2146,8 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd } /* Convert *after* loading, since sorted sets are not stored ordered. */ - if (zsetLength(o) <= server.zset_max_listpack_entries && maxelelen <= server.zset_max_listpack_value && - lpSafeToAdd(NULL, totelelen)) { + if (zsetLength(o) <= server.zset_max_listpack_entries && maxelelen <= server.zset_max_listpack_value + && lpSafeToAdd(NULL, totelelen)) { zsetConvert(o, OBJ_ENCODING_LISTPACK); } } else if (rdbtype == RDB_TYPE_HASH || rdbtype == RDB_TYPE_HASH_2) { @@ -2183,9 +2203,9 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd } /* Convert to hash table if size threshold is exceeded */ - if (o->encoding != OBJ_ENCODING_HASHTABLE && - (sdslen(field) > server.hash_max_listpack_value || sdslen(value) > server.hash_max_listpack_value || - !lpSafeToAdd(objectGetVal(o), sdslen(field) + sdslen(value)))) { + if (o->encoding != OBJ_ENCODING_HASHTABLE + && (sdslen(field) > server.hash_max_listpack_value || sdslen(value) > server.hash_max_listpack_value + || !lpSafeToAdd(objectGetVal(o), sdslen(field) + sdslen(value)))) { hashTypeConvert(o, OBJ_ENCODING_HASHTABLE); entry *entry = entryCreate(field, value, EXPIRY_NONE); sdsfree(field); @@ -2251,8 +2271,8 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd /* If this is a non-preamble RDB being loaded on the primary, and this * field is already expired relative to 'now', skip it. */ - if (iAmPrimary() && !(rdbflags & RDBFLAGS_AOF_PREAMBLE) && now != 0 && - itemexpiry != EXPIRY_NONE && itemexpiry < now) { + if (iAmPrimary() && !(rdbflags & RDBFLAGS_AOF_PREAMBLE) && now != 0 && itemexpiry != EXPIRY_NONE + && itemexpiry < now) { /* Emit HDEL to replicas. */ if ((rdbflags & RDBFLAGS_FEED_REPL) && server.repl_backlog) { robj keyobj, fieldobj; @@ -2365,10 +2385,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd } listTypeTryConversion(o, LIST_CONV_AUTO, NULL, NULL); - } else if (rdbtype == RDB_TYPE_HASH_ZIPMAP || rdbtype == RDB_TYPE_LIST_ZIPLIST || rdbtype == RDB_TYPE_SET_INTSET || - rdbtype == RDB_TYPE_SET_LISTPACK || rdbtype == RDB_TYPE_ZSET_ZIPLIST || - rdbtype == RDB_TYPE_ZSET_LISTPACK || rdbtype == RDB_TYPE_HASH_ZIPLIST || - rdbtype == RDB_TYPE_HASH_LISTPACK) { + } else if (rdbtype == RDB_TYPE_HASH_ZIPMAP || rdbtype == RDB_TYPE_LIST_ZIPLIST || rdbtype == RDB_TYPE_SET_INTSET + || rdbtype == RDB_TYPE_SET_LISTPACK || rdbtype == RDB_TYPE_ZSET_ZIPLIST + || rdbtype == RDB_TYPE_ZSET_LISTPACK || rdbtype == RDB_TYPE_HASH_ZIPLIST + || rdbtype == RDB_TYPE_HASH_LISTPACK) { size_t encoded_len; unsigned char *encoded = rdbGenericLoadStringObject(rdb, RDB_LOAD_PLAIN, &encoded_len); if (encoded == NULL) return NULL; @@ -2587,8 +2607,8 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int dbid, int *error, int rd rdbReportCorruptRDB("Unknown RDB encoding type %d", rdbtype); break; } - } else if (rdbtype == RDB_TYPE_STREAM_LISTPACKS || rdbtype == RDB_TYPE_STREAM_LISTPACKS_2 || - rdbtype == RDB_TYPE_STREAM_LISTPACKS_3) { + } else if (rdbtype == RDB_TYPE_STREAM_LISTPACKS || rdbtype == RDB_TYPE_STREAM_LISTPACKS_2 + || rdbtype == RDB_TYPE_STREAM_LISTPACKS_3) { o = createStreamObject(); stream *s = objectGetVal(o); uint64_t listpacks = rdbLoadLen(rdb, NULL); @@ -3023,7 +3043,8 @@ void stopLoading(int success) { /* Fire the loading modules end event. */ moduleFireServerEvent(VALKEYMODULE_EVENT_LOADING, - success ? VALKEYMODULE_SUBEVENT_LOADING_ENDED : VALKEYMODULE_SUBEVENT_LOADING_FAILED, NULL); + success ? VALKEYMODULE_SUBEVENT_LOADING_ENDED : VALKEYMODULE_SUBEVENT_LOADING_FAILED, + NULL); } void startSaving(int rdbflags) { @@ -3051,9 +3072,9 @@ void stopSaving(int success) { and if needed calculate rdb checksum */ void rdbLoadProgressCallback(rio *r, const void *buf, size_t len) { if (server.rdb_checksum) rioGenericUpdateChecksum(r, buf, len); - if (server.loading_process_events_interval_bytes && - (r->processed_bytes + len) / server.loading_process_events_interval_bytes > - r->processed_bytes / server.loading_process_events_interval_bytes) { + if (server.loading_process_events_interval_bytes + && (r->processed_bytes + len) / server.loading_process_events_interval_bytes + > r->processed_bytes / server.loading_process_events_interval_bytes) { if (server.primary_host && server.repl_state == REPL_STATE_TRANSFER) replicationSendNewlineToPrimary(); loadingAbsProgress(r->processed_bytes); processEventsWhileBlocked(); @@ -3193,8 +3214,7 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin /* Safeguard for unknown foreign opcode interpretations. */ if (is_redis_magic && type >= RDB_FOREIGN_TYPE_MIN && type <= RDB_FOREIGN_TYPE_MAX) { - serverLog(LL_WARNING, "Can't handle foreign type or opcode %d in RDB with version %d", - type, rdbver); + serverLog(LL_WARNING, "Can't handle foreign type or opcode %d in RDB with version %d", type, rdbver); return RDB_FAILED; } @@ -3235,7 +3255,8 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin serverLog(LL_WARNING, "FATAL: Data file was created with a %s server configured to handle " "more than %d databases. Exiting\n", - SERVER_TITLE, server.dbnum); + SERVER_TITLE, + server.dbnum); exit(1); } if (rdb_loading_ctx->dbarray[dbid] == NULL) { @@ -3326,9 +3347,13 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin * In case of relaxed rdb downgrade, trailing unknown data will simply be ignored. * The verification only verifies we read the fields known to exist when we first introduced the slot-info AUX field, * which are the slot number, number of keys in slot and the number of volatile keys. */ - if (sscanf(objectGetVal(auxval), "%i,%lu,%lu,%lu", - &slot_id, &slot_size, &expires_slot_size, - &keys_with_volatile_items_slot_size) < 3) { + if (sscanf(objectGetVal(auxval), + "%i,%lu,%lu,%lu", + &slot_id, + &slot_size, + &expires_slot_size, + &keys_with_volatile_items_slot_size) + < 3) { decrRefCount(auxkey); decrRefCount(auxval); goto eoferr; @@ -3390,7 +3415,8 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin if (!rdbCheckMode && mt == NULL) { /* Unknown module. */ - serverLog(LL_WARNING, "The RDB file contains AUX module data I can't load: no matching module '%s'", + serverLog(LL_WARNING, + "The RDB file contains AUX module data I can't load: no matching module '%s'", name); exit(1); } else if (!rdbCheckMode && mt != NULL) { @@ -3564,7 +3590,8 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin serverLog(LL_WARNING, "Wrong RDB checksum expected: (%llx) but " "got (%llx). Aborting now.", - (unsigned long long)expected, (unsigned long long)cksum); + (unsigned long long)expected, + (unsigned long long)cksum); rdbReportCorruptRDB("RDB CRC error"); return RDB_FAILED; } @@ -3572,11 +3599,19 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin } if (empty_keys_skipped) { - serverLog(LL_NOTICE, "Done loading RDB, keys loaded: %lld, keys expired: %lld, empty keys skipped: %lld, all fields expired hashes: %lld.", - server.rdb_last_load_keys_loaded, server.rdb_last_load_keys_expired, empty_keys_skipped, rdb_last_load_all_fields_expired); + serverLog(LL_NOTICE, + "Done loading RDB, keys loaded: %lld, keys expired: %lld, empty keys skipped: %lld, all fields " + "expired hashes: %lld.", + server.rdb_last_load_keys_loaded, + server.rdb_last_load_keys_expired, + empty_keys_skipped, + rdb_last_load_all_fields_expired); } else { - serverLog(LL_NOTICE, "Done loading RDB, keys loaded: %lld, keys expired: %lld, all fields expired hashes: %lld.", - server.rdb_last_load_keys_loaded, server.rdb_last_load_keys_expired, rdb_last_load_all_fields_expired); + serverLog(LL_NOTICE, + "Done loading RDB, keys loaded: %lld, keys expired: %lld, all fields expired hashes: %lld.", + server.rdb_last_load_keys_loaded, + server.rdb_last_load_keys_expired, + rdb_last_load_all_fields_expired); } return RDB_OK; @@ -3797,7 +3832,8 @@ int rdbSaveToReplicasSockets(int req, int rdbver, rdbSaveInfo *rsi) { } // do not skip RDB checksum on the primary if connection doesn't have integrity check or if the replica doesn't support it - if (!connIsIntegrityChecked(replica->conn) || !(replica->repl_data->replica_capa & REPLICA_CAPA_SKIP_RDB_CHECKSUM)) + if (!connIsIntegrityChecked(replica->conn) + || !(replica->repl_data->replica_capa & REPLICA_CAPA_SKIP_RDB_CHECKSUM)) skip_rdb_checksum = 0; } @@ -3876,7 +3912,9 @@ int rdbSaveToReplicasSockets(int req, int rdbver, rdbSaveInfo *rsi) { server.rdb_pipe_numconns_writing = 0; } } else { - serverLog(LL_NOTICE, "Background RDB transfer started by pid %ld to %s%s", (long)childpid, + serverLog(LL_NOTICE, + "Background RDB transfer started by pid %ld to %s%s", + (long)childpid, dual_channel ? "direct socket to replica" : "pipe through parent process", skip_rdb_checksum ? " while skipping RDB checksum for this transfer" : ""); @@ -3887,8 +3925,8 @@ int rdbSaveToReplicasSockets(int req, int rdbver, rdbSaveInfo *rsi) { zfree(conns); } else { close(rdb_pipe_write); /* close write in parent so that it can detect the close on the child. */ - if (aeCreateFileEvent(server.el, server.rdb_pipe_read, AE_READABLE, rdbPipeReadHandler, NULL) == - AE_ERR) { + if (aeCreateFileEvent(server.el, server.rdb_pipe_read, AE_READABLE, rdbPipeReadHandler, NULL) + == AE_ERR) { serverPanic("Unrecoverable error creating server.rdb_pipe_read file event."); } } @@ -3961,9 +3999,10 @@ void bgsaveCommand(client *c) { } addReplyStatus(c, "Background saving scheduled"); } else { - addReplyError(c, "Another child process is active (AOF?): can't BGSAVE right now. " - "Use BGSAVE SCHEDULE in order to schedule a BGSAVE whenever " - "possible."); + addReplyError(c, + "Another child process is active (AOF?): can't BGSAVE right now. " + "Use BGSAVE SCHEDULE in order to schedule a BGSAVE whenever " + "possible."); } } else if (rdbSaveBackground(REPLICA_REQ_NONE, server.rdb_filename, rsiptr, RDBFLAGS_NONE) == C_OK) { addReplyStatus(c, "Background saving started"); diff --git a/src/rdb.h b/src/rdb.h index 1c6534a5b62..a2216bf21bb 100644 --- a/src/rdb.h +++ b/src/rdb.h @@ -171,7 +171,7 @@ enum RdbType { #define RDB_LOAD_SDS (1 << 2) /* flags on the purpose of rdb save or load */ -#define RDBFLAGS_NONE 0 /* No special RDB loading or saving. */ +#define RDBFLAGS_NONE 0 /* No special RDB loading or saving. */ #define RDBFLAGS_AOF_PREAMBLE (1 << 0) /* Load/save the RDB as AOF preamble. */ #define RDBFLAGS_REPLICATION (1 << 1) /* Load/save for SYNC. */ #define RDBFLAGS_ALLOW_DUP (1 << 2) /* Allow duplicated keys when loading.*/ diff --git a/src/rdma.c b/src/rdma.c index 8a51331a8b2..0a089cc0174 100644 --- a/src/rdma.c +++ b/src/rdma.c @@ -19,8 +19,8 @@ #include "connection.h" #if defined __linux__ && defined USE_RDMA /* currently RDMA is only supported on Linux */ -#if (USE_RDMA == 1 /* BUILD_YES */) || \ - ((USE_RDMA == 2 /* BUILD_MODULE */) && defined(BUILD_RDMA_MODULE) && (BUILD_RDMA_MODULE == 2)) +#if (USE_RDMA == 1 /* BUILD_YES */) \ + || ((USE_RDMA == 2 /* BUILD_MODULE */) && defined(BUILD_RDMA_MODULE) && (BUILD_RDMA_MODULE == 2)) #include "connhelpers.h" #include @@ -357,7 +357,10 @@ static int rdmaCreateResource(RdmaContext *ctx, struct rdma_cm_id *cm_id) { comp_vector = abs((int)random()); } - cq = ibv_create_cq(cm_id->verbs, VALKEY_RDMA_MAX_WQE * 2, NULL, comp_channel, + cq = ibv_create_cq(cm_id->verbs, + VALKEY_RDMA_MAX_WQE * 2, + NULL, + comp_channel, comp_vector % cm_id->verbs->num_comp_vectors); if (!cq) { serverLog(LL_WARNING, "RDMA: ibv create cq failed"); @@ -626,8 +629,11 @@ static int connRdmaHandleCq(rdma_connection *rdma_conn) { if (wc.status != IBV_WC_SUCCESS) { if (rdma_conn->c.state == CONN_STATE_CONNECTED) { - serverLog(LL_WARNING, "RDMA: CQ handle error status: %s[0x%x], opcode : 0x%x", ibv_wc_status_str(wc.status), - wc.status, wc.opcode); + serverLog(LL_WARNING, + "RDMA: CQ handle error status: %s[0x%x], opcode : 0x%x", + ibv_wc_status_str(wc.status), + wc.status, + wc.opcode); } return C_ERR; } @@ -745,7 +751,8 @@ static void connRdmaEventHandler(struct aeEventLoop *el, int fd, void *clientDat } /* RDMA comp channel has no POLLOUT event, try to send remaining buffer */ - if (!(rdma_conn->flags & RDMA_CONN_FLAG_POSTPONE_UPDATE_STATE) && ctx->tx.offset < ctx->tx.length && conn->write_handler) { + if (!(rdma_conn->flags & RDMA_CONN_FLAG_POSTPONE_UPDATE_STATE) && ctx->tx.offset < ctx->tx.length + && conn->write_handler) { callHandler(conn, conn->write_handler); } } @@ -838,8 +845,14 @@ static rdma_listener *rdmaFdToListener(connListener *listener, int fd) { * 1, handle RDMA_CM_EVENT_CONNECT_REQUEST and return CM fd on success * 2, handle RDMA_CM_EVENT_ESTABLISHED and return C_OK on success */ -static int -rdmaAccept(aeEventLoop *el, connListener *listener, char *err, int fd, char *ip, size_t ip_len, int *port, void **priv) { +static int rdmaAccept(aeEventLoop *el, + connListener *listener, + char *err, + int fd, + char *ip, + size_t ip_len, + int *port, + void **priv) { struct rdma_cm_event *ev; enum rdma_cm_event_type ev_type; int ret = C_OK; @@ -1900,19 +1913,26 @@ int ValkeyModule_OnLoad(void *ctx, ValkeyModuleString **argv, int argc) { /* Connection modules MUST be part of the same build as valkey. */ if (strcmp(REDIS_BUILD_ID_RAW, serverBuildIdRaw())) { - serverLog(LL_NOTICE, "Connection type %s was not built together with the valkey-server used.", getConnectionTypeName(CONN_TYPE_RDMA)); + serverLog(LL_NOTICE, + "Connection type %s was not built together with the valkey-server used.", + getConnectionTypeName(CONN_TYPE_RDMA)); return VALKEYMODULE_ERR; } - if (ValkeyModule_Init(ctx, getConnectionTypeName(CONN_TYPE_RDMA), 1, VALKEYMODULE_APIVER_1) == VALKEYMODULE_ERR) return VALKEYMODULE_ERR; + if (ValkeyModule_Init(ctx, getConnectionTypeName(CONN_TYPE_RDMA), 1, VALKEYMODULE_APIVER_1) == VALKEYMODULE_ERR) + return VALKEYMODULE_ERR; /* Connection modules is available only bootup. */ if ((ValkeyModule_GetContextFlags(ctx) & VALKEYMODULE_CTX_FLAGS_SERVER_STARTUP) == 0) { - serverLog(LL_NOTICE, "Connection type %s can be loaded only during bootup", getConnectionTypeName(CONN_TYPE_RDMA)); + serverLog(LL_NOTICE, + "Connection type %s can be loaded only during bootup", + getConnectionTypeName(CONN_TYPE_RDMA)); return VALKEYMODULE_ERR; } - ValkeyModule_SetModuleOptions(ctx, VALKEYMODULE_OPTIONS_HANDLE_REPL_ASYNC_LOAD | VALKEYMODULE_OPTIONS_HANDLE_ATOMIC_SLOT_MIGRATION); + ValkeyModule_SetModuleOptions(ctx, + VALKEYMODULE_OPTIONS_HANDLE_REPL_ASYNC_LOAD + | VALKEYMODULE_OPTIONS_HANDLE_ATOMIC_SLOT_MIGRATION); if (connTypeRegister(&CT_RDMA) != C_OK) return VALKEYMODULE_ERR; diff --git a/src/replication.c b/src/replication.c index 13cbc4183d6..d6cdd8871bc 100644 --- a/src/replication.c +++ b/src/replication.c @@ -261,8 +261,10 @@ void addRdbReplicaToPsyncWait(client *replica_rdb_client) { tail->refcount++; } } - dualChannelServerLog(LL_DEBUG, "Add rdb replica %s to waiting psync, with cid %llu, %s ", - replicationGetReplicaName(replica_rdb_client), (unsigned long long)replica_rdb_client->id, + dualChannelServerLog(LL_DEBUG, + "Add rdb replica %s to waiting psync, with cid %llu, %s ", + replicationGetReplicaName(replica_rdb_client), + (unsigned long long)replica_rdb_client->id, tail ? "tracking repl-backlog tail" : "no repl-backlog to track"); replica_rdb_client->repl_data->ref_repl_buf_node = tail ? ln : NULL; /* Prevent rdb client from being freed before psync is established. */ @@ -286,7 +288,8 @@ void backfillRdbReplicasToPsyncWait(void) { if (replica_rdb_client->repl_data->ref_repl_buf_node) continue; replica_rdb_client->repl_data->ref_repl_buf_node = ln; head->refcount++; - dualChannelServerLog(LL_DEBUG, "Attach replica rdb client %llu to repl buf block", + dualChannelServerLog(LL_DEBUG, + "Attach replica rdb client %llu to repl buf block", (long long unsigned int)replica_rdb_client->id); } raxStop(&iter); @@ -305,7 +308,8 @@ void removeReplicaFromPsyncWait(client *replica_main_client) { } replica_rdb_client->repl_data->ref_repl_buf_node = NULL; replica_rdb_client->flag.protected_rdb_channel = 0; - dualChannelServerLog(LL_DEBUG, "Remove psync waiting replica %s with cid %llu, repl buffer block %s", + dualChannelServerLog(LL_DEBUG, + "Remove psync waiting replica %s with cid %llu, repl buffer block %s", replicationGetReplicaName(replica_main_client), (long long unsigned int)replica_main_client->repl_data->associated_rdb_client_id, o ? "ref count decreased" : "doesn't exist"); @@ -425,8 +429,10 @@ void freeReplicaReferencedReplBuffer(client *replica) { if (replica->flag.repl_rdb_channel) { uint64_t rdb_cid = htonu64(replica->id); if (raxRemove(server.replicas_waiting_psync, (unsigned char *)&rdb_cid, sizeof(rdb_cid), NULL)) { - dualChannelServerLog(LL_DEBUG, "Remove psync waiting replica %s with cid %llu from replicas rax.", - replicationGetReplicaName(replica), (long long unsigned int)replica->id); + dualChannelServerLog(LL_DEBUG, + "Remove psync waiting replica %s with cid %llu from replicas rax.", + replicationGetReplicaName(replica), + (long long unsigned int)replica->id); } } if (replica->repl_data->ref_repl_buf_node != NULL) { @@ -863,8 +869,8 @@ int primaryTryPartialResynchronization(client *c, long long psync_offset) { * * Note that there are two potentially valid replication IDs: the ID1 * and the ID2. The ID2 however is only valid up to a specific offset. */ - if (strcasecmp(primary_replid, server.replid) && - (strcasecmp(primary_replid, server.replid2) || psync_offset > server.second_replid_offset)) { + if (strcasecmp(primary_replid, server.replid) + && (strcasecmp(primary_replid, server.replid2) || psync_offset > server.second_replid_offset)) { /* Replid "?" is used by replicas that want to force a full resync. */ if (primary_replid[0] != '?') { if (strcasecmp(primary_replid, server.replid) && strcasecmp(primary_replid, server.replid2)) { @@ -872,13 +878,16 @@ int primaryTryPartialResynchronization(client *c, long long psync_offset) { "Partial resynchronization not accepted: " "Replication ID mismatch (Replica asked for '%s', my " "replication IDs are '%s' and '%s')", - primary_replid, server.replid, server.replid2); + primary_replid, + server.replid, + server.replid2); } else { serverLog(LL_NOTICE, "Partial resynchronization not accepted: " "Requested offset for second ID was %lld, but I can reply " "up to %lld", - psync_offset, server.second_replid_offset); + psync_offset, + server.second_replid_offset); } } else { serverLog(LL_NOTICE, "Full resync requested by replica %s", replicationGetReplicaName(c)); @@ -887,24 +896,31 @@ int primaryTryPartialResynchronization(client *c, long long psync_offset) { } /* We still have the data our replica is asking for? */ - if (!server.repl_backlog || psync_offset < server.repl_backlog->offset || - psync_offset > (server.repl_backlog->offset + server.repl_backlog->histlen)) { + if (!server.repl_backlog || psync_offset < server.repl_backlog->offset + || psync_offset > (server.repl_backlog->offset + server.repl_backlog->histlen)) { if (!server.repl_backlog) { serverLog(LL_NOTICE, "Unable to partial resync with replica %s for lack of backlog (Replica request was: %s:%lld).", - replicationGetReplicaName(c), primary_replid, psync_offset); + replicationGetReplicaName(c), + primary_replid, + psync_offset); } else { serverLog(LL_NOTICE, "Unable to partial resync with replica %s for lack of backlog (Replica request was %s:%lld, " "and I can only reply with the range [%lld, %lld]).", - replicationGetReplicaName(c), primary_replid, psync_offset, server.repl_backlog->offset, + replicationGetReplicaName(c), + primary_replid, + psync_offset, + server.repl_backlog->offset, server.repl_backlog->offset + server.repl_backlog->histlen); } if (psync_offset > server.primary_repl_offset) { serverLog(LL_WARNING, "Warning: replica %s tried to PSYNC with an offset (%lld) that is greater than " "the primary replication offset (%lld)", - replicationGetReplicaName(c), psync_offset, server.primary_repl_offset); + replicationGetReplicaName(c), + psync_offset, + server.primary_repl_offset); } goto need_full_resync; } @@ -941,10 +957,12 @@ int primaryTryPartialResynchronization(client *c, long long psync_offset) { return C_OK; } psync_len = addReplyReplicationBacklog(c, psync_offset); - serverLog( - LL_NOTICE, - "Partial resynchronization request from %s accepted. Sending %lld bytes of backlog starting from offset %lld.", - replicationGetReplicaName(c), psync_len, psync_offset); + serverLog(LL_NOTICE, + "Partial resynchronization request from %s accepted. Sending %lld bytes of backlog starting from offset " + "%lld.", + replicationGetReplicaName(c), + psync_len, + psync_offset); /* Note that we don't need to set the selected DB at server.replicas_eldb * to -1 to force the primary to emit SELECT, since the replica already * has this state from the previous connection with the primary. */ @@ -999,13 +1017,13 @@ int startBgsaveForReplication(int mincapa, int req, int rdbver) { * avoid overwriting the snapshot RDB file, which needs to be usable by * other replicas (not using filtered RDB or older versions) in disk-based * full sync. */ - socket_target = (mincapa & REPLICA_CAPA_EOF) && (server.repl_diskless_sync || - (req & REPLICA_REQ_RDB_MASK) || - rdbver != RDB_VERSION); + socket_target = (mincapa & REPLICA_CAPA_EOF) + && (server.repl_diskless_sync || (req & REPLICA_REQ_RDB_MASK) || rdbver != RDB_VERSION); /* `SYNC` should have failed with error if we don't support socket and require a filter, assert this here */ serverAssert(socket_target || !(req & REPLICA_REQ_RDB_MASK)); - serverLog(LL_NOTICE, "Starting BGSAVE for SYNC with target: %s using: %s", + serverLog(LL_NOTICE, + "Starting BGSAVE for SYNC with target: %s using: %s", socket_target ? "replicas sockets" : "disk", (req & REPLICA_REQ_RDB_CHANNEL) ? "dual-channel" : "normal sync"); @@ -1022,8 +1040,9 @@ int startBgsaveForReplication(int mincapa, int req, int rdbver) { } if (server.debug_pause_after_fork) debugPauseProcess(); } else { - serverLog(LL_WARNING, "BGSAVE for replication: replication information not available, can't generate the RDB " - "file right now. Try later."); + serverLog(LL_WARNING, + "BGSAVE for replication: replication information not available, can't generate the RDB " + "file right now. Try later."); retval = C_ERR; } @@ -1085,7 +1104,8 @@ void syncCommand(client *c) { /* Check if this is a failover request to a replica with the same replid and * become a primary if so. */ - if (c->argc > 3 && !strcasecmp(objectGetVal(c->argv[0]), "psync") && !strcasecmp(objectGetVal(c->argv[3]), "failover")) { + if (c->argc > 3 && !strcasecmp(objectGetVal(c->argv[0]), "psync") + && !strcasecmp(objectGetVal(c->argv[3]), "failover")) { serverLog(LL_NOTICE, "Failover request received for replid %s.", (unsigned char *)objectGetVal(c->argv[1])); if (!server.primary_host) { addReplyError(c, "PSYNC FAILOVER can't be sent to a master."); @@ -1151,7 +1171,8 @@ void syncCommand(client *c) { if (!strcasecmp(objectGetVal(c->argv[0]), "psync")) { long long psync_offset; if (getLongLongFromObjectOrReply(c, c->argv[2], &psync_offset, NULL) != C_OK) { - serverLog(LL_WARNING, "Replica %s asks for synchronization but with a wrong offset", + serverLog(LL_WARNING, + "Replica %s asks for synchronization but with a wrong offset", replicationGetReplicaName(c)); return; } @@ -1209,7 +1230,8 @@ void syncCommand(client *c) { serverLog(LL_NOTICE, "Replication backlog created, my new " "replication IDs are '%s' and '%s'", - server.replid, server.replid2); + server.replid, + server.replid2); } /* CASE 1: BGSAVE is in progress, with disk target. */ @@ -1226,15 +1248,15 @@ void syncCommand(client *c) { replica = ln->value; /* If the client needs a buffer of commands, we can't use * a replica without replication buffer. */ - if (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END && - (!(replica->flag.repl_rdbonly) || (c->flag.repl_rdbonly))) + if (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END + && (!(replica->flag.repl_rdbonly) || (c->flag.repl_rdbonly))) break; } /* To attach this replica, we check that it has at least all the * capabilities of the replica that triggered the current BGSAVE * and its exact requirements. */ - if (ln && ((c->repl_data->replica_capa & replica->repl_data->replica_capa) == replica->repl_data->replica_capa) && - c->repl_data->replica_req == replica->repl_data->replica_req) { + if (ln && ((c->repl_data->replica_capa & replica->repl_data->replica_capa) == replica->repl_data->replica_capa) + && c->repl_data->replica_req == replica->repl_data->replica_req) { /* Perfect, the server is already registering differences for * another replica. Set the right state, and copy the buffer. * We don't copy buffer if clients don't want. */ @@ -1256,7 +1278,8 @@ void syncCommand(client *c) { /* CASE 3: There is no BGSAVE is in progress. */ } else { - if (server.repl_diskless_sync && (c->repl_data->replica_capa & REPLICA_CAPA_EOF) && server.repl_diskless_sync_delay) { + if (server.repl_diskless_sync && (c->repl_data->replica_capa & REPLICA_CAPA_EOF) + && server.repl_diskless_sync_delay) { /* Diskless replication RDB child is created inside * replicationCron() since we want to delay its start a * few seconds to wait for more replicas to arrive. */ @@ -1265,12 +1288,11 @@ void syncCommand(client *c) { /* We don't have a BGSAVE in progress, let's start one. Diskless * or disk-based mode is determined by replica's capacity. */ if (!hasActiveChildProcess()) { - startBgsaveForReplication(c->repl_data->replica_capa, - c->repl_data->replica_req, - replicaRdbVersion(c)); + startBgsaveForReplication(c->repl_data->replica_capa, c->repl_data->replica_req, replicaRdbVersion(c)); } else { - serverLog(LL_NOTICE, "No BGSAVE in progress, but another BG operation is active. " - "BGSAVE for replication delayed"); + serverLog(LL_NOTICE, + "No BGSAVE in progress, but another BG operation is active. " + "BGSAVE for replication delayed"); } } } @@ -1312,9 +1334,9 @@ void freeClientReplicationData(client *c) { * But we also need to check if users enable 'save' RDB, if enable, we * should not remove directly since that means RDB is important for users * to keep data safe and we may delay configured 'save' for full sync. */ - if (server.saveparamslen == 0 && c->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END && - server.child_type == CHILD_TYPE_RDB && server.rdb_child_type == RDB_CHILD_TYPE_DISK && - anyOtherReplicaWaitRdb(c) == 0) { + if (server.saveparamslen == 0 && c->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END + && server.child_type == CHILD_TYPE_RDB && server.rdb_child_type == RDB_CHILD_TYPE_DISK + && anyOtherReplicaWaitRdb(c) == 0) { serverLog(LL_NOTICE, "Background saving, persistence disabled, last replica dropped, killing fork child."); killRDBChild(); } @@ -1334,7 +1356,8 @@ void freeClientReplicationData(client *c) { refreshGoodReplicasCount(); /* Fire the replica change modules event. */ if (c->repl_data->repl_state == REPLICA_STATE_ONLINE) - moduleFireServerEvent(VALKEYMODULE_EVENT_REPLICA_CHANGE, VALKEYMODULE_SUBEVENT_REPLICA_CHANGE_OFFLINE, + moduleFireServerEvent(VALKEYMODULE_EVENT_REPLICA_CHANGE, + VALKEYMODULE_SUBEVENT_REPLICA_CHANGE_OFFLINE, NULL); } if (c->flag.primary) replicationHandlePrimaryDisconnection(); @@ -1470,7 +1493,8 @@ void replconfCommand(client *c) { * quick check first (instead of waiting for the next ACK. */ if (server.child_type == CHILD_TYPE_RDB && c->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END) checkChildrenDone(); - if (c->repl_data->repl_start_cmd_stream_on_ack && c->repl_data->repl_state == REPLICA_STATE_ONLINE) replicaStartCommandStream(c); + if (c->repl_data->repl_start_cmd_stream_on_ack && c->repl_data->repl_state == REPLICA_STATE_ONLINE) + replicaStartCommandStream(c); if (c->repl_data->repl_state == REPLICA_STATE_BG_RDB_LOAD) { replicaPutOnline(c); } @@ -1587,7 +1611,8 @@ int replicaPutOnline(client *replica) { if (replica->flag.repl_rdbonly) { replica->repl_data->repl_state = REPLICA_STATE_RDB_TRANSMITTED; /* The client asked for RDB only so we should close it ASAP */ - serverLog(LL_NOTICE, "RDB transfer completed, rdb only replica (%s) should be disconnected asap", + serverLog(LL_NOTICE, + "RDB transfer completed, rdb only replica (%s) should be disconnected asap", replicationGetReplicaName(replica)); return 0; } @@ -1654,9 +1679,9 @@ void removeRDBUsedToSyncReplicas(void) { listRewind(server.replicas, &li); while ((ln = listNext(&li))) { replica = ln->value; - if (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_START || - replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END || - replica->repl_data->repl_state == REPLICA_STATE_SEND_BULK) { + if (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_START + || replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END + || replica->repl_data->repl_state == REPLICA_STATE_SEND_BULK) { delrdb = 0; break; /* No need to check the other replicas. */ } @@ -1665,8 +1690,9 @@ void removeRDBUsedToSyncReplicas(void) { struct stat sb; if (lstat(server.rdb_filename, &sb) != -1) { RDBGeneratedByReplication = 0; - serverLog(LL_NOTICE, "Removing the RDB file used to feed replicas " - "in a persistence-less instance"); + serverLog(LL_NOTICE, + "Removing the RDB file used to feed replicas " + "in a persistence-less instance"); bg_unlink(server.rdb_filename); } } @@ -1726,7 +1752,8 @@ void sendBulkToReplica(connection *conn) { lseek(replica->repl_data->repldbfd, replica->repl_data->repldboff, SEEK_SET); buflen = read(replica->repl_data->repldbfd, buf, PROTO_IOBUF_LEN); if (buflen <= 0) { - serverLog(LL_WARNING, "Read error sending DB to replica: %s", + serverLog(LL_WARNING, + "Read error sending DB to replica: %s", (buflen == 0) ? "premature EOF" : strerror(errno)); freeClient(replica); return; @@ -1773,8 +1800,10 @@ void rdbPipeWriteHandler(struct connection *conn) { serverAssert(server.rdb_pipe_bufflen > 0); client *replica = connGetPrivateData(conn); ssize_t nwritten; - if ((nwritten = connWrite(conn, server.rdb_pipe_buff + replica->repl_data->repldboff, - server.rdb_pipe_bufflen - replica->repl_data->repldboff)) == -1) { + if ((nwritten = connWrite(conn, + server.rdb_pipe_buff + replica->repl_data->repldboff, + server.rdb_pipe_bufflen - replica->repl_data->repldboff)) + == -1) { if (connGetState(conn) == CONN_STATE_CONNECTED) return; /* equivalent to EAGAIN */ serverLog(LL_WARNING, "Write error sending DB to replica: %s", connGetLastError(conn)); freeClient(replica); @@ -1843,7 +1872,8 @@ void rdbPipeReadHandler(struct aeEventLoop *eventLoop, int fd, void *clientData, client *replica = connGetPrivateData(conn); if ((nwritten = connWrite(conn, server.rdb_pipe_buff, server.rdb_pipe_bufflen)) == -1) { if (connGetState(conn) != CONN_STATE_CONNECTED) { - serverLog(LL_WARNING, "Diskless rdb transfer, write error sending DB to replica: %s", + serverLog(LL_WARNING, + "Diskless rdb transfer, write error sending DB to replica: %s", connGetLastError(conn)); freeClient(replica); server.rdb_pipe_conns[i] = NULL; @@ -1880,8 +1910,10 @@ void slotMigrationPipeWriteHandler(struct connection *conn) { serverAssert(server.slot_migration_pipe_bufflen > 0); client *target = connGetPrivateData(conn); ssize_t nwritten; - if ((nwritten = connWrite(conn, server.slot_migration_pipe_buff + target->repl_data->repldboff, - server.slot_migration_pipe_bufflen - target->repl_data->repldboff)) == -1) { + if ((nwritten = connWrite(conn, + server.slot_migration_pipe_buff + target->repl_data->repldboff, + server.slot_migration_pipe_bufflen - target->repl_data->repldboff)) + == -1) { if (connGetState(conn) == CONN_STATE_CONNECTED) return; /* equivalent to EAGAIN */ serverLog(LL_WARNING, "Write error sending slot migration snapshot to target: %s", connGetLastError(conn)); freeClient(target); @@ -1898,7 +1930,8 @@ void slotMigrationPipeWriteHandler(struct connection *conn) { /* Remove the write handler and setup the pipe read handler. */ connSetWriteHandler(conn, NULL); target->repl_data->repl_last_partial_write = 0; - if (aeCreateFileEvent(server.el, server.slot_migration_pipe_read, AE_READABLE, slotMigrationPipeReadHandler, NULL) == AE_ERR) { + if (aeCreateFileEvent(server.el, server.slot_migration_pipe_read, AE_READABLE, slotMigrationPipeReadHandler, NULL) + == AE_ERR) { serverPanic("Unrecoverable error creating server.slot_migration_pipe_read file event."); } } @@ -1940,7 +1973,8 @@ void slotMigrationPipeReadHandler(struct aeEventLoop *eventLoop, int fd, void *c client *target = connGetPrivateData(conn); if ((nwritten = connWrite(conn, server.slot_migration_pipe_buff, server.slot_migration_pipe_bufflen)) == -1) { if (connGetState(conn) != CONN_STATE_CONNECTED) { - serverLog(LL_WARNING, "Slot migration transfer, write error sending DB to target: %s", + serverLog(LL_WARNING, + "Slot migration transfer, write error sending DB to target: %s", connGetLastError(conn)); freeClient(target); /* Free client will kill the slot migration child */ server.slot_migration_pipe_conn = NULL; @@ -2050,7 +2084,9 @@ void updateReplicasWaitingBgsave(int bgsaveerr, int type) { replica->repl_data->repldboff = 0; replica->repl_data->repldbsize = buf.st_size; replica->repl_data->repl_state = REPLICA_STATE_SEND_BULK; - replica->repl_data->replpreamble = sdscatprintf(sdsempty(), "$%lld\r\n", (unsigned long long)replica->repl_data->repldbsize); + replica->repl_data->replpreamble = sdscatprintf(sdsempty(), + "$%lld\r\n", + (unsigned long long)replica->repl_data->repldbsize); /* When repl_state changes to REPLICA_STATE_SEND_BULK, we will release * the resources in freeClient. */ @@ -2098,8 +2134,11 @@ void shiftReplicationId(void) { * byte, and is asking for the new bytes starting at offset 51. */ server.second_replid_offset = server.primary_repl_offset + 1; changeReplicationId(); - serverLog(LL_NOTICE, "Setting secondary replication ID to %s, valid up to offset: %lld. New replication ID is %s", - server.replid2, server.second_replid_offset, server.replid); + serverLog(LL_NOTICE, + "Setting secondary replication ID to %s, valid up to offset: %lld. New replication ID is %s", + server.replid2, + server.second_replid_offset, + server.replid); } /* ----------------------------------- REPLICA -------------------------------- */ @@ -2184,22 +2223,24 @@ void restartAOFAfterSYNC(void) { unsigned int tries, max_tries = 10; for (tries = 0; tries < max_tries; ++tries) { if (startAppendOnly() == C_OK) break; - serverLog(LL_WARNING, "Failed enabling the AOF after successful primary synchronization! " - "Trying it again in one second."); + serverLog(LL_WARNING, + "Failed enabling the AOF after successful primary synchronization! " + "Trying it again in one second."); sleep(1); } if (tries == max_tries) { - serverLog(LL_WARNING, "FATAL: this replica instance finished the synchronization with " - "its primary, but the AOF can't be turned on. Exiting now."); + serverLog(LL_WARNING, + "FATAL: this replica instance finished the synchronization with " + "its primary, but the AOF can't be turned on. Exiting now."); exit(1); } } static int useDisklessLoad(void) { /* compute boolean decision to use diskless load */ - int enabled = server.repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB || - server.repl_diskless_load == REPL_DISKLESS_LOAD_FLUSH_BEFORE_LOAD || - (server.repl_diskless_load == REPL_DISKLESS_LOAD_WHEN_DB_EMPTY && dbTotalServerKeyCount() == 0); + int enabled = server.repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB + || server.repl_diskless_load == REPL_DISKLESS_LOAD_FLUSH_BEFORE_LOAD + || (server.repl_diskless_load == REPL_DISKLESS_LOAD_WHEN_DB_EMPTY && dbTotalServerKeyCount() == 0); if (enabled) { /* Check all modules handle read errors, otherwise it's not safe to use diskless load. */ @@ -2219,7 +2260,9 @@ static int useDisklessLoad(void) { /* Returns 1 if the node can skip RDB checksum during full sync. * We can RDB checksum when data is transmitted through a verified stream. */ -int replicationSupportSkipRDBChecksum(connection *conn, int is_replica_stream_verified, int is_primary_stream_verified) { +int replicationSupportSkipRDBChecksum(connection *conn, + int is_replica_stream_verified, + int is_primary_stream_verified) { return is_replica_stream_verified && is_primary_stream_verified && connIsIntegrityChecked(conn); } @@ -2276,7 +2319,12 @@ void replicationAttachToNewPrimary(void) { * (newline) to keep the connection alive, in which case this function * should be called again later. * Returns C_OK on success, C_ERR on error, or C_RETRY for primary ping. */ -int tryReadBulkPayloadMetadata(connection *conn, char *buf, char *eofmark, char *lastbytes, int *usemark, off_t *repl_transfer_size) { +int tryReadBulkPayloadMetadata(connection *conn, + char *buf, + char *eofmark, + char *lastbytes, + int *usemark, + off_t *repl_transfer_size) { ssize_t nread = connSyncReadLine(conn, buf, 1024, server.repl_syncio_timeout * 1000); if (nread == -1) { serverLog(LL_WARNING, "I/O error reading bulk count from PRIMARY: %s", connGetLastError(conn)); @@ -2460,8 +2508,9 @@ int replicaLoadPrimaryRDBFromSocket(connection *conn, char *buf, char *eofmark, int retval = rdbLoadRioWithLoadingCtxScopedRdb(&rdb, flags, rsi, &loadingCtx); if (retval != RDB_OK) { /* RDB loading failed. */ - serverLog(LL_WARNING, "Failed trying to load the PRIMARY synchronization DB " - "from socket, check server logs."); + serverLog(LL_WARNING, + "Failed trying to load the PRIMARY synchronization DB " + "from socket, check server logs."); loadingFailed = 1; } else if (*usemark) { /* Verify the end mark is correct. */ @@ -2477,7 +2526,8 @@ int replicaLoadPrimaryRDBFromSocket(connection *conn, char *buf, char *eofmark, if (server.repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB) { /* Discard potentially partially loaded tempDb. */ - moduleFireServerEvent(VALKEYMODULE_EVENT_REPL_ASYNC_LOAD, VALKEYMODULE_SUBEVENT_REPL_ASYNC_LOAD_ABORTED, + moduleFireServerEvent(VALKEYMODULE_EVENT_REPL_ASYNC_LOAD, + VALKEYMODULE_SUBEVENT_REPL_ASYNC_LOAD_ABORTED, NULL); disklessLoadDiscardTempDb(diskless_load_tempDb); @@ -2486,7 +2536,8 @@ int replicaLoadPrimaryRDBFromSocket(connection *conn, char *buf, char *eofmark, } else { /* If we received RDB_INCOMPATIBLE, the old data was preserved */ if (retval == RDB_INCOMPATIBLE) { - serverLog(LL_NOTICE, "PRIMARY <-> REPLICA sync: RDB version or signature incompatible, old data preserved"); + serverLog(LL_NOTICE, + "PRIMARY <-> REPLICA sync: RDB version or signature incompatible, old data preserved"); } else { /* Remove the half-loaded data in case the load failed for other reasons. */ serverLog(LL_NOTICE, "PRIMARY <-> REPLICA sync: Discarding the half-loaded data"); @@ -2513,7 +2564,8 @@ int replicaLoadPrimaryRDBFromSocket(connection *conn, char *buf, char *eofmark, /* swap existing functions ctx with the temporary one */ functionsLibCtxSwapWithCurrent(temp_functions_lib_ctx, 1); - moduleFireServerEvent(VALKEYMODULE_EVENT_REPL_ASYNC_LOAD, VALKEYMODULE_SUBEVENT_REPL_ASYNC_LOAD_COMPLETED, + moduleFireServerEvent(VALKEYMODULE_EVENT_REPL_ASYNC_LOAD, + VALKEYMODULE_SUBEVENT_REPL_ASYNC_LOAD_COMPLETED, NULL); /* Delete the old db as it's useless now. */ @@ -2552,7 +2604,8 @@ int replicaLoadPrimaryRDBFromDisk(rdbSaveInfo *rsi) { serverLog(LL_WARNING, "Failed trying to rename the temp DB into %s in " "PRIMARY <-> REPLICA synchronization: %s", - server.rdb_filename, strerror(errno)); + server.rdb_filename, + strerror(errno)); if (old_rdb_fd != -1) close(old_rdb_fd); return C_ERR; } @@ -2564,7 +2617,8 @@ int replicaLoadPrimaryRDBFromDisk(rdbSaveInfo *rsi) { serverLog(LL_WARNING, "Failed trying to sync DB directory %s in " "PRIMARY <-> REPLICA synchronization: %s", - server.rdb_filename, strerror(errno)); + server.rdb_filename, + strerror(errno)); return C_ERR; } @@ -2578,12 +2632,14 @@ int replicaLoadPrimaryRDBFromDisk(rdbSaveInfo *rsi) { int retval = rdbLoad(server.rdb_filename, rsi, RDBFLAGS_REPLICATION | RDBFLAGS_EMPTY_DATA); if (retval != RDB_OK) { - serverLog(LL_WARNING, "Failed trying to load the PRIMARY synchronization " - "DB from disk, check server logs."); + serverLog(LL_WARNING, + "Failed trying to load the PRIMARY synchronization " + "DB from disk, check server logs."); if (server.rdb_del_sync_files && allPersistenceDisabled()) { - serverLog(LL_NOTICE, "Removing the RDB file obtained from " - "the primary. This replica has persistence " - "disabled"); + serverLog(LL_NOTICE, + "Removing the RDB file obtained from " + "the primary. This replica has persistence " + "disabled"); bg_unlink(server.rdb_filename); } @@ -2605,11 +2661,11 @@ int replicaLoadPrimaryRDBFromDisk(rdbSaveInfo *rsi) { /* Cleanup. When aof-use-rdb-preamble is enabled and AOF is on, keep the * RDB file so it can be reused as the AOF base file, avoiding a redundant * bgrewriteaof that would produce an almost identical snapshot. */ - if (!(server.aof_enabled && server.aof_use_rdb_preamble) && - server.rdb_del_sync_files && allPersistenceDisabled()) { - serverLog(LL_NOTICE, "Removing the RDB file obtained from " - "the primary. This replica has persistence " - "disabled"); + if (!(server.aof_enabled && server.aof_use_rdb_preamble) && server.rdb_del_sync_files && allPersistenceDisabled()) { + serverLog(LL_NOTICE, + "Removing the RDB file obtained from " + "the primary. This replica has persistence " + "disabled"); bg_unlink(server.rdb_filename); } @@ -2662,7 +2718,9 @@ void replicaReceiveRDBFromPrimaryToMemory(connection *conn) { if (server.repl_transfer_size == 0) { serverLog(LL_NOTICE, "PRIMARY <-> REPLICA sync: receiving streamed RDB from primary with EOF to parser"); } else { - serverLog(LL_NOTICE, "PRIMARY <-> REPLICA sync: receiving %lld bytes from primary to parser", (long long)server.repl_transfer_size); + serverLog(LL_NOTICE, + "PRIMARY <-> REPLICA sync: receiving %lld bytes from primary to parser", + (long long)server.repl_transfer_size); } replicaBeforeLoadPrimaryRDB(conn, 1); @@ -2682,7 +2740,8 @@ int tryReadBulkPayload(connection *conn, char *buf, int usemark, ssize_t *nread_ readlen = sizeof(buf[0]) * PROTO_IOBUF_LEN; } else { left = server.bio_repl_transfer_size - server.bio_repl_transfer_read; - readlen = (left < (signed)(sizeof(buf[0]) * PROTO_IOBUF_LEN)) ? left : (signed)(sizeof(buf[0]) * PROTO_IOBUF_LEN); + readlen = (left < (signed)(sizeof(buf[0]) * PROTO_IOBUF_LEN)) ? left + : (signed)(sizeof(buf[0]) * PROTO_IOBUF_LEN); } nread = connRead(conn, buf, readlen); @@ -2692,7 +2751,8 @@ int tryReadBulkPayload(connection *conn, char *buf, int usemark, ssize_t *nread_ memset(buf, 0, PROTO_IOBUF_LEN); return C_RETRY; } - replicaBioSaveServerLog(LL_WARNING, "I/O error trying to sync with PRIMARY: %s", + replicaBioSaveServerLog(LL_WARNING, + "I/O error trying to sync with PRIMARY: %s", (nread == -1) ? connGetLastError(conn) : "connection lost"); return C_ERR; } @@ -2720,11 +2780,15 @@ void replicaReceiveRDBFromPrimaryToDisk(connection *conn, int is_dual_channel) { connBlock(conn); connRecvTimeout(conn, server.repl_syncio_timeout * 1000); - atomic_store_explicit(&server.replica_bio_disk_save_state, REPL_BIO_DISK_SAVE_STATE_IN_PROGRESS, memory_order_release); + atomic_store_explicit(&server.replica_bio_disk_save_state, + REPL_BIO_DISK_SAVE_STATE_IN_PROGRESS, + memory_order_release); /* Loop until we can read the sync metadata or fail */ do { if (server.replica_bio_abort_save) { - replicaBioSaveServerLog(LL_WARNING, "Main thread asked to abort the save while Bio thread is reading the sync metadata"); + replicaBioSaveServerLog(LL_WARNING, + "Main thread asked to abort the save while Bio thread is reading the sync " + "metadata"); error = 1; goto done; } @@ -2739,15 +2803,19 @@ void replicaReceiveRDBFromPrimaryToDisk(connection *conn, int is_dual_channel) { if (server.bio_repl_transfer_size == 0) { /* 0 bytes means we don't know the size of the payload beforehand, we will read until we see EOF */ - replicaBioSaveServerLog(LL_NOTICE, "PRIMARY <-> REPLICA sync: receiving streamed RDB from primary with EOF to disk"); + replicaBioSaveServerLog(LL_NOTICE, + "PRIMARY <-> REPLICA sync: receiving streamed RDB from primary with EOF to disk"); } else { - replicaBioSaveServerLog(LL_NOTICE, "PRIMARY <-> REPLICA sync: receiving %lld bytes from primary to disk", (long long)server.bio_repl_transfer_size); + replicaBioSaveServerLog(LL_NOTICE, + "PRIMARY <-> REPLICA sync: receiving %lld bytes from primary to disk", + (long long)server.bio_repl_transfer_size); } /* Now read the actual sync data and save it to disk */ do { if (server.replica_bio_abort_save) { - replicaBioSaveServerLog(LL_WARNING, "Main thread asked to abort the save while Bio thread is reading the sync payload"); + replicaBioSaveServerLog(LL_WARNING, + "Main thread asked to abort the save while Bio thread is reading the sync payload"); error = 1; goto done; } @@ -2835,7 +2903,9 @@ void replicaReceiveRDBFromPrimaryToDisk(connection *conn, int is_dual_channel) { atomic_store_explicit(&server.replica_bio_disk_save_state, REPL_BIO_DISK_SAVE_STATE_FAIL, memory_order_release); } else { replicaBioSaveServerLog(LL_NOTICE, "Done downloading RDB"); - atomic_store_explicit(&server.replica_bio_disk_save_state, REPL_BIO_DISK_SAVE_STATE_FINISHED, memory_order_release); + atomic_store_explicit(&server.replica_bio_disk_save_state, + REPL_BIO_DISK_SAVE_STATE_FINISHED, + memory_order_release); } } @@ -3003,10 +3073,17 @@ void replicationAbortDualChannelSyncTransfer(void) { int sendCurrentOffsetToReplica(client *replica) { char buf[128]; int buflen; - buflen = snprintf(buf, sizeof(buf), "$ENDOFF:%lld %s %d %llu\r\n", server.primary_repl_offset, server.replid, - server.replicas_eldb, (long long unsigned int)replica->id); - dualChannelServerLog(LL_NOTICE, "Sending to replica %s RDB end offset %lld and client-id %llu", - replicationGetReplicaName(replica), server.primary_repl_offset, + buflen = snprintf(buf, + sizeof(buf), + "$ENDOFF:%lld %s %d %llu\r\n", + server.primary_repl_offset, + server.replid, + server.replicas_eldb, + (long long unsigned int)replica->id); + dualChannelServerLog(LL_NOTICE, + "Sending to replica %s RDB end offset %lld and client-id %llu", + replicationGetReplicaName(replica), + server.primary_repl_offset, (long long unsigned int)replica->id); if (connSyncWrite(replica->conn, buf, buflen, server.repl_syncio_timeout * 1000) != buflen) { freeClientAsync(replica); @@ -3038,8 +3115,7 @@ robj *generateSelectCommand(int dictid) { char llstr[LONG_STR_SIZE]; int dictid_len; dictid_len = ll2string(llstr, sizeof(llstr), dictid); - return createObject( - OBJ_STRING, sdscatfmt(sdsempty(), "*2\r\n$6\r\nSELECT\r\n$%i\r\n%s\r\n", dictid_len, llstr)); + return createObject(OBJ_STRING, sdscatfmt(sdsempty(), "*2\r\n$6\r\nSELECT\r\n$%i\r\n%s\r\n", dictid_len, llstr)); } static int dualChannelReplHandleHandshake(connection *conn, sds *err) { @@ -3048,13 +3124,24 @@ static int dualChannelReplHandleHandshake(connection *conn, sds *err) { if (server.primary_auth) { *err = replicationSendAuth(conn); if (*err) { - dualChannelServerLog(LL_WARNING, "Sending command to primary in dual channel replication handshake: %s", *err); + dualChannelServerLog(LL_WARNING, + "Sending command to primary in dual channel replication handshake: %s", + *err); return C_ERR; } } /* Send replica listening port to primary for clarification */ sds portstr = getReplicaPortString(); - *err = sendCommand(conn, "REPLCONF", "capa", "eof", "rdb-only", "1", "rdb-channel", "1", "listening-port", portstr, + *err = sendCommand(conn, + "REPLCONF", + "capa", + "eof", + "rdb-only", + "1", + "rdb-channel", + "1", + "listening-port", + portstr, NULL); sdsfree(portstr); if (*err) { @@ -3065,14 +3152,18 @@ static int dualChannelReplHandleHandshake(connection *conn, sds *err) { if (server.replica_announce_ip) { *err = sendCommand(conn, "REPLCONF", "ip-address", server.replica_announce_ip, NULL); if (*err) { - dualChannelServerLog(LL_WARNING, "Sending command to primary in dual channel replication handshake: %s", *err); + dualChannelServerLog(LL_WARNING, + "Sending command to primary in dual channel replication handshake: %s", + *err); return C_ERR; } } if (connSetReadHandler(conn, dualChannelFullSyncWithPrimary) == C_ERR) { char conninfo[CONN_INFO_LEN]; - dualChannelServerLog(LL_WARNING, "Can't create readable event for SYNC: %s (%s)", strerror(errno), + dualChannelServerLog(LL_WARNING, + "Can't create readable event for SYNC: %s (%s)", + strerror(errno), connGetInfo(conn, conninfo, sizeof(conninfo))); return C_ERR; } @@ -3101,7 +3192,8 @@ static int dualChannelReplHandleReplconfReply(connection *conn, sds *err) { } if (*err[0] == '-') { - dualChannelServerLog(LL_NOTICE, "Server does not support sync with offset, dual channel sync approach cannot be used: %s", + dualChannelServerLog(LL_NOTICE, + "Server does not support sync with offset, dual channel sync approach cannot be used: %s", *err); return C_ERR; } @@ -3112,7 +3204,8 @@ static int dualChannelReplHandleReplconfReply(connection *conn, sds *err) { sdsfree(*err); *err = receiveSynchronousResponse(conn); if (*err == NULL) { - dualChannelServerLog(LL_WARNING, "Primary did not respond to REPLCONF ip-address command during SYNC handshake"); + dualChannelServerLog(LL_WARNING, + "Primary did not respond to REPLCONF ip-address command during SYNC handshake"); return C_ERR; } if ((*err)[0] == '-') { @@ -3200,7 +3293,8 @@ static void dualChannelFullSyncWithPrimary(connection *conn) { /* Check for errors in the socket: after a non blocking connect() we * may find that the socket is in error state. */ if (connGetState(conn) != CONN_STATE_CONNECTED) { - dualChannelServerLog(LL_WARNING, "Error condition on socket for dual channel replication: %s", + dualChannelServerLog(LL_WARNING, + "Error condition on socket for dual channel replication: %s", connGetLastError(conn)); goto error; } @@ -3226,8 +3320,7 @@ static void dualChannelFullSyncWithPrimary(connection *conn) { ret = dualChannelReplHandleEndOffsetResponse(conn, &err); if (ret == C_OK) server.repl_rdb_channel_state = REPL_DUAL_CHANNEL_RDB_LOAD; break; - default: - serverPanic("Unexpected dual replication state: %d", server.repl_rdb_channel_state); + default: serverPanic("Unexpected dual replication state: %d", server.repl_rdb_channel_state); } if (ret == C_ERR) goto error; sdsfree(err); @@ -3262,10 +3355,10 @@ void replDataBufInit(void) { * Track the local repl-data buffer streaming progress and serve clients from time to time */ void replStreamProgressCallback(size_t offset, int readlen, time_t *last_progress_callback) { time_t now = mstime(); - if (server.loading_process_events_interval_bytes && - ((offset + readlen) / server.loading_process_events_interval_bytes > - offset / server.loading_process_events_interval_bytes) && - (now - *last_progress_callback > server.loading_process_events_interval_ms)) { + if (server.loading_process_events_interval_bytes + && ((offset + readlen) / server.loading_process_events_interval_bytes + > offset / server.loading_process_events_interval_bytes) + && (now - *last_progress_callback > server.loading_process_events_interval_ms)) { replicationSendNewlineToPrimary(); processEventsWhileBlocked(); *last_progress_callback = now; @@ -3315,8 +3408,8 @@ void bufferReplData(connection *conn) { remaining_bytes = readIntoReplDataBlock(conn, tail, remaining_bytes); } if (readlen && remaining_bytes == 0) { - if (server.client_obuf_limits[CLIENT_TYPE_REPLICA].hard_limit_bytes && - server.pending_repl_data.len > server.client_obuf_limits[CLIENT_TYPE_REPLICA].hard_limit_bytes) { + if (server.client_obuf_limits[CLIENT_TYPE_REPLICA].hard_limit_bytes + && server.pending_repl_data.len > server.client_obuf_limits[CLIENT_TYPE_REPLICA].hard_limit_bytes) { dualChannelServerLog(LL_NOTICE, "Replication buffer limit reached (%llu bytes), stopping buffering. " "Further accumulation will occur on primary side.", @@ -3486,7 +3579,8 @@ int replicaSendPsyncCommand(connection *conn) { snprintf(psync_offset, sizeof(psync_offset), "%lld", server.repl_provisional_primary.reploff + 1); dualChannelServerLog(LL_NOTICE, "Trying a partial resynchronization using main channel (request %s:%s).", - psync_replid, psync_offset); + psync_replid, + psync_offset); } else if (server.cached_primary) { psync_replid = server.cached_primary->repl_data->replid; snprintf(psync_offset, sizeof(psync_offset), "%lld", server.cached_primary->repl_data->reploff + 1); @@ -3577,7 +3671,9 @@ int replicaProcessPsyncReply(connection *conn) { memcpy(server.primary_replid, replid, offset - replid - 1); server.primary_replid[CONFIG_RUN_ID_SIZE] = '\0'; server.primary_initial_offset = strtoll(offset, NULL, 10); - serverLog(LL_NOTICE, "Full resync from primary: %s:%lld", server.primary_replid, + serverLog(LL_NOTICE, + "Full resync from primary: %s:%lld", + server.primary_replid, server.primary_initial_offset); } sdsfree(reply); @@ -3720,7 +3816,8 @@ int dualChannelReplMainConnRecvPsyncReply(connection *conn, sds *err) { if (psync_result == PSYNC_WAIT_REPLY) return C_OK; /* Try again later... */ if (psync_result == PSYNC_CONTINUE) { - dualChannelServerLog(LL_NOTICE, "PRIMARY <-> REPLICA sync: Primary accepted a Partial Resynchronization%s", + dualChannelServerLog(LL_NOTICE, + "PRIMARY <-> REPLICA sync: Primary accepted a Partial Resynchronization%s", server.repl_rdb_transfer_s != NULL ? ", RDB load in background." : "."); if (server.supervised_mode == SUPERVISED_SYSTEMD) { serverCommunicateSystemd("STATUS=PRIMARY <-> REPLICA sync: Partial Resynchronization accepted. Ready to " @@ -3764,12 +3861,14 @@ void dualChannelSetupMainConnForPsync(connection *conn) { server.repl_state = REPL_STATE_TRANSFER; /* In case the RDB is already loaded, the repl_state will be set during establishPrimaryConnection. */ break; - default: - serverPanic("Unexpected replication state: %d", server.repl_state); + default: serverPanic("Unexpected replication state: %d", server.repl_state); } if (ret == C_ERR) { - dualChannelServerLog(LL_WARNING, "Aborting dual channel sync. Main channel psync result %d %s", ret, err ? err : ""); + dualChannelServerLog(LL_WARNING, + "Aborting dual channel sync. Main channel psync result %d %s", + ret, + err ? err : ""); cancelReplicationHandshake(1); } sdsfree(err); @@ -3804,8 +3903,8 @@ int syncWithPrimaryHandleReceivePingReplyState(connection *conn) { * Note that older versions of Redis OSS replied with "operation not * permitted" instead of using a proper error code, so we test * both. */ - if (err[0] != '+' && strncmp(err, "-NOAUTH", 7) != 0 && strncmp(err, "-NOPERM", 7) != 0 && - strncmp(err, "-ERR operation not permitted", 28) != 0) { + if (err[0] != '+' && strncmp(err, "-NOAUTH", 7) != 0 && strncmp(err, "-NOPERM", 7) != 0 + && strncmp(err, "-ERR operation not permitted", 28) != 0) { serverLog(LL_WARNING, "Error reply to PING from primary: '%s'", err); sdsfree(err); return C_ERR; @@ -4216,8 +4315,8 @@ void syncWithPrimary(connection *conn) { * but there is nothing technically wrong with a full resync which * could happen in edge cases. */ if (server.failover_state == FAILOVER_IN_PROGRESS) { - if (psync_result == PSYNC_CONTINUE || psync_result == PSYNC_FULLRESYNC || - psync_result == PSYNC_FULLRESYNC_DUAL_CHANNEL) { + if (psync_result == PSYNC_CONTINUE || psync_result == PSYNC_FULLRESYNC + || psync_result == PSYNC_FULLRESYNC_DUAL_CHANNEL) { clearFailoverState(true); } else { abortFailover("Failover target rejected psync request"); @@ -4272,7 +4371,8 @@ void syncWithPrimary(connection *conn) { errno = saved_errno; } if (dfd == -1) { - serverLog(LL_WARNING, "Opening the temp file needed for PRIMARY <-> REPLICA synchronization: %s", + serverLog(LL_WARNING, + "Opening the temp file needed for PRIMARY <-> REPLICA synchronization: %s", strerror(errno)); syncWithPrimaryHandleError(&conn); return; @@ -4286,9 +4386,15 @@ void syncWithPrimary(connection *conn) { if (psync_result == PSYNC_FULLRESYNC_DUAL_CHANNEL) { /* Create RDB connection */ server.repl_rdb_transfer_s = connCreate(connTypeOfReplication()); - if (connConnect(server.repl_rdb_transfer_s, server.primary_host, server.primary_port, server.bind_source_addr, - server.repl_mptcp, dualChannelFullSyncWithPrimary) == C_ERR) { - dualChannelServerLog(LL_WARNING, "Unable to connect to Primary: %s", + if (connConnect(server.repl_rdb_transfer_s, + server.primary_host, + server.primary_port, + server.bind_source_addr, + server.repl_mptcp, + dualChannelFullSyncWithPrimary) + == C_ERR) { + dualChannelServerLog(LL_WARNING, + "Unable to connect to Primary: %s", connGetLastError(server.repl_rdb_transfer_s)); connClose(server.repl_rdb_transfer_s); server.repl_rdb_transfer_s = NULL; @@ -4297,7 +4403,9 @@ void syncWithPrimary(connection *conn) { } if (connSetReadHandler(conn, NULL) == C_ERR) { char conninfo[CONN_INFO_LEN]; - dualChannelServerLog(LL_WARNING, "Can't clear main connection handler: %s (%s)", strerror(errno), + dualChannelServerLog(LL_WARNING, + "Can't clear main connection handler: %s (%s)", + strerror(errno), connGetInfo(conn, conninfo, sizeof(conninfo))); syncWithPrimaryHandleError(&conn); return; @@ -4310,7 +4418,9 @@ void syncWithPrimary(connection *conn) { /* Only create the Bio thread once the first piece of data is sent by the primary */ if (connSetReadHandler(conn, receiveRDBinBioThreadSingleChannel) == C_ERR) { char conninfo[CONN_INFO_LEN]; - serverLog(LL_WARNING, "Can't create readable event for Bio SYNC: %s (%s)", strerror(errno), + serverLog(LL_WARNING, + "Can't create readable event for Bio SYNC: %s (%s)", + strerror(errno), connGetInfo(conn, conninfo, sizeof(conninfo))); syncWithPrimaryHandleError(&conn); return; @@ -4319,7 +4429,9 @@ void syncWithPrimary(connection *conn) { /* Setup the non blocking download of the bulk file. */ if (connSetReadHandler(conn, replicaReceiveRDBFromPrimaryToMemory) == C_ERR) { char conninfo[CONN_INFO_LEN]; - serverLog(LL_WARNING, "Can't create readable event for SYNC: %s (%s)", strerror(errno), + serverLog(LL_WARNING, + "Can't create readable event for SYNC: %s (%s)", + strerror(errno), connGetInfo(conn, conninfo, sizeof(conninfo))); syncWithPrimaryHandleError(&conn); return; @@ -4336,8 +4448,13 @@ void syncWithPrimary(connection *conn) { int connectWithPrimary(void) { server.repl_transfer_s = connCreate(connTypeOfReplication()); - if (connConnect(server.repl_transfer_s, server.primary_host, server.primary_port, server.bind_source_addr, - server.repl_mptcp, syncWithPrimary) == C_ERR) { + if (connConnect(server.repl_transfer_s, + server.primary_host, + server.primary_port, + server.bind_source_addr, + server.repl_mptcp, + syncWithPrimary) + == C_ERR) { serverLog(LL_WARNING, "Unable to connect to PRIMARY: %s", connGetLastError(server.repl_transfer_s)); connClose(server.repl_transfer_s); server.repl_transfer_s = NULL; @@ -4459,8 +4576,7 @@ void replicationSetPrimary(char *ip, int port, int full_sync_required, bool disc /* Clients blocked in primary, now replica. * Note that we need to set the new primary first * since unblocking clients require redirecting to the new primary */ - if (disconnect_blocked) - disconnectOrRedirectAllBlockedClients(); + if (disconnect_blocked) disconnectOrRedirectAllBlockedClients(); /* Update oom_score_adj */ setOOMScoreAdj(-1); @@ -4481,7 +4597,8 @@ void replicationSetPrimary(char *ip, int port, int full_sync_required, bool disc } /* Fire the role change modules event. */ - moduleFireServerEvent(VALKEYMODULE_EVENT_REPLICATION_ROLE_CHANGED, VALKEYMODULE_EVENT_REPLROLECHANGED_NOW_REPLICA, + moduleFireServerEvent(VALKEYMODULE_EVENT_REPLICATION_ROLE_CHANGED, + VALKEYMODULE_EVENT_REPLROLECHANGED_NOW_REPLICA, NULL); /* Fire the primary link modules event. */ @@ -4541,7 +4658,8 @@ void replicationUnsetPrimary(void) { server.repl_down_since = 0; /* Fire the role change modules event. */ - moduleFireServerEvent(VALKEYMODULE_EVENT_REPLICATION_ROLE_CHANGED, VALKEYMODULE_EVENT_REPLROLECHANGED_NOW_PRIMARY, + moduleFireServerEvent(VALKEYMODULE_EVENT_REPLICATION_ROLE_CHANGED, + VALKEYMODULE_EVENT_REPLROLECHANGED_NOW_PRIMARY, NULL); /* Restart the AOF subsystem in case we shut it down during a sync when @@ -4627,20 +4745,26 @@ void replicaofCommand(client *c) { if (getRangeLongFromObjectOrReply(c, c->argv[2], 0, 65535, &port, "Invalid master port") != C_OK) return; /* Check if we are already attached to the specified primary */ - if (server.primary_host && !strcasecmp(server.primary_host, objectGetVal(c->argv[1])) && server.primary_port == port) { - serverLog(LL_NOTICE, "REPLICAOF would result into synchronization " - "with the primary we are already connected " - "with. No operation performed."); - addReplySds(c, sdsnew("+OK Already connected to specified " - "master\r\n")); + if (server.primary_host && !strcasecmp(server.primary_host, objectGetVal(c->argv[1])) + && server.primary_port == port) { + serverLog(LL_NOTICE, + "REPLICAOF would result into synchronization " + "with the primary we are already connected " + "with. No operation performed."); + addReplySds(c, + sdsnew("+OK Already connected to specified " + "master\r\n")); return; } /* There was no previous primary or the user specified a different one, * we can continue. */ replicationSetPrimary(objectGetVal(c->argv[1]), port, 0, true); sds client = catClientInfoShortString(sdsempty(), c, server.hide_user_data_from_log); - serverLog(LL_NOTICE, "REPLICAOF %s:%d enabled (user request from '%s')", server.primary_host, - server.primary_port, client); + serverLog(LL_NOTICE, + "REPLICAOF %s:%d enabled (user request from '%s')", + server.primary_host, + server.primary_port, + client); sdsfree(client); } addReply(c, shared.ok); @@ -4810,9 +4934,10 @@ void replicationCachePrimary(client *c) { * current offset if no data was lost during the failover. So we use our * current replication ID and offset in order to synthesize a cached primary. */ void replicationCachePrimaryUsingMyself(void) { - serverLog(LL_NOTICE, "Before turning into a replica, using my own primary parameters " - "to synthesize a cached primary: I may be able to synchronize with " - "the new primary with just a partial transfer."); + serverLog(LL_NOTICE, + "Before turning into a replica, using my own primary parameters " + "to synthesize a cached primary: I may be able to synchronize with " + "the new primary with just a partial transfer."); /* This will be used to populate the field server.primary->repl_data->reploff * by replicationCreatePrimaryClient(). We'll later set the created @@ -4883,7 +5008,8 @@ void replicationResurrectCachedPrimary(connection *conn) { * prerequisite: server.primary is already initialized and linked in client list. */ void replicationSteadyStateInit(void) { if (connSetReadHandler(server.primary->conn, readQueryFromClient)) { - serverLog(LL_WARNING, "Error resurrecting the cached primary, impossible to add the readable handler: %s", + serverLog(LL_WARNING, + "Error resurrecting the cached primary, impossible to add the readable handler: %s", strerror(errno)); freeClientAsync(server.primary); /* Close ASAP. */ } @@ -4892,7 +5018,8 @@ void replicationSteadyStateInit(void) { * pending data in the write buffers. */ if (clientHasPendingReplies(server.primary)) { if (connSetWriteHandler(server.primary->conn, sendReplyToClient)) { - serverLog(LL_WARNING, "Error resurrecting the cached primary, impossible to add the writable handler: %s", + serverLog(LL_WARNING, + "Error resurrecting the cached primary, impossible to add the writable handler: %s", strerror(errno)); freeClientAsync(server.primary); /* Close ASAP. */ } @@ -4906,7 +5033,9 @@ void replicationResurrectProvisionalPrimary(void) { /* Create a primary client, but do not initialize the read handler yet, as this replica still has a local buffer to * drain. */ replicationCreatePrimaryClientWithHandler(server.repl_transfer_s, server.repl_provisional_primary.dbid, NULL); - memcpy(server.primary->repl_data->replid, server.repl_provisional_primary.replid, sizeof(server.repl_provisional_primary.replid)); + memcpy(server.primary->repl_data->replid, + server.repl_provisional_primary.replid, + sizeof(server.repl_provisional_primary.replid)); server.primary->repl_data->reploff = server.repl_provisional_primary.reploff; server.primary->repl_data->read_reploff = server.repl_provisional_primary.read_reploff; server.primary_repl_offset = server.primary->repl_data->reploff; @@ -4938,9 +5067,9 @@ void refreshGoodReplicasCount(void) { /* return true if status of good replicas is OK. otherwise false */ int checkGoodReplicasStatus(void) { - return server.primary_host || /* not a primary status should be OK */ - !server.repl_min_replicas_max_lag || /* Min replica max lag not configured */ - !server.repl_min_replicas_to_write || /* Min replica to write not configured */ + return server.primary_host || /* not a primary status should be OK */ + !server.repl_min_replicas_max_lag || /* Min replica max lag not configured */ + !server.repl_min_replicas_to_write || /* Min replica to write not configured */ server.repl_good_replicas_count >= server.repl_min_replicas_to_write; /* check if we have enough replicas */ } @@ -5029,9 +5158,10 @@ void waitCommand(client *c) { long long offset = getClientWriteOffset(c); if (server.primary_host) { - addReplyError( - c, "WAIT cannot be used with replica instances. Please also note that if a replica is configured to be " - "writable (which is not the default) writes to replicas are just local and are not propagated."); + addReplyError(c, + "WAIT cannot be used with replica instances. Please also note that if a replica is configured to " + "be writable (which is not the default) writes to replicas are just local and are not " + "propagated."); return; } @@ -5067,8 +5197,9 @@ void waitaofCommand(client *c) { if (getTimeoutFromObjectOrReply(c, c->argv[3], &timeout, UNIT_MILLISECONDS) != C_OK) return; if (server.primary_host) { - addReplyError(c, "WAITAOF cannot be used with replica instances. Please also note that writes to replicas are " - "just local and are not propagated."); + addReplyError(c, + "WAITAOF cannot be used with replica instances. Please also note that writes to replicas are " + "just local and are not propagated."); return; } if (numlocal && !server.aof_enabled) { @@ -5138,11 +5269,11 @@ void processClientsWaitingReplicas(void) { * may be unblocked without calling replicationCountAcksByOffset() * or calling replicationCountAOFAcksByOffset() * if the requested offset / replicas were equal or less. */ - if (!is_wait_aof && last_offset && last_offset >= c->bstate->reploffset && - last_numreplicas >= c->bstate->numreplicas) { + if (!is_wait_aof && last_offset && last_offset >= c->bstate->reploffset + && last_numreplicas >= c->bstate->numreplicas) { numreplicas = last_numreplicas; - } else if (is_wait_aof && last_aof_offset && last_aof_offset >= c->bstate->reploffset && - last_aof_numreplicas >= c->bstate->numreplicas) { + } else if (is_wait_aof && last_aof_offset && last_aof_offset >= c->bstate->reploffset + && last_aof_numreplicas >= c->bstate->numreplicas) { numreplicas = last_aof_numreplicas; } else { numreplicas = is_wait_aof ? replicationCountAOFAcksByOffset(c->bstate->reploffset) @@ -5262,23 +5393,24 @@ void replicationCron(void) { updateFailoverStatus(); /* Non blocking connection timeout? */ - if (server.primary_host && (server.repl_state == REPL_STATE_CONNECTING || replicaIsInHandshakeState()) && - (time(NULL) - server.repl_transfer_lastio) > server.repl_timeout) { + if (server.primary_host && (server.repl_state == REPL_STATE_CONNECTING || replicaIsInHandshakeState()) + && (time(NULL) - server.repl_transfer_lastio) > server.repl_timeout) { serverLog(LL_WARNING, "Timeout connecting to the PRIMARY..."); cancelReplicationHandshake(1); } /* Bulk transfer I/O timeout? */ - if (server.primary_host && server.repl_state == REPL_STATE_TRANSFER && - (time(NULL) - server.repl_transfer_lastio) > server.repl_timeout) { - serverLog(LL_WARNING, "Timeout receiving bulk data from PRIMARY... If the problem persists try to set the " - "'repl-timeout' parameter in valkey.conf to a larger value."); + if (server.primary_host && server.repl_state == REPL_STATE_TRANSFER + && (time(NULL) - server.repl_transfer_lastio) > server.repl_timeout) { + serverLog(LL_WARNING, + "Timeout receiving bulk data from PRIMARY... If the problem persists try to set the " + "'repl-timeout' parameter in valkey.conf to a larger value."); cancelReplicationHandshake(1); } /* Timed out primary when we are an already connected replica? */ - if (server.primary_host && server.repl_state == REPL_STATE_CONNECTED && - (time(NULL) - server.primary->last_interaction) > server.repl_timeout) { + if (server.primary_host && server.repl_state == REPL_STATE_CONNECTED + && (time(NULL) - server.primary->last_interaction) > server.repl_timeout) { serverLog(LL_WARNING, "PRIMARY timeout: no data nor PING received..."); freeClient(server.primary); } @@ -5308,9 +5440,9 @@ void replicationCron(void) { * a Cluster manual failover: the PING we send will otherwise * alter the replication offsets of primary and replica, and will no longer * match the one stored into 'mf_primary_offset' state. */ - int manual_failover_in_progress = - ((server.cluster_enabled && clusterManualFailoverTimeLimit()) || server.failover_end_time) && - isPausedActionsWithUpdate(PAUSE_ACTION_REPLICA); + int manual_failover_in_progress = ((server.cluster_enabled && clusterManualFailoverTimeLimit()) + || server.failover_end_time) + && isPausedActionsWithUpdate(PAUSE_ACTION_REPLICA); if (!manual_failover_in_progress) { ping_argv[0] = shared.ping; @@ -5336,9 +5468,9 @@ void replicationCron(void) { while ((ln = listNext(&li))) { client *replica = ln->value; - int is_presync = - (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_START || - (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END && server.rdb_child_type != RDB_CHILD_TYPE_SOCKET)); + int is_presync = (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_START + || (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END + && server.rdb_child_type != RDB_CHILD_TYPE_SOCKET)); if (is_presync) { connWrite(replica->conn, "\n", 1); @@ -5357,7 +5489,8 @@ void replicationCron(void) { if (replica->repl_data->repl_state == REPLICA_STATE_ONLINE) { if (replica->flag.pre_psync) continue; if ((server.unixtime - replica->repl_data->repl_ack_time) > server.repl_timeout) { - serverLog(LL_WARNING, "Disconnecting timedout replica (streaming sync): %s", + serverLog(LL_WARNING, + "Disconnecting timedout replica (streaming sync): %s", replicationGetReplicaName(replica)); freeClient(replica); continue; @@ -5366,11 +5499,12 @@ void replicationCron(void) { /* We consider disconnecting only diskless replicas because disk-based replicas aren't fed * by the fork child so if a disk-based replica is stuck it doesn't prevent the fork child * from terminating. */ - if (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END && - server.rdb_child_type == RDB_CHILD_TYPE_SOCKET) { - if (replica->repl_data->repl_last_partial_write != 0 && - (server.unixtime - replica->repl_data->repl_last_partial_write) > server.repl_timeout) { - serverLog(LL_WARNING, "Disconnecting timedout replica (full sync): %s", + if (replica->repl_data->repl_state == REPLICA_STATE_WAIT_BGSAVE_END + && server.rdb_child_type == RDB_CHILD_TYPE_SOCKET) { + if (replica->repl_data->repl_last_partial_write != 0 + && (server.unixtime - replica->repl_data->repl_last_partial_write) > server.repl_timeout) { + serverLog(LL_WARNING, + "Disconnecting timedout replica (full sync): %s", replicationGetReplicaName(replica)); freeClient(replica); continue; @@ -5385,8 +5519,8 @@ void replicationCron(void) { * without sub-replicas attached should still accumulate data into the * backlog, in order to reply to PSYNC queries if they are turned into * primaries after a failover. */ - if (listLength(server.replicas) == 0 && server.repl_backlog_time_limit && server.repl_backlog && - server.primary_host == NULL) { + if (listLength(server.replicas) == 0 && server.repl_backlog_time_limit && server.repl_backlog + && server.primary_host == NULL) { time_t idle = server.unixtime - server.repl_no_replicas_since; if (idle > server.repl_backlog_time_limit) { @@ -5430,8 +5564,9 @@ void replicationCron(void) { * replicas number + 1(replication backlog). */ if (listLength(server.repl_buffer_blocks) > 0) { replBufBlock *o = listNodeValue(listFirst(server.repl_buffer_blocks)); - serverAssert(o->refcount > 0 && - o->refcount <= (int)listLength(server.replicas) + 1 + (int)raxSize(server.replicas_waiting_psync)); + serverAssert(o->refcount > 0 + && o->refcount + <= (int)listLength(server.replicas) + 1 + (int)raxSize(server.replicas_waiting_psync)); } /* Refresh the number of replicas with lag <= min-replicas-max-lag. */ @@ -5464,8 +5599,7 @@ int shouldStartChildReplication(int *mincapa_out, int *req_out, int *rdbver_out) /* Get first replica's requirements */ req = replica->repl_data->replica_req; rdbver = replicaRdbVersion(replica); - } else if (req != replica->repl_data->replica_req || - rdbver != replicaRdbVersion(replica)) { + } else if (req != replica->repl_data->replica_req || rdbver != replicaRdbVersion(replica)) { /* Skip replicas that don't match */ continue; } @@ -5477,10 +5611,11 @@ int shouldStartChildReplication(int *mincapa_out, int *req_out, int *rdbver_out) } } - if (replicas_waiting && (!server.repl_diskless_sync || - (server.repl_diskless_sync_max_replicas > 0 && - replicas_waiting >= server.repl_diskless_sync_max_replicas) || - max_idle >= server.repl_diskless_sync_delay)) { + if (replicas_waiting + && (!server.repl_diskless_sync + || (server.repl_diskless_sync_max_replicas > 0 + && replicas_waiting >= server.repl_diskless_sync_max_replicas) + || max_idle >= server.repl_diskless_sync_delay)) { if (mincapa_out) *mincapa_out = mincapa; if (req_out) *req_out = req; if (rdbver_out) *rdbver_out = rdbver; @@ -5554,7 +5689,10 @@ void abortFailover(const char *err) { if (server.failover_state == NO_FAILOVER) return; if (server.target_replica_host) { - serverLog(LL_NOTICE, "FAILOVER to %s:%d aborted: %s", server.target_replica_host, server.target_replica_port, + serverLog(LL_NOTICE, + "FAILOVER to %s:%d aborted: %s", + server.target_replica_host, + server.target_replica_port, err); } else { serverLog(LL_NOTICE, "FAILOVER to any replica aborted: %s", err); @@ -5651,8 +5789,9 @@ void failoverCommand(client *c) { } if (force_flag && (!timeout_in_ms || !host)) { - addReplyError(c, "FAILOVER with force option requires both a timeout " - "and target HOST and IP."); + addReplyError(c, + "FAILOVER with force option requires both a timeout " + "and target HOST and IP."); return; } @@ -5661,8 +5800,9 @@ void failoverCommand(client *c) { client *replica = findReplica(host, port); if (replica == NULL) { - addReplyError(c, "FAILOVER target HOST and PORT is not " - "a replica."); + addReplyError(c, + "FAILOVER target HOST and PORT is not " + "a replica."); return; } @@ -5704,7 +5844,9 @@ void updateFailoverStatus(void) { /* Check if failover operation has timed out */ if (server.failover_end_time && server.failover_end_time <= now) { if (server.force_failover) { - serverLog(LL_NOTICE, "FAILOVER to %s:%d time out exceeded, failing over.", server.target_replica_host, + serverLog(LL_NOTICE, + "FAILOVER to %s:%d time out exceeded, failing over.", + server.target_replica_host, server.target_replica_port); server.failover_state = FAILOVER_IN_PROGRESS; /* If timeout has expired force a failover if requested. */ @@ -5748,7 +5890,9 @@ void updateFailoverStatus(void) { /* We've found a replica that is caught up */ if (replica && (replica->repl_data->repl_ack_off == server.primary_repl_offset)) { server.failover_state = FAILOVER_IN_PROGRESS; - serverLog(LL_NOTICE, "Failover target %s:%d is synced, failing over.", server.target_replica_host, + serverLog(LL_NOTICE, + "Failover target %s:%d is synced, failing over.", + server.target_replica_host, server.target_replica_port); /* Designated replica is caught up, failover to it. */ replicationSetPrimary(server.target_replica_host, server.target_replica_port, 0, false); diff --git a/src/resp_parser.c b/src/resp_parser.c index 4fddbffcf78..fa69d3f2686 100644 --- a/src/resp_parser.c +++ b/src/resp_parser.c @@ -125,8 +125,8 @@ static int parseVerbatimString(ReplyParser *parser, void *p_ctx) { const char *format = parser->curr_location; parser->curr_location += bulklen; parser->curr_location += 2; /* for \r\n */ - parser->callbacks.verbatim_string_callback(p_ctx, format, format + 4, bulklen - 4, proto, - parser->curr_location - proto); + parser->callbacks + .verbatim_string_callback(p_ctx, format, format + 4, bulklen - 4, proto, parser->curr_location - proto); return C_OK; } diff --git a/src/rio.c b/src/rio.c index b0142672cd2..19bc5a525f8 100644 --- a/src/rio.c +++ b/src/rio.c @@ -133,17 +133,22 @@ static size_t rioFileWrite(rio *r, const void *buf, size_t len) { #if defined(HAVE_SYNC_FILE_RANGE) && HAVE_SYNC_FILE_RANGE /* Start writeout asynchronously. */ - if (sync_file_range(fileno(r->io.file.fp), processed - r->io.file.autosync, r->io.file.autosync, - SYNC_FILE_RANGE_WRITE) == -1) + if (sync_file_range(fileno(r->io.file.fp), + processed - r->io.file.autosync, + r->io.file.autosync, + SYNC_FILE_RANGE_WRITE) + == -1) return 0; if (processed >= (size_t)r->io.file.autosync * 2) { /* To keep the promise to 'autosync', we should make sure last * asynchronous writeout persists into disk. This call may block * if last writeout is not finished since disk is slow. */ - if (sync_file_range(fileno(r->io.file.fp), processed - r->io.file.autosync * 2, r->io.file.autosync, - SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_AFTER) == - -1) + if (sync_file_range(fileno(r->io.file.fp), + processed - r->io.file.autosync * 2, + r->io.file.autosync, + SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_AFTER) + == -1) return 0; } #else diff --git a/src/rio.h b/src/rio.h index f7d43ef84a8..a6c7ee056c4 100644 --- a/src/rio.h +++ b/src/rio.h @@ -119,8 +119,8 @@ typedef struct _rio rio; static inline size_t rioWrite(rio *r, const void *buf, size_t len) { if (r->flags & RIO_FLAG_WRITE_ERROR || r->flags & RIO_FLAG_CLOSE_ASAP) return 0; while (len) { - size_t bytes_to_write = - (r->max_processing_chunk && r->max_processing_chunk < len) ? r->max_processing_chunk : len; + size_t bytes_to_write = (r->max_processing_chunk && r->max_processing_chunk < len) ? r->max_processing_chunk + : len; if (r->update_cksum) r->update_cksum(r, buf, bytes_to_write); if (r->write(r, buf, bytes_to_write) == 0) { r->flags |= RIO_FLAG_WRITE_ERROR; @@ -136,8 +136,8 @@ static inline size_t rioWrite(rio *r, const void *buf, size_t len) { static inline size_t rioRead(rio *r, void *buf, size_t len) { if (r->flags & RIO_FLAG_READ_ERROR || r->flags & RIO_FLAG_CLOSE_ASAP) return 0; while (len) { - size_t bytes_to_read = - (r->max_processing_chunk && r->max_processing_chunk < len) ? r->max_processing_chunk : len; + size_t bytes_to_read = (r->max_processing_chunk && r->max_processing_chunk < len) ? r->max_processing_chunk + : len; if (r->read(r, buf, bytes_to_read) == 0) { r->flags |= RIO_FLAG_READ_ERROR; return 0; diff --git a/src/script.c b/src/script.c index 156fb12cf2b..acefd69b2da 100644 --- a/src/script.c +++ b/src/script.c @@ -92,7 +92,9 @@ int scriptInterrupt(scriptRunCtx *run_ctx) { serverLog(LL_WARNING, "Slow script detected: still in execution after %lld milliseconds. " "You can try killing the script using the %s command. Script name is: %s.", - elapsed, (run_ctx->flags & SCRIPT_EVAL_MODE) ? "SCRIPT KILL" : "FUNCTION KILL", run_ctx->funcname); + elapsed, + (run_ctx->flags & SCRIPT_EVAL_MODE) ? "SCRIPT KILL" : "FUNCTION KILL", + run_ctx->funcname); enterScriptTimedoutMode(run_ctx); /* Once the script timeouts we reenter the event loop to permit others @@ -133,8 +135,8 @@ int scriptPrepareForRun(scriptRunCtx *run_ctx, serverAssert(!curr_run_ctx); int client_allow_oom = !!(caller->flag.allow_oom); - int running_stale = - server.primary_host && server.repl_state != REPL_STATE_CONNECTED && server.repl_serve_stale_data == 0; + int running_stale = server.primary_host && server.repl_state != REPL_STATE_CONNECTED + && server.repl_serve_stale_data == 0; int obey_client = mustObeyClient(caller); if (!(script_flags & SCRIPT_FLAG_EVAL_COMPAT_MODE)) { @@ -144,9 +146,10 @@ int scriptPrepareForRun(scriptRunCtx *run_ctx, } if (running_stale && !(script_flags & SCRIPT_FLAG_ALLOW_STALE)) { - addReplyError(caller, "-MASTERDOWN Link with MASTER is down, " - "replica-serve-stale-data is set to 'no' " - "and 'allow-stale' flag is not set on the script."); + addReplyError(caller, + "-MASTERDOWN Link with MASTER is down, " + "replica-serve-stale-data is set to 'no' " + "and 'allow-stale' flag is not set on the script."); return C_ERR; } @@ -195,10 +198,11 @@ int scriptPrepareForRun(scriptRunCtx *run_ctx, /* Check OOM state. the no-writes flag imply allow-oom. we tested it * after the no-write error, so no need to mention it in the error reply. */ - if (!client_allow_oom && server.pre_command_oom_state && server.maxmemory && - !(script_flags & (SCRIPT_FLAG_ALLOW_OOM | SCRIPT_FLAG_NO_WRITES))) { - addReplyError(caller, "-OOM allow-oom flag is not set on the script, " - "can not run it when used memory > 'maxmemory'"); + if (!client_allow_oom && server.pre_command_oom_state && server.maxmemory + && !(script_flags & (SCRIPT_FLAG_ALLOW_OOM | SCRIPT_FLAG_NO_WRITES))) { + addReplyError(caller, + "-OOM allow-oom flag is not set on the script, " + "can not run it when used memory > 'maxmemory'"); return C_ERR; } @@ -227,8 +231,8 @@ int scriptPrepareForRun(scriptRunCtx *run_ctx, * flag, we will not allow write commands. */ run_ctx->flags |= SCRIPT_READ_ONLY; } - if (client_allow_oom || - (!(script_flags & SCRIPT_FLAG_EVAL_COMPAT_MODE) && (script_flags & SCRIPT_FLAG_ALLOW_OOM))) { + if (client_allow_oom + || (!(script_flags & SCRIPT_FLAG_EVAL_COMPAT_MODE) && (script_flags & SCRIPT_FLAG_ALLOW_OOM))) { /* Note: we don't need to test the no-writes flag here and set this run_ctx flag, * since only write commands can deny-oom. */ run_ctx->flags |= SCRIPT_ALLOW_OOM; @@ -287,15 +291,17 @@ void scriptKill(client *c, int is_eval) { return; } if (mustObeyClient(curr_run_ctx->original_client)) { - addReplyError(c, "-UNKILLABLE The busy script was sent by a master instance in the context of replication and " - "cannot be killed."); + addReplyError(c, + "-UNKILLABLE The busy script was sent by a master instance in the context of replication and " + "cannot be killed."); return; } if (curr_run_ctx->flags & SCRIPT_WRITE_DIRTY) { - addReplyError(c, "-UNKILLABLE Sorry the script already executed write " - "commands against the dataset. You can either wait the " - "script termination or kill the server in a hard way " - "using the SHUTDOWN NOSAVE command."); + addReplyError(c, + "-UNKILLABLE Sorry the script already executed write " + "commands against the dataset. You can either wait the " + "script termination or kill the server in a hard way " + "using the SHUTDOWN NOSAVE command."); return; } if (is_eval && !(curr_run_ctx->flags & SCRIPT_EVAL_MODE)) { diff --git a/src/scripting_engine.c b/src/scripting_engine.c index 1f2a7ba2cbe..78951e90279 100644 --- a/src/scripting_engine.c +++ b/src/scripting_engine.c @@ -48,9 +48,9 @@ typedef struct scriptingEngineImpl { } scriptingEngineImpl; typedef struct scriptingEngine { - sds name; /* Name of the engine */ - ValkeyModule *module; /* the module that implements the scripting engine */ - scriptingEngineImpl impl; /* engine context and callbacks to interact with the engine */ + sds name; /* Name of the engine */ + ValkeyModule *module; /* the module that implements the scripting engine */ + scriptingEngineImpl impl; /* engine context and callbacks to interact with the engine */ ValkeyModuleCtx *module_ctx_cache[MODULE_CTX_CACHE_SIZE]; /* Cache of module context objects */ } scriptingEngine; @@ -106,7 +106,8 @@ size_t scriptingEngineManagerGetMemoryUsage(void) { static inline void scriptingEngineInitializeEngineMethods(scriptingEngine *engine, engineMethods *methods) { if (methods->version < SCRIPTING_ENGINE_ABI_VERSION_4) { - serverLog(LL_WARNING, "Registering scripting engine '%s' with ABI version '%lu'", + serverLog(LL_WARNING, + "Registering scripting engine '%s' with ABI version '%lu'", engine->name, (unsigned long)methods->version); memcpy(&engine->impl.methods, methods, sizeof(engineMethodsV3)); @@ -144,9 +145,10 @@ int scriptingEngineManagerRegister(const char *engine_name, *e = (scriptingEngine){ .name = engine_name_sds, .module = engine_module, - .impl = { - .ctx = engine_ctx, - }, + .impl = + { + .ctx = engine_ctx, + }, .module_ctx_cache = {0}, }; scriptingEngineInitializeEngineMethods(e, engine_methods); @@ -158,9 +160,7 @@ int scriptingEngineManagerRegister(const char *engine_name, dictAdd(engineMgr.engines, engine_name_sds, e); engineMemoryInfo mem_info = scriptingEngineCallGetMemoryInfo(e, VMSE_ALL); - engineMgr.total_memory_overhead += zmalloc_size(e) + - sdsAllocSize(e->name) + - mem_info.engine_memory_overhead; + engineMgr.total_memory_overhead += zmalloc_size(e) + sdsAllocSize(e->name) + mem_info.engine_memory_overhead; return C_OK; } @@ -182,9 +182,7 @@ int scriptingEngineManagerUnregister(const char *engine_name) { evalRemoveScriptsFromEngine(e); engineMemoryInfo mem_info = scriptingEngineCallGetMemoryInfo(e, VMSE_ALL); - engineMgr.total_memory_overhead -= zmalloc_size(e) + - sdsAllocSize(e->name) + - mem_info.engine_memory_overhead; + engineMgr.total_memory_overhead -= zmalloc_size(e) + sdsAllocSize(e->name) + mem_info.engine_memory_overhead; /* We need to ensure that any pending async flush of eval scripts or * functions have completed before freeing the engine resources, which @@ -237,8 +235,7 @@ uint64_t scriptingEngineGetAbiVersion(scriptingEngine *engine) { * * The `context` pointer is also passed in each callback call. */ -void scriptingEngineManagerForEachEngine(engineIterCallback callback, - void *context) { +void scriptingEngineManagerForEachEngine(engineIterCallback callback, void *context) { dictIterator *iter = dictGetIterator(engineMgr.engines); dictEntry *entry = NULL; while ((entry = dictNext(iter))) { @@ -256,10 +253,7 @@ static ValkeyModuleCtx *engineSetupModuleCtx(int module_ctx_cache_index, if (e->module == NULL) return NULL; ValkeyModuleCtx *ctx = e->module_ctx_cache[module_ctx_cache_index]; - moduleScriptingEngineInitContext(ctx, - e->module, - add_script_execution_flag, - c); + moduleScriptingEngineInitContext(ctx, e->module, add_script_execution_flag, c); return ctx; } @@ -283,25 +277,23 @@ compiledFunction **scriptingEngineCallCompileCode(scriptingEngine *engine, ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(COMMON_MODULE_CTX_INDEX, engine, false, NULL); if (engine->impl.methods.version == SCRIPTING_ENGINE_ABI_VERSION_1) { - functions = engine->impl.methods.compile_code_v1( - module_ctx, - engine->impl.ctx, - type, - code, - timeout, - out_num_compiled_functions, - err); + functions = engine->impl.methods.compile_code_v1(module_ctx, + engine->impl.ctx, + type, + code, + timeout, + out_num_compiled_functions, + err); } else { /* Assume versions greater than 1 use updated interface. */ - functions = engine->impl.methods.compile_code( - module_ctx, - engine->impl.ctx, - type, - code, - code_len, - timeout, - out_num_compiled_functions, - err); + functions = engine->impl.methods.compile_code(module_ctx, + engine->impl.ctx, + type, + code, + code_len, + timeout, + out_num_compiled_functions, + err); } engineTeardownModuleCtx(COMMON_MODULE_CTX_INDEX, engine); @@ -309,9 +301,7 @@ compiledFunction **scriptingEngineCallCompileCode(scriptingEngine *engine, return functions; } -void scriptingEngineCallFreeFunction(scriptingEngine *engine, - subsystemType type, - compiledFunction *compiled_func) { +void scriptingEngineCallFreeFunction(scriptingEngine *engine, subsystemType type, compiledFunction *compiled_func) { serverAssert(type == VMSE_EVAL || type == VMSE_FUNCTION); int is_async = isCalledFromAsyncThread(); @@ -322,11 +312,7 @@ void scriptingEngineCallFreeFunction(scriptingEngine *engine, } ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(FREE_FUNCTION_MODULE_CTX_INDEX, engine, false, NULL); - engine->impl.methods.free_function( - module_ctx, - engine->impl.ctx, - type, - compiled_func); + engine->impl.methods.free_function(module_ctx, engine->impl.ctx, type, compiled_func); engineTeardownModuleCtx(FREE_FUNCTION_MODULE_CTX_INDEX, engine); if (is_async) { @@ -347,33 +333,20 @@ void scriptingEngineCallFunction(scriptingEngine *engine, ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(COMMON_MODULE_CTX_INDEX, engine, true, caller); - engine->impl.methods.call_function( - module_ctx, - engine->impl.ctx, - server_ctx, - compiled_function, - type, - keys, - nkeys, - args, - nargs); + engine->impl.methods + .call_function(module_ctx, engine->impl.ctx, server_ctx, compiled_function, type, keys, nkeys, args, nargs); engineTeardownModuleCtx(COMMON_MODULE_CTX_INDEX, engine); } -size_t scriptingEngineCallGetFunctionMemoryOverhead(scriptingEngine *engine, - compiledFunction *compiled_function) { +size_t scriptingEngineCallGetFunctionMemoryOverhead(scriptingEngine *engine, compiledFunction *compiled_function) { ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(COMMON_MODULE_CTX_INDEX, engine, false, NULL); - size_t mem = engine->impl.methods.get_function_memory_overhead( - module_ctx, - compiled_function); + size_t mem = engine->impl.methods.get_function_memory_overhead(module_ctx, compiled_function); engineTeardownModuleCtx(COMMON_MODULE_CTX_INDEX, engine); return mem; } -callableLazyEnvReset *scriptingEngineCallResetEnvFunc(scriptingEngine *engine, - subsystemType type, - int async) { +callableLazyEnvReset *scriptingEngineCallResetEnvFunc(scriptingEngine *engine, subsystemType type, int async) { ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(COMMON_MODULE_CTX_INDEX, engine, false, NULL); callableLazyEnvReset *callback = NULL; @@ -384,10 +357,7 @@ callableLazyEnvReset *scriptingEngineCallResetEnvFunc(scriptingEngine *engine, * the EVAL environment. */ if (type == VMSE_EVAL) { - callback = engine->impl.methods.reset_eval_env_v2( - module_ctx, - engine->impl.ctx, - async); + callback = engine->impl.methods.reset_eval_env_v2(module_ctx, engine->impl.ctx, async); } else { /* For FUNCTION scripts, the reset_env function is not implemented * in version 1 or 2 of the scripting engine ABI, so we just return @@ -396,24 +366,16 @@ callableLazyEnvReset *scriptingEngineCallResetEnvFunc(scriptingEngine *engine, callback = NULL; } } else { - callback = engine->impl.methods.reset_env( - module_ctx, - engine->impl.ctx, - type, - async); + callback = engine->impl.methods.reset_env(module_ctx, engine->impl.ctx, type, async); } engineTeardownModuleCtx(COMMON_MODULE_CTX_INDEX, engine); return callback; } -engineMemoryInfo scriptingEngineCallGetMemoryInfo(scriptingEngine *engine, - subsystemType type) { +engineMemoryInfo scriptingEngineCallGetMemoryInfo(scriptingEngine *engine, subsystemType type) { ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(GET_MEMORY_MODULE_CTX_INDEX, engine, false, NULL); - engineMemoryInfo mem_info = engine->impl.methods.get_memory_info( - module_ctx, - engine->impl.ctx, - type); + engineMemoryInfo mem_info = engine->impl.methods.get_memory_info(module_ctx, engine->impl.ctx, type); engineTeardownModuleCtx(GET_MEMORY_MODULE_CTX_INDEX, engine); return mem_info; } @@ -423,68 +385,49 @@ debuggerEnableRet scriptingEngineCallDebuggerEnable(scriptingEngine *engine, const debuggerCommand **commands, size_t *commands_len) { if (engine->impl.methods.version < SCRIPTING_ENGINE_ABI_VERSION_4) { - serverLog(LL_WARNING, "Scripting engine '%s' uses ABI version '%lu', which does not support debugger API", + serverLog(LL_WARNING, + "Scripting engine '%s' uses ABI version '%lu', which does not support debugger API", scriptingEngineGetName(engine), (unsigned long)engine->impl.methods.version); return VMSE_DEBUG_NOT_SUPPORTED; } - if (engine->impl.methods.debugger_enable == NULL || - engine->impl.methods.debugger_disable == NULL || - engine->impl.methods.debugger_start == NULL || - engine->impl.methods.debugger_end == NULL) { + if (engine->impl.methods.debugger_enable == NULL || engine->impl.methods.debugger_disable == NULL + || engine->impl.methods.debugger_start == NULL || engine->impl.methods.debugger_end == NULL) { return VMSE_DEBUG_NOT_SUPPORTED; } ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(COMMON_MODULE_CTX_INDEX, engine, false, NULL); - debuggerEnableRet ret = engine->impl.methods.debugger_enable( - module_ctx, - engine->impl.ctx, - type, - commands, - commands_len); + debuggerEnableRet ret = + engine->impl.methods.debugger_enable(module_ctx, engine->impl.ctx, type, commands, commands_len); engineTeardownModuleCtx(COMMON_MODULE_CTX_INDEX, engine); return ret; } -void scriptingEngineCallDebuggerDisable(scriptingEngine *engine, - subsystemType type) { +void scriptingEngineCallDebuggerDisable(scriptingEngine *engine, subsystemType type) { serverAssert(engine->impl.methods.version >= SCRIPTING_ENGINE_ABI_VERSION_4); serverAssert(engine->impl.methods.debugger_disable != NULL); ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(COMMON_MODULE_CTX_INDEX, engine, false, NULL); - engine->impl.methods.debugger_disable( - module_ctx, - engine->impl.ctx, - type); + engine->impl.methods.debugger_disable(module_ctx, engine->impl.ctx, type); engineTeardownModuleCtx(COMMON_MODULE_CTX_INDEX, engine); } -void scriptingEngineCallDebuggerStart(scriptingEngine *engine, - subsystemType type, - robj *source) { +void scriptingEngineCallDebuggerStart(scriptingEngine *engine, subsystemType type, robj *source) { serverAssert(engine->impl.methods.version >= SCRIPTING_ENGINE_ABI_VERSION_4); serverAssert(engine->impl.methods.debugger_start != NULL); ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(COMMON_MODULE_CTX_INDEX, engine, false, NULL); - engine->impl.methods.debugger_start( - module_ctx, - engine->impl.ctx, - type, - source); + engine->impl.methods.debugger_start(module_ctx, engine->impl.ctx, type, source); engineTeardownModuleCtx(COMMON_MODULE_CTX_INDEX, engine); } -void scriptingEngineCallDebuggerEnd(scriptingEngine *engine, - subsystemType type) { +void scriptingEngineCallDebuggerEnd(scriptingEngine *engine, subsystemType type) { serverAssert(engine->impl.methods.version >= SCRIPTING_ENGINE_ABI_VERSION_4); serverAssert(engine->impl.methods.debugger_end != NULL); ValkeyModuleCtx *module_ctx = engineSetupModuleCtx(COMMON_MODULE_CTX_INDEX, engine, false, NULL); - engine->impl.methods.debugger_end( - module_ctx, - engine->impl.ctx, - type); + engine->impl.methods.debugger_end(module_ctx, engine->impl.ctx, type); engineTeardownModuleCtx(COMMON_MODULE_CTX_INDEX, engine); } @@ -531,11 +474,7 @@ void debugScriptFlushLog(list *log) { /* Enable debug mode of scripts for this client. */ int scriptingEngineDebuggerEnable(client *c, scriptingEngine *engine, sds *err) { - debuggerEnableRet ret = scriptingEngineCallDebuggerEnable( - engine, - VMSE_EVAL, - &ds.commands, - &ds.commands_len); + debuggerEnableRet ret = scriptingEngineCallDebuggerEnable(engine, VMSE_EVAL, &ds.commands, &ds.commands_len); if (ret == VMSE_DEBUG_NOT_SUPPORTED) { *err = sdscatfmt(sdsempty(), @@ -595,8 +534,9 @@ void scriptingEngineDebuggerLogWithMaxLen(robj *entry) { scriptingEngineDebuggerLog(entry); if (trimmed && ds.maxlen_hint_sent == 0) { ds.maxlen_hint_sent = 1; - scriptingEngineDebuggerLog( - createObject(OBJ_STRING, sdsnew(" The above reply was trimmed. Use 'maxlen 0' to disable trimming."))); + scriptingEngineDebuggerLog(createObject(OBJ_STRING, + sdsnew(" The above reply was trimmed. Use 'maxlen 0' to disable " + "trimming."))); } } @@ -845,9 +785,7 @@ static sds *wrapText(const char *text, size_t max_len, size_t *count) { return lines; } -static void printCommandHelp(const debuggerCommand *command, - int name_width, - int line_width) { +static void printCommandHelp(const debuggerCommand *command, int name_width, int line_width) { sds msg = sdsempty(); /* Format the command name according to the prefix length. */ @@ -942,8 +880,7 @@ static debuggerCommand builtins[] = { "If no is specified, the current value is shown. " "Usage: maxlen [len]", .handler = maxlenCommandHandler, - .params = (debuggerCommandParam[]){ - {.name = "len", .optional = 1, .variadic = 0}}, + .params = (debuggerCommandParam[]){{.name = "len", .optional = 1, .variadic = 0}}, .params_len = 1, }}; @@ -1012,9 +949,9 @@ static const debuggerCommand *findCommand(robj **argv, size_t argc) { // Check built-in commands first. for (size_t i = 0; i < builtins_len; i++) { const debuggerCommand *cmd = &builtins[i]; - if ((sdslen(objectGetVal(argv[0])) == cmd->prefix_len && - strncasecmp(cmd->name, objectGetVal(argv[0]), cmd->prefix_len) == 0) || - strcasecmp(cmd->name, objectGetVal(argv[0])) == 0) { + if ((sdslen(objectGetVal(argv[0])) == cmd->prefix_len + && strncasecmp(cmd->name, objectGetVal(argv[0]), cmd->prefix_len) == 0) + || strcasecmp(cmd->name, objectGetVal(argv[0])) == 0) { if (checkCommandParameters(cmd, argc)) { return cmd; } @@ -1024,9 +961,9 @@ static const debuggerCommand *findCommand(robj **argv, size_t argc) { // Then check the commands exported by the scripting engine. for (size_t i = 0; i < ds.commands_len; i++) { const debuggerCommand *cmd = &ds.commands[i]; - if ((sdslen(objectGetVal(argv[0])) == cmd->prefix_len && - strncasecmp(cmd->name, objectGetVal(argv[0]), cmd->prefix_len) == 0) || - strcasecmp(cmd->name, objectGetVal(argv[0])) == 0) { + if ((sdslen(objectGetVal(argv[0])) == cmd->prefix_len + && strncasecmp(cmd->name, objectGetVal(argv[0]), cmd->prefix_len) == 0) + || strcasecmp(cmd->name, objectGetVal(argv[0])) == 0) { if (checkCommandParameters(cmd, argc)) { return cmd; } @@ -1038,9 +975,8 @@ static const debuggerCommand *findCommand(robj **argv, size_t argc) { static int findAndExecuteCommand(robj **argv, size_t argc) { const debuggerCommand *cmd = findCommand(argv, argc); if (cmd == NULL) { - scriptingEngineDebuggerLog(createObject( - OBJ_STRING, - sdsnew(" Unknown debugger command or wrong number of arguments."))); + scriptingEngineDebuggerLog( + createObject(OBJ_STRING, sdsnew(" Unknown debugger command or wrong number of arguments."))); scriptingEngineDebuggerFlushLogs(); return CONTINUE_READ_NEXT_COMMAND; } diff --git a/src/scripting_engine.h b/src/scripting_engine.h index 44c176f41c8..bd96148a19d 100644 --- a/src/scripting_engine.h +++ b/src/scripting_engine.h @@ -65,9 +65,7 @@ compiledFunction **scriptingEngineCallCompileCode(scriptingEngine *engine, size_t *out_num_compiled_functions, robj **err); -void scriptingEngineCallFreeFunction(scriptingEngine *engine, - subsystemType type, - compiledFunction *compiled_func); +void scriptingEngineCallFreeFunction(scriptingEngine *engine, subsystemType type, compiledFunction *compiled_func); void scriptingEngineCallFunction(scriptingEngine *engine, serverRuntimeCtx *server_ctx, @@ -79,30 +77,22 @@ void scriptingEngineCallFunction(scriptingEngine *engine, robj **args, size_t nargs); -size_t scriptingEngineCallGetFunctionMemoryOverhead(scriptingEngine *engine, - compiledFunction *compiled_function); +size_t scriptingEngineCallGetFunctionMemoryOverhead(scriptingEngine *engine, compiledFunction *compiled_function); -callableLazyEnvReset *scriptingEngineCallResetEnvFunc(scriptingEngine *engine, - subsystemType type, - int async); +callableLazyEnvReset *scriptingEngineCallResetEnvFunc(scriptingEngine *engine, subsystemType type, int async); -engineMemoryInfo scriptingEngineCallGetMemoryInfo(scriptingEngine *engine, - subsystemType type); +engineMemoryInfo scriptingEngineCallGetMemoryInfo(scriptingEngine *engine, subsystemType type); debuggerEnableRet scriptingEngineCallDebuggerEnable(scriptingEngine *engine, subsystemType type, const debuggerCommand **commands, size_t *commands_len); -void scriptingEngineCallDebuggerDisable(scriptingEngine *engine, - subsystemType type); +void scriptingEngineCallDebuggerDisable(scriptingEngine *engine, subsystemType type); -void scriptingEngineCallDebuggerStart(scriptingEngine *engine, - subsystemType type, - robj *source); +void scriptingEngineCallDebuggerStart(scriptingEngine *engine, subsystemType type, robj *source); -void scriptingEngineCallDebuggerEnd(scriptingEngine *engine, - subsystemType type); +void scriptingEngineCallDebuggerEnd(scriptingEngine *engine, subsystemType type); /* * API of scripting engine remote debugger. diff --git a/src/sds.c b/src/sds.c index dcb95b80b4e..4e80c843afd 100644 --- a/src/sds.c +++ b/src/sds.c @@ -476,8 +476,8 @@ void sdsIncrLen(sds s, ssize_t incr) { } case SDS_TYPE_32: { SDS_HDR_VAR(32, s); - assert((incr >= 0 && sh->alloc - sh->len >= (unsigned int)incr) || - (incr < 0 && sh->len >= (unsigned int)(-incr))); + assert((incr >= 0 && sh->alloc - sh->len >= (unsigned int)incr) + || (incr < 0 && sh->len >= (unsigned int)(-incr))); len = (sh->len += incr); break; } @@ -960,9 +960,7 @@ sds sdscatrepr(sds s, const char *p, size_t len) { case '\t': s = sdscatlen(s, "\\t", 2); break; case '\a': s = sdscatlen(s, "\\a", 2); break; case '\b': s = sdscatlen(s, "\\b", 2); break; - default: - s = sdscatprintf(s, "\\x%02x", (unsigned char)*p); - break; + default: s = sdscatprintf(s, "\\x%02x", (unsigned char)*p); break; } p++; len--; @@ -983,8 +981,8 @@ int sdsneedsrepr(const_sds s) { const char *p = s; while (len--) { - if (*p == '\\' || *p == '"' || *p == '\n' || *p == '\r' || *p == '\t' || *p == '\a' || *p == '\b' || - !isprint(*p) || isspace(*p)) + if (*p == '\\' || *p == '"' || *p == '\n' || *p == '\r' || *p == '\t' || *p == '\a' || *p == '\b' + || !isprint(*p) || isspace(*p)) return 1; p++; } @@ -1057,7 +1055,8 @@ static int sdsparsearg(const char *arg, const char *end, unsigned int *len, char if (!*p) { /* unterminated quotes */ return 0; - } else if (!isPtrExceedingEnd(p, 4, end) && (*p == '\\' && *(p + 1) == 'x' && is_hex_digit(*(p + 2)) && is_hex_digit(*(p + 3)))) { + } else if (!isPtrExceedingEnd(p, 4, end) + && (*p == '\\' && *(p + 1) == 'x' && is_hex_digit(*(p + 2)) && is_hex_digit(*(p + 3)))) { new_char = (hex_digit_to_int(*(p + 2)) * 16) + hex_digit_to_int(*(p + 3)); p += 4; } else if (!isPtrExceedingEnd(p, 2, end) && (*p == '\\' && *(p + 1))) { diff --git a/src/sentinel.c b/src/sentinel.c index 7340527d653..7b72cb581c8 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -66,10 +66,8 @@ typedef struct sentinelAddr { #define SRI_SENTINEL (1 << 2) #define SRI_S_DOWN (1 << 3) /* Subjectively down (no quorum). */ #define SRI_O_DOWN (1 << 4) /* Objectively down (confirmed by others). */ -#define SRI_PRIMARY_DOWN (1 << 5) /* A Sentinel with this flag set thinks that \ - its primary is down. */ -#define SRI_FAILOVER_IN_PROGRESS (1 << 6) /* Failover is in progress for \ - this primary. */ +#define SRI_PRIMARY_DOWN (1 << 5) /* A Sentinel with this flag set thinks that its primary is down. */ +#define SRI_FAILOVER_IN_PROGRESS (1 << 6) /* Failover is in progress for this primary. */ #define SRI_PROMOTED (1 << 7) /* Replica selected for promotion. */ #define SRI_RECONF_SENT (1 << 8) /* REPLICAOF sent. */ #define SRI_RECONF_INPROG (1 << 9) /* Replica synchronization in progress. */ @@ -221,7 +219,7 @@ typedef struct sentinelValkeyInstance { mstime_t role_reported_time; mstime_t replica_conf_change_time; /* Last time replica primary addr changed. */ - int monitored_instance_failover_state; /* Whether the Valkey instance supports/reports a failover in "master_failover_state" */ + int monitored_instance_failover_state; /* Whether the Valkey instance supports/reports a failover in "master_failover_state" */ mstime_t monitored_instance_failover_change_time; /* Last time monitored_instance_failover_state changed. */ /* Primary specific. */ @@ -531,7 +529,9 @@ void sentinelCheckConfigFile(void) { serverLog(LL_WARNING, "Sentinel needs config file on disk to save state. Exiting..."); exit(1); } else if (access(server.configfile, W_OK) == -1) { - serverLog(LL_WARNING, "Sentinel config file %s is not writable: %s. Exiting...", server.configfile, + serverLog(LL_WARNING, + "Sentinel config file %s is not writable: %s. Exiting...", + server.configfile, strerror(errno)); exit(1); } @@ -577,8 +577,8 @@ sentinelAddr *createSentinelAddr(char *hostname, int port, int is_accept_unresol errno = EINVAL; return NULL; } - if (anetResolve(NULL, hostname, ip, sizeof(ip), sentinel.resolve_hostnames ? ANET_NONE : ANET_IP_ONLY) == - ANET_ERR) { + if (anetResolve(NULL, hostname, ip, sizeof(ip), sentinel.resolve_hostnames ? ANET_NONE : ANET_IP_ONLY) + == ANET_ERR) { serverLog(LL_WARNING, "Failed to resolve hostname '%s'", hostname); if (sentinel.resolve_hostnames && is_accept_unresolved) { ip[0] = '\0'; @@ -624,8 +624,8 @@ int sentinelAddrEqualsHostname(sentinelAddr *a, char *hostname) { char ip[NET_IP_STR_LEN]; /* Try resolve the hostname and compare it to the address */ - if (anetResolve(NULL, hostname, ip, sizeof(ip), sentinel.resolve_hostnames ? ANET_NONE : ANET_IP_ONLY) == - ANET_ERR) { + if (anetResolve(NULL, hostname, ip, sizeof(ip), sentinel.resolve_hostnames ? ANET_NONE : ANET_IP_ONLY) + == ANET_ERR) { /* If failed resolve then compare based on hostnames. That is our best effort as * long as the server is unavailable for some reason. It is fine since an * instance cannot have multiple hostnames for a given setup */ @@ -686,12 +686,24 @@ void sentinelEvent(int level, char *type, sentinelValkeyInstance *ri, const char sentinelValkeyInstance *primary = (ri->flags & SRI_PRIMARY) ? NULL : ri->primary; if (primary) { - snprintf(msg, sizeof(msg), "%s %s %s %d @ %s %s %d", sentinelValkeyInstanceTypeStr(ri), ri->name, - announceSentinelAddr(ri->addr), ri->addr->port, primary->name, announceSentinelAddr(primary->addr), + snprintf(msg, + sizeof(msg), + "%s %s %s %d @ %s %s %d", + sentinelValkeyInstanceTypeStr(ri), + ri->name, + announceSentinelAddr(ri->addr), + ri->addr->port, + primary->name, + announceSentinelAddr(primary->addr), primary->addr->port); } else { - snprintf(msg, sizeof(msg), "%s %s %s %d", sentinelValkeyInstanceTypeStr(ri), ri->name, - announceSentinelAddr(ri->addr), ri->addr->port); + snprintf(msg, + sizeof(msg), + "%s %s %s %d", + sentinelValkeyInstanceTypeStr(ri), + ri->name, + announceSentinelAddr(ri->addr), + ri->addr->port); } fmt += 2; } else { @@ -893,7 +905,8 @@ void sentinelCollectTerminatedScripts(void) { ln = sentinelGetScriptListNodeByPid(pid); if (ln == NULL) { - serverLog(LL_WARNING, "waitpid() returned a pid (%ld) we can't find in our scripts execution queue!", + serverLog(LL_WARNING, + "waitpid() returned a pid (%ld) we can't find in our scripts execution queue!", (long)pid); continue; } @@ -999,9 +1012,15 @@ void sentinelCallClientReconfScript(sentinelValkeyInstance *primary, if (primary->client_reconfig_script == NULL) return; ll2string(fromport, sizeof(fromport), from->port); ll2string(toport, sizeof(toport), to->port); - sentinelScheduleScriptExecution(primary->client_reconfig_script, primary->name, - (role == SENTINEL_LEADER) ? "leader" : "observer", state, - announceSentinelAddr(from), fromport, announceSentinelAddr(to), toport, NULL); + sentinelScheduleScriptExecution(primary->client_reconfig_script, + primary->name, + (role == SENTINEL_LEADER) ? "leader" : "observer", + state, + announceSentinelAddr(from), + fromport, + announceSentinelAddr(to), + toport, + NULL); } /* =============================== instanceLink ============================= */ @@ -1492,8 +1511,8 @@ sentinelValkeyInstance *getSentinelValkeyInstanceByAddrAndRunID(dict *instances, sentinelValkeyInstance *ri = dictGetVal(de); if (runid && !ri->runid) continue; - if ((runid == NULL || strcmp(ri->runid, runid) == 0) && - (addr == NULL || sentinelAddrOrHostnameEqual(ri->addr, ri_addr))) { + if ((runid == NULL || strcmp(ri->runid, runid) == 0) + && (addr == NULL || sentinelAddrOrHostnameEqual(ri->addr, ri_addr))) { instance = ri; break; } @@ -1630,8 +1649,12 @@ int sentinelResetPrimaryAndChangeAddress(sentinelValkeyInstance *primary, char * for (j = 0; j < num_replicas; j++) { sentinelValkeyInstance *replica; - replica = createSentinelValkeyInstance(NULL, SRI_REPLICA, replicas[j]->hostname, replicas[j]->port, - primary->quorum, primary); + replica = createSentinelValkeyInstance(NULL, + SRI_REPLICA, + replicas[j]->hostname, + replicas[j]->port, + primary->quorum, + primary); releaseSentinelAddr(replicas[j]); if (replica) sentinelEvent(LL_NOTICE, "+slave", replica, "%@"); } @@ -1662,8 +1685,8 @@ sentinelAddr *sentinelGetCurrentPrimaryAddress(sentinelValkeyInstance *primary) * already have the new configuration epoch in the primary, and the * replica acknowledged the configuration switch. Advertise the new * address. */ - if ((primary->flags & SRI_FAILOVER_IN_PROGRESS) && primary->promoted_replica && - primary->failover_state >= SENTINEL_FAILOVER_STATE_RECONF_REPLICAS) { + if ((primary->flags & SRI_FAILOVER_IN_PROGRESS) && primary->promoted_replica + && primary->failover_state >= SENTINEL_FAILOVER_STATE_RECONF_REPLICAS) { return primary->promoted_replica->addr; } else { return primary->addr; @@ -1804,7 +1827,8 @@ void loadSentinelConfigFromQueue(void) { /* if there is no sentinel_config entry, we can return immediately */ if (server.sentinel_config == NULL) return; - list *sentinel_configs[3] = {server.sentinel_config->pre_monitor_cfg, server.sentinel_config->monitor_cfg, + list *sentinel_configs[3] = {server.sentinel_config->pre_monitor_cfg, + server.sentinel_config->monitor_cfg, server.sentinel_config->post_monitor_cfg}; /* loading from pre monitor config queue first to avoid dependency issues * loading from monitor config queue @@ -1914,8 +1938,8 @@ const char *sentinelHandleConfiguration(char **argv, int argc) { /* known-replica */ ri = sentinelGetPrimaryByName(argv[1]); if (!ri) return "No such master with specified name."; - if ((replica = createSentinelValkeyInstance(NULL, SRI_REPLICA, argv[2], atoi(argv[3]), ri->quorum, ri)) == - NULL) { + if ((replica = createSentinelValkeyInstance(NULL, SRI_REPLICA, argv[2], atoi(argv[3]), ri->quorum, ri)) + == NULL) { return sentinelCheckCreateInstanceErrors(SRI_REPLICA); } } else if (!strcasecmp(argv[0], "known-sentinel") && (argc == 4 || argc == 5)) { @@ -1925,8 +1949,8 @@ const char *sentinelHandleConfiguration(char **argv, int argc) { /* known-sentinel [runid] */ ri = sentinelGetPrimaryByName(argv[1]); if (!ri) return "No such master with specified name."; - if ((si = createSentinelValkeyInstance(argv[4], SRI_SENTINEL, argv[2], atoi(argv[3]), ri->quorum, ri)) == - NULL) { + if ((si = createSentinelValkeyInstance(argv[4], SRI_SENTINEL, argv[2], atoi(argv[3]), ri->quorum, ri)) + == NULL) { return sentinelCheckCreateInstanceErrors(SRI_SENTINEL); } si->runid = sdsnew(argv[4]); @@ -1971,9 +1995,9 @@ const char *sentinelHandleConfiguration(char **argv, int argc) { if ((sentinel.announce_hostnames = yesnotoi(argv[1])) == -1) { return "Please specify yes or no for the announce-hostnames option."; } - } else if ((!strcasecmp(argv[0], "primary-reboot-down-after-period") || - !strcasecmp(argv[0], "master-reboot-down-after-period")) && - argc == 3) { + } else if ((!strcasecmp(argv[0], "primary-reboot-down-after-period") + || !strcasecmp(argv[0], "master-reboot-down-after-period")) + && argc == 3) { /* primary-reboot-down-after-period */ ri = sentinelGetPrimaryByName(argv[1]); if (!ri) return "No such master with specified name."; @@ -2001,7 +2025,9 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { /* sentinel deny-scripts-reconfig. */ line = sdscatprintf(sdsempty(), "sentinel deny-scripts-reconfig %s", sentinel.deny_scripts_reconfig ? "yes" : "no"); - rewriteConfigRewriteLine(state, "sentinel deny-scripts-reconfig", line, + rewriteConfigRewriteLine(state, + "sentinel deny-scripts-reconfig", + line, sentinel.deny_scripts_reconfig != SENTINEL_DEFAULT_DENY_SCRIPTS_RECONFIG); /* sentinel resolve-hostnames. @@ -2009,12 +2035,16 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { * when reading the file. */ line = sdscatprintf(sdsempty(), "sentinel resolve-hostnames %s", sentinel.resolve_hostnames ? "yes" : "no"); - rewriteConfigRewriteLine(state, "sentinel resolve-hostnames", line, + rewriteConfigRewriteLine(state, + "sentinel resolve-hostnames", + line, sentinel.resolve_hostnames != SENTINEL_DEFAULT_RESOLVE_HOSTNAMES); /* sentinel announce-hostnames. */ line = sdscatprintf(sdsempty(), "sentinel announce-hostnames %s", sentinel.announce_hostnames ? "yes" : "no"); - rewriteConfigRewriteLine(state, "sentinel announce-hostnames", line, + rewriteConfigRewriteLine(state, + "sentinel announce-hostnames", + line, sentinel.announce_hostnames != SENTINEL_DEFAULT_ANNOUNCE_HOSTNAMES); /* For every primary emit a "sentinel monitor" config entry. */ @@ -2026,14 +2056,20 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { /* sentinel monitor */ primary = dictGetVal(de); primary_addr = sentinelGetCurrentPrimaryAddress(primary); - line = sdscatprintf(sdsempty(), "sentinel monitor %s %s %d %d", primary->name, - announceSentinelAddr(primary_addr), primary_addr->port, primary->quorum); + line = sdscatprintf(sdsempty(), + "sentinel monitor %s %s %d %d", + primary->name, + announceSentinelAddr(primary_addr), + primary_addr->port, + primary->quorum); rewriteConfigRewriteLine(state, "sentinel monitor", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ /* sentinel down-after-milliseconds */ if (primary->down_after_period != sentinel_default_down_after) { - line = sdscatprintf(sdsempty(), "sentinel down-after-milliseconds %s %ld", primary->name, + line = sdscatprintf(sdsempty(), + "sentinel down-after-milliseconds %s %ld", + primary->name, (long)primary->down_after_period); rewriteConfigRewriteLine(state, "sentinel down-after-milliseconds", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ @@ -2041,7 +2077,9 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { /* sentinel failover-timeout */ if (primary->failover_timeout != sentinel_default_failover_timeout) { - line = sdscatprintf(sdsempty(), "sentinel failover-timeout %s %ld", primary->name, + line = sdscatprintf(sdsempty(), + "sentinel failover-timeout %s %ld", + primary->name, (long)primary->failover_timeout); rewriteConfigRewriteLine(state, "sentinel failover-timeout", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ @@ -2056,7 +2094,9 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { /* sentinel notification-script */ if (primary->notification_script) { - line = sdscatprintf(sdsempty(), "sentinel notification-script %s %s", primary->name, + line = sdscatprintf(sdsempty(), + "sentinel notification-script %s %s", + primary->name, primary->notification_script); rewriteConfigRewriteLine(state, "sentinel notification-script", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ @@ -2064,7 +2104,9 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { /* sentinel client-reconfig-script */ if (primary->client_reconfig_script) { - line = sdscatprintf(sdsempty(), "sentinel client-reconfig-script %s %s", primary->name, + line = sdscatprintf(sdsempty(), + "sentinel client-reconfig-script %s %s", + primary->name, primary->client_reconfig_script); rewriteConfigRewriteLine(state, "sentinel client-reconfig-script", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ @@ -2085,21 +2127,27 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { /* sentinel primary-reboot-down-after-period */ if (primary->primary_reboot_down_after_period != 0) { - line = sdscatprintf(sdsempty(), "sentinel primary-reboot-down-after-period %s %ld", primary->name, + line = sdscatprintf(sdsempty(), + "sentinel primary-reboot-down-after-period %s %ld", + primary->name, (long)primary->primary_reboot_down_after_period); rewriteConfigRewriteLine(state, "sentinel primary-reboot-down-after-period", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ } /* sentinel config-epoch */ - line = sdscatprintf(sdsempty(), "sentinel config-epoch %s %llu", primary->name, + line = sdscatprintf(sdsempty(), + "sentinel config-epoch %s %llu", + primary->name, (unsigned long long)primary->config_epoch); rewriteConfigRewriteLine(state, "sentinel config-epoch", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ /* sentinel leader-epoch */ - line = sdscatprintf(sdsempty(), "sentinel leader-epoch %s %llu", primary->name, + line = sdscatprintf(sdsempty(), + "sentinel leader-epoch %s %llu", + primary->name, (unsigned long long)primary->leader_epoch); rewriteConfigRewriteLine(state, "sentinel leader-epoch", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ @@ -2118,8 +2166,11 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { * already successfully promoted. So as the address of this replica * we use the old primary address instead. */ if (sentinelAddrOrHostnameEqual(replica_addr, primary_addr)) replica_addr = primary->addr; - line = sdscatprintf(sdsempty(), "sentinel known-replica %s %s %d", primary->name, - announceSentinelAddr(replica_addr), replica_addr->port); + line = sdscatprintf(sdsempty(), + "sentinel known-replica %s %s %d", + primary->name, + announceSentinelAddr(replica_addr), + replica_addr->port); /* try to replace any known-replica option first if found */ if (rewriteConfigRewriteLine(state, "sentinel known-slave", sdsdup(line), 0) == 0) { rewriteConfigRewriteLine(state, "sentinel known-replica", line, 1); @@ -2135,8 +2186,12 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { while ((de = dictNext(di2)) != NULL) { ri = dictGetVal(de); if (ri->runid == NULL) continue; - line = sdscatprintf(sdsempty(), "sentinel known-sentinel %s %s %d %s", primary->name, - announceSentinelAddr(ri->addr), ri->addr->port, ri->runid); + line = sdscatprintf(sdsempty(), + "sentinel known-sentinel %s %s %d %s", + primary->name, + announceSentinelAddr(ri->addr), + ri->addr->port, + ri->runid); rewriteConfigRewriteLine(state, "sentinel known-sentinel", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ } @@ -2227,7 +2282,8 @@ int sentinelFlushConfig(void) { server.hz = saved_hz; if (rewrite_status == -1) { - serverLog(LL_WARNING, "WARNING: Sentinel was not able to save the new configuration on disk!!!: %s", + serverLog(LL_WARNING, + "WARNING: Sentinel was not able to save the new configuration on disk!!!: %s", strerror(errno)); return C_ERR; } else { @@ -2285,14 +2341,25 @@ void sentinelSendAuthIfNeeded(sentinelValkeyInstance *ri, valkeyAsyncContext *c) } if (auth_pass && auth_user == NULL) { - if (valkeyAsyncCommand(c, sentinelDiscardReplyCallback, ri, "%s %s", sentinelInstanceMapCommand(ri, "AUTH"), - auth_pass) == C_OK) + if (valkeyAsyncCommand(c, + sentinelDiscardReplyCallback, + ri, + "%s %s", + sentinelInstanceMapCommand(ri, "AUTH"), + auth_pass) + == C_OK) ri->link->pending_commands++; } else if (auth_pass && auth_user) { /* If we also have an username, use the ACL-style AUTH command * with two arguments, username and password. */ - if (valkeyAsyncCommand(c, sentinelDiscardReplyCallback, ri, "%s %s %s", sentinelInstanceMapCommand(ri, "AUTH"), - auth_user, auth_pass) == C_OK) + if (valkeyAsyncCommand(c, + sentinelDiscardReplyCallback, + ri, + "%s %s %s", + sentinelInstanceMapCommand(ri, "AUTH"), + auth_user, + auth_pass) + == C_OK) ri->link->pending_commands++; } } @@ -2307,8 +2374,13 @@ void sentinelSetClientName(sentinelValkeyInstance *ri, valkeyAsyncContext *c, ch char name[64]; snprintf(name, sizeof(name), "sentinel-%.8s-%s", sentinel.myid, type); - if (valkeyAsyncCommand(c, sentinelDiscardReplyCallback, ri, "%s SETNAME %s", - sentinelInstanceMapCommand(ri, "CLIENT"), name) == C_OK) { + if (valkeyAsyncCommand(c, + sentinelDiscardReplyCallback, + ri, + "%s SETNAME %s", + sentinelInstanceMapCommand(ri, "CLIENT"), + name) + == C_OK) { ri->link->pending_commands++; } } @@ -2401,8 +2473,12 @@ void sentinelReconnectInstance(sentinelValkeyInstance *ri) { sentinelSendAuthIfNeeded(ri, link->pc); sentinelSetClientName(ri, link->pc, "pubsub"); /* Now we subscribe to the Sentinels "Hello" channel. */ - retval = valkeyAsyncCommand(link->pc, sentinelReceiveHelloMessages, ri, "%s %s", - sentinelInstanceMapCommand(ri, "SUBSCRIBE"), SENTINEL_HELLO_CHANNEL); + retval = valkeyAsyncCommand(link->pc, + sentinelReceiveHelloMessages, + ri, + "%s %s", + sentinelInstanceMapCommand(ri, "SUBSCRIBE"), + SENTINEL_HELLO_CHANNEL); if (retval != C_OK) { /* If we can't subscribe, the Pub/Sub connection is useless * and we can simply disconnect it and try again. */ @@ -2424,9 +2500,9 @@ void sentinelReconnectInstance(sentinelValkeyInstance *ri) { * 3) It is not SDOWN or ODOWN. * 4) We obtained last INFO no more than two times the INFO period time ago. */ int sentinelPrimaryLooksSane(sentinelValkeyInstance *primary) { - return primary->flags & SRI_PRIMARY && primary->role_reported == SRI_PRIMARY && - (primary->flags & (SRI_S_DOWN | SRI_O_DOWN)) == 0 && - (mstime() - primary->info_refresh) < sentinel_info_period * 2; + return primary->flags & SRI_PRIMARY && primary->role_reported == SRI_PRIMARY + && (primary->flags & (SRI_S_DOWN | SRI_O_DOWN)) == 0 + && (mstime() - primary->info_refresh) < sentinel_info_period * 2; } /* Process the INFO output from primaries. */ @@ -2503,8 +2579,8 @@ void sentinelRefreshInstanceInfo(sentinelValkeyInstance *ri, const char *info) { /* Check if we already have this replica into our table, * otherwise add it. */ if (sentinelValkeyInstanceLookupReplica(ri, ip, atoi(port)) == NULL) { - if ((replica = createSentinelValkeyInstance(NULL, SRI_REPLICA, ip, atoi(port), ri->quorum, ri)) != - NULL) { + if ((replica = createSentinelValkeyInstance(NULL, SRI_REPLICA, ip, atoi(port), ri->quorum, ri)) + != NULL) { sentinelEvent(LL_NOTICE, "+slave", replica, "%@"); sentinelFlushConfig(); } @@ -2561,7 +2637,9 @@ void sentinelRefreshInstanceInfo(sentinelValkeyInstance *ri, const char *info) { /* master_failover_state: */ if (sdslen(l) >= 22 && !memcmp(l, "master_failover_state:", 22)) { - int failover_state = (sdslen(l) >= 33 && !memcmp(l, "master_failover_state:no-failover", 33)) ? SENTINEL_MONITORED_INSTANCE_NO_FAILOVER : SENTINEL_MONITORED_INSTANCE_FAILOVER; + int failover_state = (sdslen(l) >= 33 && !memcmp(l, "master_failover_state:no-failover", 33)) + ? SENTINEL_MONITORED_INSTANCE_NO_FAILOVER + : SENTINEL_MONITORED_INSTANCE_FAILOVER; if (failover_state != ri->monitored_instance_failover_state) { ri->monitored_instance_failover_state = failover_state; ri->monitored_instance_failover_change_time = mstime(); @@ -2582,8 +2660,11 @@ void sentinelRefreshInstanceInfo(sentinelValkeyInstance *ri, const char *info) { if (role == SRI_REPLICA) ri->replica_conf_change_time = mstime(); /* Log the event with +role-change if the new role is coherent or * with -role-change if there is a mismatch with the current config. */ - sentinelEvent(LL_VERBOSE, ((ri->flags & (SRI_PRIMARY | SRI_REPLICA)) == role) ? "+role-change" : "-role-change", - ri, "%@ new reported role is %s", role == SRI_PRIMARY ? "master" : "slave"); + sentinelEvent(LL_VERBOSE, + ((ri->flags & (SRI_PRIMARY | SRI_REPLICA)) == role) ? "+role-change" : "-role-change", + ri, + "%@ new reported role is %s", + role == SRI_PRIMARY ? "master" : "slave"); } /* None of the following conditions are processed when in tilt mode, so @@ -2601,8 +2682,8 @@ void sentinelRefreshInstanceInfo(sentinelValkeyInstance *ri, const char *info) { if ((ri->flags & SRI_REPLICA) && role == SRI_PRIMARY) { /* If this is a promoted replica we can change state to the * failover state machine. */ - if ((ri->flags & SRI_PROMOTED) && (ri->primary->flags & SRI_FAILOVER_IN_PROGRESS) && - (ri->primary->failover_state == SENTINEL_FAILOVER_STATE_WAIT_PROMOTION)) { + if ((ri->flags & SRI_PROMOTED) && (ri->primary->flags & SRI_FAILOVER_IN_PROGRESS) + && (ri->primary->failover_state == SENTINEL_FAILOVER_STATE_WAIT_PROMOTION)) { /* Now that we are sure the replica was reconfigured as a primary * set the primary configuration epoch to the epoch we won the * election to perform this failover. This will force the other @@ -2627,8 +2708,8 @@ void sentinelRefreshInstanceInfo(sentinelValkeyInstance *ri, const char *info) { * going forward, to receive new configs if any. */ mstime_t wait_time = sentinel_publish_period * 4; - if (!(ri->flags & SRI_PROMOTED) && sentinelPrimaryLooksSane(ri->primary) && - sentinelValkeyInstanceNoDownFor(ri, wait_time) && mstime() - ri->role_reported_time > wait_time) { + if (!(ri->flags & SRI_PROMOTED) && sentinelPrimaryLooksSane(ri->primary) + && sentinelValkeyInstanceNoDownFor(ri, wait_time) && mstime() - ri->role_reported_time > wait_time) { int retval = sentinelSendReplicaOf(ri, ri->primary->addr); if (retval == C_OK) sentinelEvent(LL_NOTICE, "+convert-to-slave", ri, "%@"); } @@ -2636,27 +2717,28 @@ void sentinelRefreshInstanceInfo(sentinelValkeyInstance *ri, const char *info) { } /* Handle replicas stuck in failover for too long. */ - if ((ri->flags & SRI_REPLICA) && role == SRI_REPLICA && ri->monitored_instance_failover_state == SENTINEL_MONITORED_INSTANCE_FAILOVER) { + if ((ri->flags & SRI_REPLICA) && role == SRI_REPLICA + && ri->monitored_instance_failover_state == SENTINEL_MONITORED_INSTANCE_FAILOVER) { mstime_t wait_time = ri->primary->failover_timeout; /* Make sure the primary is sane before reconfiguring this instance */ - if (sentinelPrimaryLooksSane(ri->primary) && sentinelValkeyInstanceNoDownFor(ri, wait_time) && - mstime() - ri->monitored_instance_failover_change_time > wait_time) { + if (sentinelPrimaryLooksSane(ri->primary) && sentinelValkeyInstanceNoDownFor(ri, wait_time) + && mstime() - ri->monitored_instance_failover_change_time > wait_time) { int retval = sentinelSendReplicaOf(ri, ri->primary->addr); if (retval == C_OK) sentinelEvent(LL_NOTICE, "+fix-slave-config", ri, "%@"); } } /* Handle replicas replicating to a different primary address. */ - if ((ri->flags & SRI_REPLICA) && role == SRI_REPLICA && - (ri->replica_primary_port != ri->primary->addr->port || - !sentinelAddrEqualsHostname(ri->primary->addr, ri->replica_primary_host))) { + if ((ri->flags & SRI_REPLICA) && role == SRI_REPLICA + && (ri->replica_primary_port != ri->primary->addr->port + || !sentinelAddrEqualsHostname(ri->primary->addr, ri->replica_primary_host))) { mstime_t wait_time = ri->primary->failover_timeout; /* Make sure the primary is sane before reconfiguring this instance * into a replica. */ - if (sentinelPrimaryLooksSane(ri->primary) && sentinelValkeyInstanceNoDownFor(ri, wait_time) && - mstime() - ri->replica_conf_change_time > wait_time) { + if (sentinelPrimaryLooksSane(ri->primary) && sentinelValkeyInstanceNoDownFor(ri, wait_time) + && mstime() - ri->replica_conf_change_time > wait_time) { int retval = sentinelSendReplicaOf(ri, ri->primary->addr); if (retval == C_OK) sentinelEvent(LL_NOTICE, "+fix-slave-config", ri, "%@"); } @@ -2666,9 +2748,9 @@ void sentinelRefreshInstanceInfo(sentinelValkeyInstance *ri, const char *info) { * changed state. */ if ((ri->flags & SRI_REPLICA) && role == SRI_REPLICA && (ri->flags & (SRI_RECONF_SENT | SRI_RECONF_INPROG))) { /* SRI_RECONF_SENT -> SRI_RECONF_INPROG. */ - if ((ri->flags & SRI_RECONF_SENT) && ri->replica_primary_host && - sentinelAddrEqualsHostname(ri->primary->promoted_replica->addr, ri->replica_primary_host) && - ri->replica_primary_port == ri->primary->promoted_replica->addr->port) { + if ((ri->flags & SRI_RECONF_SENT) && ri->replica_primary_host + && sentinelAddrEqualsHostname(ri->primary->promoted_replica->addr, ri->replica_primary_host) + && ri->replica_primary_port == ri->primary->promoted_replica->addr->port) { ri->flags &= ~SRI_RECONF_SENT; ri->flags |= SRI_RECONF_INPROG; sentinelEvent(LL_NOTICE, "+slave-reconf-inprog", ri, "%@"); @@ -2719,8 +2801,8 @@ void sentinelPingReplyCallback(valkeyAsyncContext *c, void *reply, void *privdat if (r->type == VALKEY_REPLY_STATUS || r->type == VALKEY_REPLY_ERROR) { /* Update the "instance available" field only if this is an * acceptable reply. */ - if (strncmp(r->str, "PONG", 4) == 0 || strncmp(r->str, "LOADING", 7) == 0 || - strncmp(r->str, "MASTERDOWN", 10) == 0) { + if (strncmp(r->str, "PONG", 4) == 0 || strncmp(r->str, "LOADING", 7) == 0 + || strncmp(r->str, "MASTERDOWN", 10) == 0) { link->last_avail_time = mstime(); link->act_ping_time = 0; /* Flag the pong as received. */ @@ -2730,8 +2812,12 @@ void sentinelPingReplyCallback(valkeyAsyncContext *c, void *reply, void *privdat /* Send a SCRIPT KILL command if the instance appears to be * down because of a busy script. */ if (strncmp(r->str, "BUSY", 4) == 0 && (ri->flags & SRI_S_DOWN) && !(ri->flags & SRI_SCRIPT_KILL_SENT)) { - if (valkeyAsyncCommand(ri->link->cc, sentinelDiscardReplyCallback, ri, "%s KILL", - sentinelInstanceMapCommand(ri, "SCRIPT")) == C_OK) { + if (valkeyAsyncCommand(ri->link->cc, + sentinelDiscardReplyCallback, + ri, + "%s KILL", + sentinelInstanceMapCommand(ri, "SCRIPT")) + == C_OK) { ri->link->pending_commands++; } ri->flags |= SRI_SCRIPT_KILL_SENT; @@ -2789,7 +2875,12 @@ void sentinelProcessHelloMessage(char *hello, int hello_len) { * with the new address back. */ removed = removeMatchingSentinelFromPrimary(primary, token[2]); if (removed) { - sentinelEvent(LL_NOTICE, "+sentinel-address-switch", primary, "%@ ip %s port %d for %s", token[0], port, + sentinelEvent(LL_NOTICE, + "+sentinel-address-switch", + primary, + "%@ ip %s port %d for %s", + token[0], + port, token[2]); } else { /* Check if there is another Sentinel with the same address this @@ -2847,8 +2938,15 @@ void sentinelProcessHelloMessage(char *hello, int hello_len) { sentinelAddr *old_addr; sentinelEvent(LL_WARNING, "+config-update-from", si, "%@"); - sentinelEvent(LL_WARNING, "+switch-master", primary, "%s %s %d %s %d", primary->name, - announceSentinelAddr(primary->addr), primary->addr->port, token[5], primary_port); + sentinelEvent(LL_WARNING, + "+switch-master", + primary, + "%s %s %d %s %d", + primary->name, + announceSentinelAddr(primary->addr), + primary->addr->port, + token[5], + primary_port); old_addr = dupSentinelAddr(primary->addr); sentinelResetPrimaryAndChangeAddress(primary, token[5], primary_port); @@ -2885,9 +2983,9 @@ void sentinelReceiveHelloMessages(valkeyAsyncContext *c, void *reply, void *priv * can avoid to check for details. * Note: Reply type is PUSH in resp3. Normally, sentinel will not use * resp3 but this is required for testing (see logreqres.c). */ - if ((r->type != VALKEY_REPLY_ARRAY && r->type != VALKEY_REPLY_PUSH) || r->elements != 3 || - r->element[0]->type != VALKEY_REPLY_STRING || r->element[1]->type != VALKEY_REPLY_STRING || - r->element[2]->type != VALKEY_REPLY_STRING || strcmp(r->element[0]->str, "message") != 0) + if ((r->type != VALKEY_REPLY_ARRAY && r->type != VALKEY_REPLY_PUSH) || r->elements != 3 + || r->element[0]->type != VALKEY_REPLY_STRING || r->element[1]->type != VALKEY_REPLY_STRING + || r->element[2]->type != VALKEY_REPLY_STRING || strcmp(r->element[0]->str, "message") != 0) return; /* We are not interested in meeting ourselves */ @@ -2934,15 +3032,26 @@ int sentinelSendHello(sentinelValkeyInstance *ri) { announce_port = server.port; /* Format and send the Hello message. */ - snprintf(payload, sizeof(payload), + snprintf(payload, + sizeof(payload), "%s,%d,%s,%llu," /* Info about this sentinel. */ "%s,%s,%d,%llu", /* Info about current primary. */ - announce_ip, announce_port, sentinel.myid, (unsigned long long)sentinel.current_epoch, + announce_ip, + announce_port, + sentinel.myid, + (unsigned long long)sentinel.current_epoch, /* --- */ - primary->name, announceSentinelAddr(primary_addr), primary_addr->port, + primary->name, + announceSentinelAddr(primary_addr), + primary_addr->port, (unsigned long long)primary->config_epoch); - retval = valkeyAsyncCommand(ri->link->cc, sentinelPublishReplyCallback, ri, "%s %s %s", - sentinelInstanceMapCommand(ri, "PUBLISH"), SENTINEL_HELLO_CHANNEL, payload); + retval = valkeyAsyncCommand(ri->link->cc, + sentinelPublishReplyCallback, + ri, + "%s %s %s", + sentinelInstanceMapCommand(ri, "PUBLISH"), + SENTINEL_HELLO_CHANNEL, + payload); if (retval != C_OK) return C_ERR; ri->link->pending_commands++; return C_OK; @@ -3027,8 +3136,8 @@ void sentinelSendPeriodicCommands(sentinelValkeyInstance *ri) { * Similarly we monitor the INFO output more often if the replica reports * to be disconnected from the primary, so that we can have a fresh * disconnection time figure. */ - if ((ri->flags & SRI_REPLICA) && - ((ri->primary->flags & (SRI_O_DOWN | SRI_FAILOVER_IN_PROGRESS)) || (ri->primary_link_down_time != 0))) { + if ((ri->flags & SRI_REPLICA) + && ((ri->primary->flags & (SRI_O_DOWN | SRI_FAILOVER_IN_PROGRESS)) || (ri->primary_link_down_time != 0))) { info_period = 1000; } else { info_period = sentinel_info_period; @@ -3042,7 +3151,10 @@ void sentinelSendPeriodicCommands(sentinelValkeyInstance *ri) { /* Send INFO to primaries and replicas, not sentinels. */ if ((ri->flags & SRI_SENTINEL) == 0 && (ri->info_refresh == 0 || (now - ri->info_refresh) > info_period)) { - retval = valkeyAsyncCommand(ri->link->cc, sentinelInfoReplyCallback, ri, "%s", + retval = valkeyAsyncCommand(ri->link->cc, + sentinelInfoReplyCallback, + ri, + "%s", sentinelInstanceMapCommand(ri, "INFO")); if (retval == C_OK) ri->link->pending_commands++; } @@ -3057,8 +3169,8 @@ void sentinelSendPeriodicCommands(sentinelValkeyInstance *ri) { /* Don't publish if the command would block because client writes are blocked: - during coordinated failover - during Valkey failover (this may be a failover that is stuck) */ - if (((ri->flags & SRI_COORD_FAILOVER) == 0 || ri->failover_state > SENTINEL_FAILOVER_STATE_WAIT_PROMOTION) && - ri->monitored_instance_failover_state != SENTINEL_MONITORED_INSTANCE_FAILOVER) { + if (((ri->flags & SRI_COORD_FAILOVER) == 0 || ri->failover_state > SENTINEL_FAILOVER_STATE_WAIT_PROMOTION) + && ri->monitored_instance_failover_state != SENTINEL_MONITORED_INSTANCE_FAILOVER) { sentinelSendHello(ri); } } @@ -3138,9 +3250,9 @@ void sentinelConfigSetCommand(client *c) { } else if (!strcasecmp(option, "announce-port")) { if (getLongLongFromObject(val, &numval) == C_ERR || numval < 0 || numval > 65535) goto badfmt; } else if (!strcasecmp(option, "loglevel")) { - if (!(!strcasecmp(objectGetVal(val), "debug") || !strcasecmp(objectGetVal(val), "verbose") || - !strcasecmp(objectGetVal(val), "notice") || !strcasecmp(objectGetVal(val), "warning") || - !strcasecmp(objectGetVal(val), "nothing"))) + if (!(!strcasecmp(objectGetVal(val), "debug") || !strcasecmp(objectGetVal(val), "verbose") + || !strcasecmp(objectGetVal(val), "notice") || !strcasecmp(objectGetVal(val), "warning") + || !strcasecmp(objectGetVal(val), "nothing"))) goto badfmt; } } @@ -3612,7 +3724,10 @@ void sentinelSetDebugConfigParameters(client *c) { return; badfmt: /* Bad format errors */ - addReplyErrorFormat(c, "Invalid argument '%s' for SENTINEL DEBUG '%s'", (char *)objectGetVal(c->argv[badarg]), option); + addReplyErrorFormat(c, + "Invalid argument '%s' for SENTINEL DEBUG '%s'", + (char *)objectGetVal(c->argv[badarg]), + option); return; } @@ -3818,8 +3933,8 @@ void sentinelCommand(client *c) { } else if (!strcasecmp(objectGetVal(c->argv[1]), "myid") && c->argc == 2) { /* SENTINEL MYID */ addReplyBulkCBuffer(c, sentinel.myid, CONFIG_RUN_ID_SIZE); - } else if (!strcasecmp(objectGetVal(c->argv[1]), "is-primary-down-by-addr") || - !strcasecmp(objectGetVal(c->argv[1]), "is-master-down-by-addr")) { + } else if (!strcasecmp(objectGetVal(c->argv[1]), "is-primary-down-by-addr") + || !strcasecmp(objectGetVal(c->argv[1]), "is-master-down-by-addr")) { /* SENTINEL IS-PRIMARY-DOWN-BY-ADDR * * Arguments: @@ -3845,8 +3960,8 @@ void sentinelCommand(client *c) { int isdown = 0; if (c->argc != 6) goto numargserr; - if (getLongFromObjectOrReply(c, c->argv[3], &port, NULL) != C_OK || - getLongLongFromObjectOrReply(c, c->argv[4], &req_epoch, NULL) != C_OK) + if (getLongFromObjectOrReply(c, c->argv[3], &port, NULL) != C_OK + || getLongLongFromObjectOrReply(c, c->argv[4], &req_epoch, NULL) != C_OK) return; ri = getSentinelValkeyInstanceByAddrAndRunID(sentinel.primaries, objectGetVal(c->argv[2]), port, NULL); @@ -3871,8 +3986,8 @@ void sentinelCommand(client *c) { /* SENTINEL RESET */ if (c->argc != 3) goto numargserr; addReplyLongLong(c, sentinelResetPrimariesByPattern(objectGetVal(c->argv[2]), SENTINEL_GENERATE_EVENT)); - } else if (!strcasecmp(objectGetVal(c->argv[1]), "get-primary-addr-by-name") || - !strcasecmp(objectGetVal(c->argv[1]), "get-master-addr-by-name")) { + } else if (!strcasecmp(objectGetVal(c->argv[1]), "get-primary-addr-by-name") + || !strcasecmp(objectGetVal(c->argv[1]), "get-master-addr-by-name")) { /* SENTINEL GET-PRIMARY-ADDR-BY-NAME */ sentinelValkeyInstance *ri; @@ -3893,8 +4008,7 @@ void sentinelCommand(client *c) { int coordinated = 0; if (c->argc < 3 || c->argc > 4) goto numargserr; - if ((ri = sentinelGetPrimaryByNameOrReplyError(c, c->argv[2])) == NULL) - return; + if ((ri = sentinelGetPrimaryByNameOrReplyError(c, c->argv[2])) == NULL) return; if (c->argc == 4) { if (!strcasecmp(objectGetVal(c->argv[3]), "coordinated")) { coordinated = 1; @@ -3953,14 +4067,23 @@ void sentinelCommand(client *c) { /* If resolve-hostnames is used, actual DNS resolution may take place. * Otherwise just validate address. */ - if (anetResolve(NULL, objectGetVal(c->argv[3]), ip, sizeof(ip), sentinel.resolve_hostnames ? ANET_NONE : ANET_IP_ONLY) == - ANET_ERR) { + if (anetResolve(NULL, + objectGetVal(c->argv[3]), + ip, + sizeof(ip), + sentinel.resolve_hostnames ? ANET_NONE : ANET_IP_ONLY) + == ANET_ERR) { addReplyError(c, "Invalid IP address or hostname specified"); return; } /* Parameters are valid. Try to create the primary instance. */ - ri = createSentinelValkeyInstance(objectGetVal(c->argv[2]), SRI_PRIMARY, objectGetVal(c->argv[3]), port, quorum, NULL); + ri = createSentinelValkeyInstance(objectGetVal(c->argv[2]), + SRI_PRIMARY, + objectGetVal(c->argv[3]), + port, + quorum, + NULL); if (ri == NULL) { addReplyError(c, sentinelCheckCreateInstanceErrors(SRI_PRIMARY)); } else { @@ -3989,19 +4112,22 @@ void sentinelCommand(client *c) { if ((ri = sentinelGetPrimaryByNameOrReplyError(c, c->argv[2])) == NULL) return; int result = sentinelIsQuorumReachable(ri, &usable); if (result == SENTINEL_ISQR_OK) { - addReplySds(c, sdscatfmt(sdsempty(), - "+OK %i usable Sentinels. Quorum and failover authorization " - "can be reached\r\n", - usable)); + addReplySds(c, + sdscatfmt(sdsempty(), + "+OK %i usable Sentinels. Quorum and failover authorization " + "can be reached\r\n", + usable)); } else { sds e = sdscatfmt(sdsempty(), "-NOQUORUM %i usable Sentinels. ", usable); if (result & SENTINEL_ISQR_NOQUORUM) - e = sdscat(e, "Not enough available Sentinels to reach the" - " specified quorum for this master"); + e = sdscat(e, + "Not enough available Sentinels to reach the" + " specified quorum for this master"); if (result & SENTINEL_ISQR_NOAUTH) { if (result & SENTINEL_ISQR_NOQUORUM) e = sdscat(e, ". "); - e = sdscat(e, "Not enough available Sentinels to reach the" - " majority and authorize a failover"); + e = sdscat(e, + "Not enough available Sentinels to reach the" + " majority and authorize a failover"); } addReplyErrorSds(c, e); } @@ -4014,8 +4140,9 @@ void sentinelCommand(client *c) { else if (!strcasecmp(objectGetVal(c->argv[2]), "get") && c->argc >= 4) sentinelConfigGetCommand(c); else - addReplyError(c, "Only SENTINEL CONFIG GET [ ...] / SET [ " - " ...] are supported."); + addReplyError(c, + "Only SENTINEL CONFIG GET [ ...] / SET [ " + " ...] are supported."); } else if (!strcasecmp(objectGetVal(c->argv[1]), "info-cache")) { /* SENTINEL INFO-CACHE */ if (c->argc < 2) goto numargserr; @@ -4089,13 +4216,15 @@ void sentinelCommand(client *c) { for (j = 2; j < c->argc; j++) { if (!strcasecmp(objectGetVal(c->argv[j]), "crash-after-election")) { sentinel.simfailure_flags |= SENTINEL_SIMFAILURE_CRASH_AFTER_ELECTION; - serverLog(LL_WARNING, "Failure simulation: this Sentinel " - "will crash after being successfully elected as failover " - "leader"); + serverLog(LL_WARNING, + "Failure simulation: this Sentinel " + "will crash after being successfully elected as failover " + "leader"); } else if (!strcasecmp(objectGetVal(c->argv[j]), "crash-after-promotion")) { sentinel.simfailure_flags |= SENTINEL_SIMFAILURE_CRASH_AFTER_PROMOTION; - serverLog(LL_WARNING, "Failure simulation: this Sentinel " - "will crash after promoting the selected replica to master"); + serverLog(LL_WARNING, + "Failure simulation: this Sentinel " + "will crash after promoting the selected replica to master"); } else if (!strcasecmp(objectGetVal(c->argv[j]), "help")) { addReplyArrayLen(c, 2); addReplyBulkCString(c, "crash-after-election"); @@ -4172,10 +4301,13 @@ void sentinelInfoCommand(client *c) { "sentinel_running_scripts:%d\r\n" "sentinel_scripts_queue_length:%ld\r\n" "sentinel_simulate_failure_flags:%lu\r\n", - dictSize(sentinel.primaries), sentinel.tilt, + dictSize(sentinel.primaries), + sentinel.tilt, sentinel.tilt ? (intmax_t)((mstime() - sentinel.tilt_start_time) / 1000) : -1, sentinel.total_tilt, - sentinel.running_scripts, listLength(sentinel.scripts_queue), sentinel.simfailure_flags); + sentinel.running_scripts, + listLength(sentinel.scripts_queue), + sentinel.simfailure_flags); di = dictGetIterator(sentinel.primaries); while ((de = dictNext(di)) != NULL) { @@ -4189,8 +4321,13 @@ void sentinelInfoCommand(client *c) { info = sdscatprintf(info, "master%d:name=%s,status=%s,address=%s:%d," "slaves=%zu,sentinels=%zu\r\n", - primary_id++, ri->name, status, announceSentinelAddr(ri->addr), ri->addr->port, - dictSize(ri->replicas), dictSize(ri->sentinels) + 1); + primary_id++, + ri->name, + status, + announceSentinelAddr(ri->addr), + ri->addr->port, + dictSize(ri->replicas), + dictSize(ri->sentinels) + 1); } dictReleaseIterator(di); } @@ -4267,9 +4404,10 @@ void sentinelSetCommand(client *c) { /* notification-script */ sds value = objectGetVal(c->argv[++j]); if (sentinel.deny_scripts_reconfig) { - addReplyError(c, "Reconfiguration of scripts path is denied for " - "security reasons. Check the deny-scripts-reconfig " - "configuration directive in your Sentinel configuration"); + addReplyError(c, + "Reconfiguration of scripts path is denied for " + "security reasons. Check the deny-scripts-reconfig " + "configuration directive in your Sentinel configuration"); goto seterr; } @@ -4284,15 +4422,17 @@ void sentinelSetCommand(client *c) { /* client-reconfig-script */ sds value = objectGetVal(c->argv[++j]); if (sentinel.deny_scripts_reconfig) { - addReplyError(c, "Reconfiguration of scripts path is denied for " - "security reasons. Check the deny-scripts-reconfig " - "configuration directive in your Sentinel configuration"); + addReplyError(c, + "Reconfiguration of scripts path is denied for " + "security reasons. Check the deny-scripts-reconfig " + "configuration directive in your Sentinel configuration"); goto seterr; } if (sdslen(value) && access(value, X_OK) == -1) { - addReplyError(c, "Client reconfiguration script seems non existing or " - "non executable"); + addReplyError(c, + "Client reconfiguration script seems non existing or " + "non executable"); goto seterr; } sdsfree(ri->client_reconfig_script); @@ -4343,9 +4483,9 @@ void sentinelSetCommand(client *c) { dictAdd(ri->renamed_commands, oldname, newname); } changes++; - } else if ((!strcasecmp(option, "primary-reboot-down-after-period") || - !strcasecmp(option, "master-reboot-down-after-period")) && - moreargs > 0) { + } else if ((!strcasecmp(option, "primary-reboot-down-after-period") + || !strcasecmp(option, "master-reboot-down-after-period")) + && moreargs > 0) { /* primary-reboot-down-after-period */ robj *o = c->argv[++j]; if (getLongLongFromObject(o, &ll) == C_ERR || ll < 0) { @@ -4366,12 +4506,21 @@ void sentinelSetCommand(client *c) { int numargs = j - old_j + 1; switch (numargs) { case 2: - sentinelEvent(LL_WARNING, "+set", ri, "%@ %s %s", (char *)objectGetVal(c->argv[old_j]), + sentinelEvent(LL_WARNING, + "+set", + ri, + "%@ %s %s", + (char *)objectGetVal(c->argv[old_j]), redacted ? "******" : (char *)objectGetVal(c->argv[old_j + 1])); break; case 3: - sentinelEvent(LL_WARNING, "+set", ri, "%@ %s %s %s", (char *)objectGetVal(c->argv[old_j]), - (char *)objectGetVal(c->argv[old_j + 1]), (char *)objectGetVal(c->argv[old_j + 2])); + sentinelEvent(LL_WARNING, + "+set", + ri, + "%@ %s %s %s", + (char *)objectGetVal(c->argv[old_j]), + (char *)objectGetVal(c->argv[old_j + 1]), + (char *)objectGetVal(c->argv[old_j + 2])); break; default: sentinelEvent(LL_WARNING, "+set", ri, "%@ %s", (char *)objectGetVal(c->argv[old_j])); break; } @@ -4380,7 +4529,10 @@ void sentinelSetCommand(client *c) { return; badfmt: /* Bad format errors */ - addReplyErrorFormat(c, "Invalid argument '%s' for SENTINEL SET '%s'", (char *)objectGetVal(c->argv[badarg]), option); + addReplyErrorFormat(c, + "Invalid argument '%s' for SENTINEL SET '%s'", + (char *)objectGetVal(c->argv[badarg]), + option); seterr: /* TODO: Handle the case of both bad input and save error, possibly handling * SENTINEL SET atomically. */ @@ -4419,12 +4571,12 @@ void sentinelCheckSubjectivelyDown(sentinelValkeyInstance *ri) { * 1) Check if the command link seems connected, was connected not less * than SENTINEL_MIN_LINK_RECONNECT_PERIOD, but still we have a * pending ping for more than half the timeout. */ - if (ri->link->cc && (mstime() - ri->link->cc_conn_time) > sentinel_min_link_reconnect_period && - ri->link->act_ping_time != 0 && /* There is a pending ping... */ + if (ri->link->cc && (mstime() - ri->link->cc_conn_time) > sentinel_min_link_reconnect_period + && ri->link->act_ping_time != 0 && /* There is a pending ping... */ /* The pending ping is delayed, and we did not receive * error replies as well. */ - (mstime() - ri->link->act_ping_time) > (ri->down_after_period / 2) && - (mstime() - ri->link->last_pong_time) > (ri->down_after_period / 2)) { + (mstime() - ri->link->act_ping_time) > (ri->down_after_period / 2) + && (mstime() - ri->link->last_pong_time) > (ri->down_after_period / 2)) { instanceLinkCloseConnection(ri->link, ri->link->cc); } @@ -4433,8 +4585,8 @@ void sentinelCheckSubjectivelyDown(sentinelValkeyInstance *ri) { * activity in the Pub/Sub channel for more than * SENTINEL_PUBLISH_PERIOD * 3. */ - if (ri->link->pc && (mstime() - ri->link->pc_conn_time) > sentinel_min_link_reconnect_period && - (mstime() - ri->link->pc_last_activity) > (sentinel_publish_period * 3)) { + if (ri->link->pc && (mstime() - ri->link->pc_conn_time) > sentinel_min_link_reconnect_period + && (mstime() - ri->link->pc_last_activity) > (sentinel_publish_period * 3)) { instanceLinkCloseConnection(ri->link, ri->link->pc); } @@ -4444,11 +4596,11 @@ void sentinelCheckSubjectivelyDown(sentinelValkeyInstance *ri) { * 2) We believe it is a primary, it reports to be a replica for enough time * to meet the down_after_period, plus enough time to get two times * INFO report from the instance. */ - if (elapsed > ri->down_after_period || - (ri->flags & SRI_PRIMARY && ri->role_reported == SRI_REPLICA && - mstime() - ri->role_reported_time > (ri->down_after_period + sentinel_info_period * 2)) || - (ri->flags & SRI_PRIMARY_REBOOT && - mstime() - ri->primary_reboot_since_time > ri->primary_reboot_down_after_period)) { + if (elapsed > ri->down_after_period + || (ri->flags & SRI_PRIMARY && ri->role_reported == SRI_REPLICA + && mstime() - ri->role_reported_time > (ri->down_after_period + sentinel_info_period * 2)) + || (ri->flags & SRI_PRIMARY_REBOOT + && mstime() - ri->primary_reboot_since_time > ri->primary_reboot_down_after_period)) { /* Is subjectively down */ if ((ri->flags & SRI_S_DOWN) == 0) { sentinelEvent(LL_WARNING, "+sdown", ri, "%@"); @@ -4518,8 +4670,8 @@ void sentinelReceiveIsPrimaryDownReply(valkeyAsyncContext *c, void *reply, void /* Ignore every error or unexpected reply. * Note that if the command returns an error for any reason we'll * end clearing the SRI_PRIMARY_DOWN flag for timeout anyway. */ - if (r->type == VALKEY_REPLY_ARRAY && r->elements == 3 && r->element[0]->type == VALKEY_REPLY_INTEGER && - r->element[1]->type == VALKEY_REPLY_STRING && r->element[2]->type == VALKEY_REPLY_INTEGER) { + if (r->type == VALKEY_REPLY_ARRAY && r->elements == 3 && r->element[0]->type == VALKEY_REPLY_INTEGER + && r->element[1]->type == VALKEY_REPLY_STRING && r->element[2]->type == VALKEY_REPLY_INTEGER) { ri->last_primary_down_reply_time = mstime(); if (r->element[0]->integer == 1) { ri->flags |= SRI_PRIMARY_DOWN; @@ -4531,7 +4683,10 @@ void sentinelReceiveIsPrimaryDownReply(valkeyAsyncContext *c, void *reply, void * replied with a vote. */ sdsfree(ri->leader); if ((long long)ri->leader_epoch != r->element[2]->integer) - serverLog(LL_NOTICE, "%s voted for %s %llu", ri->name, r->element[1]->str, + serverLog(LL_NOTICE, + "%s voted for %s %llu", + ri->name, + r->element[1]->str, (unsigned long long)r->element[2]->integer); ri->leader = sdsnew(r->element[1]->str); ri->leader_epoch = r->element[2]->integer; @@ -4576,10 +4731,15 @@ void sentinelAskPrimaryStateToOtherSentinels(sentinelValkeyInstance *primary, in continue; /* Ask */ - retval = valkeyAsyncCommand( - ri->link->cc, sentinelReceiveIsPrimaryDownReply, ri, "%s is-master-down-by-addr %s %s %llu %s", - sentinelInstanceMapCommand(ri, "SENTINEL"), announceSentinelAddr(primary->addr), port, - sentinel.current_epoch, (primary->failover_state > SENTINEL_FAILOVER_STATE_NONE) ? sentinel.myid : "*"); + retval = valkeyAsyncCommand(ri->link->cc, + sentinelReceiveIsPrimaryDownReply, + ri, + "%s is-master-down-by-addr %s %s %llu %s", + sentinelInstanceMapCommand(ri, "SENTINEL"), + announceSentinelAddr(primary->addr), + port, + sentinel.current_epoch, + (primary->failover_state > SENTINEL_FAILOVER_STATE_NONE) ? sentinel.myid : "*"); if (retval == C_OK) ri->link->pending_commands++; } dictReleaseIterator(di); @@ -4610,7 +4770,11 @@ char *sentinelVoteLeader(sentinelValkeyInstance *primary, uint64_t req_epoch, ch primary->leader = sdsnew(req_runid); primary->leader_epoch = sentinel.current_epoch; sentinelFlushConfig(); - sentinelEvent(LL_WARNING, "+vote-for-leader", primary, "%s %llu", primary->leader, + sentinelEvent(LL_WARNING, + "+vote-for-leader", + primary, + "%s %llu", + primary->leader, (unsigned long long)primary->leader_epoch); /* If we did not voted for ourselves, set the primary failover start * time to now, in order to force a delay before we can start a @@ -4735,27 +4899,37 @@ int sentinelFailoverTo(sentinelValkeyInstance *ri, const sentinelAddr *addr, mst /* Note that we don't check the replies returned by commands, since we * will observe instead the effects in the next INFO output. */ retval = valkeyAsyncCommand(ri->link->cc, - sentinelDiscardReplyCallback, ri, "%s", + sentinelDiscardReplyCallback, + ri, + "%s", sentinelInstanceMapCommand(ri, "MULTI")); if (retval == C_ERR) return retval; ri->link->pending_commands++; retval = valkeyAsyncCommand(ri->link->cc, - sentinelDiscardReplyCallback, ri, "%s PAUSE %d WRITE", + sentinelDiscardReplyCallback, + ri, + "%s PAUSE %d WRITE", sentinelInstanceMapCommand(ri, "CLIENT"), timeout); if (retval == C_ERR) return retval; ri->link->pending_commands++; retval = valkeyAsyncCommand(ri->link->cc, - sentinelDiscardReplyCallback, ri, "%s TO %s %s TIMEOUT %d", + sentinelDiscardReplyCallback, + ri, + "%s TO %s %s TIMEOUT %d", sentinelInstanceMapCommand(ri, "FAILOVER"), - host, portstr, timeout); + host, + portstr, + timeout); if (retval == C_ERR) return retval; ri->link->pending_commands++; retval = valkeyAsyncCommand(ri->link->cc, - sentinelDiscardReplyCallback, ri, "%s", + sentinelDiscardReplyCallback, + ri, + "%s", sentinelInstanceMapCommand(ri, "EXEC")); if (retval == C_ERR) return retval; ri->link->pending_commands++; @@ -4783,20 +4957,26 @@ int sentinelKillClients(sentinelValkeyInstance *ri) { * Note that we don't check the replies returned by commands, since we * will observe instead the effects in the next INFO output. */ retval = valkeyAsyncCommand(ri->link->cc, - sentinelDiscardReplyCallback, ri, "%s", + sentinelDiscardReplyCallback, + ri, + "%s", sentinelInstanceMapCommand(ri, "MULTI")); if (retval == C_ERR) return retval; ri->link->pending_commands++; retval = valkeyAsyncCommand(ri->link->cc, - sentinelDiscardReplyCallback, ri, "%s REWRITE", + sentinelDiscardReplyCallback, + ri, + "%s REWRITE", sentinelInstanceMapCommand(ri, "CONFIG")); if (retval == C_ERR) return retval; ri->link->pending_commands++; for (int type = 0; type < 2; type++) { retval = valkeyAsyncCommand(ri->link->cc, - sentinelDiscardReplyCallback, ri, "%s KILL TYPE %s", + sentinelDiscardReplyCallback, + ri, + "%s KILL TYPE %s", sentinelInstanceMapCommand(ri, "CLIENT"), type == 0 ? "normal" : "pubsub"); if (retval == C_ERR) return retval; @@ -4804,13 +4984,17 @@ int sentinelKillClients(sentinelValkeyInstance *ri) { } retval = valkeyAsyncCommand(ri->link->cc, - sentinelDiscardReplyCallback, ri, "%s UNPAUSE", + sentinelDiscardReplyCallback, + ri, + "%s UNPAUSE", sentinelInstanceMapCommand(ri, "CLIENT")); if (retval == C_ERR) return retval; ri->link->pending_commands++; retval = valkeyAsyncCommand(ri->link->cc, - sentinelDiscardReplyCallback, ri, "%s", + sentinelDiscardReplyCallback, + ri, + "%s", sentinelInstanceMapCommand(ri, "EXEC")); if (retval == C_ERR) return retval; ri->link->pending_commands++; @@ -4855,24 +5039,38 @@ int sentinelSendReplicaOf(sentinelValkeyInstance *ri, const sentinelAddr *addr) * * Note that we don't check the replies returned by commands, since we * will observe instead the effects in the next INFO output. */ - retval = valkeyAsyncCommand(ri->link->cc, sentinelDiscardReplyCallback, ri, "%s", + retval = valkeyAsyncCommand(ri->link->cc, + sentinelDiscardReplyCallback, + ri, + "%s", sentinelInstanceMapCommand(ri, "MULTI")); if (retval == C_ERR) return retval; ri->link->pending_commands++; if (ri->monitored_instance_failover_state == SENTINEL_MONITORED_INSTANCE_FAILOVER) { - retval = valkeyAsyncCommand(ri->link->cc, sentinelDiscardReplyCallback, ri, "%s ABORT", + retval = valkeyAsyncCommand(ri->link->cc, + sentinelDiscardReplyCallback, + ri, + "%s ABORT", sentinelInstanceMapCommand(ri, "FAILOVER")); if (retval == C_ERR) return retval; ri->link->pending_commands++; } - retval = valkeyAsyncCommand(ri->link->cc, sentinelDiscardReplyCallback, ri, "%s %s %s", - sentinelInstanceMapCommand(ri, "SLAVEOF"), host, portstr); + retval = valkeyAsyncCommand(ri->link->cc, + sentinelDiscardReplyCallback, + ri, + "%s %s %s", + sentinelInstanceMapCommand(ri, "SLAVEOF"), + host, + portstr); if (retval == C_ERR) return retval; ri->link->pending_commands++; - retval = valkeyAsyncCommand(ri->link->cc, sentinelDiscardReplyCallback, ri, "%s REWRITE", + retval = valkeyAsyncCommand(ri->link->cc, + sentinelDiscardReplyCallback, + ri, + "%s REWRITE", sentinelInstanceMapCommand(ri, "CONFIG")); if (retval == C_ERR) return retval; ri->link->pending_commands++; @@ -4883,14 +5081,21 @@ int sentinelSendReplicaOf(sentinelValkeyInstance *ri, const sentinelAddr *addr) * recognized as a syntax error, and the transaction will not fail (but * only the unsupported command will fail). */ for (int type = 0; type < 2; type++) { - retval = valkeyAsyncCommand(ri->link->cc, sentinelDiscardReplyCallback, ri, "%s KILL TYPE %s", - sentinelInstanceMapCommand(ri, "CLIENT"), type == 0 ? "normal" : "pubsub"); + retval = valkeyAsyncCommand(ri->link->cc, + sentinelDiscardReplyCallback, + ri, + "%s KILL TYPE %s", + sentinelInstanceMapCommand(ri, "CLIENT"), + type == 0 ? "normal" : "pubsub"); if (retval == C_ERR) return retval; ri->link->pending_commands++; } - retval = - valkeyAsyncCommand(ri->link->cc, sentinelDiscardReplyCallback, ri, "%s", sentinelInstanceMapCommand(ri, "EXEC")); + retval = valkeyAsyncCommand(ri->link->cc, + sentinelDiscardReplyCallback, + ri, + "%s", + sentinelInstanceMapCommand(ri, "EXEC")); if (retval == C_ERR) return retval; ri->link->pending_commands++; @@ -5124,8 +5329,7 @@ void sentinelFailoverSendFailover(sentinelValkeyInstance *ri) { * slave). */ retval = sentinelFailoverTo(ri, ri->promoted_replica->addr, ri->failover_timeout - time_passed); if (retval != C_OK) return; - sentinelEvent(LL_NOTICE, "+failover-state-wait-promotion", - ri->promoted_replica, "%@"); + sentinelEvent(LL_NOTICE, "+failover-state-wait-promotion", ri->promoted_replica, "%@"); ri->failover_state = SENTINEL_FAILOVER_STATE_WAIT_PROMOTION; ri->failover_state_change_time = mstime(); } @@ -5254,8 +5458,8 @@ void sentinelFailoverReconfNextReplica(sentinelValkeyInstance *primary) { * the next state, consider it reconfigured even if it is not. * Sentinels will detect the replica as misconfigured and fix its * configuration later. */ - if ((replica->flags & SRI_RECONF_SENT) && - (mstime() - replica->replica_reconf_sent_time) > sentinel_replica_reconf_timeout) { + if ((replica->flags & SRI_RECONF_SENT) + && (mstime() - replica->replica_reconf_sent_time) > sentinel_replica_reconf_timeout) { sentinelEvent(LL_NOTICE, "-slave-reconf-sent-timeout", replica, "%@"); replica->flags &= ~SRI_RECONF_SENT; replica->flags |= SRI_RECONF_DONE; @@ -5287,8 +5491,14 @@ void sentinelFailoverReconfNextReplica(sentinelValkeyInstance *primary) { void sentinelFailoverSwitchToPromotedReplica(sentinelValkeyInstance *primary) { sentinelValkeyInstance *ref = primary->promoted_replica ? primary->promoted_replica : primary; - sentinelEvent(LL_WARNING, "+switch-master", primary, "%s %s %d %s %d", primary->name, - announceSentinelAddr(primary->addr), primary->addr->port, announceSentinelAddr(ref->addr), + sentinelEvent(LL_WARNING, + "+switch-master", + primary, + "%s %s %d %s %d", + primary->name, + announceSentinelAddr(primary->addr), + primary->addr->port, + announceSentinelAddr(ref->addr), ref->addr->port); sentinelResetPrimaryAndChangeAddress(primary, ref->addr->hostname, ref->addr->port); diff --git a/src/server.c b/src/server.c index 41c83124212..1b6b25625f8 100644 --- a/src/server.c +++ b/src/server.c @@ -249,8 +249,13 @@ void serverLogRaw(int level, const char *msg) { case LOG_FORMAT_JSON: { sds jsonmsg = escapeJsonString(sdsempty(), msg, strlen(msg)); - fprintf(fp, "{\"pid\":%d,\"role\":\"%s\",\"timestamp\":\"%s\",\"level\":\"%s\",\"message\":%s}\n", - (int)getpid(), roles[role_index], buf, verbose_level[level], jsonmsg); + fprintf(fp, + "{\"pid\":%d,\"role\":\"%s\",\"timestamp\":\"%s\",\"level\":\"%s\",\"message\":%s}\n", + (int)getpid(), + roles[role_index], + buf, + verbose_level[level], + jsonmsg); sdsfree(jsonmsg); break; } @@ -475,7 +480,8 @@ int dictEncObjKeyCompare(const void *key1, const void *key2) { robj *o1 = (robj *)key1, *o2 = (robj *)key2; int cmp; - if (o1->encoding == OBJ_ENCODING_INT && o2->encoding == OBJ_ENCODING_INT) return objectGetVal(o1) == objectGetVal(o2); + if (o1->encoding == OBJ_ENCODING_INT && o2->encoding == OBJ_ENCODING_INT) + return objectGetVal(o1) == objectGetVal(o2); /* Due to OBJ_STATIC_REFCOUNT, we avoid calling getDecodedObject() without * good reasons, because it would incrRefCount() the object, which @@ -620,10 +626,9 @@ hashtableType objectHashtableType = { }; /* Set hashtable type. Items are SDS strings */ -hashtableType setHashtableType = { - .hashFunction = sdsHashConfigurableSeed, - .keyCompare = dictSdsKeyCompare, - .entryDestructor = dictSdsDestructor}; +hashtableType setHashtableType = {.hashFunction = sdsHashConfigurableSeed, + .keyCompare = dictSdsKeyCompare, + .entryDestructor = dictSdsDestructor}; const void *zsetHashtableGetKey(const void *element) { const zskiplistNode *node = element; @@ -648,8 +653,7 @@ const void *hashtableObjectGetKey(const void *entry) { /* Prefetch the value if it's not embedded. */ void hashtableObjectPrefetchValue(const void *entry) { const robj *obj = entry; - if (obj->encoding != OBJ_ENCODING_EMBSTR && - obj->encoding != OBJ_ENCODING_INT) { + if (obj->encoding != OBJ_ENCODING_EMBSTR && obj->encoding != OBJ_ENCODING_INT) { valkey_prefetch(objectGetVal(obj)); } } @@ -738,9 +742,7 @@ hashtableType hashWithVolatileItemsHashtableType = { }; /* Hashtable type without destructor */ -hashtableType sdsReplyHashtableType = { - .hashFunction = dictSdsCaseHash, - .keyCompare = dictSdsKeyCompare}; +hashtableType sdsReplyHashtableType = {.hashFunction = dictSdsCaseHash, .keyCompare = dictSdsKeyCompare}; /* Keylist hash table type has unencoded Objects as keys and * lists as values. It's used for blocking operations (BLPOP) and to @@ -894,7 +896,8 @@ void resetChildState(void) { /* Return if child type is mutually exclusive with other fork children */ int isMutuallyExclusiveChildType(int type) { - return type == CHILD_TYPE_RDB || type == CHILD_TYPE_AOF || type == CHILD_TYPE_MODULE || type == CHILD_TYPE_SLOT_MIGRATION; + return type == CHILD_TYPE_RDB || type == CHILD_TYPE_AOF || type == CHILD_TYPE_MODULE + || type == CHILD_TYPE_SLOT_MIGRATION; } /* Returns true when we're inside a long command that yielded to the event loop. */ @@ -1020,8 +1023,8 @@ int clientsCronResizeOutputBuffer(client *c, mstime_t now_ms) { /* reset the peak value each server.reply_buffer_peak_reset_time seconds. in case the client will be idle * it will start to shrink. */ - if (server.reply_buffer_peak_reset_time >= 0 && - now_ms - c->buf_peak_last_reset_time >= server.reply_buffer_peak_reset_time) { + if (server.reply_buffer_peak_reset_time >= 0 + && now_ms - c->buf_peak_last_reset_time >= server.reply_buffer_peak_reset_time) { c->buf_peak = c->bufpos; c->buf_peak_last_reset_time = now_ms; } @@ -1446,7 +1449,9 @@ void checkChildrenDone(void) { serverLog(LL_WARNING, "waitpid() returned an error: %s. " "child_type: %s, child_pid = %d", - strerror(errno), strChildType(server.child_type), (int)server.child_pid); + strerror(errno), + strChildType(server.child_type), + (int)server.child_pid); } else if (pid == server.child_pid) { if (!bysignal && exitcode == 0) receiveChildInfo(); if (server.child_type == CHILD_TYPE_RDB) { @@ -1494,9 +1499,11 @@ void cronUpdateMemoryStats(void) { * The fragmentation ratio it'll show is potentially more accurate * it excludes other RSS pages such as: shared libraries, LUA and other non-zmalloc * allocations, and allocator reserved pages that can be pursed (all not actual frag) */ - zmalloc_get_allocator_info( - &server.cron_malloc_stats.allocator_allocated, &server.cron_malloc_stats.allocator_active, - &server.cron_malloc_stats.allocator_resident, NULL, &server.cron_malloc_stats.allocator_muzzy); + zmalloc_get_allocator_info(&server.cron_malloc_stats.allocator_allocated, + &server.cron_malloc_stats.allocator_active, + &server.cron_malloc_stats.allocator_resident, + NULL, + &server.cron_malloc_stats.allocator_muzzy); server.cron_malloc_stats.allocator_frag_smallbins_bytes = allocatorDefragGetFragSmallbins(); /* in case the allocator isn't providing these stats, fake them so that * fragmentation info still shows some (inaccurate metrics) */ @@ -1553,19 +1560,32 @@ long long serverCron(struct aeEventLoop *eventLoop, long long id, void *clientDa monotime current_time = getMonotonicUs(); long long factor = 1000000; // us trackInstantaneousMetric(STATS_METRIC_COMMAND, server.stat_numcommands, current_time, factor); - trackInstantaneousMetric(STATS_METRIC_NET_INPUT, server.stat_net_input_bytes + server.stat_net_repl_input_bytes + server.bio_stat_net_repl_input_bytes + server.stat_net_cluster_slot_import_bytes, - current_time, factor); + trackInstantaneousMetric(STATS_METRIC_NET_INPUT, + server.stat_net_input_bytes + server.stat_net_repl_input_bytes + + server.bio_stat_net_repl_input_bytes + server.stat_net_cluster_slot_import_bytes, + current_time, + factor); trackInstantaneousMetric(STATS_METRIC_NET_OUTPUT, - server.stat_net_output_bytes + server.stat_net_repl_output_bytes + server.stat_net_cluster_slot_export_bytes, current_time, + server.stat_net_output_bytes + server.stat_net_repl_output_bytes + + server.stat_net_cluster_slot_export_bytes, + current_time, factor); - trackInstantaneousMetric(STATS_METRIC_NET_INPUT_REPLICATION, server.stat_net_repl_input_bytes + server.bio_stat_net_repl_input_bytes, current_time, + trackInstantaneousMetric(STATS_METRIC_NET_INPUT_REPLICATION, + server.stat_net_repl_input_bytes + server.bio_stat_net_repl_input_bytes, + current_time, factor); - trackInstantaneousMetric(STATS_METRIC_NET_OUTPUT_REPLICATION, server.stat_net_repl_output_bytes, current_time, + trackInstantaneousMetric(STATS_METRIC_NET_OUTPUT_REPLICATION, + server.stat_net_repl_output_bytes, + current_time, factor); - trackInstantaneousMetric(STATS_METRIC_EL_CYCLE, server.duration_stats[EL_DURATION_TYPE_EL].cnt, current_time, + trackInstantaneousMetric(STATS_METRIC_EL_CYCLE, + server.duration_stats[EL_DURATION_TYPE_EL].cnt, + current_time, factor); - trackInstantaneousMetric(STATS_METRIC_EL_DURATION, server.duration_stats[EL_DURATION_TYPE_EL].sum, - server.duration_stats[EL_DURATION_TYPE_EL].cnt, 1); + trackInstantaneousMetric(STATS_METRIC_EL_DURATION, + server.duration_stats[EL_DURATION_TYPE_EL].sum, + server.duration_stats[EL_DURATION_TYPE_EL].cnt, + 1); } cronUpdateMemoryStats(); @@ -1612,9 +1632,12 @@ long long serverCron(struct aeEventLoop *eventLoop, long long id, void *clientDa size_t zmalloc_used = zmalloc_used_memory(); bytesToHuman(hmem, sizeof(hmem), zmalloc_used); - serverLog(LL_DEBUG, "Total: %lu clients connected (%lu replicas), %zu (%s) bytes in use", - listLength(server.clients) - listLength(server.replicas), listLength(server.replicas), - zmalloc_used, hmem); + serverLog(LL_DEBUG, + "Total: %lu clients connected (%lu replicas), %zu (%s) bytes in use", + listLength(server.clients) - listLength(server.replicas), + listLength(server.replicas), + zmalloc_used, + hmem); } } @@ -1641,9 +1664,9 @@ long long serverCron(struct aeEventLoop *eventLoop, long long id, void *clientDa * the given amount of seconds, and if the latest bgsave was * successful or if, in case of an error, at least * CONFIG_BGSAVE_RETRY_DELAY seconds already elapsed. */ - if (server.dirty >= sp->changes && server.unixtime - server.lastsave > sp->seconds && - (server.unixtime - server.lastbgsave_try > CONFIG_BGSAVE_RETRY_DELAY || - server.lastbgsave_status == C_OK)) { + if (server.dirty >= sp->changes && server.unixtime - server.lastsave > sp->seconds + && (server.unixtime - server.lastbgsave_try > CONFIG_BGSAVE_RETRY_DELAY + || server.lastbgsave_status == C_OK)) { serverLog(LL_NOTICE, "%d changes in %d seconds. Saving...", sp->changes, (int)sp->seconds); rdbSaveInfo rsi, *rsiptr; rsiptr = rdbPopulateSaveInfo(&rsi); @@ -1653,8 +1676,8 @@ long long serverCron(struct aeEventLoop *eventLoop, long long id, void *clientDa } /* Trigger an AOF rewrite if needed. */ - if (server.aof_state == AOF_ON && !hasActiveChildProcess() && server.aof_rewrite_perc && - server.aof_current_size > server.aof_rewrite_min_size) { + if (server.aof_state == AOF_ON && !hasActiveChildProcess() && server.aof_rewrite_perc + && server.aof_current_size > server.aof_rewrite_min_size) { long long base = server.aof_rewrite_base_size ? server.aof_rewrite_base_size : 1; long long growth = (server.aof_current_size * 100 / base) - 100; if (growth >= server.aof_rewrite_perc && !aofRewriteLimited()) { @@ -1678,8 +1701,8 @@ long long serverCron(struct aeEventLoop *eventLoop, long long id, void *clientDa * however to try every second is enough in case of 'hz' is set to * a higher frequency. */ run_with_period(1000) { - if ((server.aof_state == AOF_ON || server.aof_state == AOF_WAIT_REWRITE) && - server.aof_last_write_status == C_ERR) { + if ((server.aof_state == AOF_ON || server.aof_state == AOF_WAIT_REWRITE) + && server.aof_last_write_status == C_ERR) { flushAppendOnlyFile(0); } } @@ -1724,8 +1747,8 @@ long long serverCron(struct aeEventLoop *eventLoop, long long id, void *clientDa * Note: this code must be after the replicationCron() call above so * make sure when refactoring this file to keep this order. This is useful * because we want to give priority to RDB savings for replication. */ - if (!hasActiveChildProcess() && server.rdb_bgsave_scheduled && - (server.unixtime - server.lastbgsave_try > CONFIG_BGSAVE_RETRY_DELAY || server.lastbgsave_status == C_OK)) { + if (!hasActiveChildProcess() && server.rdb_bgsave_scheduled + && (server.unixtime - server.lastbgsave_try > CONFIG_BGSAVE_RETRY_DELAY || server.lastbgsave_status == C_OK)) { rdbSaveInfo rsi, *rsiptr; rsiptr = rdbPopulateSaveInfo(&rsi); if (rdbSaveBackground(REPLICA_REQ_NONE, server.rdb_filename, rsiptr, RDBFLAGS_NONE) == C_OK) @@ -1734,8 +1757,8 @@ long long serverCron(struct aeEventLoop *eventLoop, long long id, void *clientDa /* TLS auto-reload if enabled (only when TLS is built-in). */ #if defined(USE_OPENSSL) && USE_OPENSSL == 1 /* BUILD_YES */ - if ((server.tls_port || server.tls_replication || server.tls_cluster) && - server.tls_ctx_config.auto_reload_interval > 0) { + if ((server.tls_port || server.tls_replication || server.tls_cluster) + && server.tls_ctx_config.auto_reload_interval > 0) { run_with_period(1000) { tlsReconfigureIfNeeded(); tlsApplyPendingReload(); @@ -2103,10 +2126,12 @@ void createSharedObjectsForCompat(int compat) { createSharedStringFromSds(sdscatfmt(sdsempty(), "-LOADING %s is loading the dataset in memory\r\n", name)); shared.slowevalerr_variants[compat] = createSharedStringFromSds( sdscatfmt(sdsempty(), - "-BUSY %s is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.\r\n", name)); + "-BUSY %s is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.\r\n", + name)); shared.slowscripterr_variants[compat] = createSharedStringFromSds( sdscatfmt(sdsempty(), - "-BUSY %s is busy running a script. You can only call FUNCTION KILL or SHUTDOWN NOSAVE.\r\n", name)); + "-BUSY %s is busy running a script. You can only call FUNCTION KILL or SHUTDOWN NOSAVE.\r\n", + name)); shared.slowmoduleerr_variants[compat] = createSharedStringFromSds(sdscatfmt(sdsempty(), "-BUSY %s is busy running a module command.\r\n", name)); shared.bgsaveerr_variants[compat] = @@ -2116,7 +2141,8 @@ void createSharedObjectsForCompat(int compat) { " disabled, because this instance is configured to report errors during" " writes if RDB snapshotting fails (stop-writes-on-bgsave-error option)." " Please check the %s logs for details about the RDB error.\r\n", - name, name)); + name, + name)); } /* These shared strings depend on the extended-redis-compatibility config and are @@ -2155,7 +2181,8 @@ void createSharedObjects(void) { createSharedObjectsForCompat(0); createSharedObjectsForCompat(1); updateSharedObjectsWithCompat(); - shared.primarydownerr = createSharedString("-MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.\r\n"); + shared.primarydownerr = createSharedString("-MASTERDOWN Link with MASTER is down and replica-serve-stale-data is " + "set to 'no'.\r\n"); shared.roreplicaerr = createSharedString("-READONLY You can't write against a read only replica.\r\n"); shared.noautherr = createSharedString("-NOAUTH Authentication required.\r\n"); shared.oomerr = createSharedString("-OOM command not allowed when used memory > 'maxmemory'.\r\n"); @@ -2189,7 +2216,10 @@ void createSharedObjects(void) { int dictid_len; dictid_len = ll2string(dictid_str, sizeof(dictid_str), j); - shared.select[j] = createSharedStringFromSds(sdscatprintf(sdsempty(), "*2\r\n$6\r\nSELECT\r\n$%d\r\n%s\r\n", dictid_len, dictid_str)); + shared.select[j] = createSharedStringFromSds(sdscatprintf(sdsempty(), + "*2\r\n$6\r\nSELECT\r\n$%d\r\n%s\r\n", + dictid_len, + dictid_str)); } shared.messagebulk = createSharedString("$7\r\nmessage\r\n"); shared.pmessagebulk = createSharedString("$8\r\npmessage\r\n"); @@ -2628,28 +2658,33 @@ void adjustOpenFilesLimit(void) { "of %llu is not enough for the server to start. " "Please increase your open file limit to at least " "%llu. Exiting.", - (unsigned long long)oldlimit, (unsigned long long)maxfiles); + (unsigned long long)oldlimit, + (unsigned long long)maxfiles); exit(1); } serverLog(LL_WARNING, "You requested maxclients of %d " "requiring at least %llu max file descriptors.", - old_maxclients, (unsigned long long)maxfiles); + old_maxclients, + (unsigned long long)maxfiles); serverLog(LL_WARNING, "Server can't set maximum open files " "to %llu because of OS error: %s.", - (unsigned long long)maxfiles, strerror(setrlimit_error)); + (unsigned long long)maxfiles, + strerror(setrlimit_error)); serverLog(LL_WARNING, "Current maximum open files is %llu. " "maxclients has been reduced to %d to compensate for " "low ulimit. " "If you need higher maxclients increase 'ulimit -n'.", - (unsigned long long)bestlimit, server.maxclients); + (unsigned long long)bestlimit, + server.maxclients); } else { serverLog(LL_NOTICE, "Increased maximum number of open files " "to %llu (it was originally set to %llu).", - (unsigned long long)maxfiles, (unsigned long long)oldlimit); + (unsigned long long)maxfiles, + (unsigned long long)oldlimit); } } } @@ -2668,7 +2703,8 @@ void checkTcpBacklogSettings(void) { serverLog(LL_WARNING, "WARNING: The TCP backlog setting of %d cannot be enforced because /proc/sys/net/core/somaxconn " "is set to the lower value of %d.", - server.tcp_backlog, somaxconn); + server.tcp_backlog, + somaxconn); } } fclose(fp); @@ -2685,7 +2721,8 @@ void checkTcpBacklogSettings(void) { serverLog(LL_WARNING, "WARNING: The TCP backlog setting of %d cannot be enforced because kern.ipc.somaxconn is set to " "the lower value of %d.", - server.tcp_backlog, somaxconn); + server.tcp_backlog, + somaxconn); } } #elif defined(HAVE_SYSCTL_KERN_SOMAXCONN) @@ -2700,7 +2737,8 @@ void checkTcpBacklogSettings(void) { serverLog(LL_WARNING, "WARNING: The TCP backlog setting of %d cannot be enforced because kern.somaxconn is set to the " "lower value of %d.", - server.tcp_backlog, somaxconn); + server.tcp_backlog, + somaxconn); } } #elif defined(SOMAXCONN) @@ -2708,7 +2746,8 @@ void checkTcpBacklogSettings(void) { serverLog(LL_WARNING, "WARNING: The TCP backlog setting of %d cannot be enforced because SOMAXCONN is set to the lower " "value of %d.", - server.tcp_backlog, SOMAXCONN); + server.tcp_backlog, + SOMAXCONN); } #endif } @@ -2768,11 +2807,14 @@ int listenToPort(connListener *sfd) { } if (sfd->fd[sfd->count] == ANET_ERR) { int net_errno = errno; - serverLog(LL_WARNING, "Warning: Could not create server TCP listening socket %s:%d: %s", addr, port, + serverLog(LL_WARNING, + "Warning: Could not create server TCP listening socket %s:%d: %s", + addr, + port, server.neterr); if (net_errno == EADDRNOTAVAIL && optional) continue; - if (net_errno == ENOPROTOOPT || net_errno == EPROTONOSUPPORT || net_errno == ESOCKTNOSUPPORT || - net_errno == EPFNOSUPPORT || net_errno == EAFNOSUPPORT) + if (net_errno == ENOPROTOOPT || net_errno == EPROTONOSUPPORT || net_errno == ESOCKTNOSUPPORT + || net_errno == EPFNOSUPPORT || net_errno == EAFNOSUPPORT) continue; /* Rollback successful listens before exiting */ @@ -2875,8 +2917,7 @@ int dbHasNoKeys(int dbid) { bool dbsHaveNoKeys(void) { for (int i = 0; i < server.dbnum; i++) { - if (!dbHasNoKeys(i)) - return false; + if (!dbHasNoKeys(i)) return false; } return true; } @@ -3005,7 +3046,8 @@ void initServer(void) { * (which has to be kvstore), see pubsubtype.serverPubSubChannels */ server.pubsub_channels = kvstoreCreate(&kvstoreChannelHashtableType, 0, KVSTORE_ALLOCATE_HASHTABLES_ON_DEMAND); server.pubsub_patterns = dictCreate(&objToHashtableDictType); - server.pubsubshard_channels = kvstoreCreate(&kvstoreChannelHashtableType, server.cluster_enabled ? CLUSTER_SLOT_MASK_BITS : 0, + server.pubsubshard_channels = kvstoreCreate(&kvstoreChannelHashtableType, + server.cluster_enabled ? CLUSTER_SLOT_MASK_BITS : 0, KVSTORE_ALLOCATE_HASHTABLES_ON_DEMAND | KVSTORE_FREE_EMPTY_HASHTABLES); server.pubsub_clients = 0; server.watching_clients = 0; @@ -3099,8 +3141,9 @@ void initServer(void) { * at 3 GB using maxmemory with 'noeviction' policy'. This avoids * useless crashes of the instance for out of memory. */ if (server.arch_bits == 32 && server.maxmemory == 0) { - serverLog(LL_WARNING, "Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit " - "with 'noeviction' policy now."); + serverLog(LL_WARNING, + "Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit " + "with 'noeviction' policy now."); server.maxmemory = 3072LL * (1024 * 1024); /* 3 GB */ server.maxmemory_policy = MAXMEMORY_NO_EVICTION; } @@ -3196,13 +3239,16 @@ void initListeners(void) { if (listener->ct == NULL) continue; if (connListen(listener) == C_ERR) { - serverLog(LL_WARNING, "Failed listening on port %u (%s), aborting.", listener->port, + serverLog(LL_WARNING, + "Failed listening on port %u (%s), aborting.", + listener->port, getConnectionTypeName(listener->ct->get_type())); exit(1); } if (createSocketAcceptHandler(listener, connAcceptHandler(listener->ct)) != C_OK) - serverPanic("Unrecoverable error creating %s listener accept handler.", getConnectionTypeName(listener->ct->get_type())); + serverPanic("Unrecoverable error creating %s listener accept handler.", + getConnectionTypeName(listener->ct->get_type())); listen_fds += listener->count; } @@ -3274,8 +3320,8 @@ void populateCommandLegacyRangeSpec(struct serverCommand *c) { return; } - if (c->key_specs_num == 1 && c->key_specs[0].begin_search_type == KSPEC_BS_INDEX && - c->key_specs[0].find_keys_type == KSPEC_FK_RANGE) { + if (c->key_specs_num == 1 && c->key_specs[0].begin_search_type == KSPEC_BS_INDEX + && c->key_specs[0].find_keys_type == KSPEC_FK_RANGE) { /* Quick win, exactly one range spec. */ c->legacy_range_key_spec = c->key_specs[0]; /* If it has the incomplete flag, set the movablekeys flag on the command. */ @@ -3291,8 +3337,8 @@ void populateCommandLegacyRangeSpec(struct serverCommand *c) { c->flags |= CMD_MOVABLE_KEYS; continue; } - if (c->key_specs[i].fk.range.keystep != 1 || - (prev_lastkey && prev_lastkey != c->key_specs[i].bs.index.pos - 1)) { + if (c->key_specs[i].fk.range.keystep != 1 + || (prev_lastkey && prev_lastkey != c->key_specs[i].bs.index.pos - 1)) { /* Found a range spec that's not plain (step of 1) or not consecutive to the previous one. * Skip it, and we set the movablekeys flag. */ c->flags |= CMD_MOVABLE_KEYS; @@ -3635,8 +3681,8 @@ static void propagateNow(int dbid, robj **argv, int argc, int target, int slot) * In this case, primary lost a slot during the pausing. * 3) The primary was paused by CLIENT PAUSE, and lost a slot during the * pausing. */ - serverAssert(!isPausedActions(PAUSE_ACTION_REPLICA) || server.client_pause_in_transaction || - server.server_del_keys_in_slot); + serverAssert(!isPausedActions(PAUSE_ACTION_REPLICA) || server.client_pause_in_transaction + || server.server_del_keys_in_slot); int propagate_to_aof = server.aof_state != AOF_OFF && target & PROPAGATE_AOF; @@ -3723,7 +3769,9 @@ void updateCommandLatencyHistogram(struct hdr_histogram **latency_histogram, int if (duration_hist < LATENCY_HISTOGRAM_MIN_VALUE) duration_hist = LATENCY_HISTOGRAM_MIN_VALUE; if (duration_hist > LATENCY_HISTOGRAM_MAX_VALUE) duration_hist = LATENCY_HISTOGRAM_MAX_VALUE; if (*latency_histogram == NULL) - hdr_init(LATENCY_HISTOGRAM_MIN_VALUE, LATENCY_HISTOGRAM_MAX_VALUE, LATENCY_HISTOGRAM_PRECISION, + hdr_init(LATENCY_HISTOGRAM_MIN_VALUE, + LATENCY_HISTOGRAM_MAX_VALUE, + LATENCY_HISTOGRAM_PRECISION, latency_histogram); hdr_record_value(*latency_histogram, duration_hist); } @@ -3745,8 +3793,8 @@ static void propagatePendingCommands(void) { /* In case a command that may modify random keys was run *directly* * (i.e. not from within a script, MULTI/EXEC, RM_Call, etc.) we want * to avoid using a transaction (much like active-expire) */ - if (server.current_client && server.current_client->cmd && - server.current_client->cmd->flags & CMD_TOUCHES_ARBITRARY_KEYS) { + if (server.current_client && server.current_client->cmd + && server.current_client->cmd->flags & CMD_TOUCHES_ARBITRARY_KEYS) { transaction = 0; } @@ -3933,8 +3981,11 @@ void call(client *c, int flags) { robj **argv = c->original_argv ? c->original_argv : c->argv; int argc = c->original_argv ? c->original_argc : c->argc; if (argc != debug_argc_clone) { - serverLog(LL_WARNING, "Debug: command %s modified argc, original value: %d, new value: %d", - c->cmd->current_name, debug_argc_clone, argc); + serverLog(LL_WARNING, + "Debug: command %s modified argc, original value: %d, new value: %d", + c->cmd->current_name, + debug_argc_clone, + argc); } serverAssert(argc == debug_argc_clone); for (int i = 0; i < debug_argc_clone; i++) { @@ -3943,8 +3994,12 @@ void call(client *c, int flags) { } serverAssert(debug_argv_clone[i] == argv[i]); if (argv[i]->refcount < debug_argv_refcount[i]) { - serverLog(LL_WARNING, "Debug: command %s modified argv[%d] refcount, original value: %d, new value: %d", - c->cmd->current_name, i, debug_argv_refcount[i], argv[i]->refcount); + serverLog(LL_WARNING, + "Debug: command %s modified argv[%d] refcount, original value: %d, new value: %d", + c->cmd->current_name, + i, + debug_argv_refcount[i], + argv[i]->refcount); } serverAssert(argv[i]->refcount >= debug_argv_refcount[i]); } @@ -3966,7 +4021,13 @@ void call(client *c, int flags) { else duration = ustime() - call_timer; - valkey_commands_trace(valkey_commands, command_call, connGetType(c->conn), getClientPeerId(c), getClientSockname(c), real_cmd->declared_name, duration); + valkey_commands_trace(valkey_commands, + command_call, + connGetType(c->conn), + getClientPeerId(c), + getClientSockname(c), + real_cmd->declared_name, + duration); c->duration += duration; dirty = server.dirty - dirty; if (dirty < 0) dirty = 0; @@ -4045,8 +4106,8 @@ void call(client *c, int flags) { * We never propagate EXEC explicitly, it will be implicitly * propagated if needed (see propagatePendingCommands). * Also, module commands take care of themselves */ - if (flags & CMD_CALL_PROPAGATE && !c->flag.prevent_prop && c->cmd->proc != execCommand && - !(c->cmd->flags & CMD_MODULE)) { + if (flags & CMD_CALL_PROPAGATE && !c->flag.prevent_prop && c->cmd->proc != execCommand + && !(c->cmd->flags & CMD_MODULE)) { int propagate_flags = PROPAGATE_NONE; /* Check if the command operated changes in the data set. If so @@ -4080,13 +4141,13 @@ void call(client *c, int flags) { /* If the client has keys tracking enabled for client side caching, * make sure to remember the keys it fetched via this command. For read-only * scripts, don't process the script, only the commands it executes. */ - if ((c->cmd->flags & CMD_READONLY) && (c->cmd->proc != evalRoCommand) && (c->cmd->proc != evalShaRoCommand) && - (c->cmd->proc != fcallroCommand)) { + if ((c->cmd->flags & CMD_READONLY) && (c->cmd->proc != evalRoCommand) && (c->cmd->proc != evalShaRoCommand) + && (c->cmd->proc != fcallroCommand)) { /* We use the tracking flag of the original external client that * triggered the command, but we take the keys from the actual command * being executed. */ - if (server.current_client && (server.current_client->flag.tracking) && - !(server.current_client->flag.tracking_bcast)) { + if (server.current_client && (server.current_client->flag.tracking) + && !(server.current_client->flag.tracking_bcast)) { trackingRememberKeys(server.current_client, c); } } @@ -4204,8 +4265,10 @@ int commandCheckExistence(client *c, sds *err) { for (i = 1; i < c->argc && sdslen(args) < 128; i++) args = sdscatprintf(args, "'%.*s' ", 128 - (int)sdslen(args), (char *)objectGetVal(c->argv[i])); *err = sdsnew(NULL); - *err = - sdscatprintf(*err, "unknown command '%.128s', with args beginning with: %s", (char *)objectGetVal(c->argv[0]), args); + *err = sdscatprintf(*err, + "unknown command '%.128s', with args beginning with: %s", + (char *)objectGetVal(c->argv[0]), + args); sdsfree(args); } /* Make sure there are no newlines in the string, otherwise invalid protocol @@ -4236,8 +4299,8 @@ uint64_t getCommandFlags(client *c) { if (c->cmd->proc == fcallCommand || c->cmd->proc == fcallroCommand) { cmd_flags = fcallGetCommandFlags(c, cmd_flags); - } else if (c->cmd->proc == evalCommand || c->cmd->proc == evalRoCommand || c->cmd->proc == evalShaCommand || - c->cmd->proc == evalShaRoCommand) { + } else if (c->cmd->proc == evalCommand || c->cmd->proc == evalRoCommand || c->cmd->proc == evalShaCommand + || c->cmd->proc == evalShaRoCommand) { cmd_flags = evalGetCommandFlags(c, cmd_flags); } @@ -4258,9 +4321,7 @@ static void prepareCommandGeneric(robj **argv, int argc, int *read_flags, struct } else if (!commandCheckArity(*cmd, argc, NULL)) { *read_flags |= READ_FLAGS_BAD_ARITY; } else if (server.cluster_enabled) { - debugServerAssert(*slot == -1 && - !(*read_flags & READ_FLAGS_CROSSSLOT) && - !(*read_flags & READ_FLAGS_NO_KEYS)); + debugServerAssert(*slot == -1 && !(*read_flags & READ_FLAGS_CROSSSLOT) && !(*read_flags & READ_FLAGS_NO_KEYS)); *slot = clusterSlotByCommand(*cmd, argv, argc, read_flags); } } @@ -4285,10 +4346,7 @@ void prepareCommandQueue(client *c) { /* Undo prepareCommand(), to allow prepareCommand() again after applying command filters. */ void unprepareCommand(client *c) { c->parsed_cmd = NULL; - c->read_flags &= ~(READ_FLAGS_COMMAND_NOT_FOUND | - READ_FLAGS_BAD_ARITY | - READ_FLAGS_CROSSSLOT | - READ_FLAGS_NO_KEYS); + c->read_flags &= ~(READ_FLAGS_COMMAND_NOT_FOUND | READ_FLAGS_BAD_ARITY | READ_FLAGS_CROSSSLOT | READ_FLAGS_NO_KEYS); c->slot = -1; } @@ -4322,8 +4380,8 @@ int processCommand(client *c) { /* If we're inside a module blocked context yielding that wants to avoid * processing clients, postpone the command. */ - if (server.busy_module_yield_flags != BUSY_MODULE_YIELD_NONE && - !(server.busy_module_yield_flags & BUSY_MODULE_YIELD_CLIENTS)) { + if (server.busy_module_yield_flags != BUSY_MODULE_YIELD_NONE + && !(server.busy_module_yield_flags & BUSY_MODULE_YIELD_CLIENTS)) { blockPostponeClient(c); return C_OK; } @@ -4372,15 +4430,15 @@ int processCommand(client *c) { /* Check if the command is marked as protected and the relevant configuration allows it */ if (c->cmd->flags & CMD_PROTECTED) { - if ((c->cmd->proc == debugCommand && !allowProtectedAction(server.enable_debug_cmd, c)) || - (c->cmd->proc == moduleCommand && !allowProtectedAction(server.enable_module_cmd, c))) { - sds protected_err = sdscatprintf( - sdsempty(), - "%s command not allowed. If the %s option is set to \"local\", " - "you can run it from a local connection, otherwise you need to set this option " - "in the configuration file, and then restart the server.", - c->cmd->proc == debugCommand ? "DEBUG" : "MODULE", - c->cmd->proc == debugCommand ? "enable-debug-command" : "enable-module-command"); + if ((c->cmd->proc == debugCommand && !allowProtectedAction(server.enable_debug_cmd, c)) + || (c->cmd->proc == moduleCommand && !allowProtectedAction(server.enable_module_cmd, c))) { + sds protected_err = + sdscatprintf(sdsempty(), + "%s command not allowed. If the %s option is set to \"local\", " + "you can run it from a local connection, otherwise you need to set this option " + "in the configuration file, and then restart the server.", + c->cmd->proc == debugCommand ? "DEBUG" : "MODULE", + c->cmd->proc == debugCommand ? "enable-debug-command" : "enable-module-command"); sdsmapchars(protected_err, "\r\n", " ", 2); rejectCommandSds(c, protected_err, 1); return C_OK; @@ -4407,8 +4465,7 @@ int processCommand(client *c) { const int obey_client = mustObeyClient(c); if (c->flag.multi && c->cmd->flags & CMD_NO_MULTI) { - sds nomulti_err = - sdscatprintf(sdsempty(), "Command '%s' not allowed inside a transaction", c->cmd->fullname); + sds nomulti_err = sdscatprintf(sdsempty(), "Command '%s' not allowed inside a transaction", c->cmd->fullname); sdsmapchars(nomulti_err, "\r\n", " ", 2); rejectCommandSds(c, nomulti_err, 1); return C_OK; @@ -4419,7 +4476,11 @@ int processCommand(client *c) { int acl_errpos; int acl_retval = ACLCheckAllPerm(c, &acl_errpos); if (acl_retval != ACL_OK) { - addACLLogEntry(c, acl_retval, (c->flag.multi) ? ACL_LOG_CTX_MULTI : ACL_LOG_CTX_TOPLEVEL, acl_errpos, NULL, + addACLLogEntry(c, + acl_retval, + (c->flag.multi) ? ACL_LOG_CTX_MULTI : ACL_LOG_CTX_TOPLEVEL, + acl_errpos, + NULL, NULL); sds msg = getAclErrorMessage(acl_retval, c->user, c->cmd, objectGetVal(c->argv[acl_errpos]), 0); rejectCommandFormat(c, 0, "-NOPERM %s", msg); @@ -4463,8 +4524,8 @@ int processCommand(client *c) { * queued commands is also considered keyless (c->slot remains -1 as set * by prepareCommand when no keys are found). */ int is_keyless_exec = is_exec && c->slot == -1; - if (server.cluster_enabled && !obey_client && (is_keyless || is_keyless_exec) && (is_read_command || is_write_command) && - (c->capa & CLIENT_CAPA_REDIRECT) && !c->flag.readonly) { + if (server.cluster_enabled && !obey_client && (is_keyless || is_keyless_exec) + && (is_read_command || is_write_command) && (c->capa & CLIENT_CAPA_REDIRECT) && !c->flag.readonly) { clusterNode *myself = getMyClusterNode(); if (clusterNodeIsReplica(myself)) { clusterNode *primary = clusterNodeGetPrimary(myself); @@ -4474,8 +4535,11 @@ int processCommand(client *c) { flagTransaction(c); } int port = clusterNodeClientPort(primary, connIsTLS(c->conn), c); - addReplyErrorSds(c, sdscatprintf(sdsempty(), "-REDIRECT %s:%d", - clusterNodePreferredEndpoint(primary, c), port)); + addReplyErrorSds(c, + sdscatprintf(sdsempty(), + "-REDIRECT %s:%d", + clusterNodePreferredEndpoint(primary, c), + port)); c->duration = 0; c->cmd->rejected_calls++; moduleFireCommandRejectedEvent(c, "-REDIRECT"); @@ -4483,8 +4547,8 @@ int processCommand(client *c) { } } - if (clientSupportStandAloneRedirect(c) && !obey_client && - (is_write_command || (is_read_command && !c->flag.readonly))) { + if (clientSupportStandAloneRedirect(c) && !obey_client + && (is_write_command || (is_read_command && !c->flag.readonly))) { if (server.failover_state == FAILOVER_IN_PROGRESS) { /* During the FAILOVER process, when conditions are met (such as * when the force time is reached or the primary and replica offsets @@ -4583,8 +4647,9 @@ int processCommand(client *c) { const mstime_t log_interval_ms = 10000; if (server.mstime > last_log_time_ms + log_interval_ms) { last_log_time_ms = server.mstime; - serverLog(LL_WARNING, "Replica is applying a command even though " - "it is unable to write to disk."); + serverLog(LL_WARNING, + "Replica is applying a command even though " + "it is unable to write to disk."); } } } else { @@ -4612,10 +4677,10 @@ int processCommand(client *c) { /* Only allow a subset of commands in the context of Pub/Sub if the * connection is in RESP2 mode. With RESP3 there are no limits. */ - if ((c->flag.pubsub && c->resp == 2) && c->cmd->proc != pingCommand && c->cmd->proc != subscribeCommand && - c->cmd->proc != ssubscribeCommand && c->cmd->proc != unsubscribeCommand && - c->cmd->proc != sunsubscribeCommand && c->cmd->proc != psubscribeCommand && - c->cmd->proc != punsubscribeCommand && c->cmd->proc != quitCommand && c->cmd->proc != resetCommand) { + if ((c->flag.pubsub && c->resp == 2) && c->cmd->proc != pingCommand && c->cmd->proc != subscribeCommand + && c->cmd->proc != ssubscribeCommand && c->cmd->proc != unsubscribeCommand + && c->cmd->proc != sunsubscribeCommand && c->cmd->proc != psubscribeCommand + && c->cmd->proc != punsubscribeCommand && c->cmd->proc != quitCommand && c->cmd->proc != resetCommand) { sds pubsub_err = sdscatprintf(sdsempty(), "Can't execute '%s': only (P|S)SUBSCRIBE / " "(P|S)UNSUBSCRIBE / PING / QUIT / RESET are allowed in this context", @@ -4628,8 +4693,8 @@ int processCommand(client *c) { /* Only allow commands with flag "t", such as INFO, REPLICAOF and so on, * when replica-serve-stale-data is no and we are a replica with a broken * link with primary. */ - if (server.primary_host && server.repl_state != REPL_STATE_CONNECTED && server.repl_serve_stale_data == 0 && - is_denystale_command) { + if (server.primary_host && server.repl_state != REPL_STATE_CONNECTED && server.repl_serve_stale_data == 0 + && is_denystale_command) { rejectCommand(c, shared.primarydownerr, 1); return C_OK; } @@ -4680,16 +4745,16 @@ int processCommand(client *c) { /* If the server is paused, block the client until the pause has ended. Replicas and slot * export clients are never paused to allow failover/slot migration to succeed. */ - if (!c->flag.replica && (!c->slot_migration_job || isImportSlotMigrationJob(c->slot_migration_job)) && - ((isPausedActions(PAUSE_ACTION_CLIENT_ALL)) || ((isPausedActions(PAUSE_ACTION_CLIENT_WRITE)) && is_may_replicate_command))) { + if (!c->flag.replica && (!c->slot_migration_job || isImportSlotMigrationJob(c->slot_migration_job)) + && ((isPausedActions(PAUSE_ACTION_CLIENT_ALL)) + || ((isPausedActions(PAUSE_ACTION_CLIENT_WRITE)) && is_may_replicate_command))) { blockPostponeClient(c); return C_OK; } /* Exec the command */ - if (c->flag.multi && c->cmd->proc != execCommand && c->cmd->proc != discardCommand && - c->cmd->proc != quitCommand && - c->cmd->proc != resetCommand) { + if (c->flag.multi && c->cmd->proc != execCommand && c->cmd->proc != discardCommand && c->cmd->proc != quitCommand + && c->cmd->proc != resetCommand) { queueMultiCommand(c, cmd_flags); addReply(c, shared.queued); } else { @@ -4871,24 +4936,34 @@ int finishShutdown(void) { num_replicas++; if (replica->repl_data->repl_ack_off != server.primary_repl_offset) { num_lagging_replicas++; - long lag = replica->repl_data->repl_state == REPLICA_STATE_ONLINE ? time(NULL) - replica->repl_data->repl_ack_time : 0; - serverLog(LL_NOTICE, "Lagging replica %s reported offset %lld behind master, lag=%ld, state=%s.", - replicationGetReplicaName(replica), server.primary_repl_offset - replica->repl_data->repl_ack_off, lag, + long lag = replica->repl_data->repl_state == REPLICA_STATE_ONLINE + ? time(NULL) - replica->repl_data->repl_ack_time + : 0; + serverLog(LL_NOTICE, + "Lagging replica %s reported offset %lld behind master, lag=%ld, state=%s.", + replicationGetReplicaName(replica), + server.primary_repl_offset - replica->repl_data->repl_ack_off, + lag, replstateToString(replica->repl_data->repl_state)); } } if (num_replicas > 0) { - serverLog(LL_NOTICE, "%d of %d replicas are in sync when shutting down.", num_replicas - num_lagging_replicas, + serverLog(LL_NOTICE, + "%d of %d replicas are in sync when shutting down.", + num_replicas - num_lagging_replicas, num_replicas); } if (safe && server.cluster_enabled && clusterNodeIsVotingPrimary(getMyClusterNode())) { if (force) { - serverLog(LL_WARNING, "This is a voting primary. Shutting down may cause the cluster to go down. Exit anyway."); + serverLog(LL_WARNING, + "This is a voting primary. Shutting down may cause the cluster to go down. Exit anyway."); } else { - serverLog(LL_WARNING, "This is a voting primary. Shutting down may cause the cluster to go down. Can't exit."); + serverLog(LL_WARNING, + "This is a voting primary. Shutting down may cause the cluster to go down. Can't exit."); if (server.supervised_mode == SUPERVISED_SYSTEMD) - serverCommunicateSystemd("This is a voting primary. Shutting down may cause the cluster to go down. Can't exit.\n"); + serverCommunicateSystemd("This is a voting primary. Shutting down may cause the cluster to go down. " + "Can't exit.\n"); goto error; } } @@ -5044,7 +5119,8 @@ sds writeCommandsGetDiskErrorMessage(int error_code) { if (error_code == DISK_ERROR_TYPE_RDB) { ret = sdsdup(objectGetVal(shared.bgsaveerr)); } else { - ret = sdscatfmt(sdsempty(), "-MISCONF Errors writing to the AOF file: %s\r\n", + ret = sdscatfmt(sdsempty(), + "-MISCONF Errors writing to the AOF file: %s\r\n", strerror(server.aof_last_write_errno)); } return ret; @@ -5879,9 +5955,11 @@ sds fillPercentileDistributionLatencies(sds info, const char *histogram_name, st char fbuf[128]; size_t len = snprintf(fbuf, sizeof(fbuf), "%f", server.latency_tracking_info_percentiles[j]); trimDoubleString(fbuf, len); - info = sdscatprintf(info, "p%s=%.3f", fbuf, - ((double)hdr_value_at_percentile(histogram, server.latency_tracking_info_percentiles[j])) / - 1000.0f); + info = sdscatprintf(info, + "p%s=%.3f", + fbuf, + ((double)hdr_value_at_percentile(histogram, server.latency_tracking_info_percentiles[j])) + / 1000.0f); if (j != server.latency_tracking_info_percentiles_len - 1) info = sdscatlen(info, ",", 1); } info = sdscatprintf(info, "\r\n"); @@ -5928,9 +6006,12 @@ sds genValkeyInfoStringCommandStats(sds info, hashtable *commands) { info = sdscatprintf(info, "cmdstat_%s:calls=%lld,usec=%lld,usec_per_call=%.2f" ",rejected_calls=%lld,failed_calls=%lld\r\n", - getSafeInfoString(c->fullname, sdslen(c->fullname), &tmpsafe), c->calls, - c->microseconds, (c->calls == 0) ? 0 : ((float)c->microseconds / c->calls), - c->rejected_calls, c->failed_calls); + getSafeInfoString(c->fullname, sdslen(c->fullname), &tmpsafe), + c->calls, + c->microseconds, + (c->calls == 0) ? 0 : ((float)c->microseconds / c->calls), + c->rejected_calls, + c->failed_calls); if (tmpsafe != NULL) zfree(tmpsafe); } if (c->subcommands_ht) { @@ -5951,9 +6032,12 @@ sds genValkeyInfoStringACLStats(sds info) { "acl_access_denied_channel:%lld\r\n" "acl_access_denied_tls_cert:%lld\r\n" "acl_access_denied_db:%lld\r\n", - server.acl_info.user_auth_failures, server.acl_info.invalid_cmd_accesses, - server.acl_info.invalid_key_accesses, server.acl_info.invalid_channel_accesses, - server.acl_info.acl_access_denied_tls_cert, server.acl_info.invalid_db_accesses); + server.acl_info.user_auth_failures, + server.acl_info.invalid_cmd_accesses, + server.acl_info.invalid_key_accesses, + server.acl_info.invalid_channel_accesses, + server.acl_info.acl_access_denied_tls_cert, + server.acl_info.invalid_db_accesses); return info; } @@ -5965,8 +6049,9 @@ sds genValkeyInfoStringLatencyStats(sds info, hashtable *commands) { struct serverCommand *c = next; char *tmpsafe; if (c->latency_histogram) { - info = fillPercentileDistributionLatencies( - info, getSafeInfoString(c->fullname, sdslen(c->fullname), &tmpsafe), c->latency_histogram); + info = fillPercentileDistributionLatencies(info, + getSafeInfoString(c->fullname, sdslen(c->fullname), &tmpsafe), + c->latency_histogram); if (tmpsafe != NULL) zfree(tmpsafe); } if (c->subcommands_ht) { @@ -6011,14 +6096,15 @@ static void collectScriptingEngineInfo(scriptingEngine *engine, void *context) { /* Get memory information for the engine */ engineMemoryInfo mem_info = scriptingEngineCallGetMemoryInfo(engine, VMSE_ALL); - collector->info = sdscatprintf(collector->info, - "engine_%d:name=%s,module=%s,abi_version=%lu,used_memory=%zu,memory_overhead=%zu\r\n", - collector->total_engines, - engine_name, - module ? module->name : "built-in", - (unsigned long)abi_version, - mem_info.used_memory, - mem_info.engine_memory_overhead); + collector->info = + sdscatprintf(collector->info, + "engine_%d:name=%s,module=%s,abi_version=%lu,used_memory=%zu,memory_overhead=%zu\r\n", + collector->total_engines, + engine_name, + module ? module->name : "built-in", + (unsigned long)abi_version, + mem_info.used_memory, + mem_info.engine_memory_overhead); collector->total_engines++; collector->total_used_memory += mem_info.used_memory; @@ -6026,11 +6112,10 @@ static void collectScriptingEngineInfo(scriptingEngine *engine, void *context) { } sds genValkeyInfoStringScriptingEngines(sds info) { - scriptingEngineInfoCollector collector = { - .info = sdsempty(), - .total_engines = 0, - .total_used_memory = 0, - .total_overhead = 0}; + scriptingEngineInfoCollector collector = {.info = sdsempty(), + .total_engines = 0, + .total_used_memory = 0, + .total_overhead = 0}; /* Collect information from all registered engines */ scriptingEngineManagerForEachEngine(collectScriptingEngineInfo, &collector); @@ -6162,6 +6247,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { call_uname = 0; } + // clang-format off info = sdscatfmt( info, "# Server\r\n" FMTARGS( @@ -6234,6 +6320,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { "tls_client_cert_expires_in_seconds:%lld\r\n", tls_client_seconds_remaining, "tls_ca_cert_serial:%s\r\n", server.tls_ca_cert_serial ? server.tls_ca_cert_serial : "none", "tls_ca_cert_expires_in_seconds:%lld\r\n", tls_ca_seconds_remaining)); + // clang-format on } /* Clients */ @@ -6258,6 +6345,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { } if (sections++) info = sdscat(info, "\r\n"); + // clang-format off info = sdscatprintf( info, "# Clients\r\n" FMTARGS( @@ -6277,6 +6365,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { "paused_reason:%s\r\n", paused_reason, "paused_actions:%s\r\n", paused_actions, "paused_timeout_milliseconds:%lld\r\n", paused_timeout)); + // clang-format on } /* Memory */ @@ -6312,6 +6401,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { bytesToHuman(maxmemory_hmem, sizeof(maxmemory_hmem), server.maxmemory); if (sections++) info = sdscat(info, "\r\n"); + // clang-format off info = sdscatprintf( info, "# Memory\r\n" FMTARGS( @@ -6375,6 +6465,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { "active_defrag_running:%d\r\n", server.active_defrag_cpu_percent, "lazyfree_pending_objects:%zu\r\n", lazyfreeGetPendingObjectsCount(), "lazyfreed_objects:%zu\r\n", lazyfreeGetFreedObjectsCount())); + // clang-format on freeMemoryOverheadData(mh); } @@ -6389,6 +6480,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { } int aof_bio_fsync_status = atomic_load_explicit(&server.aof_bio_fsync_status, memory_order_relaxed); + // clang-format off info = sdscatprintf( info, "# Persistence\r\n" FMTARGS( @@ -6435,6 +6527,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { "aof_pending_bio_fsync:%lu\r\n", bioPendingJobsOfType(BIO_AOF_FSYNC), "aof_delayed_fsync:%lu\r\n", server.aof_delayed_fsync)); } + // clang-format on if (server.loading) { double perc = 0; @@ -6460,6 +6553,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { eta = (elapsed * remaining_bytes) / (server.loading_loaded_bytes + 1); } + // clang-format off info = sdscatprintf( info, FMTARGS( @@ -6469,17 +6563,21 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { "loading_loaded_bytes:%llu\r\n", (unsigned long long)server.loading_loaded_bytes, "loading_loaded_perc:%.2f\r\n", perc, "loading_eta_seconds:%jd\r\n", (intmax_t)eta)); + // clang-format on } } /* Stats */ if (all_sections || (dictFind(section_dict, "stats") != NULL)) { - ustime_t current_eviction_exceeded_time = - server.stat_last_eviction_exceeded_time ? (ustime_t)elapsedUs(server.stat_last_eviction_exceeded_time) : 0; - ustime_t current_active_defrag_time = - server.stat_last_active_defrag_time ? (ustime_t)elapsedUs(server.stat_last_active_defrag_time) : 0; + ustime_t current_eviction_exceeded_time = server.stat_last_eviction_exceeded_time + ? (ustime_t)elapsedUs(server.stat_last_eviction_exceeded_time) + : 0; + ustime_t current_active_defrag_time = server.stat_last_active_defrag_time + ? (ustime_t)elapsedUs(server.stat_last_active_defrag_time) + : 0; if (sections++) info = sdscat(info, "\r\n"); + // clang-format off info = sdscatprintf( info, "# Stats\r\n" FMTARGS( @@ -6550,6 +6648,7 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { "eventloop_duration_cmd_sum:%llu\r\n", server.duration_stats[EL_DURATION_TYPE_CMD].sum, "instantaneous_eventloop_cycles_per_sec:%llu\r\n", getInstantaneousMetric(STATS_METRIC_EL_CYCLE), "instantaneous_eventloop_duration_usec:%llu\r\n", getInstantaneousMetric(STATS_METRIC_EL_DURATION))); + // clang-format on info = genValkeyInfoStringACLStats(info); } @@ -6572,23 +6671,32 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { replica_read_repl_offset = server.cached_primary->repl_data->read_reploff; } - info = sdscatprintf( - info, - FMTARGS( - "master_host:%s\r\n", server.primary_host, - "master_port:%d\r\n", server.primary_port, - "master_link_status:%s\r\n", (server.repl_state == REPL_STATE_CONNECTED) ? "up" : "down", - "master_last_io_seconds_ago:%d\r\n", server.primary ? ((int)(server.unixtime - server.primary->last_interaction)) : -1, - "master_sync_in_progress:%d\r\n", server.repl_state == REPL_STATE_TRANSFER, - "slave_read_repl_offset:%lld\r\n", replica_read_repl_offset, - "slave_repl_offset:%lld\r\n", replica_repl_offset, - "replicas_repl_buffer_size:%zu\r\n", server.pending_repl_data.len, - "replicas_repl_buffer_peak:%zu\r\n", server.pending_repl_data.peak)); + info = sdscatprintf(info, + FMTARGS("master_host:%s\r\n", + server.primary_host, + "master_port:%d\r\n", + server.primary_port, + "master_link_status:%s\r\n", + (server.repl_state == REPL_STATE_CONNECTED) ? "up" : "down", + "master_last_io_seconds_ago:%d\r\n", + server.primary ? ((int)(server.unixtime - server.primary->last_interaction)) + : -1, + "master_sync_in_progress:%d\r\n", + server.repl_state == REPL_STATE_TRANSFER, + "slave_read_repl_offset:%lld\r\n", + replica_read_repl_offset, + "slave_repl_offset:%lld\r\n", + replica_repl_offset, + "replicas_repl_buffer_size:%zu\r\n", + server.pending_repl_data.len, + "replicas_repl_buffer_peak:%zu\r\n", + server.pending_repl_data.peak)); if (server.repl_state == REPL_STATE_TRANSFER) { int repl_transfer_size_stat; int repl_transfer_read_stat; - if (atomic_load_explicit(&server.replica_bio_disk_save_state, memory_order_acquire) != REPL_BIO_DISK_SAVE_STATE_NONE) { + if (atomic_load_explicit(&server.replica_bio_disk_save_state, memory_order_acquire) + != REPL_BIO_DISK_SAVE_STATE_NONE) { repl_transfer_size_stat = server.bio_repl_transfer_size; repl_transfer_read_stat = server.bio_repl_transfer_read; } else { @@ -6599,26 +6707,31 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { if (repl_transfer_size_stat) { perc = ((double)repl_transfer_read_stat / repl_transfer_size_stat) * 100; } - info = sdscatprintf( - info, - FMTARGS( - "master_sync_total_bytes:%lld\r\n", (long long)repl_transfer_size_stat, - "master_sync_read_bytes:%lld\r\n", (long long)repl_transfer_read_stat, - "master_sync_left_bytes:%lld\r\n", (long long)(repl_transfer_size_stat - repl_transfer_read_stat), - "master_sync_perc:%.2f\r\n", perc, - "master_sync_last_io_seconds_ago:%d\r\n", (int)(server.unixtime - server.repl_transfer_lastio))); + info = sdscatprintf(info, + FMTARGS("master_sync_total_bytes:%lld\r\n", + (long long)repl_transfer_size_stat, + "master_sync_read_bytes:%lld\r\n", + (long long)repl_transfer_read_stat, + "master_sync_left_bytes:%lld\r\n", + (long long)(repl_transfer_size_stat - repl_transfer_read_stat), + "master_sync_perc:%.2f\r\n", + perc, + "master_sync_last_io_seconds_ago:%d\r\n", + (int)(server.unixtime - server.repl_transfer_lastio))); } if (server.repl_state != REPL_STATE_CONNECTED) { - info = sdscatprintf(info, "master_link_down_since_seconds:%jd\r\n", + info = sdscatprintf(info, + "master_link_down_since_seconds:%jd\r\n", server.repl_down_since ? (intmax_t)(server.unixtime - server.repl_down_since) : -1); } - info = sdscatprintf( - info, - FMTARGS( - "slave_priority:%d\r\n", server.replica_priority, - "slave_read_only:%d\r\n", server.repl_replica_ro, - "replica_announced:%d\r\n", server.replica_announced)); + info = sdscatprintf(info, + FMTARGS("slave_priority:%d\r\n", + server.replica_priority, + "slave_read_only:%d\r\n", + server.repl_replica_ro, + "replica_announced:%d\r\n", + server.replica_announced)); } info = sdscatprintf(info, "connected_slaves:%lu\r\n", listLength(server.replicas)); @@ -6647,32 +6760,45 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { } const char *state = replstateToString(replica->repl_data->repl_state); if (state[0] == '\0') continue; - if (replica->repl_data->repl_state == REPLICA_STATE_ONLINE) lag = time(NULL) - replica->repl_data->repl_ack_time; + if (replica->repl_data->repl_state == REPLICA_STATE_ONLINE) + lag = time(NULL) - replica->repl_data->repl_ack_time; info = sdscatprintf(info, "slave%d:ip=%s,port=%d,state=%s," "offset=%lld,lag=%ld,type=%s\r\n", - replica_id, replica_ip, replica->repl_data->replica_listening_port, state, - replica->repl_data->repl_ack_off, lag, + replica_id, + replica_ip, + replica->repl_data->replica_listening_port, + state, + replica->repl_data->repl_ack_off, + lag, replica->flag.repl_rdb_channel ? "rdb-channel" : replica->repl_data->repl_state == REPLICA_STATE_BG_RDB_LOAD ? "main-channel" : "replica"); replica_id++; } } - info = sdscatprintf( - info, - FMTARGS( - "replicas_waiting_psync:%llu\r\n", (unsigned long long)raxSize(server.replicas_waiting_psync), - "master_failover_state:%s\r\n", getFailoverStateString(), - "master_replid:%s\r\n", server.replid, - "master_replid2:%s\r\n", server.replid2, - "master_repl_offset:%lld\r\n", server.primary_repl_offset, - "second_repl_offset:%lld\r\n", server.second_replid_offset, - "repl_backlog_active:%d\r\n", server.repl_backlog != NULL, - "repl_backlog_size:%lld\r\n", server.repl_backlog_size, - "repl_backlog_first_byte_offset:%lld\r\n", server.repl_backlog ? server.repl_backlog->offset : 0, - "repl_backlog_histlen:%lld\r\n", server.repl_backlog ? server.repl_backlog->histlen : 0)); + info = sdscatprintf(info, + FMTARGS("replicas_waiting_psync:%llu\r\n", + (unsigned long long)raxSize(server.replicas_waiting_psync), + "master_failover_state:%s\r\n", + getFailoverStateString(), + "master_replid:%s\r\n", + server.replid, + "master_replid2:%s\r\n", + server.replid2, + "master_repl_offset:%lld\r\n", + server.primary_repl_offset, + "second_repl_offset:%lld\r\n", + server.second_replid_offset, + "repl_backlog_active:%d\r\n", + server.repl_backlog != NULL, + "repl_backlog_size:%lld\r\n", + server.repl_backlog_size, + "repl_backlog_first_byte_offset:%lld\r\n", + server.repl_backlog ? server.repl_backlog->offset : 0, + "repl_backlog_histlen:%lld\r\n", + server.repl_backlog ? server.repl_backlog->histlen : 0)); } /* CPU */ @@ -6688,23 +6814,28 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { "used_cpu_user:%ld.%06ld\r\n" "used_cpu_sys_children:%ld.%06ld\r\n" "used_cpu_user_children:%ld.%06ld\r\n", - (long)self_ru.ru_stime.tv_sec, (long)self_ru.ru_stime.tv_usec, - (long)self_ru.ru_utime.tv_sec, (long)self_ru.ru_utime.tv_usec, (long)c_ru.ru_stime.tv_sec, - (long)c_ru.ru_stime.tv_usec, (long)c_ru.ru_utime.tv_sec, (long)c_ru.ru_utime.tv_usec); + (long)self_ru.ru_stime.tv_sec, + (long)self_ru.ru_stime.tv_usec, + (long)self_ru.ru_utime.tv_sec, + (long)self_ru.ru_utime.tv_usec, + (long)c_ru.ru_stime.tv_sec, + (long)c_ru.ru_stime.tv_usec, + (long)c_ru.ru_utime.tv_sec, + (long)c_ru.ru_utime.tv_usec); #ifdef RUSAGE_THREAD struct rusage m_ru; getrusage(RUSAGE_THREAD, &m_ru); info = sdscatprintf(info, "used_cpu_sys_main_thread:%ld.%06ld\r\n" "used_cpu_user_main_thread:%ld.%06ld\r\n", - (long)m_ru.ru_stime.tv_sec, (long)m_ru.ru_stime.tv_usec, (long)m_ru.ru_utime.tv_sec, + (long)m_ru.ru_stime.tv_sec, + (long)m_ru.ru_stime.tv_usec, + (long)m_ru.ru_utime.tv_sec, (long)m_ru.ru_utime.tv_usec); #endif /* RUSAGE_THREAD */ long long active_seconds = server.stat_active_time / 1000000; ustime_t active_microseconds = server.stat_active_time % 1000000; - info = sdscatprintf(info, - "used_active_time_main_thread:%lld.%06lld\r\n", - active_seconds, active_microseconds); + info = sdscatprintf(info, "used_active_time_main_thread:%lld.%06lld\r\n", active_seconds, active_microseconds); for (int i = 1; i < server.io_threads_num; i++) { ustime_t used_active_time_io_thread = getIOThreadActiveTimeMicroseconds(i); info = sdscatprintf(info, @@ -6716,8 +6847,8 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { } /* Modules */ - if (all_sections || (dictFind(section_dict, "module_list") != NULL) || - (dictFind(section_dict, "modules") != NULL)) { + if (all_sections || (dictFind(section_dict, "module_list") != NULL) + || (dictFind(section_dict, "modules") != NULL)) { if (sections++) info = sdscat(info, "\r\n"); info = sdscatprintf(info, "# Modules\r\n"); info = genModulesInfoString(info); @@ -6741,8 +6872,11 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { while (raxNext(&ri)) { char *tmpsafe; e = (struct serverError *)ri.data; - info = sdscatprintf(info, "errorstat_%.*s:count=%lld\r\n", (int)ri.key_len, - getSafeInfoString((char *)ri.key, ri.key_len, &tmpsafe), e->count); + info = sdscatprintf(info, + "errorstat_%.*s:count=%lld\r\n", + (int)ri.key_len, + getSafeInfoString((char *)ri.key, ri.key_len, &tmpsafe), + e->count); if (tmpsafe != NULL) zfree(tmpsafe); } raxStop(&ri); @@ -6793,8 +6927,13 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { keysvitems = kvstoreSize(db->keys_with_volatile_items); if (keys || vkeys) { - info = sdscatprintf(info, "db%d:keys=%lld,expires=%lld,avg_ttl=%lld,keys_with_volatile_items=%lld\r\n", j, keys, vkeys, - db->expiry[KEYS].avg_ttl, keysvitems); + info = sdscatprintf(info, + "db%d:keys=%lld,expires=%lld,avg_ttl=%lld,keys_with_volatile_items=%lld\r\n", + j, + keys, + vkeys, + db->expiry[KEYS].avg_ttl, + keysvitems); } } } @@ -6804,24 +6943,29 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { * We're not aware of the module section names here, and we rather avoid the search when we can. * so we proceed if there's a requested section name that's not found yet, or when the user asked * for "all" with any additional section names. */ - if (everything || dictFind(section_dict, "modules") != NULL || sections < (int)dictSize(section_dict) || - (all_sections && dictSize(section_dict))) { - info = modulesCollectInfo(info, everything || dictFind(section_dict, "modules") != NULL ? NULL : section_dict, + if (everything || dictFind(section_dict, "modules") != NULL || sections < (int)dictSize(section_dict) + || (all_sections && dictSize(section_dict))) { + info = modulesCollectInfo(info, + everything || dictFind(section_dict, "modules") != NULL ? NULL : section_dict, 0, /* not a crash report */ sections); } if (dictFind(section_dict, "debug") != NULL) { if (sections++) info = sdscat(info, "\r\n"); - info = sdscatprintf( - info, - "# Debug\r\n" FMTARGS( - "eventloop_duration_aof_sum:%llu\r\n", server.duration_stats[EL_DURATION_TYPE_AOF].sum, - "eventloop_duration_cron_sum:%llu\r\n", server.duration_stats[EL_DURATION_TYPE_CRON].sum, - "eventloop_duration_max:%llu\r\n", server.duration_stats[EL_DURATION_TYPE_EL].max, - "eventloop_cmd_per_cycle_max:%lld\r\n", server.el_cmd_cnt_max, - "io_threaded_reads_pending:%lld\r\n", server.stat_io_reads_pending, - "io_threaded_writes_pending:%lld\r\n", server.stat_io_writes_pending)); + info = sdscatprintf(info, + "# Debug\r\n" FMTARGS("eventloop_duration_aof_sum:%llu\r\n", + server.duration_stats[EL_DURATION_TYPE_AOF].sum, + "eventloop_duration_cron_sum:%llu\r\n", + server.duration_stats[EL_DURATION_TYPE_CRON].sum, + "eventloop_duration_max:%llu\r\n", + server.duration_stats[EL_DURATION_TYPE_EL].max, + "eventloop_cmd_per_cycle_max:%lld\r\n", + server.el_cmd_cnt_max, + "io_threaded_reads_pending:%lld\r\n", + server.stat_io_reads_pending, + "io_threaded_writes_pending:%lld\r\n", + server.stat_io_writes_pending)); } return info; @@ -6945,8 +7089,13 @@ void daemonize(void) { } sds getVersion(void) { - sds version = sdscatprintf(sdsempty(), "v=%s sha=%s:%d malloc=%s bits=%d build=%llx", VALKEY_VERSION, - serverGitSHA1(), atoi(serverGitDirty()) > 0, ZMALLOC_LIB, sizeof(long) == 4 ? 32 : 64, + sds version = sdscatprintf(sdsempty(), + "v=%s sha=%s:%d malloc=%s bits=%d build=%llx", + VALKEY_VERSION, + serverGitSHA1(), + atoi(serverGitDirty()) > 0, + ZMALLOC_LIB, + sizeof(long) == 4 ? 32 : 64, (unsigned long long)serverBuildId()); return version; } @@ -6987,14 +7136,22 @@ void serverAsciiArt(void) { /* Show the ASCII logo if: log file is stdout AND stdout is a * tty AND syslog logging is disabled. Also show logo if the user * forced us to do so via valkey.conf. */ - int show_logo = - ((!server.syslog_enabled && server.logfile[0] == '\0' && isatty(fileno(stdout))) || server.always_show_logo); + int show_logo = ((!server.syslog_enabled && server.logfile[0] == '\0' && isatty(fileno(stdout))) + || server.always_show_logo); if (!show_logo) { serverLog(LL_NOTICE, "Running mode=%s, port=%d.", mode, server.port ? server.port : server.tls_port); } else { - snprintf(buf, 1024 * 16, ascii_logo, VALKEY_VERSION, serverGitSHA1(), strtol(serverGitDirty(), NULL, 10) > 0, - (sizeof(long) == 8) ? "64" : "32", mode, server.port ? server.port : server.tls_port, (long)getpid()); + snprintf(buf, + 1024 * 16, + ascii_logo, + VALKEY_VERSION, + serverGitSHA1(), + strtol(serverGitDirty(), NULL, 10) > 0, + (sizeof(long) == 8) ? "64" : "32", + mode, + server.port ? server.port : server.tls_port, + (long)getpid()); serverLogRaw(LL_NOTICE | LL_RAW, buf); } zfree(buf); @@ -7157,8 +7314,8 @@ int serverFork(int purpose) { server.stat_total_forks++; server.stat_fork_time = ustime() - start; - server.stat_fork_rate = - (double)zmalloc_used_memory() * 1000000 / server.stat_fork_time / (1024 * 1024 * 1024); /* GB per second. */ + server.stat_fork_rate = (double)zmalloc_used_memory() * 1000000 / server.stat_fork_time + / (1024 * 1024 * 1024); /* GB per second. */ latencyAddSampleIfNeeded("fork", server.stat_fork_time); if (purpose == CHILD_TYPE_RDB) { latencyTraceIfNeeded(rdb, fork, server.stat_fork_time); @@ -7354,7 +7511,9 @@ static sds serverProcTitleGetVariable(const_sds varname, void *arg) { return sdsnew(arg); } else if (!strcmp(varname, "listen-addr")) { if (server.port || server.tls_port) - return sdscatprintf(sdsempty(), "%s:%u", server.bindaddr_count ? server.bindaddr[0] : "*", + return sdscatprintf(sdsempty(), + "%s:%u", + server.bindaddr_count ? server.bindaddr[0] : "*", server.port ? server.port : server.tls_port); else return sdscatprintf(sdsempty(), "unixsocket:%s", server.unixsocket); @@ -7457,8 +7616,9 @@ static int serverSupervisedSystemd(void) { return 0; #else if (serverCommunicateSystemd("STATUS=Valkey is loading...\n") <= 0) return 0; - serverLog(LL_NOTICE, "Supervised by systemd. Please make sure you set appropriate values for TimeoutStartSec and " - "TimeoutStopSec in your service unit."); + serverLog(LL_NOTICE, + "Supervised by systemd. Please make sure you set appropriate values for TimeoutStartSec and " + "TimeoutStopSec in your service unit."); return 1; #endif } @@ -7488,8 +7648,8 @@ int serverIsSupervised(int mode) { } int iAmPrimary(void) { - return ((!server.cluster_enabled && server.primary_host == NULL) || - (server.cluster_enabled && clusterNodeIsPrimary(getMyClusterNode()))); + return ((!server.cluster_enabled && server.primary_host == NULL) + || (server.cluster_enabled && clusterNodeIsPrimary(getMyClusterNode()))); } /* Main is marked as weak so that unit tests can use their own main function. */ @@ -7628,8 +7788,8 @@ __attribute__((weak)) int main(int argc, char **argv) { /* Means that we only have one option name, like --port or "--port " */ handled_last_config_arg = 0; - if ((j != argc - 1) && argv[j + 1][0] == '-' && argv[j + 1][1] == '-' && - !strcasecmp(argv[j], "--save")) { + if ((j != argc - 1) && argv[j + 1][0] == '-' && argv[j + 1][1] == '-' + && !strcasecmp(argv[j], "--save")) { /* Special case: handle some things like `--save --config value`. * In this case, if next argument starts with `--`, we will reset * handled_last_config_arg flag and append an empty "" config value @@ -7644,8 +7804,8 @@ __attribute__((weak)) int main(int argc, char **argv) { * In this case, we append an empty "" config value to the options, * so it will become `--save ""` and will follow the same reset thing. */ options = sdscat(options, "\"\""); - } else if ((j != argc - 1) && argv[j + 1][0] == '-' && argv[j + 1][1] == '-' && - !strcasecmp(argv[j], "--sentinel")) { + } else if ((j != argc - 1) && argv[j + 1][0] == '-' && argv[j + 1][1] == '-' + && !strcasecmp(argv[j], "--sentinel")) { /* Special case: handle some things like `--sentinel --config value`. * It is a pseudo config option with no value. In this case, if next * argument starts with `--`, we will reset handled_last_config_arg flag. @@ -7710,9 +7870,10 @@ __attribute__((weak)) int main(int argc, char **argv) { "Failed to test the kernel for a bug that could lead to data corruption during background save. " "Your system could be affected, please report this error."); if (!checkIgnoreWarning("ARM64-COW-BUG")) { - serverLog(LL_WARNING, "Valkey will now exit to prevent data corruption. " - "Note that it is possible to suppress this warning by setting the following config: " - "ignore-warnings ARM64-COW-BUG"); + serverLog(LL_WARNING, + "Valkey will now exit to prevent data corruption. " + "Note that it is possible to suppress this warning by setting the following config: " + "ignore-warnings ARM64-COW-BUG"); exit(1); } } @@ -7730,8 +7891,13 @@ __attribute__((weak)) int main(int argc, char **argv) { } serverLog(LL_NOTICE, "oO0OoO0OoO0Oo Valkey is starting oO0OoO0OoO0Oo"); - serverLog(LL_NOTICE, "Valkey version=%s, bits=%d, commit=%s, modified=%d, pid=%d, just started", VALKEY_VERSION, - (sizeof(long) == 8) ? 64 : 32, serverGitSHA1(), strtol(serverGitDirty(), NULL, 10) > 0, (int)getpid()); + serverLog(LL_NOTICE, + "Valkey version=%s, bits=%d, commit=%s, modified=%d, pid=%d, just started", + VALKEY_VERSION, + (sizeof(long) == 8) ? 64 : 32, + serverGitSHA1(), + strtol(serverGitDirty(), NULL, 10) > 0, + (int)getpid()); if (argc == 1) { serverLog(LL_WARNING, @@ -7799,8 +7965,8 @@ __attribute__((weak)) int main(int argc, char **argv) { if (!server.primary_host) { serverCommunicateSystemd("STATUS=Ready to accept connections\n"); } else { - serverCommunicateSystemd( - "STATUS=Ready to accept connections in read-only mode. Waiting for MASTER <-> REPLICA sync\n"); + serverCommunicateSystemd("STATUS=Ready to accept connections in read-only mode. Waiting for MASTER <-> " + "REPLICA sync\n"); } serverCommunicateSystemd("READY=1\n"); } @@ -7850,7 +8016,15 @@ __attribute__((weak)) int main(int argc, char **argv) { * start_idx provides a way to start scanning from a specific index. * max_args provides a way to limit the scan to a specific range of arguments. */ -int parseExtendedCommandArgumentsOrReply(client *c, int command_type, int start_idx, int max_args, int *flags, int *unit, int *expire_idx, robj **expire, robj **compare_val) { +int parseExtendedCommandArgumentsOrReply(client *c, + int command_type, + int start_idx, + int max_args, + int *flags, + int *unit, + int *expire_idx, + robj **expire, + robj **compare_val) { int j = start_idx; if (expire_idx) *expire_idx = -1; for (; j < max_args; j++) { diff --git a/src/socket.c b/src/socket.c index c9f9cae046e..b0722c29df8 100644 --- a/src/socket.c +++ b/src/socket.c @@ -157,8 +157,8 @@ static void connSocketClose(connection *conn) { static int connSocketWrite(connection *conn, const void *data, size_t data_len) { /* Assert the main thread is not writing to a connection that is currently offloaded. */ - debugServerAssert(!(conn->flags & CONN_FLAG_ALLOW_ACCEPT_OFFLOAD) || !inMainThread() || - ((client *)connGetPrivateData(conn))->io_write_state != CLIENT_PENDING_IO); + debugServerAssert(!(conn->flags & CONN_FLAG_ALLOW_ACCEPT_OFFLOAD) || !inMainThread() + || ((client *)connGetPrivateData(conn))->io_write_state != CLIENT_PENDING_IO); int ret = write(conn->fd, data, data_len); if (ret < 0 && errno != EAGAIN) { @@ -189,8 +189,8 @@ static int connSocketWritev(connection *conn, const struct iovec *iov, int iovcn static int connSocketRead(connection *conn, void *buf, size_t buf_len) { /* Assert the main thread is not reading from a connection that is currently offloaded. */ - debugServerAssert(!(conn->flags & CONN_FLAG_ALLOW_ACCEPT_OFFLOAD) || !inMainThread() || - ((client *)connGetPrivateData(conn))->io_read_state != CLIENT_PENDING_IO); + debugServerAssert(!(conn->flags & CONN_FLAG_ALLOW_ACCEPT_OFFLOAD) || !inMainThread() + || ((client *)connGetPrivateData(conn))->io_read_state != CLIENT_PENDING_IO); int ret = read(conn->fd, buf, buf_len); diff --git a/src/sort.c b/src/sort.c index 2d247049ce7..44a6e15799a 100644 --- a/src/sort.c +++ b/src/sort.c @@ -226,8 +226,8 @@ void sortCommandGeneric(client *c, int readonly) { } else if (!strcasecmp(objectGetVal(c->argv[j]), "alpha")) { alpha = 1; } else if (!strcasecmp(objectGetVal(c->argv[j]), "limit") && leftargs >= 2) { - if ((getLongFromObjectOrReply(c, c->argv[j + 1], &limit_start, NULL) != C_OK) || - (getLongFromObjectOrReply(c, c->argv[j + 2], &limit_count, NULL) != C_OK)) { + if ((getLongFromObjectOrReply(c, c->argv[j + 1], &limit_start, NULL) != C_OK) + || (getLongFromObjectOrReply(c, c->argv[j + 2], &limit_count, NULL) != C_OK)) { syntax_error++; break; } @@ -245,10 +245,12 @@ void sortCommandGeneric(client *c, int readonly) { /* If BY is specified with a real pattern, we can't accept it in cluster mode, * unless we can make sure the keys formed by the pattern are in the same slot * as the key to sort. */ - if (server.cluster_enabled && - patternHashSlot(objectGetVal(sortby), sdslen(objectGetVal(sortby))) != getKeySlot(objectGetVal(c->argv[1]))) { - addReplyError(c, "BY option of SORT denied in Cluster mode when " - "keys formed by the pattern may be in different slots."); + if (server.cluster_enabled + && patternHashSlot(objectGetVal(sortby), sdslen(objectGetVal(sortby))) + != getKeySlot(objectGetVal(c->argv[1]))) { + addReplyError(c, + "BY option of SORT denied in Cluster mode when " + "keys formed by the pattern may be in different slots."); syntax_error++; break; } @@ -265,11 +267,12 @@ void sortCommandGeneric(client *c, int readonly) { /* If GET is specified with a real pattern, we can't accept it in cluster mode, * unless we can make sure the keys formed by the pattern are in the same slot * as the key to sort. */ - if (server.cluster_enabled && - !isReturnSubstPattern(objectGetVal(c->argv[j + 1])) && - patternHashSlot(objectGetVal(c->argv[j + 1]), sdslen(objectGetVal(c->argv[j + 1]))) != getKeySlot(objectGetVal(c->argv[1]))) { - addReplyError(c, "GET option of SORT denied in Cluster mode when " - "keys formed by the pattern may be in different slots."); + if (server.cluster_enabled && !isReturnSubstPattern(objectGetVal(c->argv[j + 1])) + && patternHashSlot(objectGetVal(c->argv[j + 1]), sdslen(objectGetVal(c->argv[j + 1]))) + != getKeySlot(objectGetVal(c->argv[1]))) { + addReplyError(c, + "GET option of SORT denied in Cluster mode when " + "keys formed by the pattern may be in different slots."); syntax_error++; break; } @@ -374,7 +377,8 @@ void sortCommandGeneric(client *c, int readonly) { if (end >= start) { listTypeIterator *li; listTypeEntry entry; - li = listTypeInitIterator(sortval, desc ? (long)(listTypeLength(sortval) - start - 1) : start, + li = listTypeInitIterator(sortval, + desc ? (long)(listTypeLength(sortval) - start - 1) : start, desc ? LIST_HEAD : LIST_TAIL); while (j < vectorlen && listTypeNext(li, &entry)) { diff --git a/src/syscheck.c b/src/syscheck.c index d66e7f0e195..8579ee3a87a 100644 --- a/src/syscheck.c +++ b/src/syscheck.c @@ -90,10 +90,10 @@ static int checkClocksource(sds *error_msg) { } if (getrusage(RUSAGE_SELF, &ru_end) != 0) return 0; - long long stime_us = (ru_end.ru_stime.tv_sec * 1000000 + ru_end.ru_stime.tv_usec) - - (ru_start.ru_stime.tv_sec * 1000000 + ru_start.ru_stime.tv_usec); - long long utime_us = (ru_end.ru_utime.tv_sec * 1000000 + ru_end.ru_utime.tv_usec) - - (ru_start.ru_utime.tv_sec * 1000000 + ru_start.ru_utime.tv_usec); + long long stime_us = (ru_end.ru_stime.tv_sec * 1000000 + ru_end.ru_stime.tv_usec) + - (ru_start.ru_stime.tv_sec * 1000000 + ru_start.ru_stime.tv_usec); + long long utime_us = (ru_end.ru_utime.tv_sec * 1000000 + ru_end.ru_utime.tv_usec) + - (ru_start.ru_utime.tv_sec * 1000000 + ru_start.ru_utime.tv_usec); /* If more than 10% of the process time was in system calls we probably have an inefficient clocksource, print a * warning */ @@ -108,7 +108,8 @@ static int checkClocksource(sds *error_msg) { "/sys/devices/system/clocksource/clocksource0/current_clocksource' as root. " "To permanently change the system's clocksource you'll need to set the " "'clocksource=' kernel command line parameter.", - curr ? curr : "", avail ? avail : ""); + curr ? curr : "", + avail ? avail : ""); sdsfree(avail); sdsfree(curr); return -1; @@ -181,12 +182,12 @@ int checkTHPEnabled(sds *error_msg) { fclose(fp); if (strstr(buf, "[always]") != NULL) { - *error_msg = sdsnew( - "You have Transparent Huge Pages (THP) support enabled in your kernel. " - "This will create latency and memory usage issues with Valkey. " - "To fix this issue run the command 'echo madvise > /sys/kernel/mm/transparent_hugepage/enabled' as root, " - "and add it to your /etc/rc.local in order to retain the setting after a reboot. " - "Valkey must be restarted after THP is disabled (set to 'madvise' or 'never')."); + *error_msg = sdsnew("You have Transparent Huge Pages (THP) support enabled in your kernel. " + "This will create latency and memory usage issues with Valkey. " + "To fix this issue run the command 'echo madvise > " + "/sys/kernel/mm/transparent_hugepage/enabled' as root, " + "and add it to your /etc/rc.local in order to retain the setting after a reboot. " + "Valkey must be restarted after THP is disabled (set to 'madvise' or 'never')."); return -1; } else { return 1; diff --git a/src/t_hash.c b/src/t_hash.c index 889b66709b7..5a8b2d7bc9d 100644 --- a/src/t_hash.c +++ b/src/t_hash.c @@ -45,11 +45,17 @@ /* enumeration of all the possible return values of commands manipulating fields expiration. */ typedef enum { /* SDS aux flag. If set, it indicates that the entry has TTL metadata set. */ - EXPIRATION_MODIFICATION_NOT_EXIST = -2, /* in case the provided object is NULL or the specific field was not found */ - EXPIRATION_MODIFICATION_SUCCESSFUL = 1, /* if the expiration time was applied or modified */ - EXPIRATION_MODIFICATION_FAILED_CONDITION = 0, /* if the some predefined conditions (e.g hexpire conditional flags) has not been met */ - EXPIRATION_MODIFICATION_FAILED = -1, /* if apply of the expiration modification failed (e.g hpersist on item without expiration) */ - EXPIRATION_MODIFICATION_EXPIRE_ASAP = 2, /* if apply of the expiration modification was set to a time in the past (i.e field is immediately expired) */ + + /* In case the provided object is NULL or the specific field was not found */ + EXPIRATION_MODIFICATION_NOT_EXIST = -2, + /* If the expiration time was applied or modified */ + EXPIRATION_MODIFICATION_SUCCESSFUL = 1, + /* If some predefined conditions (e.g hexpire conditional flags) have not been met */ + EXPIRATION_MODIFICATION_FAILED_CONDITION = 0, + /* If apply of the expiration modification failed (e.g hpersist on item without expiration) */ + EXPIRATION_MODIFICATION_FAILED = -1, + /* If apply of the expiration modification was set to a time in the past (i.e field is immediately expired) */ + EXPIRATION_MODIFICATION_EXPIRE_ASAP = 2, } expiryModificationResult; // A vsetGetExpiryFunc @@ -72,8 +78,7 @@ bool hashTypeHasVolatileFields(robj *o) { serverAssert(o->type == OBJ_HASH); if (o->encoding == OBJ_ENCODING_HASHTABLE) { vset *set = hashTypeGetVolatileSet(o); - if (set && !vsetIsEmpty(set)) - return true; + if (set && !vsetIsEmpty(set)) return true; } return false; } @@ -129,12 +134,15 @@ static void hashTypeUntrackEntry(robj *o, entry *entry) { } } -static void hashTypeTrackUpdateEntry(robj *o, entry *old_entry, entry *new_entry, mstime_t old_expiry, mstime_t new_expiry) { +static void hashTypeTrackUpdateEntry(robj *o, + entry *old_entry, + entry *new_entry, + mstime_t old_expiry, + mstime_t new_expiry) { int old_tracked = (old_entry && old_expiry != EXPIRY_NONE); int new_tracked = (new_entry && new_expiry != EXPIRY_NONE); /* If entry was not tracked before and not going to be tracked now, we can simply return */ - if (!old_tracked && !new_tracked) - return; + if (!old_tracked && !new_tracked) return; vset *set = hashTypeGetOrcreateVolatileSet(o); debugServerAssert(!old_tracked || !vsetIsEmpty(set)); @@ -372,7 +380,8 @@ int hashTypeSet(robj *o, sds field, sds value, mstime_t expiry, int flags, bool * This is needed for HINCRBY* case since in other commands this is handled early by * hashTypeTryConversion, so this check will be a NOP. */ if (o->encoding == OBJ_ENCODING_LISTPACK) { - if (expiry != EXPIRY_NONE || sdslen(field) > server.hash_max_listpack_value || sdslen(value) > server.hash_max_listpack_value) + if (expiry != EXPIRY_NONE || sdslen(field) > server.hash_max_listpack_value + || sdslen(value) > server.hash_max_listpack_value) hashTypeConvert(o, OBJ_ENCODING_HASHTABLE); } @@ -556,8 +565,7 @@ static expiryModificationResult hashTypePersist(robj *o, sds field) { if (o == NULL || o->type != OBJ_HASH) return EXPIRATION_MODIFICATION_NOT_EXIST; if (o->encoding == OBJ_ENCODING_LISTPACK) { - if (hashTypeExists(o, field)) - /* When listpack representation is used, All items are without expiry */ + if (hashTypeExists(o, field)) /* When listpack representation is used, All items are without expiry */ return EXPIRATION_MODIFICATION_FAILED; else return EXPIRATION_MODIFICATION_NOT_EXIST; // Did not find any element return -2 @@ -614,13 +622,9 @@ bool hashTypeDelete(robj *o, sds field) { /* Return the number of elements in a hash. */ unsigned long hashTypeLength(const robj *o) { switch (o->encoding) { - case OBJ_ENCODING_LISTPACK: - return lpLength(objectGetVal(o)) / 2; - case OBJ_ENCODING_HASHTABLE: - return hashtableSize((const hashtable *)objectGetVal(o)); - default: - serverPanic("Unknown hash encoding"); - return ULONG_MAX; + case OBJ_ENCODING_LISTPACK: return lpLength(objectGetVal(o)) / 2; + case OBJ_ENCODING_HASHTABLE: return hashtableSize((const hashtable *)objectGetVal(o)); + default: serverPanic("Unknown hash encoding"); return ULONG_MAX; } } @@ -790,7 +794,10 @@ void hashTypeConvertListpack(robj *o, int enc) { if (!hashtableAdd(ht, entry)) { entryFree(entry); hashTypeResetIterator(&hi); /* Needed for gcc ASAN */ - serverLogHexDump(LL_WARNING, "listpack with dup elements dump", objectGetVal(o), lpBytes(objectGetVal(o))); + serverLogHexDump(LL_WARNING, + "listpack with dup elements dump", + objectGetVal(o), + lpBytes(objectGetVal(o))); serverPanic("Listpack corruption detected"); } } @@ -848,8 +855,7 @@ robj *hashTypeDup(robj *o) { sds value = sdsnewlen(value_str, len); entry *entry = entryCreate(field, value, expiry); hashtableAdd(ht, entry); - if (expiry != EXPIRY_NONE) - hashTypeTrackEntry(hobj, entry); + if (expiry != EXPIRY_NONE) hashTypeTrackEntry(hobj, entry); } hashTypeResetIterator(&hi); } else { @@ -937,8 +943,8 @@ void hincrbyCommand(client *c) { } oldvalue = value; - if ((incr < 0 && oldvalue < 0 && incr < (LLONG_MIN - oldvalue)) || - (incr > 0 && oldvalue > 0 && incr > (LLONG_MAX - oldvalue))) { + if ((incr < 0 && oldvalue < 0 && incr < (LLONG_MIN - oldvalue)) + || (incr > 0 && oldvalue > 0 && incr > (LLONG_MAX - oldvalue))) { addReplyError(c, "increment or decrement would overflow"); return; } @@ -972,7 +978,8 @@ void hincrbyCommand(client *c) { rewriteClientCommandArgument(c, 3, newobj); decrRefCount(newobj); } else { - int new_argc = 8; /* HSETEX(1) + key(2) + PXAT(3) + unix-time-milliseconds(4) + FIELDS(5) + numfields(6) + field(7) + value(8) */ + /* HSETEX(1) + key(2) + PXAT(3) + unix-time-milliseconds(4) + FIELDS(5) + numfields(6) + field(7) + value(8) */ + int new_argc = 8; robj **new_argv = zmalloc(sizeof(robj *) * (8)); robj *milliseconds_obj = createStringObjectFromLongLong(expiry); new_argv[0] = shared.hsetex; @@ -1055,7 +1062,8 @@ void hincrbyfloatCommand(client *c) { rewriteClientCommandArgument(c, 3, newobj); decrRefCount(newobj); } else { - int new_argc = 8; /* HSETEX(1) + key(2) + PXAT(3) + unix-time-milliseconds(4) + FIELDS(5) + numfields(6) + field(7) + value(8) */ + /* HSETEX(1) + key(2) + PXAT(3) + unix-time-milliseconds(4) + FIELDS(5) + numfields(6) + field(7) + value(8) */ + int new_argc = 8; robj **new_argv = zmalloc(sizeof(robj *) * (8)); robj *milliseconds_obj = createStringObjectFromLongLong(expiry); new_argv[0] = shared.hsetex; @@ -1252,7 +1260,12 @@ void hsetnxCommand(client *c) { } else { hashTypeTryConversion(o, c->argv, 2, 3); bool has_volatile_fields = hashTypeHasVolatileFields(o), expired_overwritten = false; - hashTypeSet(o, objectGetVal(c->argv[2]), objectGetVal(c->argv[3]), EXPIRY_NONE, HASH_SET_COPY, &expired_overwritten); + hashTypeSet(o, + objectGetVal(c->argv[2]), + objectGetVal(c->argv[3]), + EXPIRY_NONE, + HASH_SET_COPY, + &expired_overwritten); if (has_volatile_fields != hashTypeHasVolatileFields(o)) { dbUpdateObjectWithVolatileItemsTracking(c->db, o); } @@ -1288,7 +1301,12 @@ void hsetCommand(client *c) { int expired_overwritten = 0; for (i = 2; i < c->argc; i += 2) { bool expired = false; - created += !hashTypeSet(o, objectGetVal(c->argv[i]), objectGetVal(c->argv[i + 1]), EXPIRY_NONE, HASH_SET_COPY, &expired); + created += !hashTypeSet(o, + objectGetVal(c->argv[i]), + objectGetVal(c->argv[i + 1]), + EXPIRY_NONE, + HASH_SET_COPY, + &expired); /* NOTE - We do not need to track all expired items which are overitten in order to propagate them, since the replica will surely just override them * we just need to remember that we had such items to report the keyspace notification and update the stats */ if (expired) expired_overwritten++; @@ -1381,7 +1399,17 @@ void hsetexCommand(client *c) { for (; fields_index < c->argc - 1; fields_index++) { if (!strcasecmp(objectGetVal(c->argv[fields_index]), "fields")) { /* checking optional flags */ - if (parseExtendedCommandArgumentsOrReply(c, COMMAND_HSET, 2, fields_index++, &flags, &unit, NULL, &expire, &comparison) != C_OK) return; + if (parseExtendedCommandArgumentsOrReply(c, + COMMAND_HSET, + 2, + fields_index++, + &flags, + &unit, + NULL, + &expire, + &comparison) + != C_OK) + return; if (getLongLongFromObjectOrReply(c, c->argv[fields_index++], &num_fields, NULL) != C_OK) return; break; } @@ -1393,16 +1421,14 @@ void hsetexCommand(client *c) { } o = lookupKeyWrite(c->db, c->argv[1]); - if (checkType(c, o, OBJ_HASH)) - return; + if (checkType(c, o, OBJ_HASH)) return; if (flags & (ARGS_SET_NX | ARGS_SET_XX | ARGS_SET_FNX | ARGS_SET_FXX | ARGS_EX | ARGS_PX | ARGS_EXAT)) { need_rewrite_argv = 1; } /* Check NX/XX key-level conditions before creating a new object */ - if (((flags & ARGS_SET_NX) && o != NULL) || - ((flags & ARGS_SET_XX) && o == NULL)) { + if (((flags & ARGS_SET_NX) && o != NULL) || ((flags & ARGS_SET_XX) && o == NULL)) { addReply(c, shared.czero); return; } @@ -1413,8 +1439,7 @@ void hsetexCommand(client *c) { else if (expire) { mstime_t basetime = (flags & (ARGS_EXAT | ARGS_PXAT)) ? 0 : commandTimeSnapshot(); - if (convertExpireArgumentToUnixTime(c, expire, basetime, unit, &when) == C_ERR) - return; + if (convertExpireArgumentToUnixTime(c, expire, basetime, unit, &when) == C_ERR) return; if (checkAlreadyExpired(when)) { need_rewrite_argv = 1; @@ -1427,8 +1452,8 @@ void hsetexCommand(client *c) { if (o) { /* Key exists: check fields normally */ for (i = fields_index; i < c->argc; i += 2) { - if (((flags & ARGS_SET_FNX) && hashTypeExists(o, objectGetVal(c->argv[i]))) || - ((flags & ARGS_SET_FXX) && !hashTypeExists(o, objectGetVal(c->argv[i])))) { + if (((flags & ARGS_SET_FNX) && hashTypeExists(o, objectGetVal(c->argv[i]))) + || ((flags & ARGS_SET_FXX) && !hashTypeExists(o, objectGetVal(c->argv[i])))) { addReply(c, shared.czero); return; } @@ -1465,10 +1490,8 @@ void hsetexCommand(client *c) { new_argv = zmalloc(sizeof(robj *) * c->argc); // Copy optional args (skip NX/XX/FNX/FXX) for (int i = 0; i < fields_index; i++) { - if (strcasecmp(objectGetVal(c->argv[i]), "NX") && - strcasecmp(objectGetVal(c->argv[i]), "XX") && - strcasecmp(objectGetVal(c->argv[i]), "FNX") && - strcasecmp(objectGetVal(c->argv[i]), "FXX")) { + if (strcasecmp(objectGetVal(c->argv[i]), "NX") && strcasecmp(objectGetVal(c->argv[i]), "XX") + && strcasecmp(objectGetVal(c->argv[i]), "FNX") && strcasecmp(objectGetVal(c->argv[i]), "FXX")) { /* Propagate as HSETEX Key Value PXAT millisecond-timestamp if there is * EX/PX/EXAT flag. */ if (expire && !(flags & ARGS_PXAT) && c->argv[i + 1] == expire) { @@ -1540,8 +1563,7 @@ void hsetexCommand(client *c) { /* Propagate individual fields deletions */ int idx = 0; while (idx < expired_overwritten) { - idx += propagateFieldsDeletion(c->db, o, expired_overwritten - idx, - &keepttl_fields[idx], c->slot); + idx += propagateFieldsDeletion(c->db, o, expired_overwritten - idx, &keepttl_fields[idx], c->slot); } zfree(keepttl_fields); keepttl_fields = NULL; @@ -1556,8 +1578,7 @@ void hsetexCommand(client *c) { server.dirty += changes; } else { /* If no changes were done we still need to free the new argv array and the refcount of the first argument. */ - if (set_expired) - decrRefCount(c->argv[1]); + if (set_expired) decrRefCount(c->argv[1]); if (new_argv) zfree(new_argv); } @@ -1640,7 +1661,17 @@ void hgetexCommand(client *c) { for (; fields_index < c->argc - 1; fields_index++) { if (!strcasecmp(objectGetVal(c->argv[fields_index]), "fields")) { /* checking optional flags */ - if (parseExtendedCommandArgumentsOrReply(c, COMMAND_HGET, 2, fields_index++, &flags, &unit, NULL, &expire, &comparison) != C_OK) return; + if (parseExtendedCommandArgumentsOrReply(c, + COMMAND_HGET, + 2, + fields_index++, + &flags, + &unit, + NULL, + &expire, + &comparison) + != C_OK) + return; if (getLongLongFromObjectOrReply(c, c->argv[fields_index++], &num_fields, NULL) != C_OK) return; break; } @@ -1665,8 +1696,7 @@ void hgetexCommand(client *c) { } else if (expire) { mstime_t basetime = (flags & (ARGS_EXAT | ARGS_PXAT)) ? 0 : commandTimeSnapshot(); - if (convertExpireArgumentToUnixTime(c, expire, basetime, unit, &when) == C_ERR) - return; + if (convertExpireArgumentToUnixTime(c, expire, basetime, unit, &when) == C_ERR) return; if (checkAlreadyExpired(when)) { set_expired = 1; @@ -1829,7 +1859,10 @@ void hscanCommand(client *c) { scanGenericCommand(c, o, cursor); } -static void hrandfieldReplyWithListpack(writePreparedClient *wpc, unsigned int count, listpackEntry *fields, listpackEntry *vals) { +static void hrandfieldReplyWithListpack(writePreparedClient *wpc, + unsigned int count, + listpackEntry *fields, + listpackEntry *vals) { client *c = (client *)wpc; for (unsigned long i = 0; i < count; i++) { if (vals && c->resp > 2) addWritePreparedReplyArrayLen(wpc, 2); @@ -1907,8 +1940,7 @@ void hexpireGenericCommand(client *c, mstime_t basetime, int unit) { return; } - if (convertExpireArgumentToUnixTime(c, param, basetime, unit, &when) == C_ERR) - return; + if (convertExpireArgumentToUnixTime(c, param, basetime, unit, &when) == C_ERR) return; robj *obj = lookupKeyWrite(c->db, key); @@ -2028,8 +2060,7 @@ void hpersistCommand(client *c) { } robj *hash = lookupKeyWrite(c->db, c->argv[1]); - if (checkType(c, hash, OBJ_HASH)) - return; + if (checkType(c, hash, OBJ_HASH)) return; initDeferredReplyBuffer(c); @@ -2182,8 +2213,7 @@ void hrandfieldWithCountCommand(client *c, long l, int withvalues) { /* In case we were unable to locate random element, it is probably because there is no such element * since all elements are expired. */ - if (hashTypeRandomElement(hash, size, &field, &value) != C_OK) - break; + if (hashTypeRandomElement(hash, size, &field, &value) != C_OK) break; if (withvalues && c->resp > 2) addWritePreparedReplyArrayLen(wpc, 2); addWritePreparedReplyBulkCBuffer(wpc, field.sval, field.slen); @@ -2313,8 +2343,7 @@ void hrandfieldWithCountCommand(client *c, long l, int withvalues) { while (added < count) { /* In case we were unable to locate random element, it is probably because there is no such element * since all elements are expired. */ - if (hashTypeRandomElement(hash, size, &field, withvalues ? &value : NULL) != C_OK) - break; + if (hashTypeRandomElement(hash, size, &field, withvalues ? &value : NULL) != C_OK) break; /* Try to add the object to the hashtable. If expired, stop adding (there are probably non left). * If it already exists free it, otherwise increment the number of objects we have @@ -2397,8 +2426,7 @@ static int hashTypeExpireEntry(void *entry, void *c) { void *entry_ptr = NULL; bool deleted = hashtablePop(ht, entry, &entry_ptr); if (deleted) { - if (ctx->fields) - ctx->fields[ctx->n_fields++] = createStringObjectFromSds(entryGetField(entry)); + if (ctx->fields) ctx->fields[ctx->n_fields++] = createStringObjectFromSds(entryGetField(entry)); server.stat_expiredfields++; entryFree(entry); return 1; @@ -2475,7 +2503,10 @@ size_t hashTypeScanDefrag(robj *ob, size_t cursor, void *(*defragAllocfn)(void * if (!vset_cursor->is_vsetDefrag) { hashtable *ht = objectGetVal(ob); - vset_cursor->cursor = hashtableScanDefrag(ht, vset_cursor->cursor, defragHashTypeEntry, ob, + vset_cursor->cursor = hashtableScanDefrag(ht, + vset_cursor->cursor, + defragHashTypeEntry, + ob, defragAllocfn, HASHTABLE_SCAN_EMIT_REF); if (vset_cursor->cursor == 0) { diff --git a/src/t_list.c b/src/t_list.c index c705f8e81f7..3fdd33fdcb8 100644 --- a/src/t_list.c +++ b/src/t_list.c @@ -53,7 +53,8 @@ static void listTypeTryConvertListpack(robj *o, robj **argv, int start, int end, add_length = end - start + 1; } - if (quicklistNodeExceedsLimit(server.list_max_listpack_size, lpBytes(objectGetVal(o)) + add_bytes, + if (quicklistNodeExceedsLimit(server.list_max_listpack_size, + lpBytes(objectGetVal(o)) + add_bytes, lpLength(objectGetVal(o)) + add_length)) { /* Invoke callback before conversion. */ if (fn) fn(data); @@ -123,8 +124,13 @@ static void listTypeTryConvertQuicklist(robj *o, int shrinking, beforeConvertCB * wanna consider converting from quicklist to listpack. When we * know we're shrinking, we use a lower (more strict) threshold in * order to avoid repeated conversions on every list change. */ -static void -listTypeTryConversionRaw(robj *o, list_conv_type lct, robj **argv, int start, int end, beforeConvertCB fn, void *data) { +static void listTypeTryConversionRaw(robj *o, + list_conv_type lct, + robj **argv, + int start, + int end, + beforeConvertCB fn, + void *data) { if (o->encoding == OBJ_ENCODING_QUICKLIST) { if (lct == LIST_CONV_GROWING) return; /* Growing has nothing to do with quicklist */ listTypeTryConvertQuicklist(o, lct == LIST_CONV_SHRINKING, fn, data); @@ -169,8 +175,9 @@ void listTypePush(robj *subject, robj *value, int where) { new_val = (where == LIST_HEAD) ? lpPrependInteger(objectGetVal(subject), (long)objectGetVal(value)) : lpAppendInteger(objectGetVal(subject), (long)objectGetVal(value)); } else { - new_val = (where == LIST_HEAD) ? lpPrepend(objectGetVal(subject), objectGetVal(value), sdslen(objectGetVal(value))) - : lpAppend(objectGetVal(subject), objectGetVal(value), sdslen(objectGetVal(value))); + new_val = (where == LIST_HEAD) + ? lpPrepend(objectGetVal(subject), objectGetVal(value), sdslen(objectGetVal(value))) + : lpAppend(objectGetVal(subject), objectGetVal(value), sdslen(objectGetVal(value))); } objectSetVal(subject, new_val); } else { @@ -276,8 +283,8 @@ int listTypeNext(listTypeIterator *li, listTypeEntry *entry) { } else if (li->encoding == OBJ_ENCODING_LISTPACK) { entry->lpe = li->lpi; if (entry->lpe != NULL) { - li->lpi = - (li->direction == LIST_TAIL) ? lpNext(objectGetVal(li->subject), li->lpi) : lpPrev(objectGetVal(li->subject), li->lpi); + li->lpi = (li->direction == LIST_TAIL) ? lpNext(objectGetVal(li->subject), li->lpi) + : lpPrev(objectGetVal(li->subject), li->lpi); return 1; } } else { @@ -336,7 +343,8 @@ void listTypeInsert(listTypeEntry *entry, robj *value, int where) { } } else if (entry->li->encoding == OBJ_ENCODING_LISTPACK) { int lpw = (where == LIST_TAIL) ? LP_AFTER : LP_BEFORE; - objectSetVal(subject, lpInsertString(objectGetVal(subject), (unsigned char *)str, len, entry->lpe, lpw, &entry->lpe)); + objectSetVal(subject, + lpInsertString(objectGetVal(subject), (unsigned char *)str, len, entry->lpe, lpw, &entry->lpe)); } else { serverPanic("Unknown list encoding"); } @@ -855,8 +863,8 @@ void lrangeCommand(client *c) { robj *o; long start, end; - if ((getLongFromObjectOrReply(c, c->argv[2], &start, NULL) != C_OK) || - (getLongFromObjectOrReply(c, c->argv[3], &end, NULL) != C_OK)) + if ((getLongFromObjectOrReply(c, c->argv[2], &start, NULL) != C_OK) + || (getLongFromObjectOrReply(c, c->argv[3], &end, NULL) != C_OK)) return; if ((o = lookupKeyReadOrReply(c, c->argv[1], shared.emptyarray)) == NULL || checkType(c, o, OBJ_LIST)) return; @@ -869,8 +877,8 @@ void ltrimCommand(client *c) { robj *o; long start, end, llen, ltrim, rtrim; - if ((getLongFromObjectOrReply(c, c->argv[2], &start, NULL) != C_OK) || - (getLongFromObjectOrReply(c, c->argv[3], &end, NULL) != C_OK)) + if ((getLongFromObjectOrReply(c, c->argv[2], &start, NULL) != C_OK) + || (getLongFromObjectOrReply(c, c->argv[3], &end, NULL) != C_OK)) return; if ((o = lookupKeyWriteOrReply(c, c->argv[1], shared.ok)) == NULL || checkType(c, o, OBJ_LIST)) return; @@ -949,9 +957,10 @@ void lposCommand(client *c) { j++; if (getRangeLongFromObjectOrReply(c, c->argv[j], -LONG_MAX, LONG_MAX, &rank, NULL) != C_OK) return; if (rank == 0) { - addReplyError(c, "RANK can't be zero: use 1 to start from " - "the first match, 2 from the second ... " - "or use negative to start from the end of the list"); + addReplyError(c, + "RANK can't be zero: use 1 to start from " + "the first match, 2 from the second ... " + "or use negative to start from the end of the list"); return; } } else if (!strcasecmp(opt, "COUNT") && moreargs) { @@ -1282,8 +1291,13 @@ void lmpopGenericCommand(client *c, int numkeys_idx, int is_block) { long count = -1; /* Reply will consist of up to count elements, depending on the list's length. */ /* Parse the numkeys. */ - if (getRangeLongFromObjectOrReply(c, c->argv[numkeys_idx], 1, LONG_MAX, &numkeys, - "numkeys should be greater than 0") != C_OK) + if (getRangeLongFromObjectOrReply(c, + c->argv[numkeys_idx], + 1, + LONG_MAX, + &numkeys, + "numkeys should be greater than 0") + != C_OK) return; /* Parse the where. where_idx: the index of where in the c->argv. */ @@ -1301,8 +1315,8 @@ void lmpopGenericCommand(client *c, int numkeys_idx, int is_block) { if (count == -1 && !strcasecmp(opt, "COUNT") && moreargs) { j++; - if (getRangeLongFromObjectOrReply(c, c->argv[j], 1, LONG_MAX, &count, "count should be greater than 0") != - C_OK) + if (getRangeLongFromObjectOrReply(c, c->argv[j], 1, LONG_MAX, &count, "count should be greater than 0") + != C_OK) return; } else { addReplyErrorObject(c, shared.syntaxerr); diff --git a/src/t_set.c b/src/t_set.c index 32f86e710a9..fc9cda9220e 100644 --- a/src/t_set.c +++ b/src/t_set.c @@ -63,8 +63,8 @@ robj *setTypeCreate(sds value, size_t size_hint) { /* Check if the existing set should be converted to another encoding based off the * the size hint. */ void setTypeMaybeConvert(robj *set, size_t size_hint) { - if ((set->encoding == OBJ_ENCODING_LISTPACK && size_hint > server.set_max_listpack_entries) || - (set->encoding == OBJ_ENCODING_INTSET && size_hint > server.set_max_intset_entries)) { + if ((set->encoding == OBJ_ENCODING_LISTPACK && size_hint > server.set_max_listpack_entries) + || (set->encoding == OBJ_ENCODING_INTSET && size_hint > server.set_max_intset_entries)) { setTypeConvertAndExpand(set, OBJ_ENCODING_HASHTABLE, size_hint, 1); } } @@ -161,8 +161,8 @@ int setTypeAddAux(robj *set, char *str, size_t len, int64_t llval, int str_is_sd if (p != NULL) p = lpFind(lp, p, (unsigned char *)str, len, 0); if (p == NULL) { /* Not found. */ - if (lpLength(lp) < server.set_max_listpack_entries && len <= server.set_max_listpack_value && - lpSafeToAdd(lp, len)) { + if (lpLength(lp) < server.set_max_listpack_entries && len <= server.set_max_listpack_value + && lpSafeToAdd(lp, len)) { if (str == tmpbuf) { /* This came in as integer so we can avoid parsing it again. * TODO: Create and use lpFindInteger; don't go via string. */ @@ -199,9 +199,9 @@ int setTypeAddAux(robj *set, char *str, size_t len, int64_t llval, int str_is_sd size_t s2 = lpEstimateBytesRepeatedInteger(intsetMin(objectGetVal(set)), n); totsize = max(s1, s2); } - if (intsetLen((const intset *)objectGetVal(set)) < server.set_max_listpack_entries && - len <= server.set_max_listpack_value && maxelelen <= server.set_max_listpack_value && - lpSafeToAdd(NULL, totsize + len)) { + if (intsetLen((const intset *)objectGetVal(set)) < server.set_max_listpack_entries + && len <= server.set_max_listpack_value && maxelelen <= server.set_max_listpack_value + && lpSafeToAdd(NULL, totsize + len)) { /* In the "safe to add" check above we assumed all elements in * the intset are of size maxelelen. This is an upper bound. */ setTypeConvertAndExpand(set, OBJ_ENCODING_LISTPACK, intsetLen(objectGetVal(set)) + 1, 1); @@ -1482,8 +1482,8 @@ void sunionDiffGenericCommand(client *c, robj **setkeys, int setnum, robj *dstke * If one of the set is OBJ_ENCODING_LISTPACK, let's set 'dstset' to hashtable default encoding, * the hashtable is more efficient when find and compare than the listpack. The corresponding * time complexity are O(1) vs O(n). */ - if (!dstkey && dstset_encoding == OBJ_ENCODING_INTSET && - (setobj->encoding == OBJ_ENCODING_LISTPACK || setobj->encoding == OBJ_ENCODING_HASHTABLE)) { + if (!dstkey && dstset_encoding == OBJ_ENCODING_INTSET + && (setobj->encoding == OBJ_ENCODING_LISTPACK || setobj->encoding == OBJ_ENCODING_HASHTABLE)) { dstset_encoding = OBJ_ENCODING_HASHTABLE; } sets[j] = setobj; diff --git a/src/t_stream.c b/src/t_stream.c index 9b26587e54e..6e6e1552a03 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -34,7 +34,7 @@ /* Every stream item inside the listpack, has a flags field that is used to * mark the entry as deleted, or having the same field as the "primary" * entry at the start of the listpack> */ -#define STREAM_ITEM_FLAG_NONE 0 /* No special flags. */ +#define STREAM_ITEM_FLAG_NONE 0 /* No special flags. */ #define STREAM_ITEM_FLAG_DELETED (1 << 0) /* Entry is deleted. Skip it. */ #define STREAM_ITEM_FLAG_SAMEFIELDS (1 << 1) /* Same fields as primary entry. */ @@ -231,7 +231,10 @@ robj *streamDup(robj *o) { new_consumer = zmalloc(sizeof(*new_consumer)); new_consumer->name = sdsdup(consumer->name); new_consumer->pel = raxNew(); - raxInsert(new_cg->consumers, (unsigned char *)new_consumer->name, sdslen(new_consumer->name), new_consumer, + raxInsert(new_cg->consumers, + (unsigned char *)new_consumer->name, + sdslen(new_consumer->name), + new_consumer, NULL); new_consumer->seen_time = consumer->seen_time; new_consumer->active_time = consumer->active_time; @@ -771,7 +774,7 @@ int64_t streamTrim(stream *s, streamAddTrimArgs *args) { int64_t primary_fields_count = lpGetInteger(p); p = lpNext(lp, p); /* Skip the first field. */ for (int64_t j = 0; j < primary_fields_count; j++) p = lpNext(lp, p); /* Skip all primary fields. */ - p = lpNext(lp, p); /* Skip the zero primary entry terminator. */ + p = lpNext(lp, p); /* Skip the zero primary entry terminator. */ /* 'p' is now pointing to the first entry inside the listpack. * We have to run entry after entry, marking entries as deleted @@ -1183,16 +1186,16 @@ int streamIteratorGetID(streamIterator *si, streamID *id, int64_t *numfields) { /* If current >= start, and the entry is not marked as * deleted or tombstones are included, emit it. */ if (!si->rev) { - if (streamCompareID(id, &si->start_id) >= 0 && - (!si->skip_tombstones || !(flags & STREAM_ITEM_FLAG_DELETED))) { + if (streamCompareID(id, &si->start_id) >= 0 + && (!si->skip_tombstones || !(flags & STREAM_ITEM_FLAG_DELETED))) { if (streamCompareID(id, &si->end_id) > 0) return 0; /* We are already out of range. */ si->entry_flags = flags; if (flags & STREAM_ITEM_FLAG_SAMEFIELDS) si->primary_fields_ptr = si->primary_fields_start; return 1; /* Valid item returned. */ } } else { - if (streamCompareID(id, &si->end_id) <= 0 && - (!si->skip_tombstones || !(flags & STREAM_ITEM_FLAG_DELETED))) { + if (streamCompareID(id, &si->end_id) <= 0 + && (!si->skip_tombstones || !(flags & STREAM_ITEM_FLAG_DELETED))) { if (streamCompareID(id, &si->start_id) < 0) return 0; /* We are already out of range. */ si->entry_flags = flags; if (flags & STREAM_ITEM_FLAG_SAMEFIELDS) si->primary_fields_ptr = si->primary_fields_start; @@ -1426,8 +1429,8 @@ int streamRangeHasTombstones(stream *s, streamID *start, streamID *end) { end_id.seq = UINT64_MAX; } - if (streamCompareID(&start_id, &s->max_deleted_entry_id) <= 0 && - streamCompareID(&s->max_deleted_entry_id, &end_id) <= 0) { + if (streamCompareID(&start_id, &s->max_deleted_entry_id) <= 0 + && streamCompareID(&s->max_deleted_entry_id, &end_id) <= 0) { /* start_id <= max_deleted_entry_id <= end_id: The range does include a tombstone. */ return 1; } @@ -1659,7 +1662,7 @@ void streamPropagateConsumerCreation(client *c, robj *key, robj *groupname, sds * PEL by ID) to the client. This is the use case for the STREAM_RWR_RAWENTRIES * flag. */ -#define STREAM_RWR_NOACK (1 << 0) /* Do not create entries in the PEL. */ +#define STREAM_RWR_NOACK (1 << 0) /* Do not create entries in the PEL. */ #define STREAM_RWR_RAWENTRIES \ (1 << 1) /* Do not emit protocol for array \ boundaries, just the entries. */ @@ -1698,9 +1701,8 @@ size_t streamReplyWithRange(client *c, while (streamIteratorGetID(&si, &id, &numfields)) { /* Update the group last_id if needed. */ if (group && streamCompareID(&id, &group->last_id) > 0) { - if (group->entries_read != SCG_INVALID_ENTRIES_READ && - streamCompareID(&group->last_id, &s->first_id) >= 0 && - !streamRangeHasTombstones(s, &group->last_id, NULL)) { + if (group->entries_read != SCG_INVALID_ENTRIES_READ && streamCompareID(&group->last_id, &s->first_id) >= 0 + && !streamRangeHasTombstones(s, &group->last_id, NULL)) { /* A valid counter and no tombstones in the group's last-delivered-id and the stream's last-generated-id, * we can increment the read counter to keep tracking the group's progress. */ group->entries_read++; @@ -1934,8 +1936,9 @@ int streamGenericParseIDOrReply(client *c, invalid: if (c) - addReplyError(c, "Invalid stream ID specified as stream " - "command argument"); + addReplyError(c, + "Invalid stream ID specified as stream " + "command argument"); return C_ERR; } @@ -2030,20 +2033,27 @@ void xaddCommand(client *c) { /* Return ASAP if the stream has reached the last possible ID */ if (s->last_id.ms == UINT64_MAX && s->last_id.seq == UINT64_MAX) { - addReplyError(c, "The stream has exhausted the last possible ID, " - "unable to add more items"); + addReplyError(c, + "The stream has exhausted the last possible ID, " + "unable to add more items"); return; } /* Append using the low level function and return the ID. */ errno = 0; streamID id; - if (streamAppendItem(s, c->argv + field_pos, (c->argc - field_pos) / 2, &id, - parsed_args.id_given ? &parsed_args.id : NULL, parsed_args.seq_given) == C_ERR) { + if (streamAppendItem(s, + c->argv + field_pos, + (c->argc - field_pos) / 2, + &id, + parsed_args.id_given ? &parsed_args.id : NULL, + parsed_args.seq_given) + == C_ERR) { serverAssert(errno != 0); if (errno == EDOM) - addReplyError(c, "The ID specified in XADD is equal or smaller than " - "the target stream top item"); + addReplyError(c, + "The ID specified in XADD is equal or smaller than " + "the target stream top item"); else addReplyError(c, "Elements are too large to be stored"); return; @@ -2202,15 +2212,17 @@ void xreadCommand(client *c) { "Unbalanced '%s' list of streams: " "for each stream key an ID or '%c' must be " "specified.", - c->cmd->fullname, symbol); + c->cmd->fullname, + symbol); return; } streams_count /= 2; /* We have two arguments for each stream. */ break; } else if (!strcasecmp(o, "GROUP") && moreargs >= 2) { if (!xreadgroup) { - addReplyError(c, "The GROUP option is only supported by " - "XREADGROUP. You called XREAD instead."); + addReplyError(c, + "The GROUP option is only supported by " + "XREADGROUP. You called XREAD instead."); return; } groupname = c->argv[i + 1]; @@ -2218,8 +2230,9 @@ void xreadCommand(client *c) { i += 2; } else if (!strcasecmp(o, "NOACK")) { if (!xreadgroup) { - addReplyError(c, "The NOACK option is only supported by " - "XREADGROUP. You called XREAD instead."); + addReplyError(c, + "The NOACK option is only supported by " + "XREADGROUP. You called XREAD instead."); return; } noack = 1; @@ -2264,7 +2277,8 @@ void xreadCommand(client *c) { "-NOGROUP No such key '%s' or consumer " "group '%s' in XREADGROUP with GROUP " "option", - (char *)objectGetVal(key), (char *)objectGetVal(groupname)); + (char *)objectGetVal(key), + (char *)objectGetVal(groupname)); goto cleanup; } groups[id_idx] = group; @@ -2272,11 +2286,12 @@ void xreadCommand(client *c) { if (strcmp(objectGetVal(c->argv[i]), "$") == 0) { if (xreadgroup) { - addReplyError(c, "The $ ID is meaningless in the context of " - "XREADGROUP: you want to read the history of " - "this consumer by specifying a proper ID, or " - "use the > ID to get new messages. The $ ID would " - "just return an empty result set."); + addReplyError(c, + "The $ ID is meaningless in the context of " + "XREADGROUP: you want to read the history of " + "this consumer by specifying a proper ID, or " + "use the > ID to get new messages. The $ ID would " + "just return an empty result set."); goto cleanup; } if (o) { @@ -2289,11 +2304,12 @@ void xreadCommand(client *c) { continue; } else if (strcmp(objectGetVal(c->argv[i]), "+") == 0) { if (xreadgroup) { - addReplyError(c, "The + ID is meaningless in the context of " - "XREADGROUP: you want to read the history of " - "this consumer by specifying a proper ID, or " - "use the > ID to get new messages. The + ID would " - "just return an empty result set."); + addReplyError(c, + "The + ID is meaningless in the context of " + "XREADGROUP: you want to read the history of " + "this consumer by specifying a proper ID, or " + "use the > ID to get new messages. The + ID would " + "just return an empty result set."); goto cleanup; } if (o && ((stream *)objectGetVal(o))->length) { @@ -2311,9 +2327,10 @@ void xreadCommand(client *c) { continue; } else if (strcmp(objectGetVal(c->argv[i]), ">") == 0) { if (!xreadgroup) { - addReplyError(c, "The > ID can be specified only when calling " - "XREADGROUP using the GROUP " - " option."); + addReplyError(c, + "The > ID can be specified only when calling " + "XREADGROUP using the GROUP " + " option."); goto cleanup; } /* We use just the maximum ID to signal this is a ">" ID, anyway @@ -2361,7 +2378,10 @@ void xreadCommand(client *c) { } consumer = streamLookupConsumer(groups[i], objectGetVal(consumername)); if (consumer == NULL) { - consumer = streamCreateConsumer(groups[i], objectGetVal(consumername), c->argv[streams_arg + i], c->db->id, + consumer = streamCreateConsumer(groups[i], + objectGetVal(consumername), + c->argv[streams_arg + i], + c->db->id, SCC_DEFAULT); if (noack) streamPropagateConsumerCreation(c, spi.keyname, spi.groupname, consumer->name); } @@ -2598,8 +2618,8 @@ void xgroupCommand(client *c) { if (create_subcmd && !strcasecmp(objectGetVal(c->argv[i]), "MKSTREAM")) { mkstream = 1; i++; - } else if ((create_subcmd || setid_subcmd) && !strcasecmp(objectGetVal(c->argv[i]), "ENTRIESREAD") && - i + 1 < c->argc) { + } else if ((create_subcmd || setid_subcmd) && !strcasecmp(objectGetVal(c->argv[i]), "ENTRIESREAD") + && i + 1 < c->argc) { if (getLongLongFromObjectOrReply(c, c->argv[i + 1], &entries_read, NULL) != C_OK) return; if (entries_read < 0 && entries_read != SCG_INVALID_ENTRIES_READ) { addReplyError(c, "value for ENTRIESREAD must be positive or -1"); @@ -2624,19 +2644,21 @@ void xgroupCommand(client *c) { if (c->argc >= 4 && !mkstream) { /* At this point key must exist, or there is an error. */ if (s == NULL) { - addReplyError(c, "The XGROUP subcommand requires the key to exist. " - "Note that for CREATE you may want to use the MKSTREAM " - "option to create an empty stream automatically."); + addReplyError(c, + "The XGROUP subcommand requires the key to exist. " + "Note that for CREATE you may want to use the MKSTREAM " + "option to create an empty stream automatically."); return; } /* Certain subcommands require the group to exist. */ - if ((cg = streamLookupCG(s, grpname)) == NULL && - (!strcasecmp(opt, "SETID") || !strcasecmp(opt, "CREATECONSUMER") || !strcasecmp(opt, "DELCONSUMER"))) { + if ((cg = streamLookupCG(s, grpname)) == NULL + && (!strcasecmp(opt, "SETID") || !strcasecmp(opt, "CREATECONSUMER") || !strcasecmp(opt, "DELCONSUMER"))) { addReplyErrorFormat(c, "-NOGROUP No such consumer group '%s' " "for key name '%s'", - (char *)grpname, (char *)objectGetVal(c->argv[2])); + (char *)grpname, + (char *)objectGetVal(c->argv[2])); return; } } @@ -2716,7 +2738,8 @@ void xgroupCommand(client *c) { addReply(c, shared.czero); } } else if (!strcasecmp(opt, "CREATECONSUMER") && c->argc == 5) { - streamConsumer *created = streamCreateConsumer(cg, objectGetVal(c->argv[4]), c->argv[2], c->db->id, SCC_DEFAULT); + streamConsumer *created = + streamCreateConsumer(cg, objectGetVal(c->argv[4]), c->argv[2], c->db->id, SCC_DEFAULT); addReplyLongLong(c, created ? 1 : 0); } else if (!strcasecmp(opt, "DELCONSUMER") && c->argc == 5) { long long pending = 0; @@ -2937,7 +2960,8 @@ void xpendingCommand(client *c) { addReplyErrorFormat(c, "-NOGROUP No such key '%s' or consumer " "group '%s'", - (char *)objectGetVal(key), (char *)objectGetVal(groupname)); + (char *)objectGetVal(key), + (char *)objectGetVal(groupname)); return; } @@ -3128,7 +3152,8 @@ void xclaimCommand(client *c) { addReplyErrorFormat(c, "-NOGROUP No such key '%s' or " "consumer group '%s'", - (char *)objectGetVal(c->argv[1]), (char *)objectGetVal(c->argv[2])); + (char *)objectGetVal(c->argv[1]), + (char *)objectGetVal(c->argv[2])); return; } @@ -3164,19 +3189,22 @@ void xclaimCommand(client *c) { justid = 1; } else if (!strcasecmp(opt, "IDLE") && moreargs) { j++; - if (getLongLongFromObjectOrReply(c, c->argv[j], &deliverytime, "Invalid IDLE option argument for XCLAIM") != - C_OK) + if (getLongLongFromObjectOrReply(c, c->argv[j], &deliverytime, "Invalid IDLE option argument for XCLAIM") + != C_OK) goto cleanup; deliverytime = now - deliverytime; } else if (!strcasecmp(opt, "TIME") && moreargs) { j++; - if (getLongLongFromObjectOrReply(c, c->argv[j], &deliverytime, "Invalid TIME option argument for XCLAIM") != - C_OK) + if (getLongLongFromObjectOrReply(c, c->argv[j], &deliverytime, "Invalid TIME option argument for XCLAIM") + != C_OK) goto cleanup; } else if (!strcasecmp(opt, "RETRYCOUNT") && moreargs) { j++; - if (getLongLongFromObjectOrReply(c, c->argv[j], &retrycount, - "Invalid RETRYCOUNT option argument for XCLAIM") != C_OK) + if (getLongLongFromObjectOrReply(c, + c->argv[j], + &retrycount, + "Invalid RETRYCOUNT option argument for XCLAIM") + != C_OK) goto cleanup; } else if (!strcasecmp(opt, "LASTID") && moreargs) { j++; @@ -3289,8 +3317,17 @@ void xclaimCommand(client *c) { if (justid) { addReplyStreamID(c, &id); } else { - serverAssert(streamReplyWithRange(c, objectGetVal(o), &id, &id, 1, 0, NULL, NULL, STREAM_RWR_RAWENTRIES, NULL) == - 1); + serverAssert(streamReplyWithRange(c, + objectGetVal(o), + &id, + &id, + 1, + 0, + NULL, + NULL, + STREAM_RWR_RAWENTRIES, + NULL) + == 1); } arraylen++; @@ -3376,7 +3413,9 @@ void xautoclaimCommand(client *c) { /* No key or group? Send an error given that the group creation * is mandatory. */ if (o == NULL || group == NULL) { - addReplyErrorFormat(c, "-NOGROUP No such key '%s' or consumer group '%s'", (char *)objectGetVal(c->argv[1]), + addReplyErrorFormat(c, + "-NOGROUP No such key '%s' or consumer group '%s'", + (char *)objectGetVal(c->argv[1]), (char *)objectGetVal(c->argv[2])); return; } @@ -3459,7 +3498,17 @@ void xautoclaimCommand(client *c) { if (justid) { addReplyStreamID(c, &id); } else { - serverAssert(streamReplyWithRange(c, objectGetVal(o), &id, &id, 1, 0, NULL, NULL, STREAM_RWR_RAWENTRIES, NULL) == 1); + serverAssert(streamReplyWithRange(c, + objectGetVal(o), + &id, + &id, + 1, + 0, + NULL, + NULL, + STREAM_RWR_RAWENTRIES, + NULL) + == 1); } arraylen++; count--; @@ -3860,7 +3909,8 @@ void xinfoCommand(client *c) { addReplyErrorFormat(c, "-NOGROUP No such consumer group '%s' " "for key name '%s'", - (char *)objectGetVal(c->argv[3]), (char *)objectGetVal(key)); + (char *)objectGetVal(c->argv[3]), + (char *)objectGetVal(key)); return; } diff --git a/src/t_string.c b/src/t_string.c index db590d96b5c..a0c4818992f 100644 --- a/src/t_string.c +++ b/src/t_string.c @@ -193,8 +193,8 @@ void setGenericCommand(client *c, for (j = 0; j < c->argc; j++) { char *a = objectGetVal(c->argv[j]); /* Skip GET which may be repeated multiple times. */ - if (j >= 3 && (a[0] == 'g' || a[0] == 'G') && (a[1] == 'e' || a[1] == 'E') && - (a[2] == 't' || a[2] == 'T') && a[3] == '\0') + if (j >= 3 && (a[0] == 'g' || a[0] == 'G') && (a[1] == 'e' || a[1] == 'E') && (a[2] == 't' || a[2] == 'T') + && a[3] == '\0') continue; argv[argc++] = c->argv[j]; incrRefCount(c->argv[j]); @@ -254,7 +254,8 @@ void setCommand(client *c) { int unit = UNIT_SECONDS; int flags = ARGS_NO_FLAGS; - if (parseExtendedCommandArgumentsOrReply(c, COMMAND_SET, 3, c->argc, &flags, &unit, NULL, &expire, &comparison) != C_OK) { + if (parseExtendedCommandArgumentsOrReply(c, COMMAND_SET, 3, c->argc, &flags, &unit, NULL, &expire, &comparison) + != C_OK) { return; } @@ -302,8 +303,7 @@ void delifeqCommand(client *c) { int getGenericCommand(client *c) { robj *o; - if ((o = lookupKeyReadOrReply(c, c->argv[1], shared.null[c->resp])) == NULL) - return C_OK; + if ((o = lookupKeyReadOrReply(c, c->argv[1], shared.null[c->resp])) == NULL) return C_OK; if (checkType(c, o, OBJ_STRING)) { return C_ERR; @@ -354,8 +354,7 @@ void getexCommand(client *c) { robj *o; - if ((o = lookupKeyReadOrReply(c, c->argv[1], shared.null[c->resp])) == NULL) - return; + if ((o = lookupKeyReadOrReply(c, c->argv[1], shared.null[c->resp])) == NULL) return; if (checkType(c, o, OBJ_STRING)) { return; @@ -434,8 +433,7 @@ void setrangeCommand(client *c) { long offset; sds value = objectGetVal(c->argv[3]); - if (getLongFromObjectOrReply(c, c->argv[2], &offset, NULL) != C_OK) - return; + if (getLongFromObjectOrReply(c, c->argv[2], &offset, NULL) != C_OK) return; if (offset < 0) { addReplyError(c, "offset is out of range"); @@ -451,8 +449,7 @@ void setrangeCommand(client *c) { } /* Return when the resulting string exceeds allowed size */ - if (checkStringLength(c, offset, sdslen(value)) != C_OK) - return; + if (checkStringLength(c, offset, sdslen(value)) != C_OK) return; o = createObject(OBJ_STRING, sdsnewlen(NULL, offset + sdslen(value))); dbAdd(c->db, c->argv[1], &o); @@ -460,8 +457,7 @@ void setrangeCommand(client *c) { size_t olen; /* Key exists, check type */ - if (checkType(c, o, OBJ_STRING)) - return; + if (checkType(c, o, OBJ_STRING)) return; /* Return existing string length when setting nothing */ olen = stringObjectLen(o); @@ -471,8 +467,7 @@ void setrangeCommand(client *c) { } /* Return when the resulting string exceeds allowed size */ - if (checkStringLength(c, offset, sdslen(value)) != C_OK) - return; + if (checkStringLength(c, offset, sdslen(value)) != C_OK) return; /* Create a copy when the object is shared or encoded. */ o = dbUnshareStringValue(c->db, c->argv[1], o); @@ -492,12 +487,9 @@ void getrangeCommand(client *c) { char *str, llbuf[32]; size_t strlen; - if (getLongLongFromObjectOrReply(c, c->argv[2], &start, NULL) != C_OK) - return; - if (getLongLongFromObjectOrReply(c, c->argv[3], &end, NULL) != C_OK) - return; - if ((o = lookupKeyReadOrReply(c, c->argv[1], shared.emptybulk)) == NULL || - checkType(c, o, OBJ_STRING)) return; + if (getLongLongFromObjectOrReply(c, c->argv[2], &start, NULL) != C_OK) return; + if (getLongLongFromObjectOrReply(c, c->argv[3], &end, NULL) != C_OK) return; + if ((o = lookupKeyReadOrReply(c, c->argv[1], shared.emptybulk)) == NULL || checkType(c, o, OBJ_STRING)) return; if (o->encoding == OBJ_ENCODING_INT) { str = llbuf; @@ -581,8 +573,7 @@ void msetGenericCommand(client *c, int nx) { } notifyKeyspaceEvent(NOTIFY_STRING, "set", c->argv[j], c->db->id); /* In MSETNX, It could be that we're overriding the same key, we can't be sure it doesn't exist. */ - if (nx) - setkey_flags = SETKEY_ADD_OR_UPDATE; + if (nx) setkey_flags = SETKEY_ADD_OR_UPDATE; } server.dirty += (c->argc - 1) / 2; addReply(c, nx ? shared.cone : shared.ok); @@ -611,8 +602,8 @@ void msetexCommand(client *c) { int setkey_flags = 0; /* Parse the numkeys. */ - if (getRangeLongFromObjectOrReply(c, c->argv[1], 1, INT_MAX, &numkeys, - "invalid numkeys value or out of range") != C_OK) { + if (getRangeLongFromObjectOrReply(c, c->argv[1], 1, INT_MAX, &numkeys, "invalid numkeys value or out of range") + != C_OK) { return; } @@ -623,8 +614,16 @@ void msetexCommand(client *c) { addReplyErrorObject(c, shared.syntaxerr); return; } - if (parseExtendedCommandArgumentsOrReply(c, COMMAND_MSET, (int)args_start_idx, c->argc, - &flags, &unit, &expire_idx, &expire, NULL) != C_OK) { + if (parseExtendedCommandArgumentsOrReply(c, + COMMAND_MSET, + (int)args_start_idx, + c->argc, + &flags, + &unit, + &expire_idx, + &expire, + NULL) + != C_OK) { return; } @@ -644,8 +643,7 @@ void msetexCommand(client *c) { if (flags & (ARGS_SET_NX | ARGS_SET_XX)) { for (int j = 2; j < args_start_idx; j += 2) { robj *o = lookupKeyWrite(c->db, c->argv[j]); - if (((flags & ARGS_SET_NX) && o != NULL) || - ((flags & ARGS_SET_XX) && o == NULL)) { + if (((flags & ARGS_SET_NX) && o != NULL) || ((flags & ARGS_SET_XX) && o == NULL)) { addReply(c, shared.czero); return; } @@ -703,15 +701,14 @@ void incrDecrCommand(client *c, long long incr) { if (getLongLongFromObjectOrReply(c, o, &value, NULL) != C_OK) return; oldvalue = value; - if ((incr < 0 && oldvalue < 0 && incr < (LLONG_MIN - oldvalue)) || - (incr > 0 && oldvalue > 0 && incr > (LLONG_MAX - oldvalue))) { + if ((incr < 0 && oldvalue < 0 && incr < (LLONG_MIN - oldvalue)) + || (incr > 0 && oldvalue > 0 && incr > (LLONG_MAX - oldvalue))) { addReplyError(c, "increment or decrement would overflow"); return; } value += incr; - if (o && o->refcount == 1 && o->encoding == OBJ_ENCODING_INT && - value >= LONG_MIN && value <= LONG_MAX) { + if (o && o->refcount == 1 && o->encoding == OBJ_ENCODING_INT && value >= LONG_MIN && value <= LONG_MAX) { new = o; objectSetVal(o, (void *)((long)value)); } else { @@ -761,8 +758,8 @@ void incrbyfloatCommand(client *c) { o = lookupKeyWrite(c->db, c->argv[1]); if (checkType(c, o, OBJ_STRING)) return; - if (getLongDoubleFromObjectOrReply(c, o, &value, NULL) != C_OK || - getLongDoubleFromObjectOrReply(c, c->argv[2], &incr, NULL) != C_OK) + if (getLongDoubleFromObjectOrReply(c, o, &value, NULL) != C_OK + || getLongDoubleFromObjectOrReply(c, c->argv[2], &incr, NULL) != C_OK) return; value += incr; @@ -812,13 +809,11 @@ void appendCommand(client *c) { } } else { /* Key exists, check type */ - if (checkType(c, o, OBJ_STRING)) - return; + if (checkType(c, o, OBJ_STRING)) return; /* "append" is an argument, so always an sds */ append = c->argv[2]; - if (checkStringLength(c, stringObjectLen(o), sdslen(objectGetVal(append))) != C_OK) - return; + if (checkStringLength(c, stringObjectLen(o), sdslen(objectGetVal(append))) != C_OK) return; /* Append the value */ o = dbUnshareStringValue(c->db, c->argv[1], o); @@ -833,8 +828,7 @@ void appendCommand(client *c) { void strlenCommand(client *c) { robj *o; - if ((o = lookupKeyReadOrReply(c, c->argv[1], shared.czero)) == NULL || - checkType(c, o, OBJ_STRING)) return; + if ((o = lookupKeyReadOrReply(c, c->argv[1], shared.czero)) == NULL || checkType(c, o, OBJ_STRING)) return; addReplyLongLong(c, stringObjectLen(o)); } @@ -848,10 +842,8 @@ void lcsCommand(client *c) { obja = lookupKeyRead(c->db, c->argv[1]); objb = lookupKeyRead(c->db, c->argv[2]); - if ((obja && obja->type != OBJ_STRING) || - (objb && objb->type != OBJ_STRING)) { - addReplyError(c, - "The specified keys must contain string values"); + if ((obja && obja->type != OBJ_STRING) || (objb && objb->type != OBJ_STRING)) { + addReplyError(c, "The specified keys must contain string values"); /* Don't cleanup the objects, we need to do that * only after calling getDecodedObject(). */ obja = NULL; @@ -885,8 +877,7 @@ void lcsCommand(client *c) { /* Complain if the user passed ambiguous parameters. */ if (getlen && getidx) { - addReplyError(c, - "If you want both the length and indexes, please just use IDX."); + addReplyError(c, "If you want both the length and indexes, please just use IDX."); goto cleanup; } @@ -907,7 +898,8 @@ void lcsCommand(client *c) { #define LCS(A, B) lcs[(B) + ((A) * (blen + 1))] /* Try to allocate the LCS table, and abort on overflow or insufficient memory. */ - unsigned long long lcssize = (unsigned long long)(alen + 1) * (blen + 1); /* Can't overflow due to the size limits above. */ + unsigned long long lcssize = (unsigned long long)(alen + 1) + * (blen + 1); /* Can't overflow due to the size limits above. */ unsigned long long lcsalloc = lcssize * sizeof(uint32_t); uint32_t *lcs = NULL; if (lcsalloc < SIZE_MAX && lcsalloc / lcssize == sizeof(uint32_t)) { @@ -951,10 +943,8 @@ void lcsCommand(client *c) { uint32_t idx = LCS(alen, blen); sds result = NULL; /* Resulting LCS string. */ void *arraylenptr = NULL; /* Deferred length of the array for IDX. */ - uint32_t arange_start = alen, /* alen signals that values are not set. */ - arange_end = 0, - brange_start = 0, - brange_end = 0; + uint32_t arange_start = alen; /* alen signals that values are not set. */ + uint32_t arange_end = 0, brange_start = 0, brange_end = 0; /* Do we need to compute the actual LCS string? Allocate it in that case. */ int computelcs = getidx || !getlen; diff --git a/src/t_zset.c b/src/t_zset.c index 5dbd1f38d47..69d986976da 100644 --- a/src/t_zset.c +++ b/src/t_zset.c @@ -87,20 +87,17 @@ static inline unsigned long zslGetNodeSpanAtLevel(const zskiplistNode *x, int le static inline void zslSetNodeSpanAtLevel(zskiplistNode *x, int level, unsigned long span) { /* We use the level 0 span in order to hold the node height, so we avoid overriding it. */ - if (level > 0) - x->level[level].span = span; + if (level > 0) x->level[level].span = span; } static inline void zslIncrNodeSpanAtLevel(zskiplistNode *x, int level, unsigned long incr) { /* We use the level 0 span in order to hold the node height, so we avoid overriding it. */ - if (level > 0) - x->level[level].span += incr; + if (level > 0) x->level[level].span += incr; } static inline void zslDecrNodeSpanAtLevel(zskiplistNode *x, int level, unsigned long decr) { /* We use the level 0 span in order to hold the node height, so we avoid overriding it. */ - if (level > 0) - x->level[level].span -= decr; + if (level > 0) x->level[level].span -= decr; } static inline unsigned long zslGetNodeHeight(const zskiplistNode *x) { @@ -366,8 +363,8 @@ static zskiplistNode *zslUpdateScore(zskiplist *zsl, zskiplistNode *node, double /* If the node, after the score update, would be still exactly * at the same position, we can just update the score without * actually removing and re-inserting the element in the skiplist. */ - if ((node->backward == NULL || node->backward->score < newscore) && - (node->level[0].forward == NULL || node->level[0].forward->score > newscore)) { + if ((node->backward == NULL || node->backward->score < newscore) + && (node->level[0].forward == NULL || node->level[0].forward->score > newscore)) { node->score = newscore; return NULL; } @@ -529,8 +526,7 @@ static unsigned long zslDeleteRangeByLex(zskiplist *zsl, zlexrangespec *range, h x = zslGetHeader(zsl); for (i = zslGetHeight(zsl) - 1; i >= 0; i--) { - while (x->level[i].forward && - !zslLexValueGteMin(zslGetNodeElement(x->level[i].forward), range)) { + while (x->level[i].forward && !zslLexValueGteMin(zslGetNodeElement(x->level[i].forward), range)) { x = x->level[i].forward; } update[i] = x; @@ -719,8 +715,8 @@ int zsetParseLexRange(robj *min, robj *max, zlexrangespec *spec) { if (min->encoding == OBJ_ENCODING_INT || max->encoding == OBJ_ENCODING_INT) return C_ERR; spec->min = spec->max = NULL; - if (zslParseLexRangeItem(min, &spec->min, &spec->minex) == C_ERR || - zslParseLexRangeItem(max, &spec->max, &spec->maxex) == C_ERR) { + if (zslParseLexRangeItem(min, &spec->min, &spec->minex) == C_ERR + || zslParseLexRangeItem(max, &spec->max, &spec->maxex) == C_ERR) { zsetFreeLexRange(spec); return C_ERR; } else { @@ -1294,8 +1290,8 @@ robj *zsetTypeCreate(size_t size_hint, size_t val_len_hint) { /* Check if the existing zset should be converted to another encoding based off the * the size hint. */ void zsetTypeMaybeConvert(robj *zobj, size_t size_hint, size_t value_len_hint) { - if (zobj->encoding == OBJ_ENCODING_LISTPACK && - (size_hint > server.zset_max_listpack_entries || value_len_hint > server.zset_max_listpack_value)) { + if (zobj->encoding == OBJ_ENCODING_LISTPACK + && (size_hint > server.zset_max_listpack_entries || value_len_hint > server.zset_max_listpack_value)) { zsetConvertAndExpand(zobj, OBJ_ENCODING_SKIPLIST, size_hint); } } @@ -1389,8 +1385,8 @@ void zsetConvertToListpackIfNeeded(robj *zobj, size_t maxelelen, size_t totelele if (zobj->encoding == OBJ_ENCODING_LISTPACK) return; zset *zset = objectGetVal(zobj); - if (zslGetLength(zset->zsl) <= server.zset_max_listpack_entries && - maxelelen <= server.zset_max_listpack_value && lpSafeToAdd(NULL, totelelen)) { + if (zslGetLength(zset->zsl) <= server.zset_max_listpack_entries && maxelelen <= server.zset_max_listpack_value + && lpSafeToAdd(NULL, totelelen)) { zsetConvert(zobj, OBJ_ENCODING_LISTPACK); } } @@ -1515,8 +1511,8 @@ int zsetAdd(robj *zobj, double score, sds ele, int in_flags, int *out_flags, dou } else if (!xx) { /* check if the element is too large or the list * becomes too long *before* executing zzlInsert. */ - if (zzlLength(objectGetVal(zobj)) + 1 > server.zset_max_listpack_entries || - sdslen(ele) > server.zset_max_listpack_value || !lpSafeToAdd(objectGetVal(zobj), sdslen(ele))) { + if (zzlLength(objectGetVal(zobj)) + 1 > server.zset_max_listpack_entries + || sdslen(ele) > server.zset_max_listpack_value || !lpSafeToAdd(objectGetVal(zobj), sdslen(ele))) { zsetConvertAndExpand(zobj, OBJ_ENCODING_SKIPLIST, zsetLength(zobj) + 1); } else { objectSetVal(zobj, zzlInsert(objectGetVal(zobj), ele, score)); @@ -1943,7 +1939,8 @@ void zremCommand(client *c) { break; } } - if (!keyremoved && zobj->encoding == OBJ_ENCODING_SKIPLIST) hashtableResumeAutoShrink(((zset *)objectGetVal(zobj))->ht); + if (!keyremoved && zobj->encoding == OBJ_ENCODING_SKIPLIST) + hashtableResumeAutoShrink(((zset *)objectGetVal(zobj))->ht); if (deleted) { notifyKeyspaceEvent(NOTIFY_ZSET, "zrem", key, c->db->id); @@ -1975,8 +1972,8 @@ void zremrangeGenericCommand(client *c, zrange_type rangetype) { /* Step 1: Parse the range. */ if (rangetype == ZRANGE_RANK) { notify_type = "zremrangebyrank"; - if ((getLongFromObjectOrReply(c, c->argv[2], &start, NULL) != C_OK) || - (getLongFromObjectOrReply(c, c->argv[3], &end, NULL) != C_OK)) + if ((getLongFromObjectOrReply(c, c->argv[2], &start, NULL) != C_OK) + || (getLongFromObjectOrReply(c, c->argv[3], &end, NULL) != C_OK)) return; } else if (rangetype == ZRANGE_SCORE) { notify_type = "zremrangebyscore"; @@ -2017,7 +2014,9 @@ void zremrangeGenericCommand(client *c, zrange_type rangetype) { if (zobj->encoding == OBJ_ENCODING_LISTPACK) { switch (rangetype) { case ZRANGE_AUTO: - case ZRANGE_RANK: objectSetVal(zobj, zzlDeleteRangeByRank(objectGetVal(zobj), start + 1, end + 1, &deleted)); break; + case ZRANGE_RANK: + objectSetVal(zobj, zzlDeleteRangeByRank(objectGetVal(zobj), start + 1, end + 1, &deleted)); + break; case ZRANGE_SCORE: objectSetVal(zobj, zzlDeleteRangeByScore(objectGetVal(zobj), &range, &deleted)); break; case ZRANGE_LEX: objectSetVal(zobj, zzlDeleteRangeByLex(objectGetVal(zobj), &lexrange, &deleted)); break; } @@ -2649,19 +2648,19 @@ static void zunionInterDiffGenericCommand(client *c, robj *dstkey, int numkeysIn int remaining = c->argc - j; while (remaining) { - if (op != SET_OP_DIFF && !cardinality_only && remaining >= (setnum + 1) && - !strcasecmp(objectGetVal(c->argv[j]), "weights")) { + if (op != SET_OP_DIFF && !cardinality_only && remaining >= (setnum + 1) + && !strcasecmp(objectGetVal(c->argv[j]), "weights")) { j++; remaining--; for (i = 0; i < setnum; i++, j++, remaining--) { - if (getDoubleFromObjectOrReply(c, c->argv[j], &src[i].weight, "weight value is not a float") != - C_OK) { + if (getDoubleFromObjectOrReply(c, c->argv[j], &src[i].weight, "weight value is not a float") + != C_OK) { zfree(src); return; } } - } else if (op != SET_OP_DIFF && !cardinality_only && remaining >= 2 && - !strcasecmp(objectGetVal(c->argv[j]), "aggregate")) { + } else if (op != SET_OP_DIFF && !cardinality_only && remaining >= 2 + && !strcasecmp(objectGetVal(c->argv[j]), "aggregate")) { j++; remaining--; if (!strcasecmp(objectGetVal(c->argv[j]), "sum")) { @@ -2677,7 +2676,8 @@ static void zunionInterDiffGenericCommand(client *c, robj *dstkey, int numkeysIn } j++; remaining--; - } else if (remaining >= 1 && !dstkey && !cardinality_only && !strcasecmp(objectGetVal(c->argv[j]), "withscores")) { + } else if (remaining >= 1 && !dstkey && !cardinality_only + && !strcasecmp(objectGetVal(c->argv[j]), "withscores")) { j++; remaining--; withscores = 1; @@ -2827,8 +2827,11 @@ static void zunionInterDiffGenericCommand(client *c, robj *dstkey, int numkeysIn if (zslGetLength(dstzset->zsl)) { zsetConvertToListpackIfNeeded(dstobj, maxelelen, totelelen); setKey(c, c->db, dstkey, &dstobj, 0); - notifyKeyspaceEvent(NOTIFY_ZSET, (op == SET_OP_UNION) ? "zunionstore" : (op == SET_OP_INTER ? "zinterstore" : "zdiffstore"), - dstkey, c->db->id); + notifyKeyspaceEvent(NOTIFY_ZSET, + (op == SET_OP_UNION) ? "zunionstore" + : (op == SET_OP_INTER ? "zinterstore" : "zdiffstore"), + dstkey, + c->db->id); addReplyLongLong(c, zsetLength(dstobj)); server.dirty++; } else { @@ -3620,8 +3623,8 @@ void zrangeGenericCommand(zrange_result_handler *handler, if (!store && !strcasecmp(objectGetVal(c->argv[j]), "withscores")) { opt_withscores = 1; } else if (!strcasecmp(objectGetVal(c->argv[j]), "limit") && leftargs >= 2) { - if ((getLongFromObjectOrReply(c, c->argv[j + 1], &opt_offset, NULL) != C_OK) || - (getLongFromObjectOrReply(c, c->argv[j + 2], &opt_limit, NULL) != C_OK)) { + if ((getLongFromObjectOrReply(c, c->argv[j + 1], &opt_offset, NULL) != C_OK) + || (getLongFromObjectOrReply(c, c->argv[j + 2], &opt_limit, NULL) != C_OK)) { return; } j += 2; @@ -3663,8 +3666,8 @@ void zrangeGenericCommand(zrange_result_handler *handler, case ZRANGE_AUTO: case ZRANGE_RANK: /* Z[REV]RANGE, ZRANGESTORE [REV]RANGE */ - if ((getLongFromObjectOrReply(c, c->argv[minidx], &opt_start, NULL) != C_OK) || - (getLongFromObjectOrReply(c, c->argv[maxidx], &opt_end, NULL) != C_OK)) { + if ((getLongFromObjectOrReply(c, c->argv[minidx], &opt_start, NULL) != C_OK) + || (getLongFromObjectOrReply(c, c->argv[maxidx], &opt_end, NULL) != C_OK)) { return; } break; @@ -3708,17 +3711,30 @@ void zrangeGenericCommand(zrange_result_handler *handler, switch (rangetype) { case ZRANGE_AUTO: case ZRANGE_RANK: - genericZrangebyrankCommand(handler, zobj, opt_start, opt_end, opt_withscores || store, + genericZrangebyrankCommand(handler, + zobj, + opt_start, + opt_end, + opt_withscores || store, direction == ZRANGE_DIRECTION_REVERSE); break; case ZRANGE_SCORE: - genericZrangebyscoreCommand(handler, &range, zobj, opt_offset, opt_limit, + genericZrangebyscoreCommand(handler, + &range, + zobj, + opt_offset, + opt_limit, direction == ZRANGE_DIRECTION_REVERSE); break; case ZRANGE_LEX: - genericZrangebylexCommand(handler, &lexrange, zobj, opt_withscores || store, opt_offset, opt_limit, + genericZrangebylexCommand(handler, + &lexrange, + zobj, + opt_withscores || store, + opt_offset, + opt_limit, direction == ZRANGE_DIRECTION_REVERSE); break; } @@ -4366,8 +4382,13 @@ void zmpopGenericCommand(client *c, int numkeys_idx, int is_block) { long count = -1; /* Reply will consist of up to count elements, depending on the zset's length. */ /* Parse the numkeys. */ - if (getRangeLongFromObjectOrReply(c, c->argv[numkeys_idx], 1, LONG_MAX, &numkeys, - "numkeys should be greater than 0") != C_OK) + if (getRangeLongFromObjectOrReply(c, + c->argv[numkeys_idx], + 1, + LONG_MAX, + &numkeys, + "numkeys should be greater than 0") + != C_OK) return; /* Parse the where. where_idx: the index of where in the c->argv. */ @@ -4392,8 +4413,8 @@ void zmpopGenericCommand(client *c, int numkeys_idx, int is_block) { if (count == -1 && !strcasecmp(opt, "COUNT") && moreargs) { j++; - if (getRangeLongFromObjectOrReply(c, c->argv[j], 1, LONG_MAX, &count, "count should be greater than 0") != - C_OK) + if (getRangeLongFromObjectOrReply(c, c->argv[j], 1, LONG_MAX, &count, "count should be greater than 0") + != C_OK) return; } else { addReplyErrorObject(c, shared.syntaxerr); diff --git a/src/tls.c b/src/tls.c index e75b6f0d407..f1ac4a33fb0 100644 --- a/src/tls.c +++ b/src/tls.c @@ -35,10 +35,9 @@ #include "io_threads.h" #include "bio.h" -#if defined(USE_OPENSSL) && \ - ((USE_OPENSSL == 1 /* BUILD_YES */) || \ - ((USE_OPENSSL == 2 /* BUILD_MODULE */) && \ - (defined(BUILD_TLS_MODULE) && BUILD_TLS_MODULE == 2))) +#if defined(USE_OPENSSL) \ + && ((USE_OPENSSL == 1 /* BUILD_YES */) \ + || ((USE_OPENSSL == 2 /* BUILD_MODULE */) && (defined(BUILD_TLS_MODULE) && BUILD_TLS_MODULE == 2))) #include #include @@ -102,8 +101,9 @@ static int parseProtocolsConfig(const char *str) { break; #endif } else { - serverLog(LL_WARNING, "Invalid tls-protocols specified. " - "Use a combination of 'TLSv1', 'TLSv1.1', 'TLSv1.2' and 'TLSv1.3'."); + serverLog(LL_WARNING, + "Invalid tls-protocols specified. " + "Use a combination of 'TLSv1', 'TLSv1.1', 'TLSv1.2' and 'TLSv1.3'."); protocols = -1; break; } @@ -291,7 +291,12 @@ static void tlsClearCertSerial(sds *serial) { } } -static int tlsStoreCertInfo(long long expiry, sds serial, int count, long long *out_expiry, sds *out_serial, int *out_count) { +static int tlsStoreCertInfo(long long expiry, + sds serial, + int count, + long long *out_expiry, + sds *out_serial, + int *out_count) { if (out_count) *out_count = count; tlsClearCertSerial(out_serial); if (expiry == 0) { @@ -341,7 +346,12 @@ static int tlsUpdateCertInfoFromFileHandle(FILE *fp, long long *expiry, sds *ser return C_OK; } -static void tlsMergeCertInfo(long long *expiry, sds *serial, int *count, long long src_expiry, sds src_serial, int src_count) { +static void tlsMergeCertInfo(long long *expiry, + sds *serial, + int *count, + long long src_expiry, + sds src_serial, + int src_count) { if (count) *count += src_count; if (src_expiry > 0 && (*expiry == 0 || src_expiry < *expiry)) { if (*serial) sdsfree(*serial); @@ -399,14 +409,18 @@ static int tlsUpdateCertInfoFromDir(const char *path, long long *expiry, sds *se } static void tlsRefreshServerCertInfo(void) { - if (!(server.tls_port || server.tls_replication || server.tls_cluster) || !valkey_tls_ctx || - tlsUpdateCertInfoFromCtx(valkey_tls_ctx, &server.tls_server_cert_expire_time, &server.tls_server_cert_serial) == C_ERR) { + if (!(server.tls_port || server.tls_replication || server.tls_cluster) || !valkey_tls_ctx + || tlsUpdateCertInfoFromCtx(valkey_tls_ctx, &server.tls_server_cert_expire_time, &server.tls_server_cert_serial) + == C_ERR) { tlsClearCertInfo(&server.tls_server_cert_expire_time, &server.tls_server_cert_serial); } } static void tlsRefreshClientCertInfo(void) { - if (tlsUpdateCertInfoFromCtx(valkey_tls_client_ctx, &server.tls_client_cert_expire_time, &server.tls_client_cert_serial) == C_ERR) { + if (tlsUpdateCertInfoFromCtx(valkey_tls_client_ctx, + &server.tls_client_cert_expire_time, + &server.tls_client_cert_serial) + == C_ERR) { tlsClearCertInfo(&server.tls_client_cert_expire_time, &server.tls_client_cert_serial); } } @@ -415,14 +429,10 @@ static void tlsRefreshCACertInfo(void) { long long file_expiry = 0, dir_expiry = 0; sds file_serial = NULL, dir_serial = NULL; int file_count = 0, dir_count = 0; - int file_ok = tlsUpdateCertInfoFromFile(server.tls_ctx_config.ca_cert_file, - &file_expiry, - &file_serial, - &file_count) == C_OK; - int dir_ok = tlsUpdateCertInfoFromDir(server.tls_ctx_config.ca_cert_dir, - &dir_expiry, - &dir_serial, - &dir_count) == C_OK; + int file_ok = tlsUpdateCertInfoFromFile(server.tls_ctx_config.ca_cert_file, &file_expiry, &file_serial, &file_count) + == C_OK; + int dir_ok = tlsUpdateCertInfoFromDir(server.tls_ctx_config.ca_cert_dir, &dir_expiry, &dir_serial, &dir_count) + == C_OK; tlsClearCACertInfo(); if (!file_ok && !dir_ok) { @@ -469,8 +479,7 @@ static bool isCertValid(X509 *cert) { const ASN1_TIME *not_before = X509_get0_notBefore(cert); const ASN1_TIME *not_after = X509_get0_notAfter(cert); if (!not_before || !not_after) return false; - if (X509_cmp_current_time(not_before) > 0 || - X509_cmp_current_time(not_after) < 0) { + if (X509_cmp_current_time(not_before) > 0 || X509_cmp_current_time(not_after) < 0) { return false; } return true; @@ -590,7 +599,9 @@ static SSL_CTX *createSSLContext(serverTLSContextConfig *ctx_config, int protoco } if (!isCertValid(SSL_CTX_get0_certificate(ctx))) { - serverLog(LL_WARNING, "%s TLS certificate is invalid. Aborting TLS configuration.", client ? "Client" : "Server"); + serverLog(LL_WARNING, + "%s TLS certificate is invalid. Aborting TLS configuration.", + client ? "Client" : "Server"); goto error; } @@ -657,10 +668,11 @@ static int tlsCreateContexts(serverTLSContextConfig *ctx_config, SSL_CTX **out_c goto error; } - if (((server.tls_auth_clients != TLS_CLIENT_AUTH_NO) || server.tls_cluster || server.tls_replication) && - !ctx_config->ca_cert_file && !ctx_config->ca_cert_dir) { - serverLog(LL_WARNING, "Either tls-ca-cert-file or tls-ca-cert-dir must be specified when tls-cluster, " - "tls-replication or tls-auth-clients are enabled!"); + if (((server.tls_auth_clients != TLS_CLIENT_AUTH_NO) || server.tls_cluster || server.tls_replication) + && !ctx_config->ca_cert_file && !ctx_config->ca_cert_dir) { + serverLog(LL_WARNING, + "Either tls-ca-cert-file or tls-ca-cert-dir must be specified when tls-cluster, " + "tls-replication or tls-auth-clients are enabled!"); goto error; } @@ -826,7 +838,9 @@ static void captureMetadata(serverTLSContextConfig *ctx_config, tlsMaterialsMeta /* Certificate files: fingerprint-based detection */ getCertFingerprint(ctx_config->cert_file, metadata->cert_fingerprint, &metadata->cert_fingerprint_len); - getCertFingerprint(ctx_config->client_cert_file, metadata->client_cert_fingerprint, &metadata->client_cert_fingerprint_len); + getCertFingerprint(ctx_config->client_cert_file, + metadata->client_cert_fingerprint, + &metadata->client_cert_fingerprint_len); getCertFingerprint(ctx_config->ca_cert_file, metadata->ca_cert_fingerprint, &metadata->ca_cert_fingerprint_len); /* Key files and CA dir: inode + mtime */ @@ -848,18 +862,22 @@ static void captureMetadata(serverTLSContextConfig *ctx_config, tlsMaterialsMeta /* Compare two metadata structures to detect changes. */ static int metadataChanged(const tlsMaterialsMetadata *old, const tlsMaterialsMetadata *new) { /* Check certificate fingerprints */ - if (old->cert_fingerprint_len != new->cert_fingerprint_len || - (new->cert_fingerprint_len > 0 && memcmp(old->cert_fingerprint, new->cert_fingerprint, new->cert_fingerprint_len) != 0)) { + if (old->cert_fingerprint_len != new->cert_fingerprint_len + || (new->cert_fingerprint_len > 0 + && memcmp(old->cert_fingerprint, new->cert_fingerprint, new->cert_fingerprint_len) != 0)) { return 1; } - if (old->client_cert_fingerprint_len != new->client_cert_fingerprint_len || - (new->client_cert_fingerprint_len > 0 && memcmp(old->client_cert_fingerprint, new->client_cert_fingerprint, new->client_cert_fingerprint_len) != 0)) { + if (old->client_cert_fingerprint_len != new->client_cert_fingerprint_len + || (new->client_cert_fingerprint_len > 0 + && memcmp(old->client_cert_fingerprint, new->client_cert_fingerprint, new->client_cert_fingerprint_len) + != 0)) { return 1; } - if (old->ca_cert_fingerprint_len != new->ca_cert_fingerprint_len || - (new->ca_cert_fingerprint_len > 0 && memcmp(old->ca_cert_fingerprint, new->ca_cert_fingerprint, new->ca_cert_fingerprint_len) != 0)) { + if (old->ca_cert_fingerprint_len != new->ca_cert_fingerprint_len + || (new->ca_cert_fingerprint_len > 0 + && memcmp(old->ca_cert_fingerprint, new->ca_cert_fingerprint, new->ca_cert_fingerprint_len) != 0)) { return 1; } @@ -870,7 +888,8 @@ static int metadataChanged(const tlsMaterialsMetadata *old, const tlsMaterialsMe if (old->key_file_inode != new->key_file_inode || old->key_file_mtime != new->key_file_mtime) { return 1; } - if (old->client_key_file_inode != new->client_key_file_inode || old->client_key_file_mtime != new->client_key_file_mtime) { + if (old->client_key_file_inode != new->client_key_file_inode + || old->client_key_file_mtime != new->client_key_file_mtime) { return 1; } @@ -1010,8 +1029,8 @@ void tlsReconfigureIfNeeded(void) { long long lastConfigureTime = atomic_load_explicit(&lastTlsConfigureTime, memory_order_relaxed); const long long configAgeMicros = server.ustime - lastConfigureTime; const long long configAgeSeconds = (configAgeMicros / 1000) / 1000; - if (server.tls_ctx_config.auto_reload_interval == 0 || - configAgeSeconds < server.tls_ctx_config.auto_reload_interval) { + if (server.tls_ctx_config.auto_reload_interval == 0 + || configAgeSeconds < server.tls_ctx_config.auto_reload_interval) { return; } bioCreateTlsReloadJob(); @@ -1345,7 +1364,8 @@ user *tlsGetPeerUser(connection *conn_, sds *cert_username) { long verify_result = SSL_get_verify_result(conn->ssl); if (verify_result != X509_V_OK) { - serverLog(LL_DEBUG, "TLS: Client certificate verification failed: %s", + serverLog(LL_DEBUG, + "TLS: Client certificate verification failed: %s", X509_verify_cert_error_string(verify_result)); return NULL; } @@ -1382,8 +1402,7 @@ user *tlsGetPeerUser(connection *conn_, sds *cert_username) { break; } - default: - break; + default: break; } #if OPENSSL_VERSION_NUMBER < 0x30000000L @@ -1444,10 +1463,10 @@ static void tlsHandleEvent(tls_connection *conn, int mask) { if (connTLSAccept((connection *)conn, NULL) == C_ERR || conn->c.state != CONN_STATE_CONNECTED) return; break; case CONN_STATE_CONNECTED: { - int call_read = ((mask & AE_READABLE) && conn->c.read_handler) || - ((mask & AE_WRITABLE) && (conn->flags & TLS_CONN_FLAG_READ_WANT_WRITE)); - int call_write = ((mask & AE_WRITABLE) && conn->c.write_handler) || - ((mask & AE_READABLE) && (conn->flags & TLS_CONN_FLAG_WRITE_WANT_READ)); + int call_read = ((mask & AE_READABLE) && conn->c.read_handler) + || ((mask & AE_WRITABLE) && (conn->flags & TLS_CONN_FLAG_READ_WANT_WRITE)); + int call_write = ((mask & AE_WRITABLE) && conn->c.write_handler) + || ((mask & AE_READABLE) && (conn->flags & TLS_CONN_FLAG_WRITE_WANT_READ)); /* Normally we execute the readable event first, and the writable * event laster. This is useful as sometimes we may be able @@ -2001,7 +2020,9 @@ int ValkeyModule_OnLoad(void *ctx, ValkeyModuleString **argv, int argc) { /* Connection modules must be part of the same build as the server. */ if (strcmp(REDIS_BUILD_ID_RAW, serverBuildIdRaw())) { - serverLog(LL_NOTICE, "Connection type %s was not built together with the valkey-server used.", getConnectionTypeName(CONN_TYPE_TLS)); + serverLog(LL_NOTICE, + "Connection type %s was not built together with the valkey-server used.", + getConnectionTypeName(CONN_TYPE_TLS)); return VALKEYMODULE_ERR; } @@ -2009,11 +2030,15 @@ int ValkeyModule_OnLoad(void *ctx, ValkeyModuleString **argv, int argc) { /* Connection modules is available only bootup. */ if ((ValkeyModule_GetContextFlags(ctx) & VALKEYMODULE_CTX_FLAGS_SERVER_STARTUP) == 0) { - serverLog(LL_NOTICE, "Connection type %s can be loaded only during bootup", getConnectionTypeName(CONN_TYPE_TLS)); + serverLog(LL_NOTICE, + "Connection type %s can be loaded only during bootup", + getConnectionTypeName(CONN_TYPE_TLS)); return VALKEYMODULE_ERR; } - ValkeyModule_SetModuleOptions(ctx, VALKEYMODULE_OPTIONS_HANDLE_REPL_ASYNC_LOAD | VALKEYMODULE_OPTIONS_HANDLE_ATOMIC_SLOT_MIGRATION); + ValkeyModule_SetModuleOptions(ctx, + VALKEYMODULE_OPTIONS_HANDLE_REPL_ASYNC_LOAD + | VALKEYMODULE_OPTIONS_HANDLE_ATOMIC_SLOT_MIGRATION); if (connTypeRegister(&CT_TLS) != C_OK) return VALKEYMODULE_ERR; diff --git a/src/tracking.c b/src/tracking.c index 2ef04b242e1..004c032e358 100644 --- a/src/tracking.c +++ b/src/tracking.c @@ -122,12 +122,16 @@ int checkPrefixCollisionsOrReply(client *c, robj **prefixes, size_t numprefix) { raxStart(&ri, c->pubsub_data->client_tracking_prefixes); raxSeek(&ri, "^", NULL, 0); while (raxNext(&ri)) { - if (stringCheckPrefix(ri.key, ri.key_len, objectGetVal(prefixes[i]), sdslen(objectGetVal(prefixes[i])))) { + if (stringCheckPrefix(ri.key, + ri.key_len, + objectGetVal(prefixes[i]), + sdslen(objectGetVal(prefixes[i])))) { sds collision = sdsnewlen(ri.key, ri.key_len); addReplyErrorFormat(c, "Prefix '%s' overlaps with an existing prefix '%s'. " "Prefixes for a single client must not overlap.", - (unsigned char *)objectGetVal(prefixes[i]), (unsigned char *)collision); + (unsigned char *)objectGetVal(prefixes[i]), + (unsigned char *)collision); sdsfree(collision); raxStop(&ri); return 0; @@ -137,12 +141,15 @@ int checkPrefixCollisionsOrReply(client *c, robj **prefixes, size_t numprefix) { } /* Check input has no overlap with itself. */ for (size_t j = i + 1; j < numprefix; j++) { - if (stringCheckPrefix(objectGetVal(prefixes[i]), sdslen(objectGetVal(prefixes[i])), objectGetVal(prefixes[j]), + if (stringCheckPrefix(objectGetVal(prefixes[i]), + sdslen(objectGetVal(prefixes[i])), + objectGetVal(prefixes[j]), sdslen(objectGetVal(prefixes[j])))) { addReplyErrorFormat(c, "Prefix '%s' overlaps with another provided prefix '%s'. " "Prefixes for a single client must not overlap.", - (unsigned char *)objectGetVal(prefixes[i]), (unsigned char *)objectGetVal(prefixes[j])); + (unsigned char *)objectGetVal(prefixes[i]), + (unsigned char *)objectGetVal(prefixes[j])); return 0; } } @@ -442,8 +449,10 @@ void trackingHandlePendingKeyInvalidations(void) { if (key != NULL) { sendTrackingMessage(server.current_client, (char *)objectGetVal(key), sdslen(objectGetVal(key)), 0); } else { - sendTrackingMessage(server.current_client, objectGetVal(shared.null[server.current_client->resp]), - sdslen(objectGetVal(shared.null[server.current_client->resp])), 1); + sendTrackingMessage(server.current_client, + objectGetVal(shared.null[server.current_client->resp]), + sdslen(objectGetVal(shared.null[server.current_client->resp])), + 1); } } if (key != NULL) decrRefCount(key); @@ -479,7 +488,10 @@ void trackingInvalidateKeysOnFlush(int async) { /* We use a special NULL to indicate that we should send null */ listAddNodeTail(server.tracking_pending_keys, NULL); } else { - sendTrackingMessage(c, objectGetVal(shared.null[c->resp]), sdslen(objectGetVal(shared.null[c->resp])), 1); + sendTrackingMessage(c, + objectGetVal(shared.null[c->resp]), + sdslen(objectGetVal(shared.null[c->resp])), + 1); } } } diff --git a/src/util.c b/src/util.c index 5c7cd5a21b8..f30d913ac32 100644 --- a/src/util.c +++ b/src/util.c @@ -79,7 +79,12 @@ static int stringmatchlen_impl(const char *pattern, } if (patternLen == 1) return 1; /* match */ while (stringLen) { - if (stringmatchlen_impl(pattern + 1, patternLen - 1, string, stringLen, nocase, skipLongerMatches, + if (stringmatchlen_impl(pattern + 1, + patternLen - 1, + string, + stringLen, + nocase, + skipLongerMatches, nesting + 1)) return 1; /* match */ if (*skipLongerMatches) return 0; /* no match */ @@ -510,7 +515,9 @@ static int string2llAVX512(const char *s, size_t slen, long long *value) { return 0; } + // clang-format off const __m256i mul_1_10 = _mm256_set_epi8(1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10); + // clang-format on /* Multiply by 10 and horizontally add adjacent pairs of intermediate values. */ __m256i multiplied_by_10 = _mm256_maddubs_epi16(ascii_digits, mul_1_10); __m128i reduced_to_16bit = _mm256_cvtepi16_epi8(multiplied_by_10); @@ -641,21 +648,16 @@ __attribute__((used)) static int (*string2ll_resolver(void))(const char *, size_ /* Ifunc resolvers run before ASan initialization and before CPU detection * is initialized, so disable ASan and init CPU detection here. */ __builtin_cpu_init(); - if (__builtin_cpu_supports("avx512f") && - __builtin_cpu_supports("avx512vl") && - __builtin_cpu_supports("avx512bw")) + if (__builtin_cpu_supports("avx512f") && __builtin_cpu_supports("avx512vl") && __builtin_cpu_supports("avx512bw")) return string2llAVX512; return string2llScalar; } -int string2ll(const char *s, size_t slen, long long *value) - __attribute__((ifunc("string2ll_resolver"))); +int string2ll(const char *s, size_t slen, long long *value) __attribute__((ifunc("string2ll_resolver"))); #else int string2ll(const char *s, size_t slen, long long *value) { #if HAVE_X86_SIMD - if (__builtin_cpu_supports("avx512f") && - __builtin_cpu_supports("avx512vl") && - __builtin_cpu_supports("avx512bw")) + if (__builtin_cpu_supports("avx512f") && __builtin_cpu_supports("avx512vl") && __builtin_cpu_supports("avx512bw")) return string2llAVX512(s, slen, value); #endif return string2llScalar(s, slen, value); @@ -749,9 +751,9 @@ int string2ld(const char *s, size_t slen, long double *dp) { errno = 0; value = strtold(buf, &eptr); - if (isspace(buf[0]) || eptr[0] != '\0' || (size_t)(eptr - buf) != slen || - (errno == ERANGE && (value == HUGE_VAL || value == -HUGE_VAL || fpclassify(value) == FP_ZERO)) || - errno == EINVAL || isnan(value)) + if (isspace(buf[0]) || eptr[0] != '\0' || (size_t)(eptr - buf) != slen + || (errno == ERANGE && (value == HUGE_VAL || value == -HUGE_VAL || fpclassify(value) == FP_ZERO)) + || errno == EINVAL || isnan(value)) return 0; if (dp) *dp = value; @@ -769,8 +771,9 @@ int string2d(const char *s, size_t slen, double *dp) { errno = 0; char *eptr; *dp = valkey_strtod_n(s, slen, &eptr); - if (slen == 0 || isspace(((const char *)s)[0]) || (size_t)(eptr - (char *)s) != slen || - (errno == ERANGE && (*dp == HUGE_VAL || *dp == -HUGE_VAL || fpclassify(*dp) == FP_ZERO)) || isnan(*dp) || errno == EINVAL) { + if (slen == 0 || isspace(((const char *)s)[0]) || (size_t)(eptr - (char *)s) != slen + || (errno == ERANGE && (*dp == HUGE_VAL || *dp == -HUGE_VAL || fpclassify(*dp) == FP_ZERO)) || isnan(*dp) + || errno == EINVAL) { errno = 0; return 0; } diff --git a/src/valkey-benchmark-dataset.c b/src/valkey-benchmark-dataset.c index aa903004d4b..3a6b107f371 100644 --- a/src/valkey-benchmark-dataset.c +++ b/src/valkey-benchmark-dataset.c @@ -19,9 +19,16 @@ #define PLACEHOLDER_COUNT 10 #define PLACEHOLDER_LEN 12 -static const char *PLACEHOLDERS[PLACEHOLDER_COUNT] = { - "__rand_int__", "__rand_1st__", "__rand_2nd__", "__rand_3rd__", "__rand_4th__", - "__rand_5th__", "__rand_6th__", "__rand_7th__", "__rand_8th__", "__rand_9th__"}; +static const char *PLACEHOLDERS[PLACEHOLDER_COUNT] = {"__rand_int__", + "__rand_1st__", + "__rand_2nd__", + "__rand_3rd__", + "__rand_4th__", + "__rand_5th__", + "__rand_6th__", + "__rand_7th__", + "__rand_8th__", + "__rand_9th__"}; /* Forward declarations */ static bool datasetBuildFieldMap(dataset *ds, sds *template_argv, int template_argc); @@ -33,9 +40,18 @@ static int findFieldIndex(dataset *ds, const char *field_name, size_t field_name static const char *extractDatasetFieldValue(dataset *ds, int field_idx, int record_index); static sds replaceOccurrence(sds processed_arg, const char *pos, const char *replacement); static sds processFieldsInArg(dataset *ds, sds arg, int record_index); -static sds processRandPlaceholdersForDataSet(sds cmd, _Atomic uint64_t *seq_key, int replace_placeholders, int keyspacelen, int sequential_replacement); - -dataset *datasetInit(const char *filename, int max_documents, int has_field_placeholders, sds *template_argv, int template_argc, int verbose) { +static sds processRandPlaceholdersForDataSet(sds cmd, + _Atomic uint64_t *seq_key, + int replace_placeholders, + int keyspacelen, + int sequential_replacement); + +dataset *datasetInit(const char *filename, + int max_documents, + int has_field_placeholders, + sds *template_argv, + int template_argc, + int verbose) { if (!filename) return NULL; dataset *ds = zcalloc(sizeof(dataset)); @@ -160,7 +176,14 @@ size_t datasetGetRecordCount(dataset *ds) { return ds ? ds->record_count : 0; } -sds datasetGenerateCommand(dataset *ds, int record_index, sds *template_argv, int template_argc, _Atomic uint64_t *seq_key, int replace_placeholders, int keyspacelen, int sequential_replacement) { +sds datasetGenerateCommand(dataset *ds, + int record_index, + sds *template_argv, + int template_argc, + _Atomic uint64_t *seq_key, + int replace_placeholders, + int keyspacelen, + int sequential_replacement) { if (!ds || !template_argv) return NULL; sds *processed_argv = zmalloc(template_argc * sizeof(sds)); @@ -183,8 +206,8 @@ sds datasetGenerateCommand(dataset *ds, int record_index, sds *template_argv, in sds result = sdsnewlen(cmd, len); free(cmd); - result = processRandPlaceholdersForDataSet(result, seq_key, replace_placeholders, - keyspacelen, sequential_replacement); + result = + processRandPlaceholdersForDataSet(result, seq_key, replace_placeholders, keyspacelen, sequential_replacement); for (int i = 0; i < template_argc; i++) { sdsfree(processed_argv[i]); @@ -351,8 +374,7 @@ static bool csvLoadDocuments(dataset *ds, int verbose) { static int findFieldIndex(dataset *ds, const char *field_name, size_t field_name_len) { for (int k = 0; k < ds->field_count; k++) { - if (strlen(ds->field_names[k]) == field_name_len && - !memcmp(ds->field_names[k], field_name, field_name_len)) { + if (strlen(ds->field_names[k]) == field_name_len && !memcmp(ds->field_names[k], field_name, field_name_len)) { return ds->field_map ? ds->field_map[k] : k; } } @@ -414,7 +436,11 @@ static sds processFieldsInArg(dataset *ds, sds arg, int record_index) { return arg; } -static sds processRandPlaceholdersForDataSet(sds cmd, _Atomic uint64_t *seq_key, int replace_placeholders, int keyspacelen, int sequential_replacement) { +static sds processRandPlaceholdersForDataSet(sds cmd, + _Atomic uint64_t *seq_key, + int replace_placeholders, + int keyspacelen, + int sequential_replacement) { if (!replace_placeholders || keyspacelen == 0) return cmd; for (int ph = 0; ph < PLACEHOLDER_COUNT; ph++) { diff --git a/src/valkey-benchmark-dataset.h b/src/valkey-benchmark-dataset.h index a0599aff0e6..d94f4aa9537 100644 --- a/src/valkey-benchmark-dataset.h +++ b/src/valkey-benchmark-dataset.h @@ -48,7 +48,12 @@ typedef struct dataset { } dataset; /* Initialize dataset from file - returns NULL on error */ -dataset *datasetInit(const char *filename, int max_documents, int has_field_placeholders, sds *template_argv, int template_argc, int verbose); +dataset *datasetInit(const char *filename, + int max_documents, + int has_field_placeholders, + sds *template_argv, + int template_argc, + int verbose); /* Free dataset and all memory */ void datasetFree(dataset *ds); @@ -58,7 +63,14 @@ size_t datasetGetRecordCount(dataset *ds); #ifndef __cplusplus /* Generate complete command for given record index (caller must sdsfree) */ -sds datasetGenerateCommand(dataset *ds, int record_index, sds *template_argv, int template_argc, _Atomic uint64_t *seq_key, int replace_placeholders, int keyspacelen, int sequential_replacement); +sds datasetGenerateCommand(dataset *ds, + int record_index, + sds *template_argv, + int template_argc, + _Atomic uint64_t *seq_key, + int replace_placeholders, + int keyspacelen, + int sequential_replacement); #endif #endif /* VALKEY_BENCHMARK_DATASET_H */ diff --git a/src/valkey-benchmark.c b/src/valkey-benchmark.c index fb4194696b5..37416565303 100644 --- a/src/valkey-benchmark.c +++ b/src/valkey-benchmark.c @@ -78,9 +78,16 @@ #define PLACEHOLDER_COUNT 10 static const size_t PLACEHOLDER_LEN = 12; // length of BENCHMARK_PLACEHOLDERS strings -static const char *PLACEHOLDERS[PLACEHOLDER_COUNT] = { - "__rand_int__", "__rand_1st__", "__rand_2nd__", "__rand_3rd__", "__rand_4th__", - "__rand_5th__", "__rand_6th__", "__rand_7th__", "__rand_8th__", "__rand_9th__"}; +static const char *PLACEHOLDERS[PLACEHOLDER_COUNT] = {"__rand_int__", + "__rand_1st__", + "__rand_2nd__", + "__rand_3rd__", + "__rand_4th__", + "__rand_5th__", + "__rand_6th__", + "__rand_7th__", + "__rand_8th__", + "__rand_9th__"}; struct benchmarkThread; struct clusterNode; @@ -261,7 +268,15 @@ static void freeServerConfig(serverConfig *cfg); static int fetchClusterSlotsConfiguration(client c); static void updateClusterSlotsConfiguration(void); static long long showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData); -int runFuzzerClients(const char *host, int port, int max_commands, int parallel_clients, int cluster_mode, int num_keys, cliSSLconfig *ssl_config, const char *log_level, int fuzz_flags); +int runFuzzerClients(const char *host, + int port, + int max_commands, + int parallel_clients, + int cluster_mode, + int num_keys, + cliSSLconfig *ssl_config, + const char *log_level, + int fuzz_flags); static int parseCommandTemplate(int argc, char **argv); /* Dict callbacks */ @@ -430,8 +445,7 @@ static void freeServerConfig(serverConfig *cfg) { } void resetPlaceholders(void) { - if (placeholders.index_data) - zfree(placeholders.index_data); /* indices are a single contiguous allocation */ + if (placeholders.index_data) zfree(placeholders.index_data); /* indices are a single contiguous allocation */ memset(&placeholders, 0, sizeof(placeholders)); } @@ -470,8 +484,7 @@ void initPlaceholders(const char *cmd, size_t cmd_len) { placeholders.indices[placeholder] = placeholders.index_data + overall_index; const size_t count = placeholders.count[placeholder]; - memcpy(placeholders.indices[placeholder], temp_indices[placeholder], - sizeof(size_t) * count); + memcpy(placeholders.indices[placeholder], temp_indices[placeholder], sizeof(size_t) * count); overall_index += count; zfree(temp_indices[placeholder]); @@ -681,12 +694,11 @@ static long long acquireTokenOrWait(int tokens) { last_time_ns = new_time; } - if (atomic_compare_exchange_weak_explicit( - &config.last_time_ns, - &old_last_time_ns, - last_time_ns, - memory_order_release, - memory_order_relaxed)) { + if (atomic_compare_exchange_weak_explicit(&config.last_time_ns, + &old_last_time_ns, + last_time_ns, + memory_order_release, + memory_order_relaxed)) { break; } } @@ -756,14 +768,20 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) { * before requesting the new configuration. */ fetch_slots = 1; do_wait = 1; - fprintf(stderr, "Error from server %s:%d: %s.\n", c->cluster_node->ip, - c->cluster_node->port, r->str); + fprintf(stderr, + "Error from server %s:%d: %s.\n", + c->cluster_node->ip, + c->cluster_node->port, + r->str); } if (do_wait) sleep(1); if (fetch_slots && !fetchClusterSlotsConfiguration(c)) exit(1); } else { if (c->cluster_node) { - fprintf(stderr, "Error from server %s:%d: %s\n", c->cluster_node->ip, c->cluster_node->port, + fprintf(stderr, + "Error from server %s:%d: %s\n", + c->cluster_node->ip, + c->cluster_node->port, r->str); } else fprintf(stderr, "Error from server: %s\n", r->str); @@ -916,11 +934,16 @@ static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask) { /* Generate complete pipeline commands for dataset placeholders */ sdssetlen(c->obuf, c->prefixlen); for (int p = 0; p < config.pipeline; p++) { - uint64_t record_index = atomic_fetch_add_explicit(&record_counter, 1, memory_order_relaxed) % config.current_dataset->record_count; - sds complete_cmd = datasetGenerateCommand(config.current_dataset, record_index, - config.template_argv, config.template_argc, - dataset_seq_key, config.replace_placeholders, - config.keyspacelen, config.sequential_replacement); + uint64_t record_index = atomic_fetch_add_explicit(&record_counter, 1, memory_order_relaxed) + % config.current_dataset->record_count; + sds complete_cmd = datasetGenerateCommand(config.current_dataset, + record_index, + config.template_argv, + config.template_argc, + dataset_seq_key, + config.replace_placeholders, + config.keyspacelen, + config.sequential_replacement); c->obuf = sdscatlen(c->obuf, complete_cmd, sdslen(complete_cmd)); sdsfree(complete_cmd); } @@ -1068,7 +1091,9 @@ static client createClient(char *cmd, int len, int seqlen, client from, int thre * time the replies are received, so if the client is reused the * SELECT command will not be used again. */ if (config.conn_info.input_dbnum) { - c->obuf = sdscatprintf(c->obuf, "*2\r\n$6\r\nSELECT\r\n$%d\r\n%s\r\n", (int)sdslen(config.input_dbnumstr), + c->obuf = sdscatprintf(c->obuf, + "*2\r\n$6\r\nSELECT\r\n$%d\r\n%s\r\n", + (int)sdslen(config.input_dbnumstr), config.input_dbnumstr); c->prefix_pending++; } @@ -1081,7 +1106,8 @@ static client createClient(char *cmd, int len, int seqlen, client from, int thre c->prefix_pending++; } - if (config.cluster_mode && (config.read_from_replica == FROM_REPLICA_ONLY || config.read_from_replica == FROM_ALL)) { + if (config.cluster_mode + && (config.read_from_replica == FROM_REPLICA_ONLY || config.read_from_replica == FROM_ALL)) { char *buf = NULL; int len; len = valkeyFormatCommand(&buf, "READONLY"); @@ -1264,8 +1290,15 @@ static void showReport(void) { printf(" %9s %9s %9s %9s %9s %9s\n", "avg", "min", "p50", "p95", "p99", "max"); printf(" %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f\n", avg, p0, p50, p95, p99, p100); } else if (config.csv) { - printf("\"%s\",\"%.2f\",\"%.3f\",\"%.3f\",\"%.3f\",\"%.3f\",\"%.3f\",\"%.3f\"\n", config.title, reqpersec, avg, - p0, p50, p95, p99, p100); + printf("\"%s\",\"%.2f\",\"%.3f\",\"%.3f\",\"%.3f\",\"%.3f\",\"%.3f\",\"%.3f\"\n", + config.title, + reqpersec, + avg, + p0, + p50, + p95, + p99, + p100); } else { printf("%*s\r", config.last_printed_bytes, " "); // ensure there is a clean line printf("%s: %.2f requests per second, p50=%.3f msec\n", config.title, reqpersec, p50); @@ -1315,10 +1348,7 @@ static void benchmarkSequence(const char *title, char *cmd, int len, int seqlen) &config.current_sec_latency_histogram); // Pointer to initialise if (config.rps > 0) { - hdr_init(1, - config.rps * 2, - config.precision, - &config.rps_histogram); + hdr_init(1, config.rps * 2, config.precision, &config.rps_histogram); } initPlaceholders(cmd, len); @@ -1469,7 +1499,9 @@ static int fetchClusterConfiguration(void) { int is_primary = (j == 2); if (is_primary) primary = sdsnew(nr->element[2]->str); int is_cluster_option_only = (config.read_from_replica == FROM_PRIMARY_ONLY); - if ((config.read_from_replica == FROM_REPLICA_ONLY && is_primary) || (is_cluster_option_only && !is_primary)) continue; + if ((config.read_from_replica == FROM_REPLICA_ONLY && is_primary) + || (is_cluster_option_only && !is_primary)) + continue; sds ip = sdsnew(nr->element[0]->str); sds name = sdsnew(nr->element[2]->str); @@ -1605,7 +1637,8 @@ static int fetchClusterSlotsConfiguration(client c) { fprintf(stderr, "%s: could not find node with ID %s in current " "configuration.\n", - errmsg, name); + errmsg, + name); if (name) sdsfree(name); goto cleanup; } @@ -1655,7 +1688,13 @@ static void cleanupDataset(void) { } /* Add RESP command to sequence with repeat count */ -static void addRespCommandToSequence(sds *sds_args, size_t *argvlen, int start, int end, int repeat, sds *cmd_seq, int *seq_len) { +static void addRespCommandToSequence(sds *sds_args, + size_t *argvlen, + int start, + int end, + int repeat, + sds *cmd_seq, + int *seq_len) { char *cmd = NULL; int len = valkeyFormatCommandArgv(&cmd, end - start, (const char **)sds_args + start, argvlen + start); for (int j = 0; j < repeat; j++) { @@ -1812,8 +1851,9 @@ int parseOptions(int argc, char **argv) { } else if (!strcmp(argv[i], "-I")) { config.idlemode = 1; } else if (!strcmp(argv[i], "-e")) { - fprintf(stderr, "WARNING: -e option has no effect. " - "We now immediately exit on error to avoid false results.\n"); + fprintf(stderr, + "WARNING: -e option has no effect. " + "We now immediately exit on error to avoid false results.\n"); } else if (!strcmp(argv[i], "--seed")) { if (lastarg) goto invalid; int rand_seed = atoi(argv[++i]); @@ -1989,143 +2029,143 @@ int parseOptions(int argc, char **argv) { ""; - printf( - "%s%s%s%s%s%s", /* Split to avoid strings longer than 4095 (-Woverlength-strings). */ - "Usage: valkey-benchmark [OPTIONS] [--] [COMMAND ARGS...]\n\n" - "Simulates sending commands using multiple clients. The utility provides a\n" - "default set of tests. You can run a subset of the tests using the -t option or\n" - "supply one or more custom commands on the command line.\n\n" - "To supply multiple commands on the command line, separate them with ';' as in\n" - "`SET foo bar ';' GET foo`. You can also prefix a command in the sequence with\n" - "a number N to repeat the command N times. In command arguments, the following\n" - "placeholders are substituted:\n\n" - " __rand_int__ Replaced with a zero-padded random integer in the range\n" - " selected using the -r option. Multiple occurrences within the\n" - " command will have different values.\n" - "__rand_1st__ Like __rand_int__ but multiple occurrences will have the same\n" - " value. __rand_2nd__ through __rand_9th__ are also available.\n" - " __data__ Replaced with data of the size specified by the -d option.\n" - " __field:name__ Replaced with data from the specified field/column in the\n" - " dataset. Requires --dataset option.\n" - " {tag} Replaced with a tag that routes the command to each node in\n" - " a cluster. Include this in key names when running in cluster\n" - " mode.\n" - "\n", - "Options:\n" - "\n" - " -h Server hostname (default 127.0.0.1)\n" - " -p Server port (default 6379)\n" - " -s Server socket (overrides host and port)\n" - " -a Password for Valkey Auth\n" - " --user Used to send ACL style 'AUTH username pass'. Needs -a.\n" - " -u Server URI on format valkey://user:password@host:port/dbnum\n" - " User, password and dbnum are optional. For authentication\n" - " without a username, use username 'default'. For TLS, use\n" - " the scheme 'valkeys'.\n" - " -c Number of parallel connections (default 50).\n" - " Note: If --cluster is used then number of clients has to be\n" - " the same or higher than the number of nodes.\n" - " -n Total number of requests (default 100000)\n" - " --duration \n" - " Run benchmark for specified number of seconds\n" - " (mutually exclusive with -n)\n" - " --warmup Run benchmark for specified warmup period before\n" - " recording data\n" - " -d Data size of SET/GET value in bytes (default 3)\n" - " --dbnum SELECT the specified db number (default 0)\n" - " -3 Start session in RESP3 protocol mode.\n" - " --threads Enable multi-thread mode.\n" - " --cluster Enable cluster mode.\n" - " If the command is supplied on the command line in cluster\n" - " mode, the key must contain \"{tag}\". Otherwise, the\n" - " command will not be sent to the right cluster node.\n" - " --rfr Enable read from replicas in cluster mode.\n" - " This command must be used with the --cluster option.\n" - " There are three modes for reading from replicas:\n" - " 'no' - sends read requests to primaries only (default) \n" - " 'yes' - sends read requests to replicas only.\n" - " 'all' - sends read requests to all nodes.\n" - " Since write commands will not be accepted by replicas,\n" - " it is recommended to enable read from replicas only for read\n" - " command tests.\n" - " --enable-tracking Send CLIENT TRACKING on before starting benchmark.\n" - " -k 1=keep alive 0=reconnect (default 1)\n" - " -r Use random keys for SET/GET/INCR, random values for SADD,\n" - " random members and scores for ZADD.\n" - " Using this option the benchmark will replace the string\n" - " __rand_int__ inside an argument with a random 12 digit\n" - " number in the specified range from 0 to keyspacelen-1. The\n" - " substitution changes every time a command is executed.\n" - " Default tests use this to hit random keys in the specified\n" - " range.\n" - " Note: If -r is omitted, all commands in a benchmark will\n" - " use the same key.\n" - " --sequential Modifies the -r argument to replace the string __rand_int__\n" - " with 12 digit numbers sequentially instead of randomly.\n" - " __rand_1st__ through __rand_9th__ are available with\n" - " independent counters. Used to create expected number of\n" - " elements with multiple replacements.\n" - " example: ZADD myzset __rand_int__ element:__rand_1st__\n" - " -P Pipeline requests. That is, send multiple requests\n" - " before waiting for the replies. Default 1 (no pipeline).\n" - " When multiple commands are specified on the command line,\n" - " then the full command sequence counts as one and -P controls\n" - " the number of times the command sequence is sent in each\n" - " pipeline.\n", - " -q Quiet. Just show query/sec values\n" - " --precision Number of decimal places to display in latency output\n" - " (default 0)\n" - " --csv Output in CSV format\n" - " -l Loop. Run the tests forever\n" - " -t Only run the comma separated list of tests. The test\n" - " names are the same as the ones produced as output.\n" - " The -t option is ignored if a specific command is supplied\n" - " on the command line.\n" - " -I Idle mode. Just open N idle connections and wait.\n" - " -x Read last argument from STDIN.\n" - " --rps Limit the total number of requests per second.\n" - " Default 0 (no limit)\n" - " --seed Set the seed for random number generator.\n" - " Default seed is based on time.\n" - " --num-functions \n" - " Sets the number of functions present in the Lua lib that is\n" - " loaded when running the 'function_load' test. (default 10).\n" - " --num-keys-in-fcall \n" - " Sets the number of keys passed to FCALL command when running\n" - " the 'fcall' test. (default 1)\n" - " --dataset Path to CSV/TSV dataset file for field placeholder replacement.\n" - " All fields auto-detected with natural content lengths.\n" - " --maxdocs Maximum number of documents to load from dataset file.\n" - " Default: unlimited.\n", - tls_usage, - rdma_usage, - " --mptcp Enable an MPTCP connection.\n" - " --fuzz Enable fuzzy mode to generate random commands. WARNING: Recommended for testing only, not for use with production data.\n" - " --fuzz-mode Set fuzzing modes (comma-separated): malformed-commands, config-commands.\n" - " malformed-commands: Generates also malformed commands.\n" - " config-commands: Allows CONFIG SET commands.\n" - " Default: valid commands only.\n" - " --fuzz-loglevel \n" - " Set log level for fuzzer (none, error, info, debug).\n" - " Default is 'info'.\n" - " --help Output this help and exit.\n" - " --version Output version and exit.\n\n" - "Examples:\n\n" - " Run the benchmark with the default configuration against 127.0.0.1:6379:\n" - " $ valkey-benchmark\n\n" - " Use 20 parallel clients, for a total of 100k requests, against 192.168.1.1:\n" - " $ valkey-benchmark -h 192.168.1.1 -p 6379 -n 100000 -c 20\n\n" - " Fill 127.0.0.1:6379 with about 1 million keys only using the SET test:\n" - " $ valkey-benchmark -t set -n 1000000 -r 100000000\n\n" - " Benchmark 127.0.0.1:6379 for a few commands producing CSV output:\n" - " $ valkey-benchmark -t ping,set,get -n 100000 --csv\n\n" - " Benchmark a specific command line:\n" - " $ valkey-benchmark -r 10000 -n 10000 eval 'return server.call(\"ping\")' 0\n\n" - " Fill a list with 10000 random elements:\n" - " $ valkey-benchmark -r 10000 -n 10000 lpush mylist __rand_int__\n\n" - " Benchmark a specific transaction:\n" - " $ valkey-benchmark -- multi ';' set key:__rand_int__ __data__ ';' \\\n" - " incr counter ';' exec\n\n"); + printf("%s%s%s%s%s%s", /* Split to avoid strings longer than 4095 (-Woverlength-strings). */ + "Usage: valkey-benchmark [OPTIONS] [--] [COMMAND ARGS...]\n\n" + "Simulates sending commands using multiple clients. The utility provides a\n" + "default set of tests. You can run a subset of the tests using the -t option or\n" + "supply one or more custom commands on the command line.\n\n" + "To supply multiple commands on the command line, separate them with ';' as in\n" + "`SET foo bar ';' GET foo`. You can also prefix a command in the sequence with\n" + "a number N to repeat the command N times. In command arguments, the following\n" + "placeholders are substituted:\n\n" + " __rand_int__ Replaced with a zero-padded random integer in the range\n" + " selected using the -r option. Multiple occurrences within the\n" + " command will have different values.\n" + "__rand_1st__ Like __rand_int__ but multiple occurrences will have the same\n" + " value. __rand_2nd__ through __rand_9th__ are also available.\n" + " __data__ Replaced with data of the size specified by the -d option.\n" + " __field:name__ Replaced with data from the specified field/column in the\n" + " dataset. Requires --dataset option.\n" + " {tag} Replaced with a tag that routes the command to each node in\n" + " a cluster. Include this in key names when running in cluster\n" + " mode.\n" + "\n", + "Options:\n" + "\n" + " -h Server hostname (default 127.0.0.1)\n" + " -p Server port (default 6379)\n" + " -s Server socket (overrides host and port)\n" + " -a Password for Valkey Auth\n" + " --user Used to send ACL style 'AUTH username pass'. Needs -a.\n" + " -u Server URI on format valkey://user:password@host:port/dbnum\n" + " User, password and dbnum are optional. For authentication\n" + " without a username, use username 'default'. For TLS, use\n" + " the scheme 'valkeys'.\n" + " -c Number of parallel connections (default 50).\n" + " Note: If --cluster is used then number of clients has to be\n" + " the same or higher than the number of nodes.\n" + " -n Total number of requests (default 100000)\n" + " --duration \n" + " Run benchmark for specified number of seconds\n" + " (mutually exclusive with -n)\n" + " --warmup Run benchmark for specified warmup period before\n" + " recording data\n" + " -d Data size of SET/GET value in bytes (default 3)\n" + " --dbnum SELECT the specified db number (default 0)\n" + " -3 Start session in RESP3 protocol mode.\n" + " --threads Enable multi-thread mode.\n" + " --cluster Enable cluster mode.\n" + " If the command is supplied on the command line in cluster\n" + " mode, the key must contain \"{tag}\". Otherwise, the\n" + " command will not be sent to the right cluster node.\n" + " --rfr Enable read from replicas in cluster mode.\n" + " This command must be used with the --cluster option.\n" + " There are three modes for reading from replicas:\n" + " 'no' - sends read requests to primaries only (default) \n" + " 'yes' - sends read requests to replicas only.\n" + " 'all' - sends read requests to all nodes.\n" + " Since write commands will not be accepted by replicas,\n" + " it is recommended to enable read from replicas only for read\n" + " command tests.\n" + " --enable-tracking Send CLIENT TRACKING on before starting benchmark.\n" + " -k 1=keep alive 0=reconnect (default 1)\n" + " -r Use random keys for SET/GET/INCR, random values for SADD,\n" + " random members and scores for ZADD.\n" + " Using this option the benchmark will replace the string\n" + " __rand_int__ inside an argument with a random 12 digit\n" + " number in the specified range from 0 to keyspacelen-1. The\n" + " substitution changes every time a command is executed.\n" + " Default tests use this to hit random keys in the specified\n" + " range.\n" + " Note: If -r is omitted, all commands in a benchmark will\n" + " use the same key.\n" + " --sequential Modifies the -r argument to replace the string __rand_int__\n" + " with 12 digit numbers sequentially instead of randomly.\n" + " __rand_1st__ through __rand_9th__ are available with\n" + " independent counters. Used to create expected number of\n" + " elements with multiple replacements.\n" + " example: ZADD myzset __rand_int__ element:__rand_1st__\n" + " -P Pipeline requests. That is, send multiple requests\n" + " before waiting for the replies. Default 1 (no pipeline).\n" + " When multiple commands are specified on the command line,\n" + " then the full command sequence counts as one and -P controls\n" + " the number of times the command sequence is sent in each\n" + " pipeline.\n", + " -q Quiet. Just show query/sec values\n" + " --precision Number of decimal places to display in latency output\n" + " (default 0)\n" + " --csv Output in CSV format\n" + " -l Loop. Run the tests forever\n" + " -t Only run the comma separated list of tests. The test\n" + " names are the same as the ones produced as output.\n" + " The -t option is ignored if a specific command is supplied\n" + " on the command line.\n" + " -I Idle mode. Just open N idle connections and wait.\n" + " -x Read last argument from STDIN.\n" + " --rps Limit the total number of requests per second.\n" + " Default 0 (no limit)\n" + " --seed Set the seed for random number generator.\n" + " Default seed is based on time.\n" + " --num-functions \n" + " Sets the number of functions present in the Lua lib that is\n" + " loaded when running the 'function_load' test. (default 10).\n" + " --num-keys-in-fcall \n" + " Sets the number of keys passed to FCALL command when running\n" + " the 'fcall' test. (default 1)\n" + " --dataset Path to CSV/TSV dataset file for field placeholder replacement.\n" + " All fields auto-detected with natural content lengths.\n" + " --maxdocs Maximum number of documents to load from dataset file.\n" + " Default: unlimited.\n", + tls_usage, + rdma_usage, + " --mptcp Enable an MPTCP connection.\n" + " --fuzz Enable fuzzy mode to generate random commands. WARNING: Recommended for testing only, " + "not for use with production data.\n" + " --fuzz-mode Set fuzzing modes (comma-separated): malformed-commands, config-commands.\n" + " malformed-commands: Generates also malformed commands.\n" + " config-commands: Allows CONFIG SET commands.\n" + " Default: valid commands only.\n" + " --fuzz-loglevel \n" + " Set log level for fuzzer (none, error, info, debug).\n" + " Default is 'info'.\n" + " --help Output this help and exit.\n" + " --version Output version and exit.\n\n" + "Examples:\n\n" + " Run the benchmark with the default configuration against 127.0.0.1:6379:\n" + " $ valkey-benchmark\n\n" + " Use 20 parallel clients, for a total of 100k requests, against 192.168.1.1:\n" + " $ valkey-benchmark -h 192.168.1.1 -p 6379 -n 100000 -c 20\n\n" + " Fill 127.0.0.1:6379 with about 1 million keys only using the SET test:\n" + " $ valkey-benchmark -t set -n 1000000 -r 100000000\n\n" + " Benchmark 127.0.0.1:6379 for a few commands producing CSV output:\n" + " $ valkey-benchmark -t ping,set,get -n 100000 --csv\n\n" + " Benchmark a specific command line:\n" + " $ valkey-benchmark -r 10000 -n 10000 eval 'return server.call(\"ping\")' 0\n\n" + " Fill a list with 10000 random elements:\n" + " $ valkey-benchmark -r 10000 -n 10000 lpush mylist __rand_int__\n\n" + " Benchmark a specific transaction:\n" + " $ valkey-benchmark -- multi ';' set key:__rand_int__ __data__ ';' \\\n" + " incr counter ';' exec\n\n"); exit(exit_status); } @@ -2190,9 +2230,12 @@ long long showThroughput(struct aeEventLoop *eventLoop, long long id, void *clie if (warmup_duration > 0) { config.last_printed_bytes += printf("Warming up "); } - config.last_printed_bytes += - printf("%s: rps=%.1f (overall: %.1f) avg_msec=%.3f (overall: %.3f)", config.title, instantaneous_rps, rps, - hdr_mean(config.current_sec_latency_histogram) / 1000.0f, hdr_mean(config.latency_histogram) / 1000.0f); + config.last_printed_bytes += printf("%s: rps=%.1f (overall: %.1f) avg_msec=%.3f (overall: %.3f)", + config.title, + instantaneous_rps, + rps, + hdr_mean(config.current_sec_latency_histogram) / 1000.0f, + hdr_mean(config.latency_histogram) / 1000.0f); if (warmup_duration > 0 || config.duration > 0) { config.last_printed_bytes += printf(" %.1f seconds\r", dt); } else { @@ -2215,11 +2258,13 @@ char *generateFunctionScript(uint32_t num_functions, int with_keys) { assert(buffer_len - written > 0); int n = 0; if (with_keys) { - n = snprintf(buffer + written, buffer_len - written, + n = snprintf(buffer + written, + buffer_len - written, "local function foo%u(keys, args)\nreturn keys[0]\nend\n", num_functions); } else { - n = snprintf(buffer + written, buffer_len - written, + n = snprintf(buffer + written, + buffer_len - written, "local function foo%u()\nreturn 0\nend\n", num_functions); } @@ -2229,7 +2274,8 @@ char *generateFunctionScript(uint32_t num_functions, int with_keys) { } written += n; - n = snprintf(buffer + written, buffer_len - written, + n = snprintf(buffer + written, + buffer_len - written, "server.register_function('foo%u', foo%u)\n", num_functions, num_functions); @@ -2343,10 +2389,8 @@ int main(int argc, char **argv) { * template. Without it, the dataset would be initialized and reported * but never used for command generation. */ if (!config.has_field_placeholders) { - fprintf(stderr, - "Error: Dataset mode requires at least one field placeholder\n"); - fprintf(stderr, - "Example: SET doc:__rand_int__ \"__field:content__\"\n"); + fprintf(stderr, "Error: Dataset mode requires at least one field placeholder\n"); + fprintf(stderr, "Example: SET doc:__rand_int__ \"__field:content__\"\n"); exit(1); } @@ -2355,7 +2399,8 @@ int main(int argc, char **argv) { config.current_dataset = datasetInit(config.dataset_file, config.max_documents, config.has_field_placeholders, - config.template_argv, config.template_argc, + config.template_argv, + config.template_argc, verbose); if (!config.current_dataset) { fprintf(stderr, "Failed to initialize dataset\n"); @@ -2388,7 +2433,8 @@ int main(int argc, char **argv) { fprintf(stderr, "Failed to fetch cluster configuration from " "%s:%d\n", - config.conn_info.hostip, config.conn_info.hostport); + config.conn_info.hostip, + config.conn_info.hostport); } else { fprintf(stderr, "Failed to fetch cluster configuration from " @@ -2442,10 +2488,11 @@ int main(int argc, char **argv) { } if (config.keepalive == 0) { - fprintf(stderr, "WARNING: Keepalive disabled. You probably need " - "'echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse' for Linux and " - "'sudo sysctl -w net.inet.tcp.msl=1000' for Mac OS X in order " - "to use a lot of clients/requests\n"); + fprintf(stderr, + "WARNING: Keepalive disabled. You probably need " + "'echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse' for Linux and " + "'sudo sysctl -w net.inet.tcp.msl=1000' for Mac OS X in order " + "to use a lot of clients/requests\n"); } if (argc > 0 && config.tests != NULL) { fprintf(stderr, "WARNING: Option -t is ignored.\n"); @@ -2472,16 +2519,15 @@ int main(int argc, char **argv) { } if (config.fuzz_mode) { - return runFuzzerClients( - config.conn_info.hostip, - config.conn_info.hostport, - config.requests, - config.numclients, - config.cluster_mode, - config.keyspacelen, - config.tls ? &config.sslconfig : NULL, - config.fuzz_log_level, - config.fuzz_flags); + return runFuzzerClients(config.conn_info.hostip, + config.conn_info.hostport, + config.requests, + config.numclients, + config.cluster_mode, + config.keyspacelen, + config.tls ? &config.sslconfig : NULL, + config.fuzz_log_level, + config.fuzz_flags); } /* Run benchmark with command in the remainder of the arguments. */ @@ -2531,9 +2577,7 @@ int main(int argc, char **argv) { } /* Replace data placeholders with data of length given by -d. */ int num_parts; - sds *parts = sdssplitlen(sds_args[i], sdslen(sds_args[i]), - "__data__", strlen("__data__"), - &num_parts); + sds *parts = sdssplitlen(sds_args[i], sdslen(sds_args[i]), "__data__", strlen("__data__"), &num_parts); sds newarg = parts[0]; parts[0] = NULL; /* prevent it from being freed below */ for (int j = 1; j < num_parts; j++) { @@ -2652,8 +2696,8 @@ int main(int argc, char **argv) { free(cmd); } - if (test_is_selected("lrange") || test_is_selected("lrange_100") || test_is_selected("lrange_300") || - test_is_selected("lrange_500") || test_is_selected("lrange_600")) { + if (test_is_selected("lrange") || test_is_selected("lrange_100") || test_is_selected("lrange_300") + || test_is_selected("lrange_500") || test_is_selected("lrange_600")) { len = valkeyFormatCommand(&cmd, "LPUSH mylist%s %s", tag, data); benchmark("LPUSH (needed to benchmark LRANGE)", cmd, len); free(cmd); diff --git a/src/valkey-check-aof.c b/src/valkey-check-aof.c index fcfdc809003..f20784f0cf6 100644 --- a/src/valkey-check-aof.c +++ b/src/valkey-check-aof.c @@ -195,15 +195,18 @@ int processAnnotations(FILE *fp, char *filename, int last_file) { if (epos == 0) { printf("AOF %s has nothing before timestamp %ld, " "aborting...\n", - filename, to_timestamp); + filename, + to_timestamp); exit(1); } if (!last_file) { printf("Failed to truncate AOF %s to timestamp %ld to offset %ld because it is not the last file.\n", - filename, to_timestamp, (long int)epos); - printf( - "If you insist, please delete all files after this file according to the manifest " - "file and delete the corresponding records in manifest file manually. Then re-run valkey-check-aof.\n"); + filename, + to_timestamp, + (long int)epos); + printf("If you insist, please delete all files after this file according to the manifest " + "file and delete the corresponding records in manifest file manually. Then re-run " + "valkey-check-aof.\n"); exit(1); } /* Truncate remaining AOF if exceeding 'to_timestamp' */ @@ -301,8 +304,12 @@ int checkSingleAof(char *aof_filename, char *aof_filepath, int last_file, int fi return AOF_CHECK_OK; } - printf("AOF analyzed: filename=%s, size=%lld, ok_up_to=%lld, ok_up_to_line=%lld, diff=%lld\n", aof_filename, - (long long)size, (long long)pos, line, (long long)diff); + printf("AOF analyzed: filename=%s, size=%lld, ok_up_to=%lld, ok_up_to_line=%lld, diff=%lld\n", + aof_filename, + (long long)size, + (long long)pos, + line, + (long long)diff); if (diff > 0) { if (fix) { if (!last_file) { @@ -311,8 +318,11 @@ int checkSingleAof(char *aof_filename, char *aof_filepath, int last_file, int fi } char buf[2]; - printf("This will shrink the AOF %s from %lld bytes, with %lld bytes, to %lld bytes\n", aof_filename, - (long long)size, (long long)diff, (long long)pos); + printf("This will shrink the AOF %s from %lld bytes, with %lld bytes, to %lld bytes\n", + aof_filename, + (long long)size, + (long long)diff, + (long long)pos); printf("Continue? [y/N]: "); if (fgets(buf, sizeof(buf), stdin) == NULL || strncasecmp(buf, "y", 1) != 0) { printf("Aborting...\n"); diff --git a/src/valkey-check-rdb.c b/src/valkey-check-rdb.c index 3243b9da590..e0b69b863e5 100644 --- a/src/valkey-check-rdb.c +++ b/src/valkey-check-rdb.c @@ -150,9 +150,15 @@ char *rdb_type_string[] = { "hash-volatile-items", }; -static_assert(sizeof(rdb_type_string) / sizeof(rdb_type_string[0]) == RDB_TYPE_LAST, "Mismatch between enum and string table"); - -char *type_name[OBJ_TYPE_MAX] = {"string", "list", "set", "zset", "hash", "module", /* module type is special */ +static_assert(sizeof(rdb_type_string) / sizeof(rdb_type_string[0]) == RDB_TYPE_LAST, + "Mismatch between enum and string table"); + +char *type_name[OBJ_TYPE_MAX] = {"string", + "list", + "set", + "zset", + "hash", + "module", /* module type is special */ "stream"}; /********************** Rdb stats **********************/ @@ -256,10 +262,8 @@ void computeDatasetProfile(int dbid, robj *keyobj, robj *o, long long expiretime stats->keys++; /* Check if the key already expired. */ - if (expiretime != -1 && expiretime < now) - stats->already_expired++; - if (expiretime != -1) - stats->expires++; + if (expiretime != -1 && expiretime < now) stats->already_expired++; + if (expiretime != -1) stats->expires++; /* Save the key and associated value */ if (o->type == OBJ_STRING) { @@ -378,26 +382,25 @@ void computeDatasetProfile(int dbid, robj *keyobj, robj *o, long long expiretime } } -char *stats_field_string[] = { - "type.name", - "keys.total", - "expire_keys.total", - "already_expired.total", - "keys.size", - "keys.value_size", - "elements.total", - "elements.size", - "elements.num.max", - "elements.num.avg", - "elements.num.p99", - "elements.num.p90", - "elements.num.p50", - "elements.size.max", - "elements.size.avg", - "elements.size.p99", - "elements.size.p90", - "elements.size.p50", - NULL}; +char *stats_field_string[] = {"type.name", + "keys.total", + "expire_keys.total", + "already_expired.total", + "keys.size", + "keys.value_size", + "elements.total", + "elements.size", + "elements.num.max", + "elements.num.avg", + "elements.num.p99", + "elements.num.p90", + "elements.num.p50", + "elements.size.max", + "elements.size.avg", + "elements.size.p99", + "elements.size.p90", + "elements.size.p50", + NULL}; void rdbStatsPrintInfo(rdbStats *stats, char *field_string, char *value, size_t value_len) { if (!strcasecmp(field_string, "type.name")) { @@ -429,7 +432,10 @@ void rdbStatsPrintInfo(rdbStats *stats, char *field_string, char *value, size_t } else if (!strcasecmp(field_string, "elements.size.max")) { snprintf(value, value_len, "%lu", stats->elements_size_max); } else if (!strcasecmp(field_string, "elements.size.avg")) { - snprintf(value, value_len, "%.2lf", (stats->elements > 0 ? (float)stats->all_elements_size / (float)stats->elements : 0)); + snprintf(value, + value_len, + "%.2lf", + (stats->elements > 0 ? (float)stats->all_elements_size / (float)stats->elements : 0)); } else if (!strcasecmp(field_string, "elements.size.p99")) { snprintf(value, value_len, "%.2lf", (float)hdr_value_at_percentile(stats->element_size_histogram, 99.0)); } else if (!strcasecmp(field_string, "elements.size.p90")) { @@ -480,7 +486,12 @@ void rdbShowGenericInfo(void) { if (rdbstate.format == OUTPUT_FORMAT_INFO) { if (i == 0) continue; - snprintf(field_string, sizeof(field_string), "[info] db.%d.type.%s.%s", dbid, type_name[stats->type], stats_field_string[i]); + snprintf(field_string, + sizeof(field_string), + "[info] db.%d.type.%s.%s", + dbid, + type_name[stats->type], + stats_field_string[i]); printf("%s:", field_string); } else if (rdbstate.format == OUTPUT_FORMAT_TABLE) { printf("\t"); @@ -499,8 +510,7 @@ void rdbShowGenericInfo(void) { printf("\n"); } } - if (rdbstate.format == OUTPUT_FORMAT_TABLE || rdbstate.format == OUTPUT_FORMAT_CSV) - printf("\n"); + if (rdbstate.format == OUTPUT_FORMAT_TABLE || rdbstate.format == OUTPUT_FORMAT_CSV) printf("\n"); } } if (rdbCheckOutput) { @@ -526,7 +536,8 @@ void rdbCheckError(const char *fmt, ...) { printf("[additional info] While doing: %s\n", rdb_check_doing_string[rdbstate.doing]); if (rdbstate.key) printf("[additional info] Reading key '%s'\n", (char *)objectGetVal(rdbstate.key)); if (rdbstate.key_type != -1) - printf("[additional info] Reading type %d (%s)\n", rdbstate.key_type, + printf("[additional info] Reading type %d (%s)\n", + rdbstate.key_type, ((unsigned)rdbstate.key_type < sizeof(rdb_type_string) / sizeof(char *)) ? rdb_type_string[rdbstate.key_type] : "unknown"); @@ -627,9 +638,8 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) { goto err; } rdbver = atoi(buf + 6); - if (rdbver < 1 || - (rdbver < RDB_FOREIGN_VERSION_MIN && !is_redis_magic) || - (rdbver > RDB_FOREIGN_VERSION_MAX && !is_valkey_magic)) { + if (rdbver < 1 || (rdbver < RDB_FOREIGN_VERSION_MIN && !is_redis_magic) + || (rdbver > RDB_FOREIGN_VERSION_MAX && !is_valkey_magic)) { rdbCheckError("Can't handle RDB format version %d", rdbver); goto err; } else if (rdbver > RDB_VERSION) { @@ -765,9 +775,7 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) { } rdbstate.functions_num++; continue; - } else if (rdbIsForeignVersion(rdbver) && - type >= RDB_FOREIGN_TYPE_MIN && - type <= RDB_FOREIGN_TYPE_MAX) { + } else if (rdbIsForeignVersion(rdbver) && type >= RDB_FOREIGN_TYPE_MIN && type <= RDB_FOREIGN_TYPE_MAX) { rdbCheckError("Unknown object type %d in RDB file with foreign version %d", type, rdbver); goto err; } else if (!rdbIsObjectType(type)) { @@ -788,7 +796,8 @@ int redis_check_rdb(char *rdbfilename, FILE *fp) { rdbstate.keys++; /* Read value */ rdbstate.doing = RDB_CHECK_DOING_READ_OBJECT_VALUE; - if ((val = rdbLoadObject(type, &rdb, objectGetVal(key), selected_dbid, NULL, RDBFLAGS_NONE, 0)) == NULL) goto eoferr; + if ((val = rdbLoadObject(type, &rdb, objectGetVal(key), selected_dbid, NULL, RDBFLAGS_NONE, 0)) == NULL) + goto eoferr; if (rdbCheckStats) { int max_stats_num = (rdbstate.databases + 1) * OBJ_TYPE_MAX; if (max_stats_num > rdbstate.stats_num) { diff --git a/src/valkey-cli.c b/src/valkey-cli.c index bffa33b0f19..7ba02a319ce 100644 --- a/src/valkey-cli.c +++ b/src/valkey-cli.c @@ -176,8 +176,8 @@ /* --latency-dist palettes. */ int spectrum_palette_color_size = 19; -int spectrum_palette_color[] = {0, 233, 234, 235, 237, 239, 241, 243, 245, 247, - 144, 143, 142, 184, 226, 214, 208, 202, 196}; +int spectrum_palette_color[] = + {0, 233, 234, 235, 237, 239, 241, 243, 245, 247, 144, 143, 142, 184, 226, 214, 208, 202, 196}; int spectrum_palette_mono_size = 13; int spectrum_palette_mono[] = {0, 233, 234, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253}; @@ -448,8 +448,8 @@ static void cliLegacyIntegrateHelp(void) { * don't already match what we have. */ for (size_t j = 0; j < reply->elements; j++) { valkeyReply *entry = reply->element[j]; - if (entry->type != VALKEY_REPLY_ARRAY || entry->elements < 4 || entry->element[0]->type != VALKEY_REPLY_STRING || - entry->element[1]->type != VALKEY_REPLY_INTEGER || entry->element[3]->type != VALKEY_REPLY_INTEGER) + if (entry->type != VALKEY_REPLY_ARRAY || entry->elements < 4 || entry->element[0]->type != VALKEY_REPLY_STRING + || entry->element[1]->type != VALKEY_REPLY_INTEGER || entry->element[3]->type != VALKEY_REPLY_INTEGER) return; char *cmdname = entry->element[0]->str; int i; @@ -607,8 +607,11 @@ static void cliFillInCommandHelpEntry(helpEntry *help, char *cmdname, char *subc * Returns a pointer to the next available position in the help entries table. * If the command has subcommands, this is called recursively for the subcommands. */ -static helpEntry * -cliInitCommandHelpEntry(char *cmdname, char *subcommandname, helpEntry *next, valkeyReply *specs, dict *groups) { +static helpEntry *cliInitCommandHelpEntry(char *cmdname, + char *subcommandname, + helpEntry *next, + valkeyReply *specs, + dict *groups) { helpEntry *help = next++; cliFillInCommandHelpEntry(help, cmdname, subcommandname); @@ -661,8 +664,8 @@ static size_t cliCountCommands(valkeyReply *commandTable) { /* The command docs table maps command names to a map of their specs. */ for (size_t i = 0; i < commandTable->elements; i += 2) { assert(commandTable->element[i]->type == VALKEY_REPLY_STRING); /* Command name. */ - assert(commandTable->element[i + 1]->type == VALKEY_REPLY_MAP || - commandTable->element[i + 1]->type == VALKEY_REPLY_ARRAY); + assert(commandTable->element[i + 1]->type == VALKEY_REPLY_MAP + || commandTable->element[i + 1]->type == VALKEY_REPLY_ARRAY); valkeyReply *map = commandTable->element[i + 1]; for (size_t j = 0; j < map->elements; j += 2) { assert(map->element[j]->type == VALKEY_REPLY_STRING); @@ -723,8 +726,8 @@ void cliInitCommandHelpEntries(valkeyReply *commandTable, dict *groups) { assert(commandTable->element[i]->type == VALKEY_REPLY_STRING); char *cmdname = commandTable->element[i]->str; - assert(commandTable->element[i + 1]->type == VALKEY_REPLY_MAP || - commandTable->element[i + 1]->type == VALKEY_REPLY_ARRAY); + assert(commandTable->element[i + 1]->type == VALKEY_REPLY_MAP + || commandTable->element[i + 1]->type == VALKEY_REPLY_ARRAY); valkeyReply *cmdspecs = commandTable->element[i + 1]; next = cliInitCommandHelpEntry(cmdname, NULL, next, cmdspecs, groups); } @@ -808,7 +811,11 @@ static helpEntry *cliLegacyInitCommandHelpEntry(char *cmdname, for (size_t i = 0; command->subcommands[i].name != NULL; i++) { if (!version || versionIsSupported(version, command->subcommands[i].since)) { char *subcommandname = command->subcommands[i].name; - next = cliLegacyInitCommandHelpEntry(cmdname, subcommandname, next, &command->subcommands[i], groups, + next = cliLegacyInitCommandHelpEntry(cmdname, + subcommandname, + next, + &command->subcommands[i], + groups, version); } } @@ -1648,7 +1655,12 @@ static int cliConnect(int flags) { cliRefreshPrompt(); } - context = valkeyConnectWrapper(config.ct, config.conn_info.hostip, config.conn_info.hostport, config.connect_timeout, 0, config.mptcp); + context = valkeyConnectWrapper(config.ct, + config.conn_info.hostip, + config.conn_info.hostport, + config.connect_timeout, + 0, + config.mptcp); if (!context->err && config.tls) { const char *err = NULL; @@ -1727,8 +1739,8 @@ static void cliPrintContextError(void) { } static int isInvalidateReply(valkeyReply *reply) { - return reply->type == VALKEY_REPLY_PUSH && reply->elements == 2 && reply->element[0]->type == VALKEY_REPLY_STRING && - !strncmp(reply->element[0]->str, "invalidate", 10) && reply->element[1]->type == VALKEY_REPLY_ARRAY; + return reply->type == VALKEY_REPLY_PUSH && reply->elements == 2 && reply->element[0]->type == VALKEY_REPLY_STRING + && !strncmp(reply->element[0]->str, "invalidate", 10) && reply->element[1]->type == VALKEY_REPLY_ARRAY; } /* Special display handler for RESP3 'invalidate' messages. @@ -1875,16 +1887,16 @@ static sds cliFormatReplyTTY(valkeyReply *r, char *prefix) { /* Returns 1 if the reply is a pubsub pushed reply. */ int isPubsubPush(valkeyReply *r) { - if (r == NULL || r->type != (config.current_resp3 ? VALKEY_REPLY_PUSH : VALKEY_REPLY_ARRAY) || r->elements < 3 || - r->element[0]->type != VALKEY_REPLY_STRING) { + if (r == NULL || r->type != (config.current_resp3 ? VALKEY_REPLY_PUSH : VALKEY_REPLY_ARRAY) || r->elements < 3 + || r->element[0]->type != VALKEY_REPLY_STRING) { return 0; } char *str = r->element[0]->str; size_t len = r->element[0]->len; /* Check if it is [p|s][un]subscribe or [p|s]message, but even simpler, we * just check that it ends with "message" or "subscribe". */ - return ((len >= strlen("message") && !strcmp(str + len - strlen("message"), "message")) || - (len >= strlen("subscribe") && !strcmp(str + len - strlen("subscribe"), "subscribe"))); + return ((len >= strlen("message") && !strcmp(str + len - strlen("message"), "message")) + || (len >= strlen("subscribe") && !strcmp(str + len - strlen("subscribe"), "subscribe"))); } int isColorTerm(void) { @@ -2094,8 +2106,8 @@ static sds cliFormatReplyJson(sds out, valkeyReply *r, int mode) { out = sdscat(out, "{"); for (i = 0; i < r->elements; i += 2) { valkeyReply *key = r->element[i]; - if (key->type == VALKEY_REPLY_ERROR || key->type == VALKEY_REPLY_STATUS || key->type == VALKEY_REPLY_STRING || - key->type == VALKEY_REPLY_VERB) { + if (key->type == VALKEY_REPLY_ERROR || key->type == VALKEY_REPLY_STATUS || key->type == VALKEY_REPLY_STRING + || key->type == VALKEY_REPLY_VERB) { out = cliFormatReplyJson(out, key, mode); } else { /* According to JSON spec, JSON map keys must be strings, @@ -2203,8 +2215,8 @@ static int cliReadReply(int output_raw_strings) { /* Check if we need to connect to a different node and reissue the * request. */ - if (config.cluster_mode && reply->type == VALKEY_REPLY_ERROR && - (!strncmp(reply->str, "MOVED ", 6) || !strncmp(reply->str, "ASK ", 4))) { + if (config.cluster_mode && reply->type == VALKEY_REPLY_ERROR + && (!strncmp(reply->str, "MOVED ", 6) || !strncmp(reply->str, "ASK ", 4))) { char *p = reply->str, *s; int slot; @@ -2228,7 +2240,9 @@ static int cliReadReply(int output_raw_strings) { } config.conn_info.hostport = atoi(s + 1); if (config.interactive) - printf("-> Redirected to slot [%d] located at %s:%d\n", slot, config.conn_info.hostip, + printf("-> Redirected to slot [%d] located at %s:%d\n", + slot, + config.conn_info.hostip, config.conn_info.hostport); config.cluster_reissue_command = 1; if (!strncmp(reply->str, "ASK ", 4)) { @@ -2256,7 +2270,8 @@ static void handlePubSubMode(valkeyReply *reply) { int count = reply->element[2]->integer; /* Update counts based on the command type */ - if (strcmp(cmd, "subscribe") == 0 || strcmp(cmd, "psubscribe") == 0 || strcmp(cmd, "unsubscribe") == 0 || strcmp(cmd, "punsubscribe") == 0) { + if (strcmp(cmd, "subscribe") == 0 || strcmp(cmd, "psubscribe") == 0 || strcmp(cmd, "unsubscribe") == 0 + || strcmp(cmd, "punsubscribe") == 0) { config.pubsub_unsharded_count = count; } else if (strcmp(cmd, "ssubscribe") == 0 || strcmp(cmd, "sunsubscribe") == 0) { config.pubsub_sharded_count = count; @@ -2352,18 +2367,18 @@ static int cliSendCommand(int argc, char **argv, long repeat) { if (context == NULL) return VALKEY_ERR; output_raw = 0; - if (!strcasecmp(command, "info") || !strcasecmp(command, "lolwut") || - (argc >= 2 && !strcasecmp(command, "debug") && !strcasecmp(argv[1], "htstats")) || - (argc >= 2 && !strcasecmp(command, "debug") && !strcasecmp(argv[1], "htstats-key")) || - (argc >= 2 && !strcasecmp(command, "debug") && !strcasecmp(argv[1], "client-eviction")) || - (argc >= 2 && !strcasecmp(command, "memory") && - (!strcasecmp(argv[1], "malloc-stats") || !strcasecmp(argv[1], "doctor"))) || - (argc == 2 && !strcasecmp(command, "cluster") && - (!strcasecmp(argv[1], "nodes") || !strcasecmp(argv[1], "info"))) || - (argc >= 2 && !strcasecmp(command, "client") && - (!strcasecmp(argv[1], "list") || !strcasecmp(argv[1], "info"))) || - (argc == 3 && !strcasecmp(command, "latency") && !strcasecmp(argv[1], "graph")) || - (argc == 2 && !strcasecmp(command, "latency") && !strcasecmp(argv[1], "doctor")) || + if (!strcasecmp(command, "info") || !strcasecmp(command, "lolwut") + || (argc >= 2 && !strcasecmp(command, "debug") && !strcasecmp(argv[1], "htstats")) + || (argc >= 2 && !strcasecmp(command, "debug") && !strcasecmp(argv[1], "htstats-key")) + || (argc >= 2 && !strcasecmp(command, "debug") && !strcasecmp(argv[1], "client-eviction")) + || (argc >= 2 && !strcasecmp(command, "memory") + && (!strcasecmp(argv[1], "malloc-stats") || !strcasecmp(argv[1], "doctor"))) + || (argc == 2 && !strcasecmp(command, "cluster") + && (!strcasecmp(argv[1], "nodes") || !strcasecmp(argv[1], "info"))) + || (argc >= 2 && !strcasecmp(command, "client") + && (!strcasecmp(argv[1], "list") || !strcasecmp(argv[1], "info"))) + || (argc == 3 && !strcasecmp(command, "latency") && !strcasecmp(argv[1], "graph")) + || (argc == 2 && !strcasecmp(command, "latency") && !strcasecmp(argv[1], "doctor")) || /* Format PROXY INFO command for Cluster Proxy: * https://github.com/artix75/redis-cluster-proxy */ (argc >= 2 && !strcasecmp(command, "proxy") && !strcasecmp(argv[1], "info"))) { @@ -2375,10 +2390,10 @@ static int cliSendCommand(int argc, char **argv, long repeat) { if (!strcasecmp(command, "shutdown")) config.shutdown = 1; if (!strcasecmp(command, "monitor")) config.monitor_mode = 1; - int is_subscribe = - (!strcasecmp(command, "subscribe") || !strcasecmp(command, "psubscribe") || !strcasecmp(command, "ssubscribe")); - int is_unsubscribe = (!strcasecmp(command, "unsubscribe") || !strcasecmp(command, "punsubscribe") || - !strcasecmp(command, "sunsubscribe")); + int is_subscribe = (!strcasecmp(command, "subscribe") || !strcasecmp(command, "psubscribe") + || !strcasecmp(command, "ssubscribe")); + int is_unsubscribe = (!strcasecmp(command, "unsubscribe") || !strcasecmp(command, "punsubscribe") + || !strcasecmp(command, "sunsubscribe")); if (!strcasecmp(command, "sync") || !strcasecmp(command, "psync")) config.replica_mode = 1; /* When the user manually calls SCRIPT DEBUG, setup the activation of @@ -2535,7 +2550,12 @@ static valkeyReply *reconnectingValkeyCommand(valkeyContext *c, const char *fmt, fflush(stdout); valkeyFree(c); - c = valkeyConnectWrapper(config.ct, config.conn_info.hostip, config.conn_info.hostport, config.connect_timeout, 0, config.mptcp); + c = valkeyConnectWrapper(config.ct, + config.conn_info.hostip, + config.conn_info.hostport, + config.connect_timeout, + 0, + config.mptcp); if (!c->err && config.tls) { const char *err = NULL; if (cliSecureConnection(c, config.sslconfig, &err) == VALKEY_ERR && err) { @@ -2586,7 +2606,8 @@ static int parseOptions(int argc, char **argv) { config.stdin_tag_name = argv[++i]; } else if (!strcmp(argv[i], "-p") && !lastarg) { config.conn_info.hostport = atoi(argv[++i]); - if ((config.conn_info.hostport == 0 && !(strlen(argv[i]) == 1 && argv[i][0] == '0')) || config.conn_info.hostport < 0 || config.conn_info.hostport > 65535) { + if ((config.conn_info.hostport == 0 && !(strlen(argv[i]) == 1 && argv[i][0] == '0')) + || config.conn_info.hostport < 0 || config.conn_info.hostport > 65535) { fprintf(stderr, "Invalid server port.\n"); exit(1); } @@ -2760,11 +2781,12 @@ static int parseOptions(int argc, char **argv) { config.cluster_manager_command.from_askpass = 1; } else if (!strcmp(argv[i], "--cluster-weight") && !lastarg) { if (config.cluster_manager_command.weight != NULL) { - fprintf(stderr, "WARNING: you cannot use --cluster-weight " - "more than once.\n" - "You can set more weights by adding them " - "as a space-separated list, ie:\n" - "--cluster-weight n1=w n2=w\n"); + fprintf(stderr, + "WARNING: you cannot use --cluster-weight " + "more than once.\n" + "You can set more weights by adding them " + "as a space-separated list, ie:\n" + "--cluster-weight n1=w n2=w\n"); exit(1); } int widx = i + 1; @@ -2798,13 +2820,13 @@ static int parseOptions(int argc, char **argv) { config.cluster_manager_command.flags |= CLUSTER_MANAGER_CMD_FLAG_COPY; } else if (!strcmp(argv[i], "--cluster-slave") || !strcmp(argv[i], "--cluster-replica")) { config.cluster_manager_command.flags |= CLUSTER_MANAGER_CMD_FLAG_REPLICA; - } else if (!strcmp(argv[i], "--cluster-use-empty-masters") || - !strcmp(argv[i], "--cluster-use-empty-primaries")) { + } else if (!strcmp(argv[i], "--cluster-use-empty-masters") + || !strcmp(argv[i], "--cluster-use-empty-primaries")) { config.cluster_manager_command.flags |= CLUSTER_MANAGER_CMD_FLAG_EMPTY_PRIMARY; } else if (!strcmp(argv[i], "--cluster-search-multiple-owners")) { config.cluster_manager_command.flags |= CLUSTER_MANAGER_CMD_FLAG_CHECK_OWNERS; - } else if (!strcmp(argv[i], "--cluster-fix-with-unreachable-masters") || - !strcmp(argv[i], "--cluster-fix-with-unreachable-primaries")) { + } else if (!strcmp(argv[i], "--cluster-fix-with-unreachable-masters") + || !strcmp(argv[i], "--cluster-fix-with-unreachable-primaries")) { config.cluster_manager_command.flags |= CLUSTER_MANAGER_CMD_FLAG_FIX_WITH_UNREACHABLE_PRIMARIES; } else if (!strcmp(argv[i], "--cluster-use-atomic-slot-migration")) { config.cluster_manager_command.flags |= CLUSTER_MANAGER_CMD_FLAG_USE_ATOMIC_SLOT_MIGRATION; @@ -3044,7 +3066,9 @@ static void usage(int err) { " --show-pushes Whether to print RESP3 PUSH messages. Enabled by default when\n" " STDOUT is a tty but can be overridden with --show-pushes no.\n" " --stat Print rolling stats about server: mem, clients, ...\n", - version, tls_usage, rdma_usage); + version, + tls_usage, + rdma_usage); fprintf(target, " --latency Enter a special mode continuously sampling latency.\n" @@ -3108,7 +3132,8 @@ static void usage(int err) { "Examples:\n" " valkey-cli -u valkey://default:PASSWORD@localhost:6379/0\n" " cat /etc/passwd | valkey-cli -x set mypasswd\n" - " valkey-cli -D \"\" --raw dump key > key.dump && valkey-cli -X dump_tag restore key2 0 dump_tag replace < key.dump\n" + " valkey-cli -D \"\" --raw dump key > key.dump && valkey-cli -X dump_tag restore key2 0 dump_tag replace " + "< key.dump\n" " valkey-cli -r 100 lpush mylist x\n" " valkey-cli -r 100 -i 1 info | grep used_memory_human:\n" " valkey-cli --quoted-input set '\"null-\\x00-separated\"' value\n" @@ -3152,8 +3177,8 @@ static int issueCommandRepeat(int argc, char **argv, long repeat) { } while (1) { - if (config.cluster_reissue_command || context == NULL || context->err == VALKEY_ERR_IO || - context->err == VALKEY_ERR_EOF) { + if (config.cluster_reissue_command || context == NULL || context->err == VALKEY_ERR_IO + || context->err == VALKEY_ERR_EOF) { if (cliConnect(CC_FORCE) != VALKEY_OK) { cliPrintContextError(); config.cluster_reissue_command = 0; @@ -3264,16 +3289,16 @@ void cliLoadPreferences(void) { static int isSensitiveCommand(int argc, char **argv) { if (!strcasecmp(argv[0], "auth")) { return 1; - } else if (argc > 1 && !strcasecmp(argv[0], "acl") && - (!strcasecmp(argv[1], "deluser") || !strcasecmp(argv[1], "setuser") || - !strcasecmp(argv[1], "getuser"))) { + } else if (argc > 1 && !strcasecmp(argv[0], "acl") + && (!strcasecmp(argv[1], "deluser") || !strcasecmp(argv[1], "setuser") + || !strcasecmp(argv[1], "getuser"))) { return 1; } else if (argc > 2 && !strcasecmp(argv[0], "config") && !strcasecmp(argv[1], "set")) { for (int j = 2; j < argc; j = j + 2) { - if (!strcasecmp(argv[j], "masterauth") || !strcasecmp(argv[j], "masteruser") || - !strcasecmp(argv[j], "primaryuser") || !strcasecmp(argv[j], "primaryauth") || - !strcasecmp(argv[j], "tls-key-file-pass") || !strcasecmp(argv[j], "tls-client-key-file-pass") || - !strcasecmp(argv[j], "requirepass")) { + if (!strcasecmp(argv[j], "masterauth") || !strcasecmp(argv[j], "masteruser") + || !strcasecmp(argv[j], "primaryuser") || !strcasecmp(argv[j], "primaryauth") + || !strcasecmp(argv[j], "tls-key-file-pass") || !strcasecmp(argv[j], "tls-client-key-file-pass") + || !strcasecmp(argv[j], "requirepass")) { return 1; } } @@ -3306,8 +3331,8 @@ static int isSensitiveCommand(int argc, char **argv) { } else if (argc > 4 && !strcasecmp(argv[0], "sentinel")) { /* SENTINEL CONFIG SET sentinel-pass password * SENTINEL CONFIG SET sentinel-user username */ - if (!strcasecmp(argv[1], "config") && !strcasecmp(argv[2], "set") && - (!strcasecmp(argv[3], "sentinel-pass") || !strcasecmp(argv[3], "sentinel-user"))) { + if (!strcasecmp(argv[1], "config") && !strcasecmp(argv[2], "set") + && (!strcasecmp(argv[3], "sentinel-pass") || !strcasecmp(argv[3], "sentinel-user"))) { return 1; } /* SENTINEL SET auth-pass password @@ -3553,10 +3578,9 @@ static int evalMode(int argc, char **argv) { /* If we are debugging a script, enable the Lua debugger. */ if (config.eval_ldb) { - valkeyReply *reply = valkeyCommand( - context, - config.eval_ldb_sync ? "SCRIPT DEBUG sync %s" : "SCRIPT DEBUG yes %s", - engine_name ? engine_name : ""); + valkeyReply *reply = valkeyCommand(context, + config.eval_ldb_sync ? "SCRIPT DEBUG sync %s" : "SCRIPT DEBUG yes %s", + engine_name ? engine_name : ""); if (reply) freeReplyObject(reply); } @@ -3753,24 +3777,41 @@ typedef struct clusterManagerCommandDef { clusterManagerCommandDef clusterManagerCommands[] = { {"create", clusterManagerCommandCreate, -1, "host1:port1 ... hostN:portN", "replicas "}, - {"check", clusterManagerCommandCheck, -1, " or - separated by either colon or space", + {"check", + clusterManagerCommandCheck, + -1, + " or - separated by either colon or space", "search-multiple-owners"}, {"info", clusterManagerCommandInfo, -1, " or - separated by either colon or space", NULL}, - {"fix", clusterManagerCommandFix, -1, " or - separated by either colon or space", + {"fix", + clusterManagerCommandFix, + -1, + " or - separated by either colon or space", "search-multiple-owners,fix-with-unreachable-primaries"}, - {"reshard", clusterManagerCommandReshard, -1, " or - separated by either colon or space", + {"reshard", + clusterManagerCommandReshard, + -1, + " or - separated by either colon or space", "from ,to ,slots ,yes,timeout ,pipeline ," "replace"}, - {"rebalance", clusterManagerCommandRebalance, -1, + {"rebalance", + clusterManagerCommandRebalance, + -1, " or - separated by either colon or space", "weight ,use-empty-primaries," "timeout ,simulate,pipeline ,threshold ,replace"}, - {"add-node", clusterManagerCommandAddNode, 2, "new_host:new_port existing_host:existing_port", + {"add-node", + clusterManagerCommandAddNode, + 2, + "new_host:new_port existing_host:existing_port", "replica,primaries-id "}, {"del-node", clusterManagerCommandDeleteNode, 2, "host:port node_id", NULL}, {"call", clusterManagerCommandCall, -2, "host:port command arg arg .. arg", "only-primaries,only-replicas"}, {"set-timeout", clusterManagerCommandSetTimeout, 2, "host:port milliseconds", NULL}, - {"import", clusterManagerCommandImport, 1, "host:port", + {"import", + clusterManagerCommandImport, + 1, + "host:port", "from ,from-user ,from-pass ,from-askpass,copy,replace"}, {"backup", clusterManagerCommandBackup, 2, "host:port backup_directory", NULL}, {"help", clusterManagerCommandHelp, 0, NULL, NULL}}; @@ -3829,8 +3870,9 @@ static clusterManagerCommandProc *validateClusterManagerCommand(void) { clusterManagerCommandDef cmddef = clusterManagerCommands[i]; if (!strcmp(cmddef.name, cmdname)) { if ((cmddef.arity > 0 && argc != cmddef.arity) || (cmddef.arity < 0 && argc < (cmddef.arity * -1))) { - fprintf(stderr, "[ERR] Wrong number of arguments for " - "specified --cluster sub command\n"); + fprintf(stderr, + "[ERR] Wrong number of arguments for " + "specified --cluster sub command\n"); return NULL; } proc = cmddef.proc; @@ -4429,7 +4471,13 @@ static sds clusterManagerNodeGetJSON(clusterManagerNode *node, unsigned long err " \"slots_count\": %d,\n" " \"flags\": \"%s\",\n" " \"current_epoch\": %llu", - node->name, node->ip, node->port, replicate, slots, node->slots_count, flags, + node->name, + node->ip, + node->port, + replicate, + slots, + node->slots_count, + flags, (unsigned long long)node->current_epoch); if (error_count > 0) { json = sdscatprintf(json, ",\n \"cluster_errors\": %lu", error_count); @@ -4520,7 +4568,14 @@ static sds clusterManagerNodeInfo(clusterManagerNode *node, int indent) { "%s: %S %s:%u\n" "%s slots:%S (%u slots) " "%S", - role, node->name, node->ip, node->port, spaces, slots, node->slots_count, flags); + role, + node->name, + node->ip, + node->port, + spaces, + slots, + node->slots_count, + flags); sdsfree(slots); sdsfree(flags); } @@ -4577,8 +4632,13 @@ static void clusterManagerShowClusterInfo(void) { return; }; if (reply != NULL) freeReplyObject(reply); - printf("%s:%d (%s...) -> %lld keys | %d slots | %d replicas.\n", node->ip, node->port, name, dbsize, - node->slots_count, replicas); + printf("%s:%d (%s...) -> %lld keys | %d slots | %d replicas.\n", + node->ip, + node->port, + name, + dbsize, + node->slots_count, + replicas); primaries++; keys += dbsize; } @@ -4693,7 +4753,10 @@ static sds clusterManagerGetSlotRangeString(list *slot_ranges) { return slot_range_str; } -static int clusterManagerMigrateSlots(clusterManagerNode *node1, clusterManagerNode *node2, list *slot_ranges, char **err) { +static int clusterManagerMigrateSlots(clusterManagerNode *node1, + clusterManagerNode *node2, + list *slot_ranges, + char **err) { /* Create the command */ const char **argv = zmalloc(sizeof(char *) * (5 + listLength(slot_ranges) * 2)); size_t *argvlen = zmalloc(sizeof(size_t) * (5 + listLength(slot_ranges) * 2)); @@ -4774,7 +4837,10 @@ void releaseGetSlotMigrationsEntry(void *entry) { } /* Parse the given key and value pair into the provided target_entry. */ -static int parseGetSlotMigrationsEntryKeyValuePair(getSlotMigrationsEntry *target_entry, valkeyReply *key, valkeyReply *value, char **err) { +static int parseGetSlotMigrationsEntryKeyValuePair(getSlotMigrationsEntry *target_entry, + valkeyReply *key, + valkeyReply *value, + char **err) { if (key->type != VALKEY_REPLY_STRING) { if (err) *err = zstrdup("Expected string type for each key in CLUSTER GETSLOTMIGRATIONS"); return 0; @@ -4925,12 +4991,17 @@ static int clusterManagerGetSlotMigration(clusterManagerNode *node, list *slot_r } /* Set slot status to "importing" or "migrating" */ -static int -clusterManagerSetSlot(clusterManagerNode *node1, clusterManagerNode *node2, int slot, const char *status, char **err) { +static int clusterManagerSetSlot(clusterManagerNode *node1, + clusterManagerNode *node2, + int slot, + const char *status, + char **err) { valkeyReply *reply = CLUSTER_MANAGER_COMMAND(node1, "CLUSTER " "SETSLOT %d %s %s", - slot, status, (char *)node2->name); + slot, + status, + (char *)node2->name); if (err != NULL) *err = NULL; if (!reply) { if (err) *err = zstrdup("CLUSTER SETSLOT failed to run"); @@ -5227,7 +5298,8 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source, reply = CLUSTER_MANAGER_COMMAND(source, "CLUSTER " "GETKEYSINSLOT %d %d", - slot, pipeline); + slot, + pipeline); success = (reply != NULL); if (!success) { goto next; @@ -5277,7 +5349,8 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source, if (do_fix && not_served) { clusterManagerLogWarn("*** Slot was not served, setting " "owner to node %s:%d.\n", - target->ip, target->port); + target->ip, + target->port); clusterManagerSetSlot(source, target, slot, "node", NULL); } /* If the key already exists in the target node (BUSYKEY), @@ -5302,8 +5375,8 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source, if (!success) { clusterManagerLogErr("*** Value check failed!\n"); const char *debug_not_allowed = "ERR DEBUG command not allowed."; - if ((source_err && !strncmp(source_err, debug_not_allowed, 30)) || - (target_err && !strncmp(target_err, debug_not_allowed, 30))) { + if ((source_err && !strncmp(source_err, debug_not_allowed, 30)) + || (target_err && !strncmp(target_err, debug_not_allowed, 30))) { clusterManagerLogErr("DEBUG command is not allowed.\n" "You can turn on the enable-debug-command option.\n" "Or you can relaunch the command with --cluster-replace " @@ -5325,7 +5398,11 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source, " Source node: %s:%d\n" " Target node: %s:%d\n" " Keys(s):\n", - listLength(diffs), source->ip, source->port, target->ip, target->port); + listLength(diffs), + source->ip, + source->port, + target->ip, + target->port); listIter dli; listNode *dln; listRewind(diffs, &dli); @@ -5392,10 +5469,19 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source, * CLUSTER_MANAGER_OPT_UPDATE -- Update node->slots for source/target nodes. * CLUSTER_MANAGER_OPT_QUIET -- Don't print info messages. */ -static int clusterManagerMoveSlotRangesASM(clusterManagerNode *source, clusterManagerNode *target, list *slot_ranges, int opts, char **err) { +static int clusterManagerMoveSlotRangesASM(clusterManagerNode *source, + clusterManagerNode *target, + list *slot_ranges, + int opts, + char **err) { if (!(opts & CLUSTER_MANAGER_OPT_QUIET)) { sds to_print = clusterManagerGetSlotRangeString(slot_ranges); - printf("Moving slot range %s from %s:%d to %s:%d via atomic slot migration", to_print, source->ip, source->port, target->ip, target->port); + printf("Moving slot range %s from %s:%d to %s:%d via atomic slot migration", + to_print, + source->ip, + source->port, + target->ip, + target->port); fflush(stdout); sdsfree(to_print); } @@ -5438,8 +5524,11 @@ static int clusterManagerMoveSlotRangesASM(clusterManagerNode *source, clusterMa * CLUSTER_MANAGER_OPT_UPDATE -- Update node->slots for source/target nodes. * CLUSTER_MANAGER_OPT_QUIET -- Don't print info messages. */ -static int -clusterManagerMoveSlot(clusterManagerNode *source, clusterManagerNode *target, int slot, int opts, char **err) { +static int clusterManagerMoveSlot(clusterManagerNode *source, + clusterManagerNode *target, + int slot, + int opts, + char **err) { if (!(opts & CLUSTER_MANAGER_OPT_QUIET)) { printf("Moving slot %d from %s:%d to %s:%d", slot, source->ip, source->port, target->ip, target->port); fflush(stdout); @@ -5490,7 +5579,9 @@ clusterManagerMoveSlot(clusterManagerNode *source, clusterManagerNode *target, i success = clusterManagerSetSlot(source, target, slot, "node", err); if (!success && err) { const char *acceptable[] = {"ERR Please use SETSLOT only with masters.", - "ERR Please use SETSLOT only with primaries.", "UNBLOCKED", "NOREPLICAS"}; + "ERR Please use SETSLOT only with primaries.", + "UNBLOCKED", + "NOREPLICAS"}; for (size_t i = 0; i < sizeof(acceptable) / sizeof(acceptable[0]); i++) { if (!strncmp(*err, acceptable[i], strlen(acceptable[i]))) { zfree(*err); @@ -5582,7 +5673,8 @@ static void clusterManagerWaitForClusterJoin(void) { if (parseClusterNodeAddress(nodeaddr, &node_ip, &node_port, &node_bus_port) && node_bus_port) { clusterManagerLogErr(" - The port %d of node %s may " "be unreachable from:\n", - node_bus_port, node_ip); + node_bus_port, + node_ip); } else { clusterManagerLogErr(" - Node %s may be unreachable " "from:\n", @@ -5829,15 +5921,16 @@ static int clusterManagerLoadInfoCommon(clusterManagerNode *node, int include_un if (!friend->context && !clusterManagerNodeConnect(friend)) goto invalid_friend; e = NULL; if (clusterManagerNodeLoadInfo(friend, 0, &e)) { - if (friend->flags & - (CLUSTER_MANAGER_FLAG_NOADDR | CLUSTER_MANAGER_FLAG_DISCONNECT | CLUSTER_MANAGER_FLAG_FAIL)) { + if (friend->flags + & (CLUSTER_MANAGER_FLAG_NOADDR | CLUSTER_MANAGER_FLAG_DISCONNECT | CLUSTER_MANAGER_FLAG_FAIL)) { goto invalid_friend; } listAddNodeTail(cluster_manager.nodes, friend); } else { clusterManagerLogErr("[ERR] Unable to load info for " "node %s:%d\n", - friend->ip, friend->port); + friend->ip, + friend->port); goto invalid_friend; } continue; @@ -5863,7 +5956,9 @@ static int clusterManagerLoadInfoCommon(clusterManagerNode *node, int include_un if (primary == NULL) { clusterManagerLogWarn("*** WARNING: %s:%d claims to be " "replica of unknown node ID %s.\n", - n->ip, n->port, n->replicate); + n->ip, + n->port, + n->replicate); } else primary->replicas_count++; } @@ -6384,7 +6479,9 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) { } clusterManagerLogInfo(">>> Covering slot %s moving keys " "to %s:%d\n", - slot, target->ip, target->port); + slot, + target->ip, + target->port); if (!clusterManagerSetSlotOwner(target, s, 1)) { fixed = -1; goto cleanup; @@ -6471,7 +6568,9 @@ static int clusterManagerFixOpenSlot(int slot) { if (success && r->integer > 0) { clusterManagerLogWarn("*** Found keys about slot %d " "in non-owner node %s:%d!\n", - slot, n->ip, n->port); + slot, + n->ip, + n->port); listAddNodeTail(owners, n); } if (r) freeReplyObject(r); @@ -6525,7 +6624,9 @@ static int clusterManagerFixOpenSlot(int slot) { if (success && r->integer > 0) { clusterManagerLogWarn("*** Found keys about slot %d " "in node %s:%d!\n", - slot, n->ip, n->port); + slot, + n->ip, + n->port); char *sep = (listLength(importing) == 0 ? "" : ","); importing_str = sdscatfmt(importing_str, "%s%s:%u", sep, n->ip, n->port); listAddNodeTail(importing, n); @@ -6606,7 +6707,11 @@ static int clusterManagerFixOpenSlot(int slot) { clusterManagerNode *dst = listFirst(importing)->value; clusterManagerLogInfo(">>> Case 1: Moving slot %d from " "%s:%d to %s:%d\n", - slot, src->ip, src->port, dst->ip, dst->port); + slot, + src->ip, + src->port, + dst->ip, + dst->port); move_opts |= CLUSTER_MANAGER_OPT_UPDATE; success = clusterManagerMoveSlot(src, dst, slot, move_opts, NULL); } @@ -6618,7 +6723,9 @@ static int clusterManagerFixOpenSlot(int slot) { else if (listLength(migrating) == 0 && listLength(importing) > 0) { clusterManagerLogInfo(">>> Case 2: Moving all the %d slot keys to its " "owner %s:%d\n", - slot, owner->ip, owner->port); + slot, + owner->ip, + owner->port); move_opts |= CLUSTER_MANAGER_OPT_COLD; listRewind(importing, &li); while ((ln = listNext(&li)) != NULL) { @@ -6628,7 +6735,9 @@ static int clusterManagerFixOpenSlot(int slot) { if (!success) goto cleanup; clusterManagerLogInfo(">>> Setting %d as STABLE in " "%s:%d\n", - slot, n->ip, n->port); + slot, + n->ip, + n->port); success = clusterManagerClearSlotStatus(n, slot); if (!success) goto cleanup; } @@ -6683,7 +6792,11 @@ static int clusterManagerFixOpenSlot(int slot) { clusterManagerLogInfo(">>> Case 3: Moving slot %d from %s:%d to " "%s:%d and closing it on all the other " "importing nodes.\n", - slot, src->ip, src->port, dst->ip, dst->port); + slot, + src->ip, + src->port, + dst->ip, + dst->port); /* Move the slot to the destination node. */ success = clusterManagerMoveSlot(src, dst, slot, move_opts, NULL); if (!success) goto cleanup; @@ -6742,7 +6855,10 @@ static int clusterManagerFixOpenSlot(int slot) { "yet (work in progress). Slot is set as " "migrating in %s, as importing in %s, " "owner is %s:%d\n", - migrating_str, importing_str, owner->ip, owner->port); + migrating_str, + importing_str, + owner->ip, + owner->port); } } cleanup: @@ -6818,7 +6934,8 @@ static int clusterManagerCheckCluster(int quiet) { errstr = sdscatprintf(errstr, "[WARNING] Node %s:%d has slots in " "migrating state ", - n->ip, n->port); + n->ip, + n->port); for (i = 0; i < n->migrating_count; i += 2) { sds slot = n->migrating[i]; dictReplace(open_slots, slot, sdsdup(n->migrating[i + 1])); @@ -6834,7 +6951,8 @@ static int clusterManagerCheckCluster(int quiet) { errstr = sdscatprintf(errstr, "[WARNING] Node %s:%d has slots in " "importing state ", - n->ip, n->port); + n->ip, + n->port); for (i = 0; i < n->importing_count; i += 2) { sds slot = n->importing[i]; dictReplace(open_slots, slot, sdsdup(n->importing[i + 1])); @@ -7187,7 +7305,8 @@ static int clusterManagerCommandCreate(int argc, char **argv) { int ignore_force = 0; clusterManagerLogInfo("Requested to create a cluster with %d primaries and " "%d replicas per primary.\n", - primaries_count, replicas); + primaries_count, + replicas); if (!confirmWithYes("Valkey cluster requires at least 3 primary nodes for " "automatic failover. Are you sure?", ignore_force)) @@ -7539,7 +7658,8 @@ static int clusterManagerCommandAddNode(int argc, char **argv) { // Send CLUSTER MEET command to the new node clusterManagerLogInfo(">>> Send CLUSTER MEET to node %s:%d to make it " "join the cluster.\n", - ip, port); + ip, + port); /* CLUSTER MEET requires an IP address, so we do a DNS lookup here. */ char first_ip[NET_IP_STR_LEN]; int anet_flags = ANET_NONE; @@ -7606,7 +7726,8 @@ static int clusterManagerCommandDeleteNode(int argc, char **argv) { if (node->slots_count != 0) { clusterManagerLogErr("[ERR] Node %s:%d is not empty! Reshard data " "away and try again.\n", - node->ip, node->port); + node->ip, + node->port); return 0; } @@ -7625,7 +7746,8 @@ static int clusterManagerCommandDeleteNode(int argc, char **argv) { clusterManagerLogWarn(">>> Skipping unreachable node %s:%d. " "It may need manual reconfiguration " "when it comes back online.\n", - n->ip, n->port); + n->ip, + n->port); continue; } @@ -7635,7 +7757,8 @@ static int clusterManagerCommandDeleteNode(int argc, char **argv) { if (primary == NULL) { clusterManagerLogErr("[ERR] Could not find a reachable primary node " "to reassign replica %s:%d.\n", - n->ip, n->port); + n->ip, + n->port); return 0; } clusterManagerLogInfo(">>> %s:%d as replica of %s:%d\n", n->ip, n->port, primary->ip, primary->port); @@ -7661,7 +7784,8 @@ static int clusterManagerCommandDeleteNode(int argc, char **argv) { } else { clusterManagerLogWarn(">>> WARNING: Could not connect to node %s:%d, " "unable to send CLUSTER RESET.\n", - node->ip ? node->ip : "(null)", node->port); + node->ip ? node->ip : "(null)", + node->port); } clusterManagerLogOk("[OK] Node %s removed from the cluster.\n", node_id); return success; @@ -8034,7 +8158,8 @@ static int clusterManagerCommandRebalance(int argc, char **argv) { qsort(weightedNodes, nodes_involved, sizeof(clusterManagerNode *), clusterManagerCompareNodeBalance); clusterManagerLogInfo(">>> Rebalancing across %d nodes. " "Total weight = %.2f\n", - nodes_involved, total_weight); + nodes_involved, + total_weight); if (config.verbose) { for (i = 0; i < nodes_involved; i++) { clusterManagerNode *n = weightedNodes[i]; @@ -8100,8 +8225,9 @@ static int clusterManagerCommandSetTimeout(int argc, char **argv) { if (!getClusterHostFromCmdArgs(1, argv, &ip, &port)) goto invalid_args; int timeout = atoi(argv[1]); if (timeout < 100) { - fprintf(stderr, "Setting a node timeout of less than 100 " - "milliseconds is a bad idea.\n"); + fprintf(stderr, + "Setting a node timeout of less than 100 " + "milliseconds is a bad idea.\n"); return 0; } // Load cluster information @@ -8273,7 +8399,9 @@ static int clusterManagerCommandImport(int argc, char **argv) { if (r && r->str) { clusterManagerLogErr("Source %s:%d replied with " "error:\n%s\n", - src_ip, src_port, r->str); + src_ip, + src_port, + r->str); } success = 0; } @@ -8436,10 +8564,11 @@ static int clusterManagerCommandHelp(int argc, char **argv) { } } } - fprintf(stdout, "\nFor check, fix, reshard, del-node, set-timeout, " - "info, rebalance, call, import, backup you " - "can specify the host and port of any working node in " - "the cluster.\n"); + fprintf(stdout, + "\nFor check, fix, reshard, del-node, set-timeout, " + "info, rebalance, call, import, backup you " + "can specify the host and port of any working node in " + "the cluster.\n"); int options_count = sizeof(clusterManagerOptions) / sizeof(clusterManagerOptionDef); i = 0; @@ -8817,7 +8946,8 @@ static void replicaMode(int send_sync) { fprintf(stderr, "%s with primary, discarding %llu " "bytes of bulk transfer...\n", - info, payload); + info, + payload); } else if (out_full_mode == 0 && payload == 0) { /* PSYNC +CONTINUE (no RDB payload). */ fprintf(stderr, "%s with primary...\n", info); @@ -9114,7 +9244,11 @@ static valkeyReply *sendScan(unsigned long long *it) { valkeyReply *reply; if (config.pattern) - reply = valkeyCommand(context, "SCAN %llu MATCH %b COUNT %d", *it, config.pattern, sdslen(config.pattern), + reply = valkeyCommand(context, + "SCAN %llu MATCH %b COUNT %d", + *it, + config.pattern, + sdslen(config.pattern), config.count); else reply = valkeyCommand(context, "SCAN %llu COUNT %d", *it, config.count); @@ -9184,8 +9318,11 @@ static int getDatabases(valkeyContext *ctx) { if (reply->type == VALKEY_REPLY_ERROR) { dbnum = config.cluster_mode ? 1 : 16; - fprintf(stderr, "%s fails: %s, use default value %d instead\n", - config.cluster_mode ? cluster : standalone, reply->str, dbnum); + fprintf(stderr, + "%s fails: %s, use default value %d instead\n", + config.cluster_mode ? cluster : standalone, + reply->str, + dbnum); } else { assert(reply->elements == 2); dbnum = atoi(reply->element[1]->str); @@ -9255,7 +9392,10 @@ static void getKeyTypes(dict *types_dict, valkeyReply *keys, typeinfo **types) { /* Retrieve types */ for (i = 0; i < keys->elements; i++) { if (valkeyGetReply(context, (void **)&reply) != VALKEY_OK) { - fprintf(stderr, "Error getting type for key '%s' (%d: %s)\n", keys->element[i]->str, context->err, + fprintf(stderr, + "Error getting type for key '%s' (%d: %s)\n", + keys->element[i]->str, + context->err, context->errstr); exit(1); } else if (reply->type != VALKEY_REPLY_STATUS) { @@ -9280,8 +9420,11 @@ static void getKeyTypes(dict *types_dict, valkeyReply *keys, typeinfo **types) { } } -static void -getKeySizes(valkeyReply *keys, typeinfo **types, unsigned long long *sizes, int memkeys, unsigned memkeys_samples) { +static void getKeySizes(valkeyReply *keys, + typeinfo **types, + unsigned long long *sizes, + int memkeys, + unsigned memkeys_samples) { valkeyReply *reply; unsigned int i; @@ -9317,14 +9460,19 @@ getKeySizes(valkeyReply *keys, typeinfo **types, unsigned long long *sizes, int /* Retrieve size */ if (valkeyGetReply(context, (void **)&reply) != VALKEY_OK) { - fprintf(stderr, "Error getting size for key '%s' (%d: %s)\n", keys->element[i]->str, context->err, + fprintf(stderr, + "Error getting size for key '%s' (%d: %s)\n", + keys->element[i]->str, + context->err, context->errstr); exit(1); } else if (reply->type != VALKEY_REPLY_INTEGER) { /* Theoretically the key could have been removed and * added as a different type between TYPE and SIZE */ - fprintf(stderr, "Warning: %s on '%s' failed (may have changed type)\n", - !memkeys ? types[i]->sizecmd : "MEMORY USAGE", keys->element[i]->str); + fprintf(stderr, + "Warning: %s on '%s' failed (may have changed type)\n", + !memkeys ? types[i]->sizecmd : "MEMORY USAGE", + keys->element[i]->str); sizes[i] = 0; } else { sizes[i] = reply->integer; @@ -9347,8 +9495,8 @@ static void sendReadOnly(void) { if (read_reply == NULL) { fprintf(stderr, "\nI/O error\n"); exit(1); - } else if (read_reply->type == VALKEY_REPLY_ERROR && - strcmp(read_reply->str, "ERR This instance has cluster support disabled") != 0) { + } else if (read_reply->type == VALKEY_REPLY_ERROR + && strcmp(read_reply->str, "ERR This instance has cluster support disabled") != 0) { fprintf(stderr, "Error: %s\n", read_reply->str); exit(1); } @@ -9431,8 +9579,12 @@ static void findBigKeys(int memkeys, unsigned memkeys_samples) { exit(1); } - printf("[%05.2f%%] Biggest %-6s found so far '%s' with %llu %s\n", pct, type->name, type->biggest_key, - sizes[i], !memkeys ? type->sizeunit : "bytes"); + printf("[%05.2f%%] Biggest %-6s found so far '%s' with %llu %s\n", + pct, + type->name, + type->biggest_key, + sizes[i], + !memkeys ? type->sizeunit : "bytes"); /* Keep track of the biggest size for this type */ type->biggest = sizes[i]; @@ -9466,7 +9618,10 @@ static void findBigKeys(int memkeys, unsigned memkeys_samples) { while ((de = dictNext(di))) { typeinfo *type = dictGetVal(de); if (type->biggest_key) { - printf("Biggest %6s found '%s' has %llu %s\n", type->name, type->biggest_key, type->biggest, + printf("Biggest %6s found '%s' has %llu %s\n", + type->name, + type->biggest_key, + type->biggest, !memkeys ? type->sizeunit : "bytes"); } } @@ -9477,8 +9632,12 @@ static void findBigKeys(int memkeys, unsigned memkeys_samples) { di = dictGetIterator(types_dict); while ((de = dictNext(di))) { typeinfo *type = dictGetVal(de); - printf("%llu %ss with %llu %s (%05.2f%% of keys, avg size %.2f)\n", type->count, type->name, type->totalsize, - !memkeys ? type->sizeunit : "bytes", sampled ? 100 * (double)type->count / sampled : 0, + printf("%llu %ss with %llu %s (%05.2f%% of keys, avg size %.2f)\n", + type->count, + type->name, + type->totalsize, + !memkeys ? type->sizeunit : "bytes", + sampled ? 100 * (double)type->count / sampled : 0, type->count ? (double)type->totalsize / type->count : 0); } dictReleaseIterator(di); @@ -9783,8 +9942,9 @@ static void scanMode(void) { reply = sendScan(&cur); for (unsigned int j = 0; j < reply->element[1]->elements; j++) { if (config.output == OUTPUT_STANDARD) { - sds out = - sdscatrepr(sdsempty(), reply->element[1]->element[j]->str, reply->element[1]->element[j]->len); + sds out = sdscatrepr(sdsempty(), + reply->element[1]->element[j]->str, + reply->element[1]->element[j]->len); printf("%s\n", out); sdsfree(out); } else { @@ -9869,8 +10029,12 @@ static void LRUTestMode(void) { } } /* Print stats. */ - printf("%lld Gets/sec | Hits: %lld (%.2f%%) | Misses: %lld (%.2f%%)\n", hits + misses, hits, - (double)hits / (hits + misses) * 100, misses, (double)misses / (hits + misses) * 100); + printf("%lld Gets/sec | Hits: %lld (%.2f%%) | Misses: %lld (%.2f%%)\n", + hits + misses, + hits, + (double)hits / (hits + misses) * 100, + misses, + (double)misses / (hits + misses) * 100); } exit(0); } @@ -9947,7 +10111,9 @@ static void intrinsicLatencyMode(void) { printf("\n%lld total runs " "(avg latency: " "%.4f microseconds / %.2f nanoseconds per run).\n", - runs, avg_us, avg_ns); + runs, + avg_us, + avg_ns); printf("Worst run took %.0fx longer than the average latency.\n", max_latency / avg_us); exit(0); } diff --git a/src/valkey_strtod.c b/src/valkey_strtod.c index 608aefcf7f8..dc231bf4853 100644 --- a/src/valkey_strtod.c +++ b/src/valkey_strtod.c @@ -9,9 +9,7 @@ #define FFC_DEBUG 0 #include "ffc.h" -const ffc_parse_options valkey_strtod_options = { - FFC_PRESET_GENERAL | FFC_FORMAT_FLAG_ALLOW_LEADING_PLUS, - '.'}; +const ffc_parse_options valkey_strtod_options = {FFC_PRESET_GENERAL | FFC_FORMAT_FLAG_ALLOW_LEADING_PLUS, '.'}; /** * Converts a null-terminated string to a double-precision floating-point number. diff --git a/src/vset.c b/src/vset.c index f2a32dcbb46..6963e62d31d 100644 --- a/src/vset.c +++ b/src/vset.c @@ -235,8 +235,7 @@ static const size_t PV_HEADER_SIZE = (sizeof(pVector)); * Return: * The number of elements in the vector. * Note that a NULL is a !!!valid!!! vector - returns 0 if the vector is NULL. */ -static inline uint32_t -pvLen(pVector *vec) { +static inline uint32_t pvLen(pVector *vec) { return (vec ? vec->len : 0); } @@ -761,8 +760,7 @@ typedef struct vsetInternalIterator { } vsetInternalIterator; /* The opaque hashtableIterator is defined as a blob of bytes. */ -static_assert(sizeof(vsetIterator) >= sizeof(vsetInternalIterator), - "Opaque iterator size"); +static_assert(sizeof(vsetIterator) >= sizeof(vsetInternalIterator), "Opaque iterator size"); /* Conversion from user-facing opaque iterator type to internal struct. */ static inline vsetInternalIterator *iteratorFromOpaque(vsetIterator *iterator) { @@ -781,8 +779,7 @@ static inline int vsetBucketType(vsetBucket *b) { if (b == VSET_NONE_BUCKET_PTR) return VSET_BUCKET_NONE; uintptr_t bits = (uintptr_t)b; - if (bits & 0x1) - return VSET_BUCKET_SINGLE; + if (bits & 0x1) return VSET_BUCKET_SINGLE; return bits & VSET_TAG_MASK; } @@ -1066,7 +1063,12 @@ hashtableType pointerHashtableType = { .hashFunction = hash_pointer, }; -static inline vsetBucket *findBucket(rax *expiry_buckets, long long expiry, unsigned char *key, size_t *key_len, long long *pbucket_ts, raxNode **node) { +static inline vsetBucket *findBucket(rax *expiry_buckets, + long long expiry, + unsigned char *key, + size_t *key_len, + long long *pbucket_ts, + raxNode **node) { *key_len = encodeExpiryKey(expiry, key); vsetBucket *bucket = vsetBucketFromNone(); /* First try to locate the first bucket which is larger than the specified key */ @@ -1102,21 +1104,18 @@ static void freeVsetBucket(vsetBucket *bucket) { case VSET_BUCKET_SINGLE: // No internal memory to free break; - case VSET_BUCKET_VECTOR: - pvFree(vsetBucketVector(bucket)); - break; - case VSET_BUCKET_HT: - hashtableRelease(vsetBucketHashtable(bucket)); - break; - case VSET_BUCKET_RAX: - raxFreeWithCallback(vsetBucketRax(bucket), freeVsetBucket); - break; - default: - panic("Unknown volatile set type in freeVsetBucket"); + case VSET_BUCKET_VECTOR: pvFree(vsetBucketVector(bucket)); break; + case VSET_BUCKET_HT: hashtableRelease(vsetBucketHashtable(bucket)); break; + case VSET_BUCKET_RAX: raxFreeWithCallback(vsetBucketRax(bucket), freeVsetBucket); break; + default: panic("Unknown volatile set type in freeVsetBucket"); } } -static bool splitBucketIfPossible(vsetBucket *parent, vsetGetExpiryFunc getExpiry, vsetBucket *bucket, long long bucket_ts, raxNode *node) { +static bool splitBucketIfPossible(vsetBucket *parent, + vsetGetExpiryFunc getExpiry, + vsetBucket *bucket, + long long bucket_ts, + raxNode *node) { /* We can only split vector encoded buckets */ if (vsetBucketType(bucket) != VSET_BUCKET_VECTOR) { return false; @@ -1171,14 +1170,20 @@ static bool splitBucketIfPossible(vsetBucket *parent, vsetGetExpiryFunc getExpir return true; } -static inline vsetBucket *insertToBucket_NONE(vsetGetExpiryFunc getExpiry, vsetBucket *bucket, void *entry, long long expiry) { +static inline vsetBucket *insertToBucket_NONE(vsetGetExpiryFunc getExpiry, + vsetBucket *bucket, + void *entry, + long long expiry) { UNUSED(getExpiry); UNUSED(expiry); UNUSED(bucket); return vsetBucketFromSingle(entry); } -static inline vsetBucket *insertToBucket_SINGLE(vsetGetExpiryFunc getExpiry, vsetBucket *bucket, void *entry, long long expiry) { +static inline vsetBucket *insertToBucket_SINGLE(vsetGetExpiryFunc getExpiry, + vsetBucket *bucket, + void *entry, + long long expiry) { /* Upgrade to vector */ pVector *pv = pvNew(2); void *curr_entry = vsetBucketSingle(bucket); @@ -1194,7 +1199,11 @@ static inline vsetBucket *insertToBucket_SINGLE(vsetGetExpiryFunc getExpiry, vse return bucket; } -static inline vsetBucket *insertToBucket_VECTOR(vsetGetExpiryFunc getExpiry, vsetBucket *bucket, void *entry, long long expiry, int pos) { +static inline vsetBucket *insertToBucket_VECTOR(vsetGetExpiryFunc getExpiry, + vsetBucket *bucket, + void *entry, + long long expiry, + int pos) { UNUSED(getExpiry); UNUSED(expiry); pVector *pv = vsetBucketVector(bucket); @@ -1211,8 +1220,7 @@ static inline vsetBucket *insertToBucket_VECTOR(vsetGetExpiryFunc getExpiry, vse return vsetBucketFromHashtable(ht); } else { - if (pos >= 0) - /* In case we are explicitly provided a position to insert place the entry there */ + if (pos >= 0) /* In case we are explicitly provided a position to insert place the entry there */ return vsetBucketFromVector(pvInsertAt(pv, entry, pos)); else /* Otherwise it is better to just push the entry to the vector with less change of memmove and reallocation. */ @@ -1221,7 +1229,10 @@ static inline vsetBucket *insertToBucket_VECTOR(vsetGetExpiryFunc getExpiry, vse return vsetBucketFromNone(); } -static inline vsetBucket *insertToBucket_HASHTABLE(vsetGetExpiryFunc getExpiry, vsetBucket *bucket, void *entry, long long expiry) { +static inline vsetBucket *insertToBucket_HASHTABLE(vsetGetExpiryFunc getExpiry, + vsetBucket *bucket, + void *entry, + long long expiry) { UNUSED(getExpiry); UNUSED(expiry); @@ -1230,7 +1241,10 @@ static inline vsetBucket *insertToBucket_HASHTABLE(vsetGetExpiryFunc getExpiry, return bucket; } -static inline vsetBucket *insertToBucket_RAX(vsetGetExpiryFunc getExpiry, vsetBucket *target, void *entry, long long expiry) { +static inline vsetBucket *insertToBucket_RAX(vsetGetExpiryFunc getExpiry, + vsetBucket *target, + void *entry, + long long expiry) { unsigned char key[VSET_BUCKET_KEY_LEN] = {0}; size_t key_len; long long bucket_ts; @@ -1269,8 +1283,7 @@ static inline vsetBucket *insertToBucket_RAX(vsetGetExpiryFunc getExpiry, vsetBu } } else { vsetBucket *new_bucket = insertToBucket_VECTOR(getExpiry, bucket, entry, expiry, -1); - if (new_bucket != bucket) - /* In order to avoid rax override, we directly change the node data */ + if (new_bucket != bucket) /* In order to avoid rax override, we directly change the node data */ // alternative: raxInsert(expiry_buckets, key, key_len, new_bucket, NULL); raxSetData(node, new_bucket); } @@ -1282,7 +1295,11 @@ static inline vsetBucket *insertToBucket_RAX(vsetGetExpiryFunc getExpiry, vsetBu return target; } -static inline vsetBucket *removeFromBucket_SINGLE(vsetGetExpiryFunc getExpiry, vsetBucket *bucket, void *entry, long long expiry, bool *removed) { +static inline vsetBucket *removeFromBucket_SINGLE(vsetGetExpiryFunc getExpiry, + vsetBucket *bucket, + void *entry, + long long expiry, + bool *removed) { UNUSED(getExpiry); UNUSED(expiry); @@ -1295,7 +1312,12 @@ static inline vsetBucket *removeFromBucket_SINGLE(vsetGetExpiryFunc getExpiry, v } } -static inline vsetBucket *removeFromBucket_VECTOR(vsetGetExpiryFunc getExpiry, vsetBucket *bucket, void *entry, long long expiry, bool *removed, bool pop) { +static inline vsetBucket *removeFromBucket_VECTOR(vsetGetExpiryFunc getExpiry, + vsetBucket *bucket, + void *entry, + long long expiry, + bool *removed, + bool pop) { UNUSED(getExpiry); UNUSED(expiry); @@ -1331,15 +1353,18 @@ static inline vsetBucket *removeFromBucket_VECTOR(vsetGetExpiryFunc getExpiry, v } } else { pv = pvRemove(pv, entry, &success); - if (success) - new_bucket = vsetBucketFromVector(pv); + if (success) new_bucket = vsetBucketFromVector(pv); } } if (removed) *removed = success; return new_bucket; } -static inline vsetBucket *removeFromBucket_HASHTABLE(vsetGetExpiryFunc getExpiry, vsetBucket *bucket, void *entry, long long expiry, bool *removed) { +static inline vsetBucket *removeFromBucket_HASHTABLE(vsetGetExpiryFunc getExpiry, + vsetBucket *bucket, + void *entry, + long long expiry, + bool *removed) { UNUSED(getExpiry); UNUSED(expiry); @@ -1362,7 +1387,14 @@ static inline vsetBucket *removeFromBucket_HASHTABLE(vsetGetExpiryFunc getExpiry if (removed) *removed = success; return new_bucket; } -static bool removeEntryFromRaxBucket(vsetBucket *rax_bucket, vsetGetExpiryFunc getExpiry, void *entry, vsetBucket *bucket, unsigned char *key, size_t key_len, vsetBucket **pbucket, raxNode *node) { +static bool removeEntryFromRaxBucket(vsetBucket *rax_bucket, + vsetGetExpiryFunc getExpiry, + void *entry, + vsetBucket *bucket, + unsigned char *key, + size_t key_len, + vsetBucket **pbucket, + raxNode *node) { bool removed = false; switch (vsetBucketType(bucket)) { case VSET_BUCKET_SINGLE: @@ -1389,17 +1421,14 @@ static bool removeEntryFromRaxBucket(vsetBucket *rax_bucket, vsetGetExpiryFunc g } case VSET_BUCKET_HT: { vsetBucket *new_bucket = removeFromBucket_HASHTABLE(getExpiry, bucket, entry, 0, &removed); - if (new_bucket != bucket) - /* In order to avoid rax override, we directly change the node data */ + if (new_bucket != bucket) /* In order to avoid rax override, we directly change the node data */ // alternative: raxInsert(*set, key, key_len, bucket, NULL); raxSetData(node, new_bucket); if (pbucket) *pbucket = new_bucket; break; } - default: - panic("Unknown bucket type for removeEntryFromRaxBucket"); - return false; + default: panic("Unknown bucket type for removeEntryFromRaxBucket"); return false; } return removed; } @@ -1416,8 +1445,9 @@ static inline bool shrinkRaxBucketIfPossible(vsetBucket **target, vsetGetExpiryF raxStop(&it); /* We will not convert hashtable to our only bucket since we will lose the ability to scan the items in a sorted way. * We will also not shrink when we have a full vector, since it might immediately be repopulated. */ - if (bucket_type == VSET_BUCKET_SINGLE || - (bucket_type == VSET_BUCKET_VECTOR && pvLen(vsetBucketVector(bucket)) < VOLATILESET_VECTOR_BUCKET_MAX_SIZE)) { + if (bucket_type == VSET_BUCKET_SINGLE + || (bucket_type == VSET_BUCKET_VECTOR + && pvLen(vsetBucketVector(bucket)) < VOLATILESET_VECTOR_BUCKET_MAX_SIZE)) { if (bucket_type == VSET_BUCKET_VECTOR) { pVector *pv = vsetBucketVector(bucket); /* first lets sort the vector. we cannot set the target bucket as unsorted vector bucket */ @@ -1434,7 +1464,11 @@ static inline bool shrinkRaxBucketIfPossible(vsetBucket **target, vsetGetExpiryF return false; } -static inline vsetBucket *removeFromBucket_RAX(vsetGetExpiryFunc getExpiry, vsetBucket *target, void *entry, long long expiry, bool *removed) { +static inline vsetBucket *removeFromBucket_RAX(vsetGetExpiryFunc getExpiry, + vsetBucket *target, + void *entry, + long long expiry, + bool *removed) { unsigned char key[VSET_BUCKET_KEY_LEN] = {0}; long long bucket_ts; size_t key_len; @@ -1449,7 +1483,12 @@ static inline vsetBucket *removeFromBucket_RAX(vsetGetExpiryFunc getExpiry, vset return target; } -static inline size_t vsetBucketRemoveExpired_NONE(vsetBucket **bucket, vsetGetExpiryFunc getExpiry, vsetExpiryFunc expiryFunc, mstime_t now, size_t max_count, void *ctx) { +static inline size_t vsetBucketRemoveExpired_NONE(vsetBucket **bucket, + vsetGetExpiryFunc getExpiry, + vsetExpiryFunc expiryFunc, + mstime_t now, + size_t max_count, + void *ctx) { UNUSED(bucket); UNUSED(getExpiry); UNUSED(expiryFunc); @@ -1459,7 +1498,12 @@ static inline size_t vsetBucketRemoveExpired_NONE(vsetBucket **bucket, vsetGetEx return 0; } -static inline size_t vsetBucketRemoveExpired_SINGLE(vsetBucket **bucket, vsetGetExpiryFunc getExpiry, vsetExpiryFunc expiryFunc, mstime_t now, size_t max_count, void *ctx) { +static inline size_t vsetBucketRemoveExpired_SINGLE(vsetBucket **bucket, + vsetGetExpiryFunc getExpiry, + vsetExpiryFunc expiryFunc, + mstime_t now, + size_t max_count, + void *ctx) { void *entry = vsetBucketSingle(*bucket); if (max_count && getExpiry(entry) <= now) { freeVsetBucket(*bucket); @@ -1470,15 +1514,19 @@ static inline size_t vsetBucketRemoveExpired_SINGLE(vsetBucket **bucket, vsetGet return 0; } -static inline size_t vsetBucketRemoveExpired_VECTOR(vsetBucket **bucket, vsetGetExpiryFunc getExpiry, vsetExpiryFunc expiryFunc, mstime_t now, size_t max_count, void *ctx) { +static inline size_t vsetBucketRemoveExpired_VECTOR(vsetBucket **bucket, + vsetGetExpiryFunc getExpiry, + vsetExpiryFunc expiryFunc, + mstime_t now, + size_t max_count, + void *ctx) { pVector *pv = vsetBucketVector(*bucket); uint32_t len = min(pvLen(pv), max_count); uint32_t i = 0; for (; i < len; i++) { void *entry = pvGet(pv, i); /* break as soon as the expiryFunc stops us OR we reached an entry which is not expired */ - if (getExpiry(entry) > now) - break; + if (getExpiry(entry) > now) break; if (expiryFunc) expiryFunc(entry, ctx); } /* If no expiry occurred, no need to split. */ @@ -1490,7 +1538,12 @@ static inline size_t vsetBucketRemoveExpired_VECTOR(vsetBucket **bucket, vsetGet return i; } -static inline size_t vsetBucketRemoveExpired_HASHTABLE(vsetBucket **bucket, vsetGetExpiryFunc getExpiry, vsetExpiryFunc expiryFunc, mstime_t now, size_t max_count, void *ctx) { +static inline size_t vsetBucketRemoveExpired_HASHTABLE(vsetBucket **bucket, + vsetGetExpiryFunc getExpiry, + vsetExpiryFunc expiryFunc, + mstime_t now, + size_t max_count, + void *ctx) { UNUSED(getExpiry); UNUSED(now); hashtable *ht = vsetBucketHashtable(*bucket); @@ -1514,7 +1567,12 @@ static inline size_t vsetBucketRemoveExpired_HASHTABLE(vsetBucket **bucket, vset return count; } -static inline size_t vsetBucketRemoveExpired_RAX(vsetBucket **bucket, vsetGetExpiryFunc getExpiry, vsetExpiryFunc expiryFunc, mstime_t now, size_t max_count, void *ctx) { +static inline size_t vsetBucketRemoveExpired_RAX(vsetBucket **bucket, + vsetGetExpiryFunc getExpiry, + vsetExpiryFunc expiryFunc, + mstime_t now, + size_t max_count, + void *ctx) { UNUSED(getExpiry); rax *buckets = vsetBucketRax(*bucket); size_t count = 0; @@ -1532,20 +1590,33 @@ static inline size_t vsetBucketRemoveExpired_RAX(vsetBucket **bucket, vsetGetExp size_t key_len = it.key_len; raxNode *node = it.node; raxStop(&it); - if (time_bucket_ts > now) - break; + if (time_bucket_ts > now) break; switch (time_bucket_type) { case VSET_BUCKET_SINGLE: - count += vsetBucketRemoveExpired_SINGLE(&time_bucket, vsetGetExpiryZero, expiryFunc, now, max_count - count, ctx); + count += vsetBucketRemoveExpired_SINGLE(&time_bucket, + vsetGetExpiryZero, + expiryFunc, + now, + max_count - count, + ctx); break; case VSET_BUCKET_VECTOR: - count += vsetBucketRemoveExpired_VECTOR(&time_bucket, vsetGetExpiryZero, expiryFunc, now, max_count - count, ctx); + count += vsetBucketRemoveExpired_VECTOR(&time_bucket, + vsetGetExpiryZero, + expiryFunc, + now, + max_count - count, + ctx); break; case VSET_BUCKET_HT: - count += vsetBucketRemoveExpired_HASHTABLE(&time_bucket, vsetGetExpiryZero, expiryFunc, now, max_count - count, ctx); + count += vsetBucketRemoveExpired_HASHTABLE(&time_bucket, + vsetGetExpiryZero, + expiryFunc, + now, + max_count - count, + ctx); break; - default: - panic("Cannot expire entries from bucket which is not single, vector or hashtable"); + default: panic("Cannot expire entries from bucket which is not single, vector or hashtable"); } if (time_bucket == VSET_NONE_BUCKET_PTR) { /* in case the bucket is freed, we can just remove it and continue to the next bucket. */ @@ -1669,20 +1740,11 @@ static inline size_t vsetBucketMemUsage_RAX(vsetBucket *bucket) { assert(raxSeek(&it, "^", NULL, 0)); while (raxNext(&it)) { switch (vsetBucketType(it.data)) { - case VSET_BUCKET_NONE: - total_mem += vsetBucketMemUsage_NONE(it.data); - break; - case VSET_BUCKET_SINGLE: - total_mem += vsetBucketMemUsage_SINGLE(it.data); - break; - case VSET_BUCKET_VECTOR: - total_mem += vsetBucketMemUsage_VECTOR(it.data); - break; - case VSET_BUCKET_HT: - total_mem += vsetBucketMemUsage_HASHTABLE(it.data); - break; - default: - panic("Unknown bucket type encountered in vsetBucketMemUsage_HASHTABLE"); + case VSET_BUCKET_NONE: total_mem += vsetBucketMemUsage_NONE(it.data); break; + case VSET_BUCKET_SINGLE: total_mem += vsetBucketMemUsage_SINGLE(it.data); break; + case VSET_BUCKET_VECTOR: total_mem += vsetBucketMemUsage_VECTOR(it.data); break; + case VSET_BUCKET_HT: total_mem += vsetBucketMemUsage_HASHTABLE(it.data); break; + default: panic("Unknown bucket type encountered in vsetBucketMemUsage_HASHTABLE"); } } raxStop(&it); @@ -1743,12 +1805,8 @@ bool vsetAddEntry(vset *set, vsetGetExpiryFunc getExpiry, void *entry) { assert(expiry_buckets); int bucket_type = vsetBucketType(expiry_buckets); switch (bucket_type) { - case VSET_BUCKET_NONE: - expiry_buckets = insertToBucket_NONE(getExpiry, expiry_buckets, entry, expiry); - break; - case VSET_BUCKET_SINGLE: - expiry_buckets = insertToBucket_SINGLE(getExpiry, expiry_buckets, entry, expiry); - break; + case VSET_BUCKET_NONE: expiry_buckets = insertToBucket_NONE(getExpiry, expiry_buckets, entry, expiry); break; + case VSET_BUCKET_SINGLE: expiry_buckets = insertToBucket_SINGLE(getExpiry, expiry_buckets, entry, expiry); break; case VSET_BUCKET_VECTOR: { pVector *vec = vsetBucketVector(expiry_buckets); uint32_t len = pvLen(vec); @@ -1782,11 +1840,8 @@ bool vsetAddEntry(vset *set, vsetGetExpiryFunc getExpiry, void *entry) { } break; } - case VSET_BUCKET_RAX: - expiry_buckets = insertToBucket_RAX(getExpiry, expiry_buckets, entry, expiry); - break; - default: - panic("Cannot insert to bucket which is not single, vector or rax"); + case VSET_BUCKET_RAX: expiry_buckets = insertToBucket_RAX(getExpiry, expiry_buckets, entry, expiry); break; + default: panic("Cannot insert to bucket which is not single, vector or rax"); } /* update the set */ *set = expiry_buckets; @@ -1802,20 +1857,11 @@ static inline bool vsetRemoveEntryWithExpiry(vset *set, vsetGetExpiryFunc getExp case VSET_BUCKET_NONE: /* We cannot remove from empty set */ return false; - case VSET_BUCKET_SINGLE: - bucket = removeFromBucket_SINGLE(getExpiry, bucket, entry, expiry, &removed); - break; - case VSET_BUCKET_VECTOR: - bucket = removeFromBucket_VECTOR(getExpiry, bucket, entry, expiry, &removed, false); - break; - case VSET_BUCKET_HT: - bucket = removeFromBucket_HASHTABLE(getExpiry, bucket, entry, expiry, &removed); - break; - case VSET_BUCKET_RAX: - bucket = removeFromBucket_RAX(getExpiry, bucket, entry, expiry, &removed); - break; - default: - panic("Cannot remove from bucket which is not single, vector, hashtable or rax"); + case VSET_BUCKET_SINGLE: bucket = removeFromBucket_SINGLE(getExpiry, bucket, entry, expiry, &removed); break; + case VSET_BUCKET_VECTOR: bucket = removeFromBucket_VECTOR(getExpiry, bucket, entry, expiry, &removed, false); break; + case VSET_BUCKET_HT: bucket = removeFromBucket_HASHTABLE(getExpiry, bucket, entry, expiry, &removed); break; + case VSET_BUCKET_RAX: bucket = removeFromBucket_RAX(getExpiry, bucket, entry, expiry, &removed); break; + default: panic("Cannot remove from bucket which is not single, vector, hashtable or rax"); } *set = bucket; return removed; @@ -1875,7 +1921,12 @@ bool vsetRemoveEntry(vset *set, vsetGetExpiryFunc getExpiry, void *entry) { return vsetRemoveEntryWithExpiry(set, getExpiry, entry, getExpiry(entry)); } -static inline vsetBucket *vsetBucketUpdateEntry_SINGLE(vsetBucket *bucket, vsetGetExpiryFunc getExpiry, void *old_entry, void *new_entry, long long old_expiry, long long new_expiry) { +static inline vsetBucket *vsetBucketUpdateEntry_SINGLE(vsetBucket *bucket, + vsetGetExpiryFunc getExpiry, + void *old_entry, + void *new_entry, + long long old_expiry, + long long new_expiry) { UNUSED(getExpiry); UNUSED(old_expiry); UNUSED(new_expiry); @@ -1886,7 +1937,12 @@ static inline vsetBucket *vsetBucketUpdateEntry_SINGLE(vsetBucket *bucket, vsetG return vsetBucketFromNone(); } -static inline vsetBucket *vsetBucketUpdateEntry_VECTOR(vsetBucket *bucket, vsetGetExpiryFunc getExpiry, void *old_entry, void *new_entry, long long old_expiry, long long new_expiry) { +static inline vsetBucket *vsetBucketUpdateEntry_VECTOR(vsetBucket *bucket, + vsetGetExpiryFunc getExpiry, + void *old_entry, + void *new_entry, + long long old_expiry, + long long new_expiry) { UNUSED(getExpiry); UNUSED(old_expiry); UNUSED(new_expiry); @@ -1894,20 +1950,23 @@ static inline vsetBucket *vsetBucketUpdateEntry_VECTOR(vsetBucket *bucket, vsetG pVector *pv = vsetBucketVector(bucket); uint32_t idx = pvFind(pv, old_entry); /* in case we did not locate the entry, just return NONE bucket */ - if (idx == pvLen(pv)) - return vsetBucketFromNone(); + if (idx == pvLen(pv)) return vsetBucketFromNone(); pvSet(pv, idx, new_entry); return bucket; } -static inline vsetBucket *vsetBucketUpdateEntry_HASHTABLE(vsetBucket *bucket, vsetGetExpiryFunc getExpiry, void *old_entry, void *new_entry, long long old_expiry, long long new_expiry) { +static inline vsetBucket *vsetBucketUpdateEntry_HASHTABLE(vsetBucket *bucket, + vsetGetExpiryFunc getExpiry, + void *old_entry, + void *new_entry, + long long old_expiry, + long long new_expiry) { UNUSED(getExpiry); UNUSED(old_expiry); UNUSED(new_expiry); /* In this case no need to change anything. */ - if (old_entry == new_entry) - return bucket; + if (old_entry == new_entry) return bucket; hashtable *ht = vsetBucketHashtable(bucket); hashtableDelete(ht, old_entry); @@ -1915,7 +1974,12 @@ static inline vsetBucket *vsetBucketUpdateEntry_HASHTABLE(vsetBucket *bucket, vs return bucket; } -static inline vsetBucket *vsetBucketUpdateEntry_RAX(vsetBucket *target, vsetGetExpiryFunc getExpiry, void *old_entry, void *new_entry, long long old_expiry, long long new_expiry) { +static inline vsetBucket *vsetBucketUpdateEntry_RAX(vsetBucket *target, + vsetGetExpiryFunc getExpiry, + void *old_entry, + void *new_entry, + long long old_expiry, + long long new_expiry) { unsigned char key[VSET_BUCKET_KEY_LEN] = {0}; size_t key_len; long long bucket_ts; @@ -1946,8 +2010,7 @@ static inline vsetBucket *vsetBucketUpdateEntry_RAX(vsetBucket *target, vsetGetE case VSET_BUCKET_HT: bucket = vsetBucketUpdateEntry_HASHTABLE(bucket, getExpiry, old_entry, new_entry, old_expiry, new_expiry); break; - default: - panic("Unknown bucket type to update entry"); + default: panic("Unknown bucket type to update entry"); } if (bucket) raxSetData(node, bucket); @@ -1999,17 +2062,20 @@ static inline vsetBucket *vsetBucketUpdateEntry_RAX(vsetBucket *target, vsetGetE * Example usage: * vsetUpdateEntry(myset, getExpiry, old_ptr, new_ptr, old_ts, new_ts); */ -bool vsetUpdateEntry(vset *set, vsetGetExpiryFunc getExpiry, void *old_entry, void *new_entry, long long old_expiry, long long new_expiry) { +bool vsetUpdateEntry(vset *set, + vsetGetExpiryFunc getExpiry, + void *old_entry, + void *new_entry, + long long old_expiry, + long long new_expiry) { assert(*set); /* Nothing to do */ - if (old_entry == new_entry && old_expiry == new_expiry) - return true; + if (old_entry == new_entry && old_expiry == new_expiry) return true; vsetBucket *updated = vsetBucketFromNone(); /* case 1 - both entries were tracked. update the bucket */ if (old_entry && old_expiry != -1 && new_entry && new_expiry != -1) { switch (vsetBucketType(*set)) { - case VSET_BUCKET_NONE: - return false; + case VSET_BUCKET_NONE: return false; case VSET_BUCKET_SINGLE: updated = vsetBucketUpdateEntry_SINGLE(*set, getExpiry, old_entry, new_entry, old_expiry, new_expiry); break; @@ -2017,8 +2083,7 @@ bool vsetUpdateEntry(vset *set, vsetGetExpiryFunc getExpiry, void *old_entry, vo if (old_expiry != new_expiry) { /* NOTE! - in this specific case we might have changed the vector order - need to sort it again (NLogN) */ /* or remove it from the vector and re-add it (N+LogN). the later also looks cleaner... */ - if (!vsetRemoveEntryWithExpiry(set, getExpiry, old_entry, old_expiry)) - return false; + if (!vsetRemoveEntryWithExpiry(set, getExpiry, old_entry, old_expiry)) return false; return vsetAddEntry(set, getExpiry, new_entry); } /* We are just updating the entry ref, so sorting is not impacted */ @@ -2028,8 +2093,7 @@ bool vsetUpdateEntry(vset *set, vsetGetExpiryFunc getExpiry, void *old_entry, vo case VSET_BUCKET_RAX: updated = vsetBucketUpdateEntry_RAX(*set, getExpiry, old_entry, new_entry, old_expiry, new_expiry); } - if (updated == VSET_NONE_BUCKET_PTR) - return false; + if (updated == VSET_NONE_BUCKET_PTR) return false; *set = updated; return true; } @@ -2071,16 +2135,17 @@ bool vsetUpdateEntry(vset *set, vsetGetExpiryFunc getExpiry, void *old_entry, vo * * Return: * Number of expired entries removed (size_t). */ -size_t vsetRemoveExpired(vset *set, vsetGetExpiryFunc getExpiry, vsetExpiryFunc expiryFunc, mstime_t now, size_t max_count, void *ctx) { +size_t vsetRemoveExpired(vset *set, + vsetGetExpiryFunc getExpiry, + vsetExpiryFunc expiryFunc, + mstime_t now, + size_t max_count, + void *ctx) { vsetBucket *bucket = *set; int bucket_type = vsetBucketType(bucket); switch (bucket_type) { - case VSET_BUCKET_NONE: - return vsetBucketRemoveExpired_NONE(set, getExpiry, expiryFunc, now, max_count, ctx); - break; - case VSET_BUCKET_RAX: - return vsetBucketRemoveExpired_RAX(set, getExpiry, expiryFunc, now, max_count, ctx); - break; + case VSET_BUCKET_NONE: return vsetBucketRemoveExpired_NONE(set, getExpiry, expiryFunc, now, max_count, ctx); break; + case VSET_BUCKET_RAX: return vsetBucketRemoveExpired_RAX(set, getExpiry, expiryFunc, now, max_count, ctx); break; case VSET_BUCKET_SINGLE: return vsetBucketRemoveExpired_SINGLE(set, getExpiry, expiryFunc, now, max_count, ctx); break; @@ -2090,8 +2155,7 @@ size_t vsetRemoveExpired(vset *set, vsetGetExpiryFunc getExpiry, vsetExpiryFunc case VSET_BUCKET_HT: return vsetBucketRemoveExpired_HASHTABLE(set, getExpiry, expiryFunc, now, max_count, ctx); break; - default: - panic("Unknown volatile set bucket type in vsetPopExpired"); + default: panic("Unknown volatile set bucket type in vsetPopExpired"); } return 0; } @@ -2123,9 +2187,7 @@ long long vsetEstimatedEarliestExpiry(vset *set, vsetGetExpiryFunc getExpiry) { void *entry = NULL; long long expiry; switch (set_type) { - case VSET_BUCKET_NONE: - return -1; - break; + case VSET_BUCKET_NONE: return -1; break; case VSET_BUCKET_RAX: { rax *r = vsetBucketRax(*set); raxIterator it; @@ -2144,8 +2206,7 @@ long long vsetEstimatedEarliestExpiry(vset *set, vsetGetExpiryFunc getExpiry) { expiry = getExpiry(entry); break; } - default: - panic("Unsupported vset encoding type. Only supported types are single, vector or rax"); + default: panic("Unsupported vset encoding type. Only supported types are single, vector or rax"); } return expiry; } @@ -2171,23 +2232,12 @@ bool vsetNext(vsetIterator *iter, void **entryptr) { int bucket_type = vsetBucketType(bucket); int ret = 0; switch (bucket_type) { - case VSET_BUCKET_NONE: - return vsetBucketNext_NONE(it, entryptr); - break; - case VSET_BUCKET_RAX: - return vsetBucketNext_RAX(it, entryptr); - break; - case VSET_BUCKET_SINGLE: - ret = vsetBucketNext_SINGLE(it, entryptr); - break; - case VSET_BUCKET_VECTOR: - ret = vsetBucketNext_VECTOR(it, entryptr); - break; - case VSET_BUCKET_HT: - ret = vsetBucketNext_HASHTABLE(it, entryptr); - break; - default: - panic("Unknown volatile set bucket type in vsetNext"); + case VSET_BUCKET_NONE: return vsetBucketNext_NONE(it, entryptr); break; + case VSET_BUCKET_RAX: return vsetBucketNext_RAX(it, entryptr); break; + case VSET_BUCKET_SINGLE: ret = vsetBucketNext_SINGLE(it, entryptr); break; + case VSET_BUCKET_VECTOR: ret = vsetBucketNext_VECTOR(it, entryptr); break; + case VSET_BUCKET_HT: ret = vsetBucketNext_HASHTABLE(it, entryptr); break; + default: panic("Unknown volatile set bucket type in vsetNext"); } if (ret == 0) { /* continue iterating the parent bucket */ @@ -2201,18 +2251,12 @@ bool vsetNext(vsetIterator *iter, void **entryptr) { size_t vsetMemUsage(vset *set) { int bucket_type = vsetBucketType(*set); switch (bucket_type) { - case VSET_BUCKET_NONE: - return vsetBucketMemUsage_NONE(*set); - case VSET_BUCKET_SINGLE: - return vsetBucketMemUsage_SINGLE(*set); - case VSET_BUCKET_VECTOR: - return vsetBucketMemUsage_VECTOR(*set); - case VSET_BUCKET_HT: - panic("Unsupported hashtable bucket type for vset"); - case VSET_BUCKET_RAX: - return vsetBucketMemUsage_RAX(*set); - default: - panic("Unknown set type encountered in vsetMemUsage"); + case VSET_BUCKET_NONE: return vsetBucketMemUsage_NONE(*set); + case VSET_BUCKET_SINGLE: return vsetBucketMemUsage_SINGLE(*set); + case VSET_BUCKET_VECTOR: return vsetBucketMemUsage_VECTOR(*set); + case VSET_BUCKET_HT: panic("Unsupported hashtable bucket type for vset"); + case VSET_BUCKET_RAX: return vsetBucketMemUsage_RAX(*set); + default: panic("Unknown set type encountered in vsetMemUsage"); } return 0; } @@ -2245,10 +2289,8 @@ void vsetResetIterator(vsetIterator *iter) { vsetInternalIterator *it = iteratorFromOpaque(iter); int bucket_type = vsetBucketType(it->bucket); int parent_bucket_type = vsetBucketType(it->parent_bucket); - if (parent_bucket_type == VSET_BUCKET_RAX) - raxStop(&it->riter); - if (bucket_type == VSET_BUCKET_HT) - hashtableCleanupIterator(&it->hiter); + if (parent_bucket_type == VSET_BUCKET_RAX) raxStop(&it->riter); + if (bucket_type == VSET_BUCKET_HT) hashtableCleanupIterator(&it->hiter); } /* Initializes an empty volatile set. @@ -2293,8 +2335,7 @@ bool vsetIsValid(vset *set) { case VSET_BUCKET_SINGLE: case VSET_BUCKET_VECTOR: case VSET_BUCKET_HT: - case VSET_BUCKET_RAX: - return true; + case VSET_BUCKET_RAX: return true; } } return false; @@ -2325,8 +2366,7 @@ static size_t vsetBucketDefrag_VECTOR(vsetBucket **bucket, size_t cursor, void * UNUSED(cursor); pVector *pv = vsetBucketVector(*bucket); pv = defragfn(pv); - if (pv) - *bucket = vsetBucketFromVector(pv); + if (pv) *bucket = vsetBucketFromVector(pv); return 0; } @@ -2343,7 +2383,10 @@ static size_t vsetBucketDefrag_HASHTABLE(vsetBucket **bucket, size_t cursor, voi return hashtableScanDefrag(ht, cursor, NULL, NULL, defragfn, 0); } -static size_t vsetBucketDefrag_RAX(vsetBucket **bucket, size_t cursor, void *(*defragfn)(void *), int (*defragRaxNode)(raxNode **)) { +static size_t vsetBucketDefrag_RAX(vsetBucket **bucket, + size_t cursor, + void *(*defragfn)(void *), + int (*defragRaxNode)(raxNode **)) { struct vsetDefragState *state = (struct vsetDefragState *)cursor; size_t bucket_cursor = 0; unsigned char key[VSET_BUCKET_KEY_LEN] = {0}; @@ -2396,21 +2439,16 @@ static size_t vsetBucketDefrag_RAX(vsetBucket **bucket, size_t cursor, void *(*d vsetBucket *time_bucket = ri.data; switch (vsetBucketType(time_bucket)) { case VSET_BUCKET_NONE: - case VSET_BUCKET_SINGLE: - bucket_cursor = 0; - break; + case VSET_BUCKET_SINGLE: bucket_cursor = 0; break; case VSET_BUCKET_VECTOR: bucket_cursor = vsetBucketDefrag_VECTOR(&time_bucket, bucket_cursor, defragfn); - if (time_bucket != ri.data) - raxSetData(ri.node, time_bucket); + if (time_bucket != ri.data) raxSetData(ri.node, time_bucket); break; case VSET_BUCKET_HT: bucket_cursor = vsetBucketDefrag_HASHTABLE(&time_bucket, bucket_cursor, defragfn); - if (time_bucket != ri.data) - raxSetData(ri.node, time_bucket); + if (time_bucket != ri.data) raxSetData(ri.node, time_bucket); break; - default: - panic("Unsupported vset bucket type for RAX bucket. Only supported types are single, vector or hashtable"); + default: panic("Unsupported vset bucket type for RAX bucket. Only supported types are single, vector or hashtable"); } /* if we reached here, we are not done. lets return the state and next time we can continue from this bucket. */ state->bucket_ts = bucket_ts; @@ -2435,12 +2473,9 @@ size_t vsetScanDefrag(vset *set, size_t cursor, void *(*defragfn)(void *)) { case VSET_BUCKET_SINGLE: /* nothing to do */ return 0; - case VSET_BUCKET_VECTOR: - return vsetBucketDefrag_VECTOR(set, cursor, defragfn); - case VSET_BUCKET_RAX: - return vsetBucketDefrag_RAX(set, cursor, defragfn, defragRaxNode); - default: - panic("Unknown vset node type to defrag"); + case VSET_BUCKET_VECTOR: return vsetBucketDefrag_VECTOR(set, cursor, defragfn); + case VSET_BUCKET_RAX: return vsetBucketDefrag_RAX(set, cursor, defragfn, defragRaxNode); + default: panic("Unknown vset node type to defrag"); } return 0; } diff --git a/src/vset.h b/src/vset.h index 23270395ac4..411fc005b55 100644 --- a/src/vset.h +++ b/src/vset.h @@ -79,7 +79,12 @@ typedef uint8_t vsetIterator[600]; bool vsetAddEntry(vset *set, vsetGetExpiryFunc getExpiry, void *entry); bool vsetRemoveEntry(vset *set, vsetGetExpiryFunc getExpiry, void *entry); -bool vsetUpdateEntry(vset *set, vsetGetExpiryFunc getExpiry, void *old_entry, void *new_entry, long long old_expiry, long long new_expiry); +bool vsetUpdateEntry(vset *set, + vsetGetExpiryFunc getExpiry, + void *old_entry, + void *new_entry, + long long old_expiry, + long long new_expiry); bool vsetIsEmpty(vset *set); void vsetInitIterator(vset *set, vsetIterator *it); bool vsetNext(vsetIterator *it, void **entryptr); @@ -89,7 +94,12 @@ void vsetClear(vset *set); void vsetRelease(vset *set); bool vsetIsValid(vset *set); long long vsetEstimatedEarliestExpiry(vset *set, vsetGetExpiryFunc getExpiry); -size_t vsetRemoveExpired(vset *set, vsetGetExpiryFunc getExpiry, vsetExpiryFunc expiryFunc, mstime_t now, size_t max_count, void *ctx); +size_t vsetRemoveExpired(vset *set, + vsetGetExpiryFunc getExpiry, + vsetExpiryFunc expiryFunc, + mstime_t now, + size_t max_count, + void *ctx); size_t vsetMemUsage(vset *set); size_t vsetScanDefrag(vset *set, size_t cursor, void *(*defragfn)(void *)); diff --git a/src/ziplist.c b/src/ziplist.c index 10ec786c15e..a96d01e3e49 100644 --- a/src/ziplist.c +++ b/src/ziplist.c @@ -191,13 +191,13 @@ #include "endianconv.h" #include "serverassert.h" -#define ZIP_END 255 /* Special "end of ziplist" entry. */ -#define ZIP_BIG_PREVLEN 254 /* ZIP_BIG_PREVLEN - 1 is the max number of bytes of \ - the previous entry, for the "prevlen" field prefixing \ - each entry, to be represented with just a single byte. \ - Otherwise it is represented as FE AA BB CC DD, where \ - AA BB CC DD are a 4 bytes unsigned integer \ - representing the previous entry len. */ +#define ZIP_END 255 /* Special "end of ziplist" entry. */ +#define ZIP_BIG_PREVLEN 254 /* ZIP_BIG_PREVLEN - 1 is the max number of bytes of \ + the previous entry, for the "prevlen" field prefixing \ + each entry, to be represented with just a single byte. \ + Otherwise it is represented as FE AA BB CC DD, where \ + AA BB CC DD are a 4 bytes unsigned integer \ + representing the previous entry len. */ /* Different encoding/length possibilities */ #define ZIP_STR_MASK 0xc0 @@ -213,10 +213,10 @@ /* 4 bit integer immediate encoding |1111xxxx| with xxxx between * 0001 and 1101. */ -#define ZIP_INT_IMM_MASK 0x0f /* Mask to extract the 4 bits value. To add \ +#define ZIP_INT_IMM_MASK 0x0f /* Mask to extract the 4 bits value. To add \ one is needed to reconstruct the value. */ -#define ZIP_INT_IMM_MIN 0xf1 /* 11110001 */ -#define ZIP_INT_IMM_MAX 0xfd /* 11111101 */ +#define ZIP_INT_IMM_MIN 0xf1 /* 11110001 */ +#define ZIP_INT_IMM_MAX 0xfd /* 11111101 */ #define INT24_MAX 0x7fffff #define INT24_MIN (-INT24_MAX - 1) @@ -320,8 +320,8 @@ typedef struct zlentry { /* Return the number of bytes required to encode the entry type + length. * On error, return ZIP_ENCODING_SIZE_INVALID */ static inline unsigned int zipEncodingLenSize(unsigned char encoding) { - if (encoding == ZIP_INT_16B || encoding == ZIP_INT_32B || encoding == ZIP_INT_24B || encoding == ZIP_INT_64B || - encoding == ZIP_INT_8B) + if (encoding == ZIP_INT_16B || encoding == ZIP_INT_32B || encoding == ZIP_INT_24B || encoding == ZIP_INT_64B + || encoding == ZIP_INT_8B) return 1; if (encoding >= ZIP_INT_IMM_MIN && encoding <= ZIP_INT_IMM_MAX) return 1; if (encoding == ZIP_STR_06B) return 1; @@ -416,9 +416,10 @@ unsigned int zipStoreEntryEncoding(unsigned char *p, unsigned char encoding, uns (len) = ((uint32_t)(ptr)[1] << 24) | ((uint32_t)(ptr)[2] << 16) | ((uint32_t)(ptr)[3] << 8) | \ ((uint32_t)(ptr)[4]); \ } else { \ - (lensize) = 0; /* bad encoding, should be covered by a previous */ \ - (len) = 0; /* ZIP_ASSERT_ENCODING / zipEncodingLenSize, or */ \ - /* match the lensize after this macro with 0. */ \ + (lensize) = 0; /* bad encoding, should be covered by a previous \ + ZIP_ASSERT_ENCODING / zipEncodingLenSize, or \ + match the lensize after this macro with 0. */ \ + (len) = 0; \ } \ } else { \ (lensize) = 1; \ @@ -1079,14 +1080,16 @@ unsigned char *ziplistMerge(unsigned char **first, unsigned char **second) { /* append == appending to target */ /* Copy source after target (copying over original [END]): * [TARGET - END, SOURCE - HEADER] */ - memcpy(target + target_bytes - ZIPLIST_END_SIZE, source + ZIPLIST_HEADER_SIZE, + memcpy(target + target_bytes - ZIPLIST_END_SIZE, + source + ZIPLIST_HEADER_SIZE, source_bytes - ZIPLIST_HEADER_SIZE); } else { /* !append == prepending to target */ /* Move target *contents* exactly size of (source - [END]), * then copy source into vacated space (source - [END]): * [SOURCE - END, TARGET - HEADER] */ - memmove(target + source_bytes - ZIPLIST_END_SIZE, target + ZIPLIST_HEADER_SIZE, + memmove(target + source_bytes - ZIPLIST_END_SIZE, + target + ZIPLIST_HEADER_SIZE, target_bytes - ZIPLIST_HEADER_SIZE); memcpy(target, source, source_bytes - ZIPLIST_END_SIZE); } @@ -1099,8 +1102,8 @@ unsigned char *ziplistMerge(unsigned char **first, unsigned char **second) { * - 1 byte for [END] of first ziplist * + M bytes for the offset of the original tail of the second ziplist * - J bytes for HEADER because second_offset keeps no header. */ - ZIPLIST_TAIL_OFFSET(target) = - intrev32ifbe((first_bytes - ZIPLIST_END_SIZE) + (second_offset - ZIPLIST_HEADER_SIZE)); + ZIPLIST_TAIL_OFFSET(target) = intrev32ifbe((first_bytes - ZIPLIST_END_SIZE) + + (second_offset - ZIPLIST_HEADER_SIZE)); /* __ziplistCascadeUpdate just fixes the prev length values until it finds a * correct prev length value (then it assumes the rest of the list is okay). @@ -1327,8 +1330,11 @@ unsigned int ziplistCompare(unsigned char *p, unsigned char *sstr, unsigned int /* Find pointer to the entry equal to the specified entry. Skip 'skip' entries * between every comparison. Returns NULL when the field could not be found. */ -unsigned char * -ziplistFind(unsigned char *zl, unsigned char *p, unsigned char *vstr, unsigned int vlen, unsigned int skip) { +unsigned char *ziplistFind(unsigned char *zl, + unsigned char *p, + unsigned char *vstr, + unsigned int vlen, + unsigned int skip) { int skipcnt = 0; unsigned char vencoding = 0; long long vll = 0; @@ -1420,7 +1426,9 @@ void ziplistRepr(unsigned char *zl) { printf("{total bytes %u} " "{num entries %u}\n" "{tail offset %u}\n", - intrev32ifbe(ZIPLIST_BYTES(zl)), intrev16ifbe(ZIPLIST_LENGTH(zl)), intrev32ifbe(ZIPLIST_TAIL_OFFSET(zl))); + intrev32ifbe(ZIPLIST_BYTES(zl)), + intrev16ifbe(ZIPLIST_LENGTH(zl)), + intrev32ifbe(ZIPLIST_TAIL_OFFSET(zl))); p = ZIPLIST_ENTRY_HEAD(zl); while (*p != ZIP_END) { assert(zipEntrySafe(zl, zlbytes, p, &entry, 1)); @@ -1433,8 +1441,14 @@ void ziplistRepr(unsigned char *zl) { "\tprevrawlen: %5u,\n" "\tprevrawlensize: %2u,\n" "\tpayload %5u\n", - (long unsigned)p, index, (unsigned long)(p - zl), entry.headersize + entry.len, entry.headersize, - entry.prevrawlen, entry.prevrawlensize, entry.len); + (long unsigned)p, + index, + (unsigned long)(p - zl), + entry.headersize + entry.len, + entry.headersize, + entry.prevrawlen, + entry.prevrawlensize, + entry.len); printf("\tbytes: "); for (unsigned int i = 0; i < entry.headersize + entry.len; i++) { printf("%02x|", p[i]); diff --git a/src/ziplist.h b/src/ziplist.h index a839c66c60f..f58ecc33543 100644 --- a/src/ziplist.h +++ b/src/ziplist.h @@ -55,8 +55,11 @@ unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p); unsigned char *ziplistDeleteRange(unsigned char *zl, int index, unsigned int num); unsigned char *ziplistReplace(unsigned char *zl, unsigned char *p, unsigned char *s, unsigned int slen); unsigned int ziplistCompare(unsigned char *p, unsigned char *s, unsigned int slen); -unsigned char * -ziplistFind(unsigned char *zl, unsigned char *p, unsigned char *vstr, unsigned int vlen, unsigned int skip); +unsigned char *ziplistFind(unsigned char *zl, + unsigned char *p, + unsigned char *vstr, + unsigned int vlen, + unsigned int skip); unsigned int ziplistLen(unsigned char *zl); size_t ziplistBlobLen(unsigned char *zl); void ziplistRepr(unsigned char *zl); diff --git a/src/zipmap.c b/src/zipmap.c index 5214eaa5782..c541fc9ba6d 100644 --- a/src/zipmap.c +++ b/src/zipmap.c @@ -153,8 +153,11 @@ unsigned char *zipmapRewind(unsigned char *zm) { * printf("%d bytes value at $p\n", vlen, value); * } */ -unsigned char * -zipmapNext(unsigned char *zm, unsigned char **key, unsigned int *klen, unsigned char **value, unsigned int *vlen) { +unsigned char *zipmapNext(unsigned char *zm, + unsigned char **key, + unsigned int *klen, + unsigned char **value, + unsigned int *vlen) { if (zm[0] == ZIPMAP_END) return NULL; if (key) { *key = zm; @@ -197,8 +200,7 @@ int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep) { /* read the field name length */ l = zipmapDecodeLength(p); /* Sanity check: length < 254 must be encoded in 1 byte, not 5 bytes */ - if (l < ZIPMAP_BIGLEN && s != 1) - return 0; + if (l < ZIPMAP_BIGLEN && s != 1) return 0; p += s; /* skip the encoded field size */ p += l; /* skip the field */ @@ -214,8 +216,7 @@ int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep) { /* read the value length */ l = zipmapDecodeLength(p); /* Sanity check: length < 254 must be encoded in 1 byte, not 5 bytes */ - if (l < ZIPMAP_BIGLEN && s != 1) - return 0; + if (l < ZIPMAP_BIGLEN && s != 1) return 0; p += s; /* skip the encoded value size*/ e = *p++; /* skip the encoded free space (always encoded in one byte) */ p += l + e; /* skip the value and free space */ diff --git a/src/zipmap.h b/src/zipmap.h index 4b1dd4a1220..13228e56cf9 100644 --- a/src/zipmap.h +++ b/src/zipmap.h @@ -36,8 +36,11 @@ #define _ZIPMAP_H unsigned char *zipmapRewind(unsigned char *zm); -unsigned char * -zipmapNext(unsigned char *zm, unsigned char **key, unsigned int *klen, unsigned char **value, unsigned int *vlen); +unsigned char *zipmapNext(unsigned char *zm, + unsigned char **key, + unsigned int *klen, + unsigned char **value, + unsigned int *vlen); int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep); #endif diff --git a/src/zmalloc.c b/src/zmalloc.c index 453b83fb80f..8cb0bb62929 100644 --- a/src/zmalloc.c +++ b/src/zmalloc.c @@ -103,12 +103,15 @@ static thread_local int thread_index = -1; * the reader will see the inconsistency memory on non x86 architecture potentially. * For the ARM and PowerPC platform, we can solve this issue by make the memory aligned. * For the other architecture, lets fall back to the atomic operation to keep safe. */ -#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || defined(__POWERPC__) || defined(__arm__) || \ - defined(__arm64__) +#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__) || defined(__POWERPC__) || defined(__arm__) \ + || defined(__arm64__) +// clang-format off static __attribute__((aligned(CACHE_LINE_SIZE))) size_t used_memory_thread_padded[MAX_THREADS_NUM + PADDING_ELEMENT_NUM]; +// clang-format on static size_t *used_memory_thread = &used_memory_thread_padded[PADDING_ELEMENT_NUM]; #else -static __attribute__((aligned(CACHE_LINE_SIZE))) _Atomic size_t used_memory_thread_padded[MAX_THREADS_NUM + PADDING_ELEMENT_NUM]; +static __attribute__((aligned(CACHE_LINE_SIZE))) _Atomic size_t + used_memory_thread_padded[MAX_THREADS_NUM + PADDING_ELEMENT_NUM]; static _Atomic size_t *used_memory_thread = &used_memory_thread_padded[PADDING_ELEMENT_NUM]; #endif static atomic_int total_active_threads = 0; @@ -233,8 +236,8 @@ void *zmalloc_cache_aligned(size_t size) { unsigned char *raw = malloc(alloc_size + extra); if (!raw) zmalloc_oom_handler(size); - uintptr_t aligned = - ((uintptr_t)(raw + sizeof(void *) + PREFIX_SIZE + CACHE_LINE_SIZE - 1)) & ~((uintptr_t)CACHE_LINE_SIZE - 1); + uintptr_t aligned = ((uintptr_t)(raw + sizeof(void *) + PREFIX_SIZE + CACHE_LINE_SIZE - 1)) + & ~((uintptr_t)CACHE_LINE_SIZE - 1); void *ptr = (void *)aligned; *((void **)((unsigned char *)ptr - PREFIX_SIZE - sizeof(void *))) = raw; diff --git a/src/zmalloc.h b/src/zmalloc.h index a35b7cb434c..c6cc5f4f5a4 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -76,8 +76,9 @@ #define ZMALLOC_LIB "libc" #define USE_LIBC 1 -#if !defined(NO_MALLOC_USABLE_SIZE) && (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__DragonFly__) || \ - defined(__HAIKU__) || defined(USE_MALLOC_USABLE_SIZE)) +#if !defined(NO_MALLOC_USABLE_SIZE) \ + && (defined(__GLIBC__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__HAIKU__) \ + || defined(USE_MALLOC_USABLE_SIZE)) /* Includes for malloc_usable_size() */ #ifdef __FreeBSD__