jvrao commented on a change in pull request #1532: ISSUE #1527: Make 
ExplicitLAC persistent
URL: https://github.com/apache/bookkeeper/pull/1532#discussion_r201730658
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
 ##########
 @@ -784,6 +787,23 @@ public void process(int journalVersion, long offset, 
ByteBuffer recBuff) throws
                                     + " but layout version (" + journalVersion
                                     + ") is too old to hold this");
                         }
+                    } else if (entryId == METAENTRY_ID_LEDGER_EXPLICITLAC) {
+                        if (journalVersion >= JournalChannel.V5) {
+                            int explicitLacBufLength = recBuff.getInt();
+                            ByteBuf explicitLacBuf = 
Unpooled.buffer(explicitLacBufLength);
+                            byte[] explicitLacBufArray = new 
byte[explicitLacBufLength];
+                            recBuff.get(explicitLacBufArray);
+                            explicitLacBuf.writeBytes(explicitLacBufArray);
+                            byte[] key = masterKeyCache.get(ledgerId);
+                            if (key == null) {
+                                key = ledgerStorage.readMasterKey(ledgerId);
+                            }
+                            LedgerDescriptor handle = 
handles.getHandle(ledgerId, key);
+                            handle.setExplicitLac(explicitLacBuf);
+                        } else {
+                            throw new IOException("Invalid journal. Contains 
explicitLAC " + " but layout version ("
+                                    + journalVersion + ") is too old to hold 
this");
 
 Review comment:
   Just curious, if the software is an older version, how can it even recognize 
that the entryId is METAENTRY_ID_LEDGER_EXPLICITLAC??

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to