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

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new d1d6804  During journal replay, force to re-insert the master key in 
ledger storage
d1d6804 is described below

commit d1d6804e15c03a138431945df59a2c41a4f1f205
Author: Matteo Merli <[email protected]>
AuthorDate: Sat Dec 16 09:05:01 2017 -0800

    During journal replay, force to re-insert the master key in ledger storage
    
    When the bookie crashes and restart, it will replay the entries from the 
journal. In the case of ledgers that were created, but their metadata was not 
flushed on disk, the ledger metadata might be lost.
    
    This is more evident in `DbLedgerStorage`, since the ledger metadata is 
cached in memory and it's only inserted in the db at the checkpoint time, 
though it applies as well for `InterleavedLedgerStorage` where the ledger 
metadata was inserted in the cache but not fsynced on disk.
    
    If the page cache content is gone, when replaying the journal content, the 
ledger will be tracked in memory but the bookie won't have the metadata on disk 
anymore.
    
    Merging from yahoo branch: 
https://github.com/yahoo/bookkeeper/commit/d3626396ecf1a2b98c782bb30a7b9c00c75c6cdf
    
    Author: Matteo Merli <[email protected]>
    
    Reviewers: Enrico Olivelli <[email protected]>, Sijie Guo 
<[email protected]>
    
    This closes #867 from merlimat/master
---
 .../src/main/java/org/apache/bookkeeper/bookie/Bookie.java             | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
index 812942d..90b1939 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
@@ -767,6 +767,9 @@ public class Bookie extends BookieCriticalThread {
 
                             recBuff.get(masterKey);
                             masterKeyCache.put(ledgerId, masterKey);
+
+                            // Force to re-insert the master key in ledger 
storage
+                            handles.getHandle(ledgerId, masterKey);
                         } else {
                             throw new IOException("Invalid journal. Contains 
journalKey "
                                     + " but layout version (" + journalVersion

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to