Skip to content

Commit a5c46d9

Browse files
committed
更新 redis.c 中关于持久化的部分
1 parent 7442437 commit a5c46d9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/redis.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2934,11 +2934,13 @@ int checkForSentinelMode(int argc, char **argv) {
29342934
// 从 RDB 文件或 AOF 文件中载入数据到内存
29352935
void loadDataFromDisk(void) {
29362936
long long start = ustime();
2937-
// AOF 开启,并且有 AOF 文件时,优先使用 AOF 来还原
2937+
2938+
// 如果开启了 AOF 功能,那么优先使用 AOF 文件来还原数据
29382939
if (server.aof_state == REDIS_AOF_ON) {
29392940
if (loadAppendOnlyFile(server.aof_filename) == REDIS_OK)
29402941
redisLog(REDIS_NOTICE,"DB loaded from append only file: %.3f seconds",(float)(ustime()-start)/1000000);
29412942
} else {
2943+
// 在没有开启 AOF 功能时,才使用 RDB 来还原
29422944
if (rdbLoad(server.rdb_filename) == REDIS_OK) {
29432945
redisLog(REDIS_NOTICE,"DB loaded from disk: %.3f seconds",
29442946
(float)(ustime()-start)/1000000);

0 commit comments

Comments
 (0)