You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2024/07/05 22:45:32 UTC

(hbase) branch branch-2.6 updated: HBASE-28703 Data race in RecoveredEditsOutputSink while closing writers (#6045)

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

apurtell pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new b89b4667a4b HBASE-28703 Data race in RecoveredEditsOutputSink while closing writers (#6045)
b89b4667a4b is described below

commit b89b4667a4b8010f3a05562fb9ccf3bc8c538a04
Author: Andrew Purtell <ap...@apache.org>
AuthorDate: Fri Jul 5 15:21:13 2024 -0700

    HBASE-28703 Data race in RecoveredEditsOutputSink while closing writers (#6045)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
---
 .../src/main/java/org/apache/hadoop/hbase/wal/OutputSink.java     | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/OutputSink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/OutputSink.java
index 5bd01e7212b..7b5637cc009 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/OutputSink.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/OutputSink.java
@@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.wal;
 import java.io.IOException;
 import java.io.InterruptedIOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletionService;
@@ -58,9 +59,12 @@ public abstract class OutputSink {
   protected final AtomicLong totalSkippedEdits = new AtomicLong();
 
   /**
-   * List of all the files produced by this sink
+   * List of all the files produced by this sink,
+   * <p>
+   * Must be a synchronized list to avoid concurrency issues. CopyOnWriteArrayList is not a good
+   * choice because all we do is add to the list and then return the result.
    */
-  protected final List<Path> splits = new ArrayList<>();
+  protected final List<Path> splits = Collections.synchronizedList(new ArrayList<>());
 
   protected MonitoredTask status = null;