This is an automated email from the ASF dual-hosted git repository.

ayegorov pushed a commit to branch branch-4.10
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/branch-4.10 by this push:
     new 0203873  ISSUE #2563: Fix SST file corruption.
0203873 is described below

commit 020387366a85c47f187dbad2f37e1d4f1153b220
Author: Surinder Singh <[email protected]>
AuthorDate: Fri Jan 29 12:03:29 2021 -0800

    ISSUE #2563: Fix SST file corruption.
    
    Fix SST File corruption during checkpointing
    
    ### Motivation
    
    Since the SST files are shared among checkpoints, this will not be resolved 
by future checkpoints. We will fail to restore all future checkpoints that 
depend on this file.
    
    ### Changes
    
    The record is sent asynchronously. We need to use a copy of the passed 
buffer
    in the record. The ownership is retained by the caller and will be 
potentially
    changed by the caller. In case of corruption the later blocks were
    overwriting the previous blocks resulting in corruption
    
    
    Master Issue: #2563
    
    
    
    Reviewers: Andrey Yegorov <None>, Enrico Olivelli <[email protected]>, 
Matteo Merli <[email protected]>
    
    This closes #2564 from sursingh/fix-sst-corruption, closes #2563
---
 .../statelib/impl/rocksdb/checkpoint/dlog/DLOutputStream.java           | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/rocksdb/checkpoint/dlog/DLOutputStream.java
 
b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/rocksdb/checkpoint/dlog/DLOutputStream.java
index 8fe6200..bfb1011 100644
--- 
a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/rocksdb/checkpoint/dlog/DLOutputStream.java
+++ 
b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/rocksdb/checkpoint/dlog/DLOutputStream.java
@@ -95,7 +95,7 @@ class DLOutputStream extends OutputStream {
         }
 
         writePos += buf.readableBytes();
-        LogRecord record = new LogRecord(writePos, buf);
+        LogRecord record = new LogRecord(writePos, buf.copy());
         writer.write(record).whenComplete(new FutureEventListener<DLSN>() {
             @Override
             public void onSuccess(DLSN value) {

Reply via email to