From 4a8e6dc02fb1d0dc89c3981b444575494511444a Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Thu, 4 Aug 2016 11:53:44 -0500 Subject: [PATCH] HDFS-10722. Fix race condition in TestEditLog#testBatchedSyncWithClosedLogs. Contributed by Daryn Sharp. --- .../apache/hadoop/hdfs/server/namenode/TestEditLog.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java index dcd7cc29cb..6aa619f97c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java @@ -591,9 +591,12 @@ public class TestEditLog { // Log an edit from thread A doLogEdit(threadA, editLog, "thread-a 1"); - assertEquals("logging edit without syncing should do not affect txid", - 1, editLog.getSyncTxId()); - + // async log is doing batched syncs in background. logSync just ensures + // the edit is durable, so the txid may increase prior to sync + if (!useAsyncEditLog) { + assertEquals("logging edit without syncing should do not affect txid", + 1, editLog.getSyncTxId()); + } // logSyncAll in Thread B doCallLogSyncAll(threadB, editLog); assertEquals("logSyncAll should sync thread A's transaction",