This is an automated email from the ASF dual-hosted git repository.
sodonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 124723a4b2 HDDS-6661. TestBackgroundPipelineScrubber.testRun() fails
intermittently (#3359)
124723a4b2 is described below
commit 124723a4b2a790bef872a6c01b62dd6f7e507b69
Author: Stephen O'Donnell <[email protected]>
AuthorDate: Thu Apr 28 14:34:42 2022 +0100
HDDS-6661. TestBackgroundPipelineScrubber.testRun() fails intermittently
(#3359)
---
.../hadoop/hdds/scm/pipeline/BackgroundPipelineScrubber.java | 11 ++++++++++-
.../hdds/scm/pipeline/TestBackgroundPipelineScrubber.java | 4 ++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/BackgroundPipelineScrubber.java
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/BackgroundPipelineScrubber.java
index 2063ac37d6..be465f6321 100644
---
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/BackgroundPipelineScrubber.java
+++
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/BackgroundPipelineScrubber.java
@@ -57,6 +57,7 @@ public class BackgroundPipelineScrubber implements SCMService
{
private final long intervalInMillis;
private final long waitTimeInMillis;
private long lastTimeToBeReadyInMillis = 0;
+ private volatile boolean runImmediately = false;
public BackgroundPipelineScrubber(PipelineManager pipelineManager,
ConfigurationSource conf, SCMContext scmContext) {
@@ -152,7 +153,10 @@ public class BackgroundPipelineScrubber implements
SCMService {
scrubAllPipelines();
}
synchronized (this) {
- wait(intervalInMillis);
+ if (!runImmediately) {
+ wait(intervalInMillis);
+ }
+ runImmediately = false;
}
} catch (InterruptedException e) {
LOG.warn("{} is interrupted, exit", THREAD_NAME);
@@ -162,6 +166,11 @@ public class BackgroundPipelineScrubber implements
SCMService {
}
}
+ public synchronized void runImmediately() {
+ runImmediately = true;
+ notify();
+ }
+
private void scrubAllPipelines() {
try {
pipelineManager.scrubPipelines();
diff --git
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestBackgroundPipelineScrubber.java
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestBackgroundPipelineScrubber.java
index dfa528454e..8efa4a38ca 100644
---
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestBackgroundPipelineScrubber.java
+++
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestBackgroundPipelineScrubber.java
@@ -92,8 +92,8 @@ public class TestBackgroundPipelineScrubber {
synchronized (scrubber) {
scrubber.notifyStatusChanged();
assertTrue(scrubber.shouldRun());
- scrubber.notifyAll();
+ scrubber.runImmediately();
}
- verify(pipelineManager, timeout(3000).times(1)).scrubPipelines();
+ verify(pipelineManager, timeout(3000).atLeastOnce()).scrubPipelines();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]