This is an automated email from the ASF dual-hosted git repository. rong pushed a commit to branch fix-protential-pipe-npe in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 0cb04c085d6886c731eb5722318a4bf0dbbf5036 Author: Steve Yurong Su <[email protected]> AuthorDate: Wed Dec 4 17:30:23 2024 +0800 Pipe: Fix potential NPE from WALEntryHandler#getInsertNodeViaCacheIfPossible & Improve performance for pipe slightly --- .../iotdb/db/storageengine/dataregion/wal/utils/WALEntryHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALEntryHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALEntryHandler.java index edc67edccfa..de2379c380e 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALEntryHandler.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALEntryHandler.java @@ -89,8 +89,9 @@ public class WALEntryHandler { public InsertNode getInsertNodeViaCacheIfPossible() { try { - return value instanceof InsertNode - ? (InsertNode) value + final WALEntryValue finalValue = value; + return finalValue instanceof InsertNode + ? (InsertNode) finalValue : walEntryPosition.readByteBufferOrInsertNodeViaCacheDirectly().getRight(); } catch (Exception e) { logger.warn("Fail to get insert node via cache. {}", this, e);
