This is an automated email from the ASF dual-hosted git repository.
justinchen pushed a commit to branch schema_cache_cal_fix
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/schema_cache_cal_fix by this
push:
new e6ece382ba0 ff
e6ece382ba0 is described below
commit e6ece382ba017d0cbc9d0cc33bb2b92423d064e0
Author: Caideyipi <[email protected]>
AuthorDate: Wed Nov 26 17:31:30 2025 +0800
ff
---
.../relational/metadata/fetcher/cache/TableDeviceLastCache.java | 9 +++++----
.../metadata/fetcher/cache/TreeDeviceNormalSchema.java | 8 ++++++--
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceLastCache.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceLastCache.java
index 62dbfdccdeb..797d94cac7d 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceLastCache.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceLastCache.java
@@ -120,14 +120,14 @@ public class TableDeviceLastCache {
(measurementKey, tvPair) -> {
if (Objects.isNull(newPair)) {
diff.addAndGet(
- -((isTableModel ? 0 : (int)
RamUsageEstimator.sizeOf(finalMeasurement))
- + getTVPairEntrySize(tvPair)));
+ -(isTableModel ? 0 : (int)
RamUsageEstimator.sizeOf(finalMeasurement))
+ + getTVPairEntrySize(tvPair));
return null;
}
if (Objects.isNull(tvPair)) {
diff.addAndGet(
(isTableModel ? 0 : (int)
RamUsageEstimator.sizeOf(finalMeasurement))
- + (int) RamUsageEstimator.HASHTABLE_RAM_BYTES_PER_ENTRY);
+ + getTVPairEntrySize(newPair));
return newPair;
}
return tvPair;
@@ -151,7 +151,8 @@ public class TableDeviceLastCache {
for (int i = 0; i < measurements.length; ++i) {
if (Objects.isNull(timeValuePairs[i])) {
if (invalidateNull) {
- measurement2CachedLastMap.remove(measurements[i]);
+ final TimeValuePair pair =
measurement2CachedLastMap.remove(measurements[i]);
+ diff.addAndGet(-getTVPairEntrySize(pair));
}
continue;
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceNormalSchema.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceNormalSchema.java
index bca4dbdaa02..4e9c2fe9fde 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceNormalSchema.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceNormalSchema.java
@@ -88,7 +88,10 @@ public class TreeDeviceNormalSchema implements IDeviceSchema
{
final SchemaCacheEntry putEntry = new SchemaCacheEntry(schema, tagMap);
final SchemaCacheEntry cachedEntry = measurementMap.put(measurement,
putEntry);
return Objects.isNull(cachedEntry)
- ? (int) (RamUsageEstimator.sizeOf(measurement) +
SchemaCacheEntry.estimateSize(putEntry))
+ ? (int)
+ (RamUsageEstimator.sizeOf(measurement)
+ + SchemaCacheEntry.estimateSize(putEntry)
+ + RamUsageEstimator.HASHTABLE_RAM_BYTES_PER_ENTRY)
: SchemaCacheEntry.estimateSize(putEntry) -
SchemaCacheEntry.estimateSize(cachedEntry);
}
@@ -101,7 +104,8 @@ public class TreeDeviceNormalSchema implements
IDeviceSchema {
entry ->
Math.toIntExact(
RamUsageEstimator.sizeOf(entry.getKey())
- + SchemaCacheEntry.estimateSize(entry.getValue())))
+ + SchemaCacheEntry.estimateSize(entry.getValue())
+ + RamUsageEstimator.HASHTABLE_RAM_BYTES_PER_ENTRY))
.reduce(0, Integer::sum);
}
}