From aa31b0f695ab02015a7a183aaf10ac9963a22ddb Mon Sep 17 00:00:00 2001 From: Wellington Ramos Chevreuil Date: Thu, 12 May 2022 09:36:46 +0100 Subject: [PATCH] HBASE-27021 StoreFileInfo should set its initialPath in a consistent way (#4419) Signed-off-by: Josh Elser Signed-off-by: Duo Zhang --- .../hadoop/hbase/regionserver/StoreFileInfo.java | 2 +- .../hadoop/hbase/regionserver/TestHStore.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java index 575ab1303a8..093b6879d9c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileInfo.java @@ -130,7 +130,7 @@ public class StoreFileInfo implements Configurable { this.fs = fs; this.conf = conf; - this.initialPath = initialPath; + this.initialPath = fs.makeQualified(initialPath); this.primaryReplica = primaryReplica; this.noReadahead = this.conf.getBoolean(STORE_FILE_READER_NO_READAHEAD, DEFAULT_STORE_FILE_READER_NO_READAHEAD); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHStore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHStore.java index d8dd6b21b78..6ff5112e39d 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHStore.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHStore.java @@ -940,13 +940,16 @@ public class TestHStore { private void closeCompactedFile(int index) throws IOException { Collection files = this.store.getStoreEngine().getStoreFileManager().getCompactedfiles(); - HStoreFile sf = null; - Iterator it = files.iterator(); - for (int i = 0; i <= index; i++) { - sf = it.next(); + if (files.size() > 0) { + HStoreFile sf = null; + Iterator it = files.iterator(); + for (int i = 0; i <= index; i++) { + sf = it.next(); + } + sf.closeStoreFile(true); + store.getStoreEngine().getStoreFileManager(). + removeCompactedFiles(Collections.singletonList(sf)); } - sf.closeStoreFile(true); - store.getStoreEngine().getStoreFileManager().removeCompactedFiles(Lists.newArrayList(sf)); } @Test