You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "luoluoyuyu (via GitHub)" <gi...@apache.org> on 2026/04/15 07:46:51 UTC
[PR] Show pipe plugin loading errors in plugin listing [iotdb]
luoluoyuyu opened a new pull request, #17487:
URL: https://github.com/apache/iotdb/pull/17487
## Description
Add plugin loading exception messages to pipe plugin metadata and expose them through SHOW PIPEPLUGINS and information_schema.pipe_plugins, so users can diagnose initialization and class loading failures directly from query results.
<!--
In each section, please describe design decisions made, including:
- Choice of algorithms
- Behavioral aspects. What configuration values are acceptable? How are corner cases and error
conditions handled, such as when there are insufficient resources?
- Class organization and design (how the logic is split between classes, inheritance, composition,
design patterns)
- Method organization and design (how the logic is split between methods, parameters and return types)
- Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
-->
<!-- It's good to describe an alternative design (or mention an alternative name) for every design
(or naming) decision point and compare the alternatives with the designs that you've implemented
(or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
<!-- If there was a discussion of the design of the feature implemented in this PR elsewhere
(e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list),
link to that discussion from this PR description and explain what have changed in your final design
compared to your original proposal or the consensus version in the end of the discussion.
If something hasn't changed since the original discussion, you can omit a detailed discussion of
those aspects of the design here, perhaps apart from brief mentioning for the sake of readability
of this PR description. -->
<!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
<hr>
This PR has:
- [ ] been self-reviewed.
- [ ] concurrent read
- [ ] concurrent write
- [ ] concurrent read and write
- [ ] added documentation for new or modified features or behaviors.
- [ ] added Javadocs for most classes and all non-trivial methods.
- [ ] added or updated version, __license__, or notice information
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious
for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold
for code coverage.
- [ ] added integration tests.
- [ ] been tested in a test IoTDB cluster.
<!-- Check the items by putting "x" in the brackets for the done things. Not all of these items
apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items
from the checklist above are strictly necessary, but it would be very helpful if you at least
self-review the PR. -->
<hr>
##### Key changed/added classes (or packages if there are too many classes) in this PR
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Show pipe plugin loading errors in plugin listing [iotdb]
Posted by "luoluoyuyu (via GitHub)" <gi...@apache.org>.
luoluoyuyu commented on code in PR #17487:
URL: https://github.com/apache/iotdb/pull/17487#discussion_r3099004048
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java:
##########
@@ -177,6 +187,7 @@ public void checkPipePluginExistence(
LOGGER.info(exceptionMessage);
throw new PipeException(exceptionMessage);
}
+ checkPipePluginAvailabilityForPipeCreation(sourcePluginName, "extractor");
Review Comment:
fixed
##########
integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSyntaxIT.java:
##########
@@ -884,4 +901,171 @@ public void testPipePluginValidation() {
fail(e.getMessage());
}
}
+
+ @Test
+ public void testShowPipePluginAfterJarDeletedAndClusterRestart() throws Exception {
+ final String pluginName = "TEST_MISSING_JAR_PROCESSOR";
+ final String pluginClassName = "org.apache.iotdb.pipe.it.plugin.TestMissingJarProcessor";
+ final Path temporaryDir = Files.createTempDirectory("pipe-plugin-it-");
+ final Path pluginJarPath = temporaryDir.resolve("test-missing-jar-processor.jar");
+
+ buildTestPipePluginJar(temporaryDir, pluginJarPath, pluginClassName);
+
+ try (final Connection connection = senderEnv.getConnection();
+ final Statement statement = connection.createStatement()) {
+ statement.execute(
+ String.format(
+ "create pipePlugin %s as '%s' USING URI '%s'",
+ pluginName, pluginClassName, pluginJarPath.toUri()));
+ }
+
+ senderEnv.shutdownAllDataNodes();
+ senderEnv.shutdownAllConfigNodes();
+
+ deletePluginJarUnderConfigNodes(pluginName);
+
+ senderEnv.startAllConfigNodes();
+ senderEnv.startAllDataNodes();
+ ((AbstractEnv) senderEnv).checkClusterStatusWithoutUnknown();
+
+ boolean pluginFound = false;
+ boolean exceptionMessageFound = false;
+ SQLException lastException = null;
+ for (int retry = 0; retry < 10; retry++) {
+ try (final Connection connection = senderEnv.getConnection();
+ final Statement statement = connection.createStatement();
+ final ResultSet resultSet = statement.executeQuery("show pipeplugins")) {
+ while (resultSet.next()) {
+ if (pluginName.equalsIgnoreCase(resultSet.getString("PluginName"))) {
+ pluginFound = true;
+ final String exceptionMessage = resultSet.getString("ExceptionMessage");
+ exceptionMessageFound = exceptionMessage != null && !exceptionMessage.trim().isEmpty();
+ break;
+ }
+ }
+ lastException = null;
+ break;
+ } catch (final SQLException e) {
+ lastException = e;
+ Thread.sleep(1000);
+ }
+ }
+ if (lastException != null) {
+ throw lastException;
+ }
+
+ Assert.assertTrue("Expected plugin in show pipe plugins result.", pluginFound);
+ Assert.assertTrue(
+ "Expected non-empty ExceptionMessage after deleting plugin jar and restarting cluster.",
+ exceptionMessageFound);
+
+ try (final Connection connection = senderEnv.getConnection();
+ final Statement statement = connection.createStatement()) {
+ statement.execute(String.format("drop pipePlugin %s", pluginName));
+ } finally {
+ cleanupTemporaryDirectory(temporaryDir);
+ }
+ }
+
+ private void buildTestPipePluginJar(
+ final Path tempDir, final Path jarPath, final String pluginClassName) throws IOException {
+ final int lastDot = pluginClassName.lastIndexOf('.');
+ final String packageName = pluginClassName.substring(0, lastDot);
+ final String simpleClassName = pluginClassName.substring(lastDot + 1);
+ final Path packageDir = tempDir.resolve(packageName.replace('.', File.separatorChar));
+ Files.createDirectories(packageDir);
+
+ final Path sourcePath = packageDir.resolve(simpleClassName + ".java");
+ final String sourceCode =
+ "package "
+ + packageName
+ + ";\n"
+ + "import org.apache.iotdb.pipe.api.PipeProcessor;\n"
+ + "import org.apache.iotdb.pipe.api.collector.EventCollector;\n"
+ + "import org.apache.iotdb.pipe.api.customizer.configuration.PipeProcessorRuntimeConfiguration;\n"
+ + "import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameterValidator;\n"
+ + "import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameters;\n"
+ + "import org.apache.iotdb.pipe.api.event.Event;\n"
+ + "import org.apache.iotdb.pipe.api.event.dml.insertion.TabletInsertionEvent;\n"
+ + "import org.apache.iotdb.pipe.api.event.dml.insertion.TsFileInsertionEvent;\n"
+ + "import java.io.IOException;\n"
+ + "public class "
+ + simpleClassName
+ + " implements PipeProcessor {\n"
+ + " @Override public void validate(PipeParameterValidator validator) {}\n"
+ + " @Override public void customize(PipeParameters parameters, PipeProcessorRuntimeConfiguration configuration) {}\n"
+ + " @Override public void process(TabletInsertionEvent tabletInsertionEvent, EventCollector eventCollector) throws IOException { eventCollector.collect(tabletInsertionEvent); }\n"
+ + " @Override public void process(TsFileInsertionEvent tsFileInsertionEvent, EventCollector eventCollector) throws IOException { eventCollector.collect(tsFileInsertionEvent); }\n"
+ + " @Override public void process(Event event, EventCollector eventCollector) throws IOException { eventCollector.collect(event); }\n"
+ + " @Override public void close() {}\n"
+ + "}\n";
+ Files.write(sourcePath, sourceCode.getBytes(StandardCharsets.UTF_8));
+
+ final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ Objects.requireNonNull(compiler, "JDK compiler is required for this test.");
+
+ final int compileStatus =
+ compiler.run(
+ null,
+ null,
+ null,
+ "-cp",
+ System.getProperty("java.class.path"),
+ "-d",
+ tempDir.toString(),
+ sourcePath.toString());
+ Assert.assertEquals("Failed to compile test pipe plugin class.", 0, compileStatus);
+
+ final String classEntry = pluginClassName.replace('.', '/') + ".class";
+ final Path classPath = tempDir.resolve(Paths.get(classEntry));
+ try (final OutputStream fos = new FileOutputStream(jarPath.toFile());
+ final JarOutputStream jos = new JarOutputStream(fos)) {
+ final JarEntry jarEntry = new JarEntry(classEntry);
+ jos.putNextEntry(jarEntry);
+ jos.write(Files.readAllBytes(classPath));
+ jos.closeEntry();
+ }
+ }
+
+ private void deletePluginJarUnderConfigNodes(final String pluginName) throws IOException {
+ for (final ConfigNodeWrapper configNodeWrapper : senderEnv.getConfigNodeWrapperList()) {
+ final Path pluginJarDirPath =
+ Paths.get(
+ configNodeWrapper.getNodePath(), "ext", "pipe", "install", pluginName.toUpperCase());
+ if (!Files.exists(pluginJarDirPath)) {
+ continue;
+ }
+ try (final java.util.stream.Stream<Path> children = Files.walk(pluginJarDirPath)) {
Review Comment:
fixed
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Show pipe plugin loading errors in plugin listing [iotdb]
Posted by "luoluoyuyu (via GitHub)" <gi...@apache.org>.
luoluoyuyu commented on PR #17487:
URL: https://github.com/apache/iotdb/pull/17487#issuecomment-4251250767
drop pipeplugin
<img width="3658" height="1412" alt="image" src="https://github.com/user-attachments/assets/6468af00-5d1f-4711-b1ea-ce4d71e21272" />
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Show pipe plugin loading errors in plugin listing [iotdb]
Posted by "luoluoyuyu (via GitHub)" <gi...@apache.org>.
luoluoyuyu commented on PR #17487:
URL: https://github.com/apache/iotdb/pull/17487#issuecomment-4251243644
show pipe
<img width="3648" height="552" alt="image" src="https://github.com/user-attachments/assets/aea05d77-c85f-4d47-9fce-f6e456e70598" />
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Show pipe plugin loading errors in plugin listing [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #17487:
URL: https://github.com/apache/iotdb/pull/17487#discussion_r3085775008
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/pipe/PipePluginInfo.java:
##########
@@ -177,6 +187,7 @@ public void checkPipePluginExistence(
LOGGER.info(exceptionMessage);
throw new PipeException(exceptionMessage);
}
+ checkPipePluginAvailabilityForPipeCreation(sourcePluginName, "extractor");
Review Comment:
Use source/sink?
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/plugin/meta/PipePluginMeta.java:
##########
@@ -104,7 +122,10 @@ public static PipePluginMeta deserialize(ByteBuffer byteBuffer) {
final boolean isBuiltin = ReadWriteIOUtils.readBool(byteBuffer);
final String jarName = ReadWriteIOUtils.readString(byteBuffer);
final String jarMD5 = ReadWriteIOUtils.readString(byteBuffer);
- return new PipePluginMeta(pluginName, className, isBuiltin, jarName, jarMD5);
+ final String pluginLoadingExceptionMessage =
+ byteBuffer.hasRemaining() ? ReadWriteIOUtils.readString(byteBuffer) : null;
+ return new PipePluginMeta(
+ pluginName, className, isBuiltin, jarName, jarMD5, pluginLoadingExceptionMessage);
Review Comment:
Will there be compatibility issue?
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Show pipe plugin loading errors in plugin listing [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #17487:
URL: https://github.com/apache/iotdb/pull/17487#discussion_r3098467730
##########
integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeSyntaxIT.java:
##########
@@ -884,4 +901,171 @@ public void testPipePluginValidation() {
fail(e.getMessage());
}
}
+
+ @Test
+ public void testShowPipePluginAfterJarDeletedAndClusterRestart() throws Exception {
+ final String pluginName = "TEST_MISSING_JAR_PROCESSOR";
+ final String pluginClassName = "org.apache.iotdb.pipe.it.plugin.TestMissingJarProcessor";
+ final Path temporaryDir = Files.createTempDirectory("pipe-plugin-it-");
+ final Path pluginJarPath = temporaryDir.resolve("test-missing-jar-processor.jar");
+
+ buildTestPipePluginJar(temporaryDir, pluginJarPath, pluginClassName);
+
+ try (final Connection connection = senderEnv.getConnection();
+ final Statement statement = connection.createStatement()) {
+ statement.execute(
+ String.format(
+ "create pipePlugin %s as '%s' USING URI '%s'",
+ pluginName, pluginClassName, pluginJarPath.toUri()));
+ }
+
+ senderEnv.shutdownAllDataNodes();
+ senderEnv.shutdownAllConfigNodes();
+
+ deletePluginJarUnderConfigNodes(pluginName);
+
+ senderEnv.startAllConfigNodes();
+ senderEnv.startAllDataNodes();
+ ((AbstractEnv) senderEnv).checkClusterStatusWithoutUnknown();
+
+ boolean pluginFound = false;
+ boolean exceptionMessageFound = false;
+ SQLException lastException = null;
+ for (int retry = 0; retry < 10; retry++) {
+ try (final Connection connection = senderEnv.getConnection();
+ final Statement statement = connection.createStatement();
+ final ResultSet resultSet = statement.executeQuery("show pipeplugins")) {
+ while (resultSet.next()) {
+ if (pluginName.equalsIgnoreCase(resultSet.getString("PluginName"))) {
+ pluginFound = true;
+ final String exceptionMessage = resultSet.getString("ExceptionMessage");
+ exceptionMessageFound = exceptionMessage != null && !exceptionMessage.trim().isEmpty();
+ break;
+ }
+ }
+ lastException = null;
+ break;
+ } catch (final SQLException e) {
+ lastException = e;
+ Thread.sleep(1000);
+ }
+ }
+ if (lastException != null) {
+ throw lastException;
+ }
+
+ Assert.assertTrue("Expected plugin in show pipe plugins result.", pluginFound);
+ Assert.assertTrue(
+ "Expected non-empty ExceptionMessage after deleting plugin jar and restarting cluster.",
+ exceptionMessageFound);
+
+ try (final Connection connection = senderEnv.getConnection();
+ final Statement statement = connection.createStatement()) {
+ statement.execute(String.format("drop pipePlugin %s", pluginName));
+ } finally {
+ cleanupTemporaryDirectory(temporaryDir);
+ }
+ }
+
+ private void buildTestPipePluginJar(
+ final Path tempDir, final Path jarPath, final String pluginClassName) throws IOException {
+ final int lastDot = pluginClassName.lastIndexOf('.');
+ final String packageName = pluginClassName.substring(0, lastDot);
+ final String simpleClassName = pluginClassName.substring(lastDot + 1);
+ final Path packageDir = tempDir.resolve(packageName.replace('.', File.separatorChar));
+ Files.createDirectories(packageDir);
+
+ final Path sourcePath = packageDir.resolve(simpleClassName + ".java");
+ final String sourceCode =
+ "package "
+ + packageName
+ + ";\n"
+ + "import org.apache.iotdb.pipe.api.PipeProcessor;\n"
+ + "import org.apache.iotdb.pipe.api.collector.EventCollector;\n"
+ + "import org.apache.iotdb.pipe.api.customizer.configuration.PipeProcessorRuntimeConfiguration;\n"
+ + "import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameterValidator;\n"
+ + "import org.apache.iotdb.pipe.api.customizer.parameter.PipeParameters;\n"
+ + "import org.apache.iotdb.pipe.api.event.Event;\n"
+ + "import org.apache.iotdb.pipe.api.event.dml.insertion.TabletInsertionEvent;\n"
+ + "import org.apache.iotdb.pipe.api.event.dml.insertion.TsFileInsertionEvent;\n"
+ + "import java.io.IOException;\n"
+ + "public class "
+ + simpleClassName
+ + " implements PipeProcessor {\n"
+ + " @Override public void validate(PipeParameterValidator validator) {}\n"
+ + " @Override public void customize(PipeParameters parameters, PipeProcessorRuntimeConfiguration configuration) {}\n"
+ + " @Override public void process(TabletInsertionEvent tabletInsertionEvent, EventCollector eventCollector) throws IOException { eventCollector.collect(tabletInsertionEvent); }\n"
+ + " @Override public void process(TsFileInsertionEvent tsFileInsertionEvent, EventCollector eventCollector) throws IOException { eventCollector.collect(tsFileInsertionEvent); }\n"
+ + " @Override public void process(Event event, EventCollector eventCollector) throws IOException { eventCollector.collect(event); }\n"
+ + " @Override public void close() {}\n"
+ + "}\n";
+ Files.write(sourcePath, sourceCode.getBytes(StandardCharsets.UTF_8));
+
+ final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ Objects.requireNonNull(compiler, "JDK compiler is required for this test.");
+
+ final int compileStatus =
+ compiler.run(
+ null,
+ null,
+ null,
+ "-cp",
+ System.getProperty("java.class.path"),
+ "-d",
+ tempDir.toString(),
+ sourcePath.toString());
+ Assert.assertEquals("Failed to compile test pipe plugin class.", 0, compileStatus);
+
+ final String classEntry = pluginClassName.replace('.', '/') + ".class";
+ final Path classPath = tempDir.resolve(Paths.get(classEntry));
+ try (final OutputStream fos = new FileOutputStream(jarPath.toFile());
+ final JarOutputStream jos = new JarOutputStream(fos)) {
+ final JarEntry jarEntry = new JarEntry(classEntry);
+ jos.putNextEntry(jarEntry);
+ jos.write(Files.readAllBytes(classPath));
+ jos.closeEntry();
+ }
+ }
+
+ private void deletePluginJarUnderConfigNodes(final String pluginName) throws IOException {
+ for (final ConfigNodeWrapper configNodeWrapper : senderEnv.getConfigNodeWrapperList()) {
+ final Path pluginJarDirPath =
+ Paths.get(
+ configNodeWrapper.getNodePath(), "ext", "pipe", "install", pluginName.toUpperCase());
+ if (!Files.exists(pluginJarDirPath)) {
+ continue;
+ }
+ try (final java.util.stream.Stream<Path> children = Files.walk(pluginJarDirPath)) {
Review Comment:
Use short name
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Show pipe plugin loading errors in plugin listing [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 merged PR #17487:
URL: https://github.com/apache/iotdb/pull/17487
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Show pipe plugin loading errors in plugin listing [iotdb]
Posted by "luoluoyuyu (via GitHub)" <gi...@apache.org>.
luoluoyuyu commented on PR #17487:
URL: https://github.com/apache/iotdb/pull/17487#issuecomment-4251240739
show pipeplugins
<img width="3654" height="968" alt="image" src="https://github.com/user-attachments/assets/9b14fbb4-15fa-427f-ab2e-71509e63ff51" />
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org