HBASE-19728 Add lock to filesCompacting in all place.

This commit is contained in:
binlijin 2018-01-31 17:01:58 +08:00
parent df317a7db3
commit e1bcf50b10
1 changed files with 8 additions and 2 deletions

View File

@ -1447,7 +1447,9 @@ public class HStore implements Store {
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();
}
@ -2560,7 +2562,11 @@ public class HStore implements Store {
@Override
public boolean needsCompaction() {
return this.storeEngine.needsCompaction(this.filesCompacting);
List<StoreFile> filesCompactingClone = null;
synchronized (filesCompacting) {
filesCompactingClone = Lists.newArrayList(filesCompacting);
}
return this.storeEngine.needsCompaction(filesCompactingClone);
}
@Override