gesterzhou commented on a change in pull request #6430: URL: https://github.com/apache/geode/pull/6430#discussion_r641744281
########## File path: geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionMap.java ########## @@ -388,89 +375,105 @@ public void close(BucketRegion bucketRegion) { if (logger.isDebugEnabled()) { logger.debug("Clearing entries for {} rvv={}", _getOwner(), rvv); } - LocalRegion lr = _getOwner(); + final LocalRegion lr = _getOwner(); RegionVersionVector localRvv = lr.getVersionVector(); - incClearCount(lr); - // lock for size calcs if the region might have tombstones - Object lockObj = lr.getConcurrencyChecksEnabled() ? lr.getSizeGuard() : new Object(); - synchronized (lockObj) { - if (rvv == null) { - int delta = 0; - try { - delta = sizeInVM(); // TODO soplog need to determine if stats should - // reflect only size in memory or the complete thing - } catch (GemFireIOException e) { - // ignore rather than throwing an exception during cache close - } - int tombstones = lr.getTombstoneCount(); - _mapClear(); - _getOwner().updateSizeOnClearRegion(delta - tombstones); - _getOwner().incTombstoneCount(-tombstones); - if (delta != 0) { - incEntryCount(-delta); - } - } else { - int delta = 0; - int tombstones = 0; - VersionSource myId = _getOwner().getVersionMember(); - if (localRvv != rvv) { - localRvv.recordGCVersions(rvv); - } - final boolean isTraceEnabled = logger.isTraceEnabled(); - for (RegionEntry re : regionEntries()) { - synchronized (re) { - Token value = re.getValueAsToken(); - // if it's already being removed or the entry is being created we leave it alone - if (value == Token.REMOVED_PHASE1 || value == Token.REMOVED_PHASE2) { - continue; - } - VersionSource id = re.getVersionStamp().getMemberID(); - if (id == null) { - id = myId; - } - if (rvv.contains(id, re.getVersionStamp().getRegionVersion())) { - if (isTraceEnabled) { - logger.trace("region clear op is removing {} {}", re.getKey(), - re.getVersionStamp()); + boolean isBucketRegion = false; + PartitionedRegionStats prStats = null; + long startTime = 0L; + + if (lr.isUsedForPartitionedRegionBucket()) { + prStats = lr.getPartitionedRegion().getPrStats(); + startTime = prStats.startBucketClear(); + isBucketRegion = true; + } Review comment: do you need "else" here? how about replicate region? -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org