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

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


The following commit(s) were added to refs/heads/3.1 by this push:
     new 07b1ec1a54 switches volumes prior to recovery check (#4889)
07b1ec1a54 is described below

commit 07b1ec1a54fbc406cc02d989e60abb9c3f947ecc
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Tue Sep 17 20:13:45 2024 -0400

    switches volumes prior to recovery check (#4889)
    
    In #4873 a check was added to inspect walogs during tablet load to see
    if they had any data for the tablet.  This check happens prior to
    volume replacement that also runs during tablet load. Therefore if
    volume replacement is needed for the walogs then this check will fail
    because it can not find the files and the tablet will fail to load.
    
    To fix this problem modified the new check to switch volumes if needed
    prior to running the check.
    
    
    Co-authored-by: Christopher Tubbs <ctubb...@apache.org>
---
 .../java/org/apache/accumulo/tserver/TabletServer.java | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index eae6637702..2cb9caf23c 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -116,6 +116,7 @@ import 
org.apache.accumulo.server.compaction.PausedCompactionMetrics;
 import org.apache.accumulo.server.conf.TableConfiguration;
 import org.apache.accumulo.server.fs.VolumeChooserEnvironmentImpl;
 import org.apache.accumulo.server.fs.VolumeManager;
+import org.apache.accumulo.server.fs.VolumeUtil;
 import org.apache.accumulo.server.log.WalStateManager;
 import org.apache.accumulo.server.log.WalStateManager.WalMarkerException;
 import org.apache.accumulo.server.rpc.ServerAddress;
@@ -1087,8 +1088,23 @@ public class TabletServer extends AbstractServer 
implements TabletHostingServer
       return false;
     }
 
+    // This method is called prior to volumes being switched for a tablet 
during the load process,
+    // so switch volumes before calling needsRecovery()
+    var switchedLogEntries = new ArrayList<LogEntry>(logEntries.size());
+    for (LogEntry logEntry : logEntries) {
+      var switchedWalog = VolumeUtil.switchVolume(logEntry, 
context.getVolumeReplacements());
+      LogEntry walog;
+      if (switchedWalog != null) {
+        log.debug("Volume switched for needsRecovery {} -> {}", logEntry, 
switchedWalog);
+        walog = switchedWalog;
+      } else {
+        walog = logEntry;
+      }
+      switchedLogEntries.add(walog);
+    }
+
     try {
-      return logger.needsRecovery(getContext(), tabletMetadata.getExtent(), 
logEntries);
+      return logger.needsRecovery(getContext(), tabletMetadata.getExtent(), 
switchedLogEntries);
     } catch (IOException e) {
       throw new UncheckedIOException(e);
     }

Reply via email to