Apache9 commented on PR #5443:
URL: https://github.com/apache/hbase/pull/5443#issuecomment-1741990568
OK, I think the problem is `inflightWALClosures`.
```
@Override
public OptionalLong getLogFileSizeIfBeingWritten(Path path) {
rollWriterLock.lock();
try {
Path currentPath = getOldPath();
if (path.equals(currentPath)) {
// Currently active path.
W writer = this.writer;
return writer != null ? OptionalLong.of(writer.getSyncedLength()) :
OptionalLong.empty();
} else {
W temp = inflightWALClosures.get(path.getName());
if (temp != null) {
// In the process of being closed, trailer bytes may or may not be
flushed.
// Ensuring that we read all the bytes in a file is critical for
correctness of tailing
// use cases like replication, see HBASE-25924/HBASE-25932.
return OptionalLong.of(temp.getSyncedLength());
}
// Log rolled successfully.
return OptionalLong.empty();
}
} finally {
rollWriterLock.unlock();
}
}
```
Since we close the WAL writers in a background thread, to speed up the log
rolling, it is possible that, we have write the trailer and closed the WAL
writer, but we haven't removed it from the `inflightWALClosures` yet, so we
will get a beingWritten == true but we have a trailer, but there should be no
harm.
Let me think what is the best way to handle this 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]