nsnycde commented on PR #4607: URL: https://github.com/apache/bookkeeper/pull/4607#issuecomment-3235463643
> > > @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:然而它也很奇怪地假设 `ledgersMap` 是并发修改的,并且在并发修改后具有稳定的迭代顺序: > > > 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.理论上来说,这里判断 ledgerMapSize <= 0应该不会导致误删除,因为在上面的判断中,如果leaderMapIndex数据没有写入成功,logHeader头指向的offset数据为0,在这个判断之前会直接抛出异常。 > > > 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.而且 leaderMapIndex 中 logHeader 头指向的偏移量数据只有在写入索引数据后才会设置,如果异常崩溃,则不应该写入偏移量。 > > > 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.在此拉取请求之前,leaderMapIndex 是 entryLog 文件中的一个随机值,它可能不为零。 You are right, I ignored the fix of this issue -- 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]
