jt2594838 commented on code in PR #16877:
URL: https://github.com/apache/iotdb/pull/16877#discussion_r2596927327
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java:
##########
@@ -212,34 +212,29 @@ public TSStatus createPipePlugin(final
CreatePipePluginPlan createPipePluginPlan
try {
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());
- final String pluginDirPath =
pipePluginExecutableManager.getPluginsDirPath(pluginName);
- final PipePluginClassLoader pipePluginClassLoader =
- classLoaderManager.createPipePluginClassLoader(pluginDirPath);
- try {
- final Class<?> pluginClass =
- Class.forName(pipePluginMeta.getClassName(), true,
pipePluginClassLoader);
- pipePluginMetaKeeper.addPipePluginVisibility(
- pluginName,
VisibilityUtils.calculateFromPluginClass(pluginClass));
- classLoaderManager.addPluginAndClassLoader(pluginName,
pipePluginClassLoader);
- } catch (final Exception e) {
- try {
- pipePluginClassLoader.close();
- } catch (final Exception ignored) {
- }
- throw e;
+ ByteBuffer.wrap(createPipePluginPlan.getJarFile().getValues()),
pluginName, jarName);
+ computeFromPluginClass(pluginName, className);
+ } else {
+ final String existed =
pipePluginMetaKeeper.getPluginNameByJarName(jarName);
+ if (Objects.nonNull(existed)) {
+ pipePluginExecutableManager.linkExistedPlugin(existed, pluginName,
jarName);
+ computeFromPluginClass(pluginName, className);
+ } else {
+ throw new PipeException(
+ String.format(
+ "The %s's creation has not passed in jarName, which does not
exists in other pipePlugins. Please check",
Review Comment:
does not exist
--
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]