Repository: hbase Updated Branches: refs/heads/branch-2 2835d51f9 -> b3824b8c9
HBASE-19728 Add lock to filesCompacting in all place. Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b3824b8c Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b3824b8c Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b3824b8c Branch: refs/heads/branch-2 Commit: b3824b8c92727996e7240cc9a23ce435f7355649 Parents: 2835d51 Author: binlijin <[email protected]> Authored: Wed Jan 31 14:18:27 2018 +0800 Committer: binlijin <[email protected]> Committed: Wed Jan 31 14:18:27 2018 +0800 ---------------------------------------------------------------------- .../java/org/apache/hadoop/hbase/regionserver/HStore.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/b3824b8c/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 f228d44..b00758f 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 @@ -1451,7 +1451,9 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat this.lock.writeLock().lock(); try { this.storeEngine.getStoreFileManager().addCompactionResults(compactedFiles, result); - filesCompacting.removeAll(compactedFiles); // safe bc: lock.writeLock(); + synchronized (filesCompacting) { + filesCompacting.removeAll(compactedFiles); + } } finally { this.lock.writeLock().unlock(); } @@ -2306,7 +2308,11 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat @Override public boolean needsCompaction() { - return this.storeEngine.needsCompaction(this.filesCompacting); + List<HStoreFile> filesCompactingClone = null; + synchronized (filesCompacting) { + filesCompactingClone = Lists.newArrayList(filesCompacting); + } + return this.storeEngine.needsCompaction(filesCompactingClone); } /**
