bharathv commented on a change in pull request #3332:
URL: https://github.com/apache/hbase/pull/3332#discussion_r642781222
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/AbstractFSWAL.java
##########
@@ -1190,9 +1201,18 @@ public OptionalLong getLogFileSizeIfBeingWritten(Path
path) {
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) {
Review comment:
Thanks for clarifying.
> What we are in effect doing is, when the WAL file is not yet closed, we
get the length from writer which tracks the synced length. Once the WAL file is
closed,
Correct.
> Now with the async close, it is possible that when this method execution
is at Line 1208, the close is not over but before we return from this method,
the WAL file is really closed
Correct
> Still we will return a value and system thinks WAL file is still active
one and undergo related logic. It may be very much fine in those places. But I
just wanted to make sure we double check.
Yes this is transparently handled by WalEntryStream. If what you said
happens (which is possible), WALEntryStream thinks that the file is not fully
done yet (in that loop iteration) and in the next attempt when it does the same
check again to read more bytes, it sees that the file is already done and
closed and either reads or terminates accordingly.
Relevant code links
https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java#L283
(the entry read is null, so it just loops again)
https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java#L197
(this is for looping again, in the subsequent next() call, this fill will be
seen as closed and it enters the if block in L180)
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]