From 1b9927afe1dba136ea460ec1417514c0d7815504 Mon Sep 17 00:00:00 2001 From: Viraj Jasani Date: Wed, 25 Aug 2021 14:07:25 +0530 Subject: [PATCH] HDFS-16184. De-flake TestBlockScanner#testSkipRecentAccessFile (#3329) Reviewed-by: Ayush Saxena Signed-off-by: Takanobu Asanuma --- .../apache/hadoop/hdfs/server/datanode/TestBlockScanner.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockScanner.java index fdbcb51ae4..e1473fb7e9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockScanner.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockScanner.java @@ -1004,6 +1004,8 @@ public void testSkipRecentAccessFile() throws Exception { TestScanResultHandler.getInfo(ctx.volumes.get(0)); synchronized (info) { info.shouldRun = true; + info.sem = new Semaphore(1); + info.sem.acquire(); info.notify(); } try { @@ -1017,6 +1019,7 @@ public void testSkipRecentAccessFile() throws Exception { LOG.debug("Timeout for all files are accessed in last period."); } synchronized (info) { + info.sem.release(); info.shouldRun = false; info.notify(); }