Apache9 commented on PR #5443: URL: https://github.com/apache/hbase/pull/5443#issuecomment-1741087122
I tried to reproduce the problem by matching the above executing sequence, but then I found that the newly added code was not executed... The problem here is that, we are only safe to move to the next file when beingWritten == true when we get a EOF_WITH_TRAILER, and we will schedule a close writer task, which will write the trailer, under the rollWriterLock. And the trailerPresent flag is set while opening the wal reader. This means that if we get beingWritten == true, then it is impossible the reader has a trailerPresent == true at the same time, because we can make sure that the wal reader is opened before we write the trailer, so we can only get a EOF_AND_RESET, and next time when we hit `walFileLengthProvider.getLogFileSizeIfBeingWritten` again, it can only return beingWritten == false, because we need to get the rollWriterLock, and once we get the rollWriterLock, it means the log roll has already been finished, thus the postLogRoll has been called so the new WAL file has been enqueued to the logQueue... Let me just add more comments in code to describe the logic here. -- 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]
