Skip to content

Commit

Permalink
remove do_delete arg
Browse files Browse the repository at this point in the history
Signed-off-by: Binbin <[email protected]>
  • Loading branch information
enjoy-binbin committed Aug 23, 2024
1 parent fef9cc9 commit c7f74af
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
10 changes: 4 additions & 6 deletions src/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -1713,12 +1713,10 @@ void deleteExpiredKeyAndPropagate(serverDb *db, robj *keyobj) {
}

/* Delete the specified expired key from overwriting and propagate the DEL or UNLINK. */
void deleteExpiredKeyFromOverwriteAndPropagate(client *c, robj *keyobj, int do_delete) {
if (do_delete) {
int deleted = dbGenericDelete(c->db, keyobj, server.lazyfree_lazy_expire, DB_FLAG_KEY_EXPIRED);
serverAssertWithInfo(c, keyobj, deleted);
server.dirty++;
}
void deleteExpiredKeyFromOverwriteAndPropagate(client *c, robj *keyobj) {
int deleted = dbGenericDelete(c->db, keyobj, server.lazyfree_lazy_expire, DB_FLAG_KEY_EXPIRED);
serverAssertWithInfo(c, keyobj, deleted);
server.dirty++;

/* Replicate/AOF this as an explicit DEL or UNLINK. */
robj *aux = server.lazyfree_lazy_expire ? shared.unlink : shared.del;
Expand Down
2 changes: 1 addition & 1 deletion src/expire.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ void expireGenericCommand(client *c, long long basetime, int unit) {
}

if (checkAlreadyExpired(when)) {
deleteExpiredKeyFromOverwriteAndPropagate(c, key, 1);
deleteExpiredKeyFromOverwriteAndPropagate(c, key);
addReply(c, shared.cone);
return;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -3490,7 +3490,7 @@ int setModuleNumericConfig(ModuleConfig *config, long long val, const char **err
/* db.c -- Keyspace access API */
int removeExpire(serverDb *db, robj *key);
void deleteExpiredKeyAndPropagate(serverDb *db, robj *keyobj);
void deleteExpiredKeyFromOverwriteAndPropagate(client *c, robj *keyobj, int do_delete);
void deleteExpiredKeyFromOverwriteAndPropagate(client *c, robj *keyobj);
void propagateDeletion(serverDb *db, robj *key, int lazy);
int keyIsExpired(serverDb *db, robj *key);
long long getExpire(serverDb *db, robj *key);
Expand Down
4 changes: 2 additions & 2 deletions src/t_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void setGenericCommand(client *c,
* database, and then wait for the active expire to delete it, it is wasteful.
* If the key already exists, delete it. */
if (expire && checkAlreadyExpired(milliseconds)) {
if (found) deleteExpiredKeyFromOverwriteAndPropagate(c, key, 1);
if (found) deleteExpiredKeyFromOverwriteAndPropagate(c, key);
if (!(flags & OBJ_SET_GET)) addReply(c, shared.ok);
return;
}
Expand Down Expand Up @@ -404,7 +404,7 @@ void getexCommand(client *c) {
if (((flags & OBJ_PXAT) || (flags & OBJ_EXAT)) && checkAlreadyExpired(milliseconds)) {
/* When PXAT/EXAT absolute timestamp is specified, there can be a chance that timestamp
* has already elapsed so delete the key in that case. */
deleteExpiredKeyFromOverwriteAndPropagate(c, c->argv[1], 1);
deleteExpiredKeyFromOverwriteAndPropagate(c, c->argv[1]);
} else if (expire) {
setExpire(c,c->db,c->argv[1],milliseconds);
/* Propagate as PXEXPIREAT millisecond-timestamp if there is
Expand Down

0 comments on commit c7f74af

Please sign in to comment.