This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new dc5f4464c0 Close shared conditional writers independently (#5780)
dc5f4464c0 is described below

commit dc5f4464c0b23c636691426f80f7b7d8539b615b
Author: Dave Marion <[email protected]>
AuthorDate: Wed Aug 6 10:51:00 2025 -0400

    Close shared conditional writers independently (#5780)
    
    ServerContext.close was closing both conditional
    shared writers when only one of them was created.
    This caused the other shared writer to be created
    during the ServerContext.close call, which fails
    when called from MiniAccumuloClusterImpl.terminate.
---
 .../java/org/apache/accumulo/server/ServerContext.java     | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java 
b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
index 3bf5450391..4363648ff5 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
@@ -116,7 +116,8 @@ public class ServerContext extends ClientContext {
 
   private final AtomicBoolean metricsInfoCreated = new AtomicBoolean(false);
   private final AtomicBoolean sharedSchedExecutorCreated = new 
AtomicBoolean(false);
-  private final AtomicBoolean sharedWritersCreated = new AtomicBoolean(false);
+  private final AtomicBoolean sharedMetadataWriterCreated = new 
AtomicBoolean(false);
+  private final AtomicBoolean sharedUserWriterCreated = new 
AtomicBoolean(false);
 
   public ServerContext(SiteConfiguration siteConfig) {
     this(ServerInfo.fromServerConfig(siteConfig));
@@ -495,7 +496,11 @@ public class ServerContext extends ClientContext {
       String tableName = level.metaTable();
       log.info("Creating shared ConditionalWriter for DataLevel {} with max 
threads: {}", level,
           maxThreads);
-      sharedWritersCreated.set(true);
+      if (level == DataLevel.METADATA) {
+        sharedMetadataWriterCreated.set(true);
+      } else if (level == DataLevel.USER) {
+        sharedUserWriterCreated.set(true);
+      }
       return createConditionalWriter(tableName, config);
     } catch (TableNotFoundException e) {
       throw new RuntimeException("Failed to create shared ConditionalWriter 
for level " + level, e);
@@ -519,7 +524,7 @@ public class ServerContext extends ClientContext {
     if (sharedSchedExecutorCreated.get()) {
       getScheduledExecutor().shutdownNow();
     }
-    if (sharedWritersCreated.get()) {
+    if (sharedMetadataWriterCreated.get()) {
       try {
         ConditionalWriter writer = sharedMetadataWriter.get();
         if (writer != null) {
@@ -528,7 +533,8 @@ public class ServerContext extends ClientContext {
       } catch (Exception e) {
         log.warn("Error closing shared metadata ConditionalWriter", e);
       }
-
+    }
+    if (sharedUserWriterCreated.get()) {
       try {
         ConditionalWriter writer = sharedUserWriter.get();
         if (writer != null) {

Reply via email to