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
4e933e00
Commit
4e933e00
authored
Jul 31, 2018
by
antirez
Browse files
Introduce writeCommandsDeniedByDiskError().
parent
41607dfd
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/server.c
View file @
4e933e00
...
...
@@ -2805,6 +2805,25 @@ int prepareForShutdown(int flags) {
/*================================== Commands =============================== */
/* Sometimes Redis cannot accept write commands because there is a perstence
* error with the RDB or AOF file, and Redis is configured in order to stop
* accepting writes in such situation. This function returns if such a
* condition is active, and the type of the condition. */
int
writeCommandsDeniedByDiskError
(
void
)
{
if
(
server
.
stop_writes_on_bgsave_err
&&
server
.
saveparamslen
>
0
&&
server
.
lastbgsave_status
==
C_ERR
)
{
return
DISK_ERROR_TYPE_AOF
;
}
else
if
(
server
.
aof_state
!=
AOF_OFF
&&
server
.
aof_last_write_status
==
C_ERR
)
{
return
DISK_ERROR_TYPE_RDB
;
}
else
{
return
DISK_ERROR_TYPE_NONE
;
}
}
/* Return zero if strings are the same, non-zero if they are not.
* The comparison is performed in a way that prevents an attacker to obtain
* information about the nature of the strings just monitoring the execution
...
...
src/server.h
View file @
4e933e00
...
...
@@ -1591,6 +1591,11 @@ void startLoading(FILE *fp);
void
loadingProgress
(
off_t
pos
);
void
stopLoading
(
void
);
#define DISK_ERROR_TYPE_AOF 1
/* Don't accept writes: AOF errors. */
#define DISK_ERROR_TYPE_RDB 2
/* Don't accept writes: RDB errors. */
#define DISK_ERROR_TYPE_NONE 0
/* No problems, we can accept writes. */
int
writeCommandsDeniedByDiskError
(
void
);
/* RDB persistence */
#include "rdb.h"
int
rdbSaveRio
(
rio
*
rdb
,
int
*
error
,
int
flags
,
rdbSaveInfo
*
rsi
);
...
...
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