luoluoyuyu commented on code in PR #17732:
URL: https://github.com/apache/iotdb/pull/17732#discussion_r3309365538
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java:
##########
@@ -248,6 +253,7 @@ public void processLoadSnapshot(File snapshotDir) throws
IOException {
deserializeExistedJarToMD5(fileInputStream);
udfTable.deserializeUDFTable(fileInputStream);
+ rebuildJarMetadataFromUDFTable();
Review Comment:
After deserializeExistedJarToMD5, rebuildJarMetadataFromUDFTable() clears
both maps and rebuilds from udfTable. That makes udfTable the source of truth
on load.
A short comment here explaining that deserialized existedJarToMD5 is
intentionally discarded would help future readers.
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/UDFInfo.java:
##########
@@ -272,6 +278,32 @@ public void deserializeExistedJarToMD5(InputStream
inputStream) throws IOExcepti
public void clear() {
existedJarToMD5.clear();
+ existedJarToReferenceCount.clear();
udfTable.clear();
}
+
+ private void addJarReference(String jarName, String jarMD5) {
+ existedJarToMD5.putIfAbsent(jarName, jarMD5);
Review Comment:
putIfAbsent keeps the first MD5 for a jar name but always increments the
reference count. That is fine when validate() runs before addUDFInTable, but if
addJarReference is ever called without that check, ref count and MD5 could
diverge.
Consider rejecting a conflicting MD5 inside addJarReference (same check as
in validate() at lines 107-115) so this helper is safe on its own.
--
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]