You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by wc...@apache.org on 2022/05/12 10:10:28 UTC

[hbase] 01/03: HBASE-27021 StoreFileInfo should set its initialPath in a consistent way (#4419)

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

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

commit b7647d8d5fac115c0806c0631dc31c6e68eeaa16
Author: Wellington Ramos Chevreuil <wc...@apache.org>
AuthorDate: Thu May 12 09:36:46 2022 +0100

    HBASE-27021 StoreFileInfo should set its initialPath in a consistent way (#4419)
    
    Signed-off-by: Josh Elser <el...@apache.org>
    Signed-off-by: Duo Zhang <zh...@apache.org>
---
 .../apache/hadoop/hbase/regionserver/StoreFileInfo.java   |  2 +-
 .../org/apache/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 8bd2ffcb873..7a65d0e6ea2 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
@@ -139,7 +139,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 e9f87353bc7..5f817bdb414 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
@@ -941,13 +941,16 @@ public class TestHStore {
   private void closeCompactedFile(int index) throws IOException {
     Collection<HStoreFile> files =
       this.store.getStoreEngine().getStoreFileManager().getCompactedfiles();
-    HStoreFile sf = null;
-    Iterator<HStoreFile> it = files.iterator();
-    for (int i = 0; i <= index; i++) {
-      sf = it.next();
+    if (files.size() > 0) {
+      HStoreFile sf = null;
+      Iterator<HStoreFile> 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