You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by op...@apache.org on 2018/10/22 11:30:12 UTC
hbase git commit: HBASE-21355 (addendum) replace the expensive reload
storefiles with reading the merge result of compacted storefiles and current
storefiles
Repository: hbase
Updated Branches:
refs/heads/master 3b66b65b9 -> d0e7367c8
HBASE-21355 (addendum) replace the expensive reload storefiles with reading the merge result of compacted storefiles and current storefiles
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/d0e7367c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/d0e7367c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/d0e7367c
Branch: refs/heads/master
Commit: d0e7367c8d631fcfe95b6d8b3a49759b2b1c0538
Parents: 3b66b65
Author: huzheng <op...@gmail.com>
Authored: Mon Oct 22 15:17:32 2018 +0800
Committer: huzheng <op...@gmail.com>
Committed: Mon Oct 22 19:28:53 2018 +0800
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/HStore.java | 30 ++++++++------------
1 file changed, 12 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/d0e7367c/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
index 694b2b6..6f2a6fa 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
@@ -303,6 +303,10 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
this.storeEngine = createStoreEngine(this, this.conf, this.comparator);
List<HStoreFile> hStoreFiles = loadStoreFiles();
+ // Move the storeSize calculation out of loadStoreFiles() method, because the secondary read
+ // replica's refreshStoreFiles() will also use loadStoreFiles() to refresh its store files and
+ // update the storeSize in the completeCompaction(..) finally (just like compaction) , so
+ // no need calculate the storeSize twice.
this.storeSize.addAndGet(getStorefilesSize(hStoreFiles, sf -> true));
this.totalUncompressedBytes.addAndGet(getTotalUmcompressedBytes(hStoreFiles));
this.storeEngine.getStoreFileManager().loadFiles(hStoreFiles);
@@ -1705,26 +1709,16 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
@Override
public boolean hasReferences() {
List<HStoreFile> reloadedStoreFiles = null;
+ // Grab the read lock here, because we need to ensure that: only when the atomic
+ // replaceStoreFiles(..) finished, we can get all the complete store file list.
+ this.lock.readLock().lock();
try {
- // Reloading the store files from file system due to HBASE-20940. As split can happen with an
- // region which has references
- reloadedStoreFiles = loadStoreFiles();
- return StoreUtils.hasReferences(reloadedStoreFiles);
- } catch (IOException ioe) {
- LOG.error("Error trying to determine if store has references, assuming references exists",
- ioe);
- return true;
+ // Merge the current store files with compacted files here due to HBASE-20940.
+ Collection<HStoreFile> allStoreFiles = new ArrayList<>(getStorefiles());
+ allStoreFiles.addAll(getCompactedFiles());
+ return StoreUtils.hasReferences(allStoreFiles);
} finally {
- if (reloadedStoreFiles != null) {
- for (HStoreFile storeFile : reloadedStoreFiles) {
- try {
- storeFile.closeStoreFile(false);
- } catch (IOException ioe) {
- LOG.warn("Encountered exception closing " + storeFile + ": " + ioe.getMessage());
- // continue with closing the remaining store files
- }
- }
- }
+ this.lock.readLock().unlock();
}
}