From 74af7d44268d584e47a6f40178ebcb42bb9fed8e Mon Sep 17 00:00:00 2001 From: Jinmei Liao Date: Mon, 28 Feb 2022 16:28:05 -0800 Subject: [PATCH] GEODE-10092: add more logging for future debug when region size gets below 0. (#7402) --- .../apache/geode/internal/cache/LocalRegion.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java index b8b585c0d9c2..0c3a396bee19 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java @@ -2111,9 +2111,20 @@ public int getRegionSize() { // if this is a client with no tombstones then we subtract the number // of entries being affected by register-interest refresh if (imageState.isClient() && !getConcurrencyChecksEnabled()) { - return result - imageState.getDestroyedEntriesCount(); + int destroyedEntriesCount = imageState.getDestroyedEntriesCount(); + if (result < destroyedEntriesCount) { + logger.error("Incorrect region size: mapSize={}, destroyedEntriesCount={}.", result, + destroyedEntriesCount); + } + return result - destroyedEntriesCount; + } + + int tombstoneNumber = tombstoneCount.get(); + if (result < tombstoneNumber) { + logger.error("Incorrect region size: mapSize={}, tombstoneCount={}.", result, + tombstoneNumber); } - return result - tombstoneCount.get(); + return result - tombstoneNumber; } }