You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/06/27 00:34:16 UTC

[GitHub] reddycharan edited a comment on issue #1527: Make ExplicitLAC persistent

reddycharan edited a comment on issue #1527: Make ExplicitLAC persistent
URL: https://github.com/apache/bookkeeper/issues/1527#issuecomment-400505143
 
 
   Actually I missed a crucial aspect of explicitLAC in FileInfo. In FileInfo class, explicitLAC value is stored as ByteBuf but not simple long value. This ByteBuf contains Checksum/Digest information (variable length digestcode) as well, which would be needed to verify digest when explicitLAC is read back by the client. So to persist explicitLAC we received, we have to persist complete ByteBuf we received but not just long value.
   
   So the special entry in Journal should be -
   
   ```
       static ByteBuf createExplicitLACEntry(long ledgerId, ByteBuf explicitLac) {
           ByteBuf bb = Unpooled.buffer(8 + 8 + lac.capacity());
           bb.writeLong(ledgerId);
           bb.writeLong(METAENTRY_ID_LEDGER_EXPLICITLAC);
           bb.writeBytes(explicitLac);
           return bb;
       }
   ```
   In FileInfo file to persist this variable length explicitLac in the header of FileInfo, we should write length of the explicitLac byteBuf first and then the actual explicitLac ByteBuf (just like how masterKey is persisted in the header of FileInfo). This length of explicitLac ByteBuf and actual ByteBuf should go to the Head of the FileInfo after statebits (this and need for changing version of HEADER is as described earlier and remains same).

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services