Unverified Commit f18c9da3 authored by Binbin's avatar Binbin Committed by GitHub
Browse files

loadAppendOnlyFiles and loadSingleAppendOnlyFile ret should be AOF_OK, not C_OK (#10790)

The ret value should be AOF_OK instead of C_OK.
AOF_OK and C_OK are both 0, so this is just a cleanup.
Also updated some outdated comments.
parent 2f5edd03
...@@ -1353,7 +1353,7 @@ int loadSingleAppendOnlyFile(char *filename) { ...@@ -1353,7 +1353,7 @@ int loadSingleAppendOnlyFile(char *filename) {
off_t valid_up_to = 0; /* Offset of latest well-formed command loaded. */ off_t valid_up_to = 0; /* Offset of latest well-formed command loaded. */
off_t valid_before_multi = 0; /* Offset before MULTI command loaded. */ off_t valid_before_multi = 0; /* Offset before MULTI command loaded. */
off_t last_progress_report_size = 0; off_t last_progress_report_size = 0;
int ret = C_OK; int ret = AOF_OK;
sds aof_filepath = makePath(server.aof_dirname, filename); sds aof_filepath = makePath(server.aof_dirname, filename);
FILE *fp = fopen(aof_filepath, "r"); FILE *fp = fopen(aof_filepath, "r");
...@@ -1533,7 +1533,7 @@ int loadSingleAppendOnlyFile(char *filename) { ...@@ -1533,7 +1533,7 @@ int loadSingleAppendOnlyFile(char *filename) {
goto uxeof; goto uxeof;
} }
loaded_ok: /* DB loaded, cleanup and return C_OK to the caller. */ loaded_ok: /* DB loaded, cleanup and return success (AOF_OK or AOF_TRUNCATED). */
loadingIncrProgress(ftello(fp) - last_progress_report_size); loadingIncrProgress(ftello(fp) - last_progress_report_size);
server.aof_state = old_aof_state; server.aof_state = old_aof_state;
goto cleanup; goto cleanup;
...@@ -1594,7 +1594,7 @@ cleanup: ...@@ -1594,7 +1594,7 @@ cleanup:
/* Load the AOF files according the aofManifest pointed by am. */ /* Load the AOF files according the aofManifest pointed by am. */
int loadAppendOnlyFiles(aofManifest *am) { int loadAppendOnlyFiles(aofManifest *am) {
serverAssert(am != NULL); serverAssert(am != NULL);
int status, ret = C_OK; int status, ret = AOF_OK;
long long start; long long start;
off_t total_size = 0, base_size = 0; off_t total_size = 0, base_size = 0;
sds aof_name; sds aof_name;
...@@ -2268,7 +2268,7 @@ int rewriteAppendOnlyFileRio(rio *aof) { ...@@ -2268,7 +2268,7 @@ int rewriteAppendOnlyFileRio(rio *aof) {
} }
/* In fork child process, we can try to release memory back to the /* In fork child process, we can try to release memory back to the
* OS and possibly avoid or decrease COW. We guve the dismiss * OS and possibly avoid or decrease COW. We give the dismiss
* mechanism a hint about an estimated size of the object we stored. */ * mechanism a hint about an estimated size of the object we stored. */
size_t dump_size = aof->processed_bytes - aof_bytes_before_key; size_t dump_size = aof->processed_bytes - aof_bytes_before_key;
if (server.in_fork_child) dismissObject(o, dump_size); if (server.in_fork_child) dismissObject(o, dump_size);
......
...@@ -291,7 +291,7 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT]; ...@@ -291,7 +291,7 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT];
#define AOF_ON 1 /* AOF is on */ #define AOF_ON 1 /* AOF is on */
#define AOF_WAIT_REWRITE 2 /* AOF waits rewrite to start appending */ #define AOF_WAIT_REWRITE 2 /* AOF waits rewrite to start appending */
/* AOF return values for loadAppendOnlyFile() */ /* AOF return values for loadAppendOnlyFiles() and loadSingleAppendOnlyFile() */
#define AOF_OK 0 #define AOF_OK 0
#define AOF_NOT_EXIST 1 #define AOF_NOT_EXIST 1
#define AOF_EMPTY 2 #define AOF_EMPTY 2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment