/** * @return A new Map of online regions sorted by region size with the first entry being the * biggest. If two regions are the same size, then the last one found wins; i.e. this method * may NOT return all regions. */ SortedMap<Long, Region> getCopyOfOnlineRegionsSortedBySize() { // we'll sort the regions in reverse SortedMap<Long, Region> sortedRegions = new TreeMap<Long, Region>( new Comparator<Long>() { @Override public int compare(Long a, Long b) { return -1 * a.compareTo(b); } }); // Copy over all regions. Regions are sorted by size with biggest first. for (Region region : this.onlineRegions.values()) { sortedRegions.put(region.getMemstoreSize(), region); } return sortedRegions; }
@Override public void postFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException { // Record whether the region is empty after a flush Region region = e.getEnvironment().getRegion(); // After a flush, if the memstore size is zero and there are no store files for any stores in the region // then the region must be empty long numStoreFiles = numStoreFilesForRegion(e); long memstoreSize = region.getMemstoreSize(); LOG.debug(String.format("Region %s: memstore size = %s, num store files = %s", region.getRegionInfo().getRegionNameAsString(), memstoreSize, numStoreFiles)); if (memstoreSize == 0 && numStoreFiles == 0) { if (compactionState != null) { compactionState.persistRegionEmpty(System.currentTimeMillis()); } } }
@Override public void postFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException { // Record whether the region is empty after a flush Region region = e.getEnvironment().getRegion(); // After a flush, if the memstore size is zero and there are no store files for any stores in the region // then the region must be empty long numStoreFiles = numStoreFilesForRegion(e); long memstoreSize = region.getMemstoreSize(); LOG.debug(String.format("Region %s: memstore size = %s, num store files = %s", region.getRegionInfo().getRegionNameAsString(), memstoreSize, numStoreFiles)); if (memstoreSize == 0 && numStoreFiles == 0) { if (compactionState != null) { compactionState.persistRegionEmpty(System.currentTimeMillis()); } } }
@Override public void postFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException { // Record whether the region is empty after a flush Region region = e.getEnvironment().getRegion(); // After a flush, if the memstore size is zero and there are no store files for any stores in the region // then the region must be empty long numStoreFiles = numStoreFilesForRegion(e); long memstoreSize = region.getMemstoreSize(); LOG.debug(String.format("Region %s: memstore size = %s, num store files = %s", region.getRegionInfo().getRegionNameAsString(), memstoreSize, numStoreFiles)); if (memstoreSize == 0 && numStoreFiles == 0) { if (compactionState != null) { compactionState.persistRegionEmpty(System.currentTimeMillis()); } } }
bestAnyRegion.getMemstoreSize() > 2 * bestFlushableRegion.getMemstoreSize()) { + bestAnyRegion.getRegionInfo().getRegionNameAsString() + " has too many " + "store files, but is " + TraditionalBinaryPrefix.long2String(bestAnyRegion.getMemstoreSize(), "", 1) + " vs best flushable region's " + TraditionalBinaryPrefix.long2String(bestFlushableRegion.getMemstoreSize(), "", 1) + ". Choosing the bigger."); (regionToFlush != null && regionToFlush.getMemstoreSize() > 0) || (bestRegionReplica != null && bestRegionReplica.getMemstoreSize() > 0)); (bestRegionReplica.getMemstoreSize() > secondaryMultiplier * regionToFlush.getMemstoreSize()))) { LOG.info("Refreshing storefiles of region " + bestRegionReplica + " due to global heap pressure. memstore size=" + StringUtils.humanReadableInt( + humanReadableInt(server.getRegionServerAccounting().getGlobalMemstoreSize()) + ", Region memstore size=" + humanReadableInt(regionToFlush.getMemstoreSize())); flushedOne = flushRegion(regionToFlush, true, true);
int storeUncompressedSizeMB = 0; int storefileSizeMB = 0; int memstoreSizeMB = (int) (r.getMemstoreSize() / 1024 / 1024); int storefileIndexSizeMB = 0; int rootIndexSizeKB = 0;