Skip to content

Commit 7b937d8

Browse files
committed
memory mode: skip restore rocksdb from checkpoint on eof error.
1 parent c8c2498 commit 7b937d8

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/ctrip_swap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2443,7 +2443,7 @@ typedef struct swapRdbLoadCtx {
24432443

24442444
void swapRdbLoadCtxInit(swapRdbLoadCtx *ctx);
24452445
void swapRdbLoadBegin(swapRdbLoadCtx *ctx);
2446-
void swapRdbLoadEnd(swapRdbLoadCtx *ctx, rio *rdb);
2446+
void swapRdbLoadEnd(swapRdbLoadCtx *ctx, rio *rdb, int eoferr);
24472447
int swapRdbLoadAuxField(swapRdbLoadCtx *ctx, rio *rdb, robj *auxkey, robj *auxval);
24482448
int swapRdbLoadNoKV(swapRdbLoadCtx *ctx, rio *rdb, redisDb *db, int type);
24492449
int swapRdbLoadKVBegin(swapRdbLoadCtx *ctx, rio *rdb);

src/ctrip_swap_rdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,9 +1242,9 @@ void swapRdbLoadKVEnd(swapRdbLoadCtx *ctx) {
12421242
ctx->rordb_object_flags = -1;
12431243
}
12441244

1245-
void swapRdbLoadEnd(swapRdbLoadCtx *ctx, rio *rdb) {
1245+
void swapRdbLoadEnd(swapRdbLoadCtx *ctx, rio *rdb, int eoferr) {
12461246
if (ctx->rordb && !ctx->rordb_sstloaded) {
1247-
rordbLoadSSTFinished(rdb);
1247+
if (!eoferr) rordbLoadSSTFinished(rdb);
12481248
ctx->rordb_sstloaded = 1;
12491249
}
12501250

src/rdb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2919,7 +2919,7 @@ int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
29192919
#endif
29202920
}
29212921
#ifdef ENABLE_SWAP
2922-
swapRdbLoadEnd(ctx,rdb);
2922+
swapRdbLoadEnd(ctx,rdb,0);
29232923
#endif
29242924
/* Verify the checksum if RDB version is >= 5 */
29252925
if (rdbver >= 5) {
@@ -2958,7 +2958,7 @@ int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
29582958
* we'll report the error to the caller, so that we can retry. */
29592959
eoferr:
29602960
#ifdef ENABLE_SWAP
2961-
swapRdbLoadEnd(ctx,rdb);
2961+
swapRdbLoadEnd(ctx,rdb,1);
29622962
#endif
29632963
serverLog(LL_WARNING,
29642964
"Short read or OOM loading DB. Unrecoverable error, aborting now.");

0 commit comments

Comments
 (0)