You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ni...@apache.org on 2022/05/11 17:25:58 UTC
[pulsar] branch branch-2.10 updated: [improve][test] Reduce LedgerUnderreplicationManagerTest flakyness (#15541)
This is an automated email from the ASF dual-hosted git repository.
nicoloboschi pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.10 by this push:
new 4358600f305 [improve][test] Reduce LedgerUnderreplicationManagerTest flakyness (#15541)
4358600f305 is described below
commit 4358600f3054c3083a8d894d10698bd13b2410cf
Author: Nicolò Boschi <bo...@gmail.com>
AuthorDate: Wed May 11 17:48:03 2022 +0200
[improve][test] Reduce LedgerUnderreplicationManagerTest flakyness (#15541)
(cherry picked from commit 1757c1b77304fee756fa073a06e5dbd4049d8e72)
---
.../bookkeeper/LedgerUnderreplicationManagerTest.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/LedgerUnderreplicationManagerTest.java b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/LedgerUnderreplicationManagerTest.java
index 97812273e8e..7f89f28e2d6 100644
--- a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/LedgerUnderreplicationManagerTest.java
+++ b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/LedgerUnderreplicationManagerTest.java
@@ -33,6 +33,8 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -74,7 +76,7 @@ public class LedgerUnderreplicationManagerTest extends BaseMetadataStoreTest {
log.error("Error getting ledger id", e);
return -1L;
}
- });
+ }, executor);
}
private MetadataStoreExtended store;
@@ -84,8 +86,10 @@ public class LedgerUnderreplicationManagerTest extends BaseMetadataStoreTest {
private String basePath;
private String urLedgerPath;
+ private ExecutorService executor;
private void methodSetup(Supplier<String> urlSupplier) throws Exception {
+ this.executor = Executors.newSingleThreadExecutor();
String ledgersRoot = "/ledgers-" + UUID.randomUUID();
this.store = MetadataStoreExtended.create(urlSupplier.get(), MetadataStoreConfig.builder().build());
this.layoutManager = new PulsarLayoutManager(store, ledgersRoot);
@@ -113,6 +117,15 @@ public class LedgerUnderreplicationManagerTest extends BaseMetadataStoreTest {
if (store != null) {
store.close();
}
+ if (executor != null) {
+ try {
+ executor.shutdownNow();
+ executor.awaitTermination(5, TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
+ executor = null;
+ }
}
/**