Skip to content

Commit 752c0ce

Browse files
committed
Update the flush and snapshot interface to deal with the changed interface of hashtable_mcmp_op_get_by_index
1 parent 20e0870 commit 752c0ce

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/storage/db/storage_db.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -1632,13 +1632,16 @@ bool storage_db_op_flush_sync(
16321632
transaction_acquire(&transaction);
16331633

16341634
storage_db_entry_index_t *entry_index = NULL;
1635+
storage_db_database_number_t entry_database_number;
16351636
if (hashtable_mcmp_op_get_by_index(
16361637
db->hashtable,
1637-
database_number,
16381638
&transaction,
16391639
bucket_index,
1640+
&entry_database_number,
16401641
(void *) &entry_index)) {
1641-
if (entry_index->created_time_ms <= deletion_start_ms) {
1642+
// Ensure that the entry is from the correct database and that it's older than the deletion start time, to
1643+
// avoid deleting entries that have been created after the flush has started
1644+
if (database_number == entry_database_number && entry_index->created_time_ms <= deletion_start_ms) {
16421645
storage_db_op_delete_by_index(
16431646
db,
16441647
database_number,

src/storage/db/storage_db_snapshot.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -964,9 +964,9 @@ bool storage_db_snapshot_rdb_process_block(
964964
storage_db_entry_index_t *entry_index = NULL;
965965
if (!hashtable_mcmp_op_get_by_index(
966966
db->hashtable,
967-
database_number,
968967
&transaction,
969968
bucket_index,
969+
&database_number,
970970
(void *) &entry_index)) {
971971
goto loop_end;
972972
}

0 commit comments

Comments
 (0)