This is an automated email from the ASF dual-hosted git repository. ctubbsii 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 1443a7edaf Make RecoveryPath more strict (#4243) 1443a7edaf is described below commit 1443a7edaf3131457939fc3abb5116b81a229ae3 Author: Christopher Tubbs <ctubb...@apache.org> AuthorDate: Wed Feb 7 22:54:31 2024 -0500 Make RecoveryPath more strict (#4243) Make RecoveryPath more strictly check that a WAL file path includes the expected server that created it, and improve exception messages. This fixes #4087 --------- Co-authored-by: Arbaaz Khan <bazzy...@yahoo.com> --- .../accumulo/server/manager/recovery/RecoveryPath.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/RecoveryPath.java b/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/RecoveryPath.java index e739887ba0..893867bad2 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/RecoveryPath.java +++ b/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/RecoveryPath.java @@ -30,19 +30,22 @@ public class RecoveryPath { String uuid = walPath.getName(); // drop uuid walPath = walPath.getParent(); - // recovered 1.4 WALs won't have a server component - if (!walPath.getName().equals(FileType.WAL.getDirectory())) { - // drop server - walPath = walPath.getParent(); + + // expect and drop the server component + if (walPath.getName().equals(FileType.WAL.getDirectory())) { + throw new IllegalArgumentException("Bath path " + walPath + " (missing server component)"); } + walPath = walPath.getParent(); + // expect and drop the wal component if (!walPath.getName().equals(FileType.WAL.getDirectory())) { - throw new IllegalArgumentException("Bad path " + walPath); + throw new IllegalArgumentException( + "Bad path " + walPath + " (missing wal directory component)"); } - - // drop wal walPath = walPath.getParent(); + // create new path in recovery directory that is a sibling to the wal directory (same volume), + // without the server component walPath = new Path(walPath, FileType.RECOVERY.getDirectory()); walPath = new Path(walPath, uuid); @@ -50,7 +53,6 @@ public class RecoveryPath { } throw new IllegalArgumentException("Bad path " + walPath); - } }