hangc0276 commented on code in PR #3940:
URL: https://github.com/apache/bookkeeper/pull/3940#discussion_r1182024566
##########
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageTest.java:
##########
@@ -224,6 +224,7 @@ public void testBookieCompaction() throws Exception {
entry3.writeLong(3); // entry id
entry3.writeBytes("entry-3".getBytes());
storage.addEntry(entry3);
+ storage.flush();
Review Comment:
> Let me take one case for example.
Timeline: [t1, t2, t3]
t1: One entry (LedgerId = 1, EntryId = 1) with value "test-v1" written into
the bookie from one bookie client
t2: The entry (LedgerId = 1, EntryId = 1) with new value "test-new-v1"
written into the bookie from one bookie client
t3: Bookie triggers compaction to compact the entry written in t1, the entry
(LedgerId = 1, EntryId = 1) with value "test-v1" will be written into the
current entry log file, and update the entry's lookup index.
> Before this change
Due to the compactor flushing the current ledger storage write cache before
updating the entry's lookup index, the updated value of the entry "test-new-v1"
in t2 will be flushed into storage and removed from the write cache. If we get
the entry (LedgerId = 1, EntryId = 1) after t3, we will get the old value
test-v1
This test shows the above behavior
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]