Skip to content

Commit

Permalink
change assertion condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Apache9 committed Oct 1, 2023
1 parent 0bbca07 commit 196e9f1
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,13 @@ private HasNext tryAdvanceEntry() {
case EOF_WITH_TRAILER:
// in readNextEntryAndRecordReaderPosition, we will acquire rollWriteLock, and we can only
// schedule a close writer task, in which we will write trailer, under the rollWriteLock, so
// if beingWritten == true, it means that the reader is opened before writing the trailer,
// so we can not get a EOF_WITH_TRAILER return value while reading from this reader.
// this is very important for make sure that we will not consume the logQueue to empty for a
// normal replication queue
assert !beingWritten;
// typically if beingWritten == true, we should not reach here, as we need to reopen the
// reader after writing the trailer. The only possible way to reach here while beingWritten
// == true is due to the inflightWALClosures logic in AbstractFSWAL, as if the writer is
// still in this map, we will consider it as beingWritten, but actually, here we could make
// sure that the new WAL file has already been enqueued into the logQueue, so here dequeuing
// the current log file is safe.
assert beingWritten && logQueue.getQueue(walGroupId).size() > 1;
// we have reached the trailer, which means this WAL file has been closed cleanly and we
// have finished reading it successfully, just move to the next WAL file and let the upper
// layer start reading the next WAL file
Expand Down

0 comments on commit 196e9f1

Please sign in to comment.