oneby-wang commented on PR #4607: URL: https://github.com/apache/bookkeeper/pull/4607#issuecomment-3235255337
> > @oneby-wang oh yes, based on your description, you are pointing that this is an issue: > > https://github.com/apache/bookkeeper/blob/e80d0318cfdebbc79f37d9120de8df28c8c1c13a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java#L1104-L1106 > > > > It seems that this code might explain the negative value: > > https://github.com/apache/bookkeeper/blob/e80d0318cfdebbc79f37d9120de8df28c8c1c13a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java#L159-L171 > > > > However it's also very strange that it assumes that `ledgersMap` is concurrently modified and has a stable iteration order after concurrent modifications: > > https://github.com/apache/bookkeeper/blob/e80d0318cfdebbc79f37d9120de8df28c8c1c13a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java#L143-L188 > > @lhotari @oneby-wang Theoretically, judging that ledgerMapSize <= 0 here should not lead to incorrect deletion, because in the above judgment, if the leaderMapIndex data is not written successfully, the offset data pointed to by the logHeader header is 0, and an exception will be thrown directly before this judgment. > > > https://github.com/apache/bookkeeper/blob/e80d0318cfdebbc79f37d9120de8df28c8c1c13a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java#L1079-L1082 > > Moreover, the offset data pointed to by the logHeader header in leaderMapIndex will only be set after the index data is written. If it crashes abnormally, the offset should not be written. > > > https://github.com/apache/bookkeeper/blob/e80d0318cfdebbc79f37d9120de8df28c8c1c13a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/DefaultEntryLogger.java#L204-L208 Before this pull request, leaderMapIndex is a random value in entryLog file, it may probably not zero. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
