HDFS-10722. Fix race condition in TestEditLog#testBatchedSyncWithClosedLogs. Contributed by Daryn Sharp.

(cherry picked from commit 4a8e6dc02f)
This commit is contained in:
Kihwal Lee 2016-08-04 11:56:26 -05:00
parent cefa21e98a
commit 3a85aea42d
1 changed files with 6 additions and 3 deletions

View File

@ -562,9 +562,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",