Skip to content

Commit b43333f

Browse files
tomscutsteveloughran
authored andcommitted
HDFS-16507. [SBN read] Avoid purging edit log which is in progress (#4082)
1 parent 581ca34 commit b43333f

File tree

1 file changed

+6
-5
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode

1 file changed

+6
-5
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,11 +1512,12 @@ public synchronized void purgeLogsOlderThan(final long minTxIdToKeep) {
15121512
if (!isOpenForWrite()) {
15131513
return;
15141514
}
1515-
1516-
assert curSegmentTxId == HdfsServerConstants.INVALID_TXID || // on format this is no-op
1517-
minTxIdToKeep <= curSegmentTxId :
1518-
"cannot purge logs older than txid " + minTxIdToKeep +
1519-
" when current segment starts at " + curSegmentTxId;
1515+
1516+
Preconditions.checkArgument(
1517+
curSegmentTxId == HdfsServerConstants.INVALID_TXID || // on format this is no-op
1518+
minTxIdToKeep <= curSegmentTxId,
1519+
"cannot purge logs older than txid " + minTxIdToKeep +
1520+
" when current segment starts at " + curSegmentTxId);
15201521
if (minTxIdToKeep == 0) {
15211522
return;
15221523
}

0 commit comments

Comments
 (0)