jt2594838 commented on code in PR #18029:
URL: https://github.com/apache/iotdb/pull/18029#discussion_r3472592792
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/tag/TagManager.java:
##########
@@ -166,34 +165,33 @@ public void addIndex(String tagKey, String tagValue,
IMeasurementMNode<?> measur
return;
}
- int tagIndexOldSize = tagIndex.size();
- Map<String, Set<IMeasurementMNode<?>>> tagValueMap =
- tagIndex.computeIfAbsent(tagKey, k -> new ConcurrentHashMap<>());
- int tagIndexNewSize = tagIndex.size();
-
- int tagValueMapOldSize = tagValueMap.size();
- Set<IMeasurementMNode<?>> measurementsSet =
- tagValueMap.computeIfAbsent(tagValue, v ->
Collections.synchronizedSet(new HashSet<>()));
- int tagValueMapNewSize = tagValueMap.size();
+ tagIndex.compute(
+ tagKey,
+ (key, tagValueMap) -> {
+ long memorySize = 0;
+ if (tagValueMap == null) {
+ tagValueMap = new ConcurrentHashMap<>();
+ // the last 4 is the memory occupied by the size of tagvaluemap
+ memorySize += RamUsageEstimator.sizeOf(tagKey) + 4;
Review Comment:
Why is it only 4 bytes? The same below
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]