diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index c85fb597188..e7b3b2373f3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -2796,22 +2796,21 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi // Switch snapshot (in memstore) -> new hfile (thus causing // all the store scanners to reset/reseek). - Iterator it = storesToFlush.iterator(); - // stores.values() and storeFlushCtxs have same order - for (StoreFlushContext flush : storeFlushCtxs.values()) { - boolean needsCompaction = flush.commit(status); + for (Map.Entry flushEntry : storeFlushCtxs.entrySet()) { + StoreFlushContext sfc = flushEntry.getValue(); + boolean needsCompaction = sfc.commit(status); if (needsCompaction) { compactionRequested = true; } - byte[] storeName = it.next().getColumnFamilyDescriptor().getName(); - List storeCommittedFiles = flush.getCommittedFiles(); + byte[] storeName = flushEntry.getKey(); + List storeCommittedFiles = sfc.getCommittedFiles(); committedFiles.put(storeName, storeCommittedFiles); // Flush committed no files, indicating flush is empty or flush was canceled if (storeCommittedFiles == null || storeCommittedFiles.isEmpty()) { MemStoreSize storeFlushableSize = prepareResult.storeFlushableSize.get(storeName); prepareResult.totalFlushableSize.decMemStoreSize(storeFlushableSize); } - flushedOutputFileSize += flush.getOutputFileSize(); + flushedOutputFileSize += sfc.getOutputFileSize(); } storeFlushCtxs.clear();