Apache9 commented on a change in pull request #3859: URL: https://github.com/apache/hbase/pull/3859#discussion_r756848953
########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java ########## @@ -1222,6 +1225,14 @@ private boolean updateStorefiles(List<HStoreFile> sfs, long snapshotId) throws I this.lock.writeLock().lock(); try { this.storeEngine.getStoreFileManager().insertNewFiles(sfs); + /** + * NOTE:we should keep clearSnapshot method inside the write lock because clearSnapshot may + * close {@link DefaultMemStore#snapshot}, which may be used by + * {@link DefaultMemStore#getScanners}. + */ + if (snapshotId > 0) { Review comment: So the problem here is that we can not call memstore.clearSnapshot and memstore.getScanners at the same time? Looking at the code, seems you are right. There is no atomic operations when getting the snapshot segment, it is possible that we put the segment into the list, and before we increase its ref count by calling getScanner on it, we could have already closed it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org