Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
1797c5e3
Commit
1797c5e3
authored
Feb 20, 2023
by
Madelyn Olson
Committed by
Oran Agra
Feb 28, 2023
Browse files
Backport client pause cron from #9549
parent
683a4ce4
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
1797c5e3
...
...
@@ -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
;
...
...
src/server.c
View file @
1797c5e3
...
...
@@ -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
);
...
...
src/server.h
View file @
1797c5e3
...
...
@@ -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) */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment