HBASE-19728 Add lock to filesCompacting in all place.

This commit is contained in:
binlijin 2018-01-31 14:18:27 +08:00
parent 2835d51f9a
commit b3824b8c92
1 changed files with 8 additions and 2 deletions

View File

@ -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);
}
/**