HDFS-16507. [SBN read] Avoid purging edit log which is in progress (#4082)

This commit is contained in:
litao 2022-03-31 14:01:48 +08:00 committed by Chao Sun
parent e24bd1c15b
commit cfca024190
1 changed files with 6 additions and 5 deletions

View File

@ -1513,10 +1513,11 @@ public synchronized void purgeLogsOlderThan(final long minTxIdToKeep) {
return;
}
assert curSegmentTxId == HdfsServerConstants.INVALID_TXID || // on format this is no-op
minTxIdToKeep <= curSegmentTxId :
Preconditions.checkArgument(
curSegmentTxId == HdfsServerConstants.INVALID_TXID || // on format this is no-op
minTxIdToKeep <= curSegmentTxId,
"cannot purge logs older than txid " + minTxIdToKeep +
" when current segment starts at " + curSegmentTxId;
" when current segment starts at " + curSegmentTxId);
if (minTxIdToKeep == 0) {
return;
}