[
https://issues.apache.org/jira/browse/BOOKKEEPER-455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13491230#comment-13491230
]
Sijie Guo commented on BOOKKEEPER-455:
--------------------------------------
{quote}
According to the description, it seems at one point, the
last-confirmed-entry-id in the add-entry-package was used
{quote}
{quote}
Instead, ledger recovery just look at the index file to get last-written-entry.
{quote}
As the code below, Bookie actually responds last written entry. But in
BookKeeper client, ReadLastConfirmedOp would try to read LAC carried in the
last written entry. LAC is retrieved here when fencing read -1. The client
doesn't use last written entry id as last acked entry id. so the implementation
is same as the documentation.
{code:title=InterleavedLedgerStorage.java}
/*
* If entryId is BookieProtocol.LAST_ADD_CONFIRMED, then return the
last written.
*/
if (entryId == BookieProtocol.LAST_ADD_CONFIRMED) {
entryId = ledgerCache.getLastEntry(ledgerId);
}
{code}
{code:title=ReadLastConfirmedOp.java}
RecoveryData recoveryData =
lh.macManager.verifyDigestAndReturnLastConfirmed(buffer); if
(recoveryData.lastAddConfirmed > maxRecoveredData.lastAddConfirmed) {
maxRecoveredData = recoveryData;
}
{code}
{code:title=DigestManager.java}
RecoveryData verifyDigestAndReturnLastConfirmed(ChannelBuffer dataReceived)
throws BKDigestMatchException {
verifyDigest(dataReceived);
dataReceived.readerIndex(8);
dataReceived.readLong(); // skip unused entryId
long lastAddConfirmed = dataReceived.readLong();
long length = dataReceived.readLong();
return new RecoveryData(lastAddConfirmed, length);
}
{code}
> Bookie recovery made assumption that entries are persisted in entry id order
> ----------------------------------------------------------------------------
>
> Key: BOOKKEEPER-455
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-455
> Project: Bookkeeper
> Issue Type: Bug
> Components: bookkeeper-server
> Affects Versions: 4.2.0
> Reporter: Yixue (Andrew) Zhu
> Priority: Minor
>
> The entries sent by bookkeeper client can be out of order (due to network).
> The client uses queue to track last-confirmed-entry-id correctly.
> The bookie server will happily persist the entries out of order, i.e. gaps
> are possible. If bookie crash, the recovery can cause last-confirmed-entry-id
> to be set to the last-entry persisted by bookie. The gap is not tracked nor
> detected at server side.
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira