This is an automated email from the ASF dual-hosted git repository.

justinchen pushed a commit to branch plugin-fix
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/plugin-fix by this push:
     new 450b15d12cb link
450b15d12cb is described below

commit 450b15d12cb8b8e22b6d458f88e5d46c51606539
Author: Caideyipi <[email protected]>
AuthorDate: Mon Dec 8 10:22:36 2025 +0800

    link
---
 .../persistence/pipe/PipePluginInfo.java           | 41 ++++++++++------------
 .../service/PipePluginExecutableManager.java       |  9 +++++
 2 files changed, 28 insertions(+), 22 deletions(-)

diff --git 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java
 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java
index e64dc67e011..9c299d219fd 100644
--- 
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java
+++ 
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java
@@ -213,35 +213,32 @@ public class PipePluginInfo implements SnapshotProcessor {
       final PipePluginMeta pipePluginMeta = 
createPipePluginPlan.getPipePluginMeta();
       final String pluginName = pipePluginMeta.getPluginName();
       final String className = pipePluginMeta.getClassName();
+      final String jarName = pipePluginMeta.getJarName();
 
       // try to drop the old pipe plugin if exists to reduce the effect of the 
inconsistency
       dropPipePlugin(new DropPipePluginPlan(pluginName));
 
       pipePluginMetaKeeper.addPipePluginMeta(pluginName, pipePluginMeta);
-      pipePluginMetaKeeper.addJarNameAndMd5(
-          pipePluginMeta.getJarName(), pipePluginMeta.getJarMD5());
+      pipePluginMetaKeeper.addJarNameAndMd5(jarName, 
pipePluginMeta.getJarMD5());
 
       if (createPipePluginPlan.getJarFile() != null) {
         pipePluginExecutableManager.savePluginToInstallDir(
-            ByteBuffer.wrap(createPipePluginPlan.getJarFile().getValues()),
-            pluginName,
-            pipePluginMeta.getJarName());
-        computeFromPluginClass(
-            pipePluginExecutableManager.getPluginsDirPath(pluginName), 
pluginName, className);
+            ByteBuffer.wrap(createPipePluginPlan.getJarFile().getValues()), 
pluginName, jarName);
+        computeFromPluginClass(pluginName, className);
       } else {
-        final String existed =
-            
pipePluginMetaKeeper.getPluginNameByJarName(pipePluginMeta.getJarName());
-        if (Objects.nonNull(existed)
-            && pipePluginMetaKeeper
-                .getPipePluginMeta(existed)
-                .getClassName()
-                .equals(pipePluginMeta.getClassName())
-            && 
pipePluginMetaKeeper.getPipePluginNameToVisibilityMap().containsKey(existed)) {
-          pipePluginMetaKeeper.addPipePluginVisibility(
-              pluginName, 
pipePluginMetaKeeper.getPipePluginNameToVisibilityMap().get(existed));
-        } else {
-          computeFromPluginClass(
-              pipePluginExecutableManager.getPluginsDirPath(existed), 
pluginName, className);
+        final String existed = 
pipePluginMetaKeeper.getPluginNameByJarName(jarName);
+        if (Objects.nonNull(existed)) {
+          if (pipePluginMetaKeeper
+                  .getPipePluginMeta(existed)
+                  .getClassName()
+                  .equals(pipePluginMeta.getClassName())
+              && 
pipePluginMetaKeeper.getPipePluginNameToVisibilityMap().containsKey(existed)) {
+            pipePluginMetaKeeper.addPipePluginVisibility(
+                pluginName, 
pipePluginMetaKeeper.getPipePluginNameToVisibilityMap().get(existed));
+          } else {
+            pipePluginExecutableManager.linkExistedPlugin(existed, pluginName, 
jarName);
+            computeFromPluginClass(pluginName, className);
+          }
         }
       }
 
@@ -257,9 +254,9 @@ public class PipePluginInfo implements SnapshotProcessor {
     }
   }
 
-  private void computeFromPluginClass(
-      final String pluginDirPath, final String pluginName, final String 
className)
+  private void computeFromPluginClass(final String pluginName, final String 
className)
       throws Exception {
+    final String pluginDirPath = 
pipePluginExecutableManager.getPluginsDirPath(pluginName);
     final PipePluginClassLoader pipePluginClassLoader =
         classLoaderManager.createPipePluginClassLoader(pluginDirPath);
     try {
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginExecutableManager.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginExecutableManager.java
index 9d28ea0130e..276af31bb1a 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginExecutableManager.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/plugin/service/PipePluginExecutableManager.java
@@ -22,6 +22,7 @@ package org.apache.iotdb.commons.pipe.agent.plugin.service;
 import org.apache.iotdb.commons.executable.ExecutableManager;
 import org.apache.iotdb.commons.file.SystemFileFactory;
 import org.apache.iotdb.commons.pipe.agent.plugin.meta.PipePluginMeta;
+import org.apache.iotdb.commons.utils.FileUtils;
 import org.apache.iotdb.pipe.api.exception.PipeException;
 
 import org.apache.tsfile.external.commons.codec.digest.DigestUtils;
@@ -123,6 +124,14 @@ public class PipePluginExecutableManager extends 
ExecutableManager {
     return this.libRoot + File.separator + INSTALL_DIR + File.separator + 
fileName;
   }
 
+  public void linkExistedPlugin(
+      final String oldPluginName, final String newPluginName, final String 
fileName)
+      throws IOException {
+    FileUtils.createHardLink(
+        new File(getPluginsDirPath(oldPluginName), fileName),
+        new File(getPluginsDirPath(newPluginName), fileName));
+  }
+
   /**
    * @param byteBuffer file
    * @param pluginName

Reply via email to