Backport client pause cron from #9549

This commit is contained in:
Madelyn Olson
2023-02-28 18:32:14 +02:00
committed by Oran Agra
parent 683a4ce4b2
commit 1797c5e374
3 changed files with 10 additions and 0 deletions
+5
View File
@@ -467,6 +467,8 @@ void debugCommand(client *c) {
" Return the size of different Redis core C structures.",
"ZIPLIST <key>",
" Show low level info about the ziplist encoding of <key>.",
"PAUSE-CRON <0|1>",
" Stop periodic cron job processing.",
NULL
};
addReplyHelp(c, help);
@@ -887,6 +889,9 @@ NULL
mallctl_string(c, c->argv+2, c->argc-2);
return;
#endif
} else if (!strcasecmp(c->argv[1]->ptr,"pause-cron") && c->argc == 3) {
server.pause_cron = atoi(c->argv[2]->ptr);
addReply(c,shared.ok);
} else {
addReplySubcommandSyntaxError(c);
return;
+4
View File
@@ -2072,6 +2072,9 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
}
}
/* for debug purposes: skip actual cron work if pause_cron is on */
if (server.pause_cron) return 1000/server.hz;
run_with_period(100) {
long long stat_net_input_bytes, stat_net_output_bytes;
atomicGet(server.stat_net_input_bytes, stat_net_input_bytes);
@@ -2697,6 +2700,7 @@ void initServerConfig(void) {
server.migrate_cached_sockets = dictCreate(&migrateCacheDictType,NULL);
server.next_client_id = 1; /* Client IDs, start from 1 .*/
server.loading_process_events_interval_bytes = (1024*1024*2);
server.pause_cron = 0;
unsigned int lruclock = getLRUClock();
atomicSet(server.lruclock,lruclock);
+1
View File
@@ -1345,6 +1345,7 @@ struct redisServer {
int set_proc_title; /* True if change proc title */
char *proc_title_template; /* Process title template format */
clientBufferLimitsConfig client_obuf_limits[CLIENT_TYPE_OBUF_COUNT];
int pause_cron; /* Don't run cron tasks (debug) */
/* AOF persistence */
int aof_enabled; /* AOF configuration */
int aof_state; /* AOF_(ON|OFF|WAIT_REWRITE) */