From 91b5fb8bd7fbdf5aee479559f52441060ea6ed50 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:15:28 +0800 Subject: [PATCH 1/3] Update DeviceAttributeCacheUpdater.java --- .../attribute/update/DeviceAttributeCacheUpdater.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java index 28f92bad165fe..ffe303e12e41c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java @@ -189,16 +189,11 @@ public Pair> getAttributeUpdateInfo( public void commit(final TableDeviceAttributeCommitUpdateNode node) { final Set shrunkNodes = node.getShrunkNodes(); targetDataNodeLocations.removeAll(shrunkNodes); - shrunkNodes.forEach( - location -> { - if (attributeUpdateMap.containsKey(location)) { - removeLocation(location); - } - }); + shrunkNodes.forEach(this::removeLocation); updateContainerStatistics.keySet().removeAll(shrunkNodes); final TDataNodeLocation leaderLocation = node.getLeaderLocation(); - if (version.get() == node.getVersion() && attributeUpdateMap.containsKey(leaderLocation)) { + if (version.get() == node.getVersion()) { removeLocation(leaderLocation); } From 1ff8ee418a7ad1b55b8baf38a9c69fbc9d25e7c5 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:22:50 +0800 Subject: [PATCH 2/3] Update DeviceAttributeCacheUpdater.java --- .../attribute/update/DeviceAttributeCacheUpdater.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java index ffe303e12e41c..e390d41191b80 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java @@ -190,11 +190,9 @@ public void commit(final TableDeviceAttributeCommitUpdateNode node) { final Set shrunkNodes = node.getShrunkNodes(); targetDataNodeLocations.removeAll(shrunkNodes); shrunkNodes.forEach(this::removeLocation); - updateContainerStatistics.keySet().removeAll(shrunkNodes); - final TDataNodeLocation leaderLocation = node.getLeaderLocation(); if (version.get() == node.getVersion()) { - removeLocation(leaderLocation); + removeLocation(node.getLeaderLocation()); } node.getCommitMap() @@ -233,6 +231,7 @@ private void removeLocation(final TDataNodeLocation location) { ? updateContainerStatistics.get(location).getContainerSize() : ((UpdateClearContainer) attributeUpdateMap.get(location)).ramBytesUsed()); attributeUpdateMap.remove(location); + updateContainerStatistics.remove(location); } } From 3d7923d3f6999619e3d5ee1425bd6944268b0c64 Mon Sep 17 00:00:00 2001 From: Caideyipi <87789683+Caideyipi@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:29:04 +0800 Subject: [PATCH 3/3] Update DeviceAttributeCacheUpdater.java --- .../attribute/update/DeviceAttributeCacheUpdater.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java index e390d41191b80..7f37309f632e9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/attribute/update/DeviceAttributeCacheUpdater.java @@ -379,10 +379,9 @@ private void deserialize(final InputStream inputStream) throws IOException { size = ReadWriteIOUtils.readInt(inputStream); for (int i = 0; i < size; ++i) { final TDataNodeLocation location = deserializeNodeLocationForAttributeUpdate(inputStream); + final boolean isDetails = ReadWriteIOUtils.readBool(inputStream); final UpdateContainer container = - ReadWriteIOUtils.readBool(inputStream) - ? new UpdateDetailContainer() - : new UpdateClearContainer(); + isDetails ? new UpdateDetailContainer() : new UpdateClearContainer(); container.deserialize(inputStream); // Update local cache for region migration @@ -395,6 +394,9 @@ private void deserialize(final InputStream inputStream) throws IOException { guard.handleContainer(databaseName, container); } else { attributeUpdateMap.put(location, container); + if (isDetails) { + updateContainerStatistics.put(location, new UpdateDetailContainerStatistics()); + } } } }