Copilot commented on code in PR #15263:
URL: https://github.com/apache/iotdb/pull/15263#discussion_r2024564941
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALInsertNodeCache.java:
##########
@@ -229,6 +229,12 @@ public Pair<ByteBuffer, InsertNode>
getByteBufferOrInsertNode(final WALEntryPosi
return pair;
}
+ public Pair<ByteBuffer, InsertNode> getByteBufferOrInsertNodeIfPossible(
+ final WALEntryPosition position) {
+ hasPipeRunning = true;
+ return lruCache.getIfPresent(position);
+ }
+
Review Comment:
The getter method getByteBufferOrInsertNodeIfPossible() introduces a side
effect by setting hasPipeRunning to true. Consider either separating state
mutation from data retrieval or renaming the method to reflect its mutative
behavior.
```suggestion
return lruCache.getIfPresent(position);
}
public Pair<ByteBuffer, InsertNode>
setPipeRunningAndGetByteBufferOrInsertNodeIfPossible(
final WALEntryPosition position) {
hasPipeRunning = true;
return getByteBufferOrInsertNodeIfPossible(position);
}
```
--
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]