From 6ae2102f8cc1caf3fb40e0fc529080ba4a36fdb8 Mon Sep 17 00:00:00 2001 From: fengyubiao Date: Wed, 31 May 2023 17:43:26 +0800 Subject: [PATCH 1/3] [branch-2.11] [fix] [test]fix test testThreadSwitchOfZkMetadataStore --- .../org/apache/pulsar/metadata/MetadataStoreTest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java index 888a1186d86e8..15d791be79e87 100644 --- a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java +++ b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java @@ -432,10 +432,9 @@ public Object[][] conditionOfSwitchThread(){ @Test(dataProvider = "conditionOfSwitchThread") public void testThreadSwitchOfZkMetadataStore(boolean hasSynchronizer, boolean enabledBatch) throws Exception { final String prefix = newKey(); - final String metadataStoreName = UUID.randomUUID().toString().replaceAll("-", ""); + final String metadataStoreNamePrefix = "metadata-store-"; MetadataStoreConfig.MetadataStoreConfigBuilder builder = - MetadataStoreConfig.builder().metadataStoreName(metadataStoreName); - builder.fsyncEnable(false); + MetadataStoreConfig.builder(); builder.batchingEnabled(enabledBatch); if (!hasSynchronizer) { builder.synchronizer(null); @@ -447,8 +446,8 @@ public void testThreadSwitchOfZkMetadataStore(boolean hasSynchronizer, boolean e final Runnable verify = () -> { String currentThreadName = Thread.currentThread().getName(); String errorMessage = String.format("Expect to switch to thread %s, but currently it is thread %s", - metadataStoreName, currentThreadName); - assertTrue(Thread.currentThread().getName().startsWith(metadataStoreName), errorMessage); + metadataStoreNamePrefix, currentThreadName); + assertTrue(Thread.currentThread().getName().startsWith(metadataStoreNamePrefix), errorMessage); }; // put with node which has parent(but the parent node is not exists). From e50085ceb0aced2aa74063bb73594a76223de138 Mon Sep 17 00:00:00 2001 From: fengyubiao Date: Wed, 31 May 2023 17:50:22 +0800 Subject: [PATCH 2/3] [branch-2.11] [fix] [test]fix test testThreadSwitchOfZkMetadataStore --- .../test/java/org/apache/pulsar/metadata/MetadataStoreTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java index 15d791be79e87..09c13d878d307 100644 --- a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java +++ b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java @@ -432,7 +432,7 @@ public Object[][] conditionOfSwitchThread(){ @Test(dataProvider = "conditionOfSwitchThread") public void testThreadSwitchOfZkMetadataStore(boolean hasSynchronizer, boolean enabledBatch) throws Exception { final String prefix = newKey(); - final String metadataStoreNamePrefix = "metadata-store-"; + final String metadataStoreNamePrefix = "metadata-store"; MetadataStoreConfig.MetadataStoreConfigBuilder builder = MetadataStoreConfig.builder(); builder.batchingEnabled(enabledBatch); From a7f730184d5f3b76730efcffae88efdde48edf6c Mon Sep 17 00:00:00 2001 From: fengyubiao Date: Wed, 31 May 2023 17:55:47 +0800 Subject: [PATCH 3/3] remove unnecessary imports --- .../test/java/org/apache/pulsar/metadata/MetadataStoreTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java index 09c13d878d307..fcc89340febdb 100644 --- a/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java +++ b/pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataStoreTest.java @@ -29,7 +29,6 @@ import java.util.List; import java.util.Optional; import java.util.Set; -import java.util.UUID; import java.util.concurrent.BlockingQueue; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException;