diff --git a/src/UserGuide/Master/User-Manual/Data-Sync_apache.md b/src/UserGuide/Master/User-Manual/Data-Sync_apache.md index 122b60202..65eb6fbb3 100644 --- a/src/UserGuide/Master/User-Manual/Data-Sync_apache.md +++ b/src/UserGuide/Master/User-Manual/Data-Sync_apache.md @@ -103,7 +103,7 @@ Use the `CREATE PIPE` statement to create a data synchronization task. The `Pipe The SQL example is as follows: ```SQL -CREATE PIPE -- PipeId is the name that uniquely identifies the task. +CREATE PIPE [IF NOT EXISTS] -- PipeId is the name that uniquely identifies the task. -- Data extraction plugin, optional plugin WITH SOURCE ( [ = ,], @@ -118,6 +118,8 @@ WITH SINK ( ) ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified Pipe does not exist, preventing errors caused by attempting to create an existing Pipe. + ### Start Task After creation, the task will not be processed immediately and needs to be started. Use the `START PIPE` statement to start the task and begin processing data: @@ -139,8 +141,9 @@ STOP PIPE Deletes the specified task: ```SQL -DROP PIPE +DROP PIPE [IF EXISTS] ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that when a specified Pipe exists, the delete command is executed to prevent errors caused by attempting to delete non-existent Pipes. Deleting a task does not require stopping the synchronization task first. diff --git a/src/UserGuide/Master/User-Manual/Data-Sync_timecho.md b/src/UserGuide/Master/User-Manual/Data-Sync_timecho.md index 83a5aacbe..fb1077343 100644 --- a/src/UserGuide/Master/User-Manual/Data-Sync_timecho.md +++ b/src/UserGuide/Master/User-Manual/Data-Sync_timecho.md @@ -105,7 +105,7 @@ Use the `CREATE PIPE` statement to create a data synchronization task. The `Pipe The SQL example is as follows: ```SQL -CREATE PIPE -- PipeId is the name that uniquely identifies the task. +CREATE PIPE [IF NOT EXISTS] -- PipeId is the name that uniquely identifies the task. -- Data extraction plugin, optional plugin WITH SOURCE ( [ = ,], @@ -120,6 +120,8 @@ WITH SINK ( ) ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified Pipe does not exist, preventing errors caused by attempting to create an existing Pipe. + ### Start Task After creation, the task will not be processed immediately and needs to be started. Use the `START PIPE` statement to start the task and begin processing data: @@ -141,8 +143,9 @@ STOP PIPE Deletes the specified task: ```SQL -DROP PIPE +DROP PIPE [IF EXISTS] ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that when a specified Pipe exists, the delete command is executed to prevent errors caused by attempting to delete non-existent Pipes. Deleting a task does not require stopping the synchronization task first. diff --git a/src/UserGuide/Master/User-Manual/Data-subscription.md b/src/UserGuide/Master/User-Manual/Data-subscription.md index 1c7b1aee6..ce353f65c 100644 --- a/src/UserGuide/Master/User-Manual/Data-subscription.md +++ b/src/UserGuide/Master/User-Manual/Data-subscription.md @@ -46,12 +46,14 @@ IoTDB supports the creation, deletion, and viewing of Topics through SQL stateme The SQL statement is as follows: ```SQL - CREATE TOPIC + CREATE TOPIC [IF NOT EXISTS] WITH ( [ = ,], ); ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified topic does not exist, preventing errors caused by attempting to create an existing topic. + Detailed explanation of each parameter is as follows: | Key | Required or Optional with Default | Description | @@ -74,7 +76,7 @@ Examples are as follows: CREATE TOPIC root_all; -- Custom subscription -CREATE TOPIC db_timerange +CREATE TOPIC IF NOT EXISTS db_timerange WITH ( 'path' = 'root.db.**', 'start-time' = '2023-01-01', @@ -87,8 +89,9 @@ WITH ( A Topic can only be deleted if it is not subscribed to. When a Topic is deleted, its related consumption progress will be cleared. ```SQL -DROP TOPIC ; +DROP TOPIC [IF EXISTS] ; ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that the delete command is executed when a specified topic exists, preventing errors caused by attempting to delete non-existent topics. #### 3.1.3 View Topic @@ -142,7 +145,7 @@ The `SubscriptionSession` class in the IoTDB subscription client provides interf #### 4.1.1 Create Topic ```Java -Topic createTopic(String topicName, Properties properties) throws Exception; + void createTopicIfNotExists(String topicName, Properties properties) throws Exception; ``` Example: @@ -159,7 +162,7 @@ try (final SubscriptionSession session = new SubscriptionSession(host, port)) { #### 4.1.2 Delete Topic ```Java -void dropTopic(String topicName) throws Exception; +void dropTopicIfExists(String topicName) throws Exception; ``` #### 4.1.3 View Topic diff --git a/src/UserGuide/Master/User-Manual/Streaming_apache.md b/src/UserGuide/Master/User-Manual/Streaming_apache.md index 357957209..bd1711a4f 100644 --- a/src/UserGuide/Master/User-Manual/Streaming_apache.md +++ b/src/UserGuide/Master/User-Manual/Streaming_apache.md @@ -445,15 +445,17 @@ In IoTDB, to dynamically load a user-defined plugin into the system, you first n The syntax of the loading plugin management statement is as follows: ```sql -CREATE PIPEPLUGIN +CREATE PIPEPLUGIN [IF NOT EXISTS] AS USING ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified Pipe Plugin does not exist, preventing errors caused by attempting to create an existing Pipe Plugin. + For example, if a user implements a data processing plugin with the fully qualified class name "edu.tsinghua.iotdb.pipe.ExampleProcessor" and packages it into a jar file, which is stored at "https://example.com:8080/iotdb/pipe-plugin.jar", and the user wants to use this plugin in the stream processing engine, marking the plugin as "example". The creation statement for this data processing plugin is as follows: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -462,9 +464,11 @@ USING URI '' When user no longer wants to use a plugin and needs to uninstall the plugin from the system, you can use the Remove plugin statement as shown below. ```sql -DROP PIPEPLUGIN +DROP PIPEPLUGIN [IF EXISTS] ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that when a specified Pipe Plugin exists, the delete command is executed to prevent errors caused by attempting to delete a non-existent Pipe Plugin. + ### Show Plugin Statement User can also view the plugin in the system on need. The statement to view plugin is as follows. diff --git a/src/UserGuide/Master/User-Manual/Streaming_timecho.md b/src/UserGuide/Master/User-Manual/Streaming_timecho.md index 7e7eef5e9..e4c460cac 100644 --- a/src/UserGuide/Master/User-Manual/Streaming_timecho.md +++ b/src/UserGuide/Master/User-Manual/Streaming_timecho.md @@ -451,10 +451,11 @@ Then the plugin class needs to be compiled and packaged into a jar executable fi The syntax of the management statement for loading the plugin is shown in the figure. ```sql -CREATE PIPEPLUGIN +CREATE PIPEPLUGIN [IF NOT EXISTS] AS USING ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified Pipe Plugin does not exist, preventing errors caused by attempting to create an existing Pipe Plugin. Example: If you implement a data processing plugin named edu.tsinghua.iotdb.pipe.ExampleProcessor, and the packaged jar package is pipe-plugin.jar, you want to use this plugin in the stream processing engine, and mark the plugin as example. There are two ways to use the plugin package, one is to upload to the URI server, and the other is to upload to the local directory of the cluster. @@ -465,7 +466,7 @@ Preparation: To register in this way, you need to upload the JAR package to the SQL: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -477,7 +478,7 @@ Preparation: To register in this way, you need to place the JAR package in any p SQL: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -487,9 +488,11 @@ USING URI ' +DROP PIPEPLUGIN [IF EXISTS] ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that when a specified Pipe Plugin exists, the delete command is executed to prevent errors caused by attempting to delete a non-existent Pipe Plugin. + ### View plugin statements Users can also view plugins in the system on demand. View the statement of the plugin as shown in the figure. diff --git a/src/UserGuide/latest/User-Manual/Data-Sync_apache.md b/src/UserGuide/latest/User-Manual/Data-Sync_apache.md index 122b60202..65eb6fbb3 100644 --- a/src/UserGuide/latest/User-Manual/Data-Sync_apache.md +++ b/src/UserGuide/latest/User-Manual/Data-Sync_apache.md @@ -103,7 +103,7 @@ Use the `CREATE PIPE` statement to create a data synchronization task. The `Pipe The SQL example is as follows: ```SQL -CREATE PIPE -- PipeId is the name that uniquely identifies the task. +CREATE PIPE [IF NOT EXISTS] -- PipeId is the name that uniquely identifies the task. -- Data extraction plugin, optional plugin WITH SOURCE ( [ = ,], @@ -118,6 +118,8 @@ WITH SINK ( ) ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified Pipe does not exist, preventing errors caused by attempting to create an existing Pipe. + ### Start Task After creation, the task will not be processed immediately and needs to be started. Use the `START PIPE` statement to start the task and begin processing data: @@ -139,8 +141,9 @@ STOP PIPE Deletes the specified task: ```SQL -DROP PIPE +DROP PIPE [IF EXISTS] ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that when a specified Pipe exists, the delete command is executed to prevent errors caused by attempting to delete non-existent Pipes. Deleting a task does not require stopping the synchronization task first. diff --git a/src/UserGuide/latest/User-Manual/Data-Sync_timecho.md b/src/UserGuide/latest/User-Manual/Data-Sync_timecho.md index 83a5aacbe..fb1077343 100644 --- a/src/UserGuide/latest/User-Manual/Data-Sync_timecho.md +++ b/src/UserGuide/latest/User-Manual/Data-Sync_timecho.md @@ -105,7 +105,7 @@ Use the `CREATE PIPE` statement to create a data synchronization task. The `Pipe The SQL example is as follows: ```SQL -CREATE PIPE -- PipeId is the name that uniquely identifies the task. +CREATE PIPE [IF NOT EXISTS] -- PipeId is the name that uniquely identifies the task. -- Data extraction plugin, optional plugin WITH SOURCE ( [ = ,], @@ -120,6 +120,8 @@ WITH SINK ( ) ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified Pipe does not exist, preventing errors caused by attempting to create an existing Pipe. + ### Start Task After creation, the task will not be processed immediately and needs to be started. Use the `START PIPE` statement to start the task and begin processing data: @@ -141,8 +143,9 @@ STOP PIPE Deletes the specified task: ```SQL -DROP PIPE +DROP PIPE [IF EXISTS] ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that when a specified Pipe exists, the delete command is executed to prevent errors caused by attempting to delete non-existent Pipes. Deleting a task does not require stopping the synchronization task first. diff --git a/src/UserGuide/latest/User-Manual/Data-subscription.md b/src/UserGuide/latest/User-Manual/Data-subscription.md index 1c7b1aee6..ce353f65c 100644 --- a/src/UserGuide/latest/User-Manual/Data-subscription.md +++ b/src/UserGuide/latest/User-Manual/Data-subscription.md @@ -46,12 +46,14 @@ IoTDB supports the creation, deletion, and viewing of Topics through SQL stateme The SQL statement is as follows: ```SQL - CREATE TOPIC + CREATE TOPIC [IF NOT EXISTS] WITH ( [ = ,], ); ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified topic does not exist, preventing errors caused by attempting to create an existing topic. + Detailed explanation of each parameter is as follows: | Key | Required or Optional with Default | Description | @@ -74,7 +76,7 @@ Examples are as follows: CREATE TOPIC root_all; -- Custom subscription -CREATE TOPIC db_timerange +CREATE TOPIC IF NOT EXISTS db_timerange WITH ( 'path' = 'root.db.**', 'start-time' = '2023-01-01', @@ -87,8 +89,9 @@ WITH ( A Topic can only be deleted if it is not subscribed to. When a Topic is deleted, its related consumption progress will be cleared. ```SQL -DROP TOPIC ; +DROP TOPIC [IF EXISTS] ; ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that the delete command is executed when a specified topic exists, preventing errors caused by attempting to delete non-existent topics. #### 3.1.3 View Topic @@ -142,7 +145,7 @@ The `SubscriptionSession` class in the IoTDB subscription client provides interf #### 4.1.1 Create Topic ```Java -Topic createTopic(String topicName, Properties properties) throws Exception; + void createTopicIfNotExists(String topicName, Properties properties) throws Exception; ``` Example: @@ -159,7 +162,7 @@ try (final SubscriptionSession session = new SubscriptionSession(host, port)) { #### 4.1.2 Delete Topic ```Java -void dropTopic(String topicName) throws Exception; +void dropTopicIfExists(String topicName) throws Exception; ``` #### 4.1.3 View Topic diff --git a/src/UserGuide/latest/User-Manual/Streaming_apache.md b/src/UserGuide/latest/User-Manual/Streaming_apache.md index 357957209..bd1711a4f 100644 --- a/src/UserGuide/latest/User-Manual/Streaming_apache.md +++ b/src/UserGuide/latest/User-Manual/Streaming_apache.md @@ -445,15 +445,17 @@ In IoTDB, to dynamically load a user-defined plugin into the system, you first n The syntax of the loading plugin management statement is as follows: ```sql -CREATE PIPEPLUGIN +CREATE PIPEPLUGIN [IF NOT EXISTS] AS USING ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified Pipe Plugin does not exist, preventing errors caused by attempting to create an existing Pipe Plugin. + For example, if a user implements a data processing plugin with the fully qualified class name "edu.tsinghua.iotdb.pipe.ExampleProcessor" and packages it into a jar file, which is stored at "https://example.com:8080/iotdb/pipe-plugin.jar", and the user wants to use this plugin in the stream processing engine, marking the plugin as "example". The creation statement for this data processing plugin is as follows: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -462,9 +464,11 @@ USING URI '' When user no longer wants to use a plugin and needs to uninstall the plugin from the system, you can use the Remove plugin statement as shown below. ```sql -DROP PIPEPLUGIN +DROP PIPEPLUGIN [IF EXISTS] ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that when a specified Pipe Plugin exists, the delete command is executed to prevent errors caused by attempting to delete a non-existent Pipe Plugin. + ### Show Plugin Statement User can also view the plugin in the system on need. The statement to view plugin is as follows. diff --git a/src/UserGuide/latest/User-Manual/Streaming_timecho.md b/src/UserGuide/latest/User-Manual/Streaming_timecho.md index 7e7eef5e9..e4c460cac 100644 --- a/src/UserGuide/latest/User-Manual/Streaming_timecho.md +++ b/src/UserGuide/latest/User-Manual/Streaming_timecho.md @@ -451,10 +451,11 @@ Then the plugin class needs to be compiled and packaged into a jar executable fi The syntax of the management statement for loading the plugin is shown in the figure. ```sql -CREATE PIPEPLUGIN +CREATE PIPEPLUGIN [IF NOT EXISTS] AS USING ``` +**IF NOT EXISTS semantics**: Used in creation operations to ensure that the create command is executed when the specified Pipe Plugin does not exist, preventing errors caused by attempting to create an existing Pipe Plugin. Example: If you implement a data processing plugin named edu.tsinghua.iotdb.pipe.ExampleProcessor, and the packaged jar package is pipe-plugin.jar, you want to use this plugin in the stream processing engine, and mark the plugin as example. There are two ways to use the plugin package, one is to upload to the URI server, and the other is to upload to the local directory of the cluster. @@ -465,7 +466,7 @@ Preparation: To register in this way, you need to upload the JAR package to the SQL: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -477,7 +478,7 @@ Preparation: To register in this way, you need to place the JAR package in any p SQL: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -487,9 +488,11 @@ USING URI ' +DROP PIPEPLUGIN [IF EXISTS] ``` +**IF EXISTS semantics**: Used in deletion operations to ensure that when a specified Pipe Plugin exists, the delete command is executed to prevent errors caused by attempting to delete a non-existent Pipe Plugin. + ### View plugin statements Users can also view plugins in the system on demand. View the statement of the plugin as shown in the figure. diff --git a/src/zh/UserGuide/Master/User-Manual/Data-Sync_apache.md b/src/zh/UserGuide/Master/User-Manual/Data-Sync_apache.md index 8a89c377e..d145609ce 100644 --- a/src/zh/UserGuide/Master/User-Manual/Data-Sync_apache.md +++ b/src/zh/UserGuide/Master/User-Manual/Data-Sync_apache.md @@ -102,7 +102,7 @@ SQL 示例如下: ```SQL -CREATE PIPE -- PipeId 是能够唯一标定任务任务的名字 +CREATE PIPE [IF NOT EXISTS] -- PipeId 是能够唯一标定任务的名字 -- 数据抽取插件,可选插件 WITH SOURCE ( [ = ,], @@ -117,6 +117,8 @@ WITH SINK ( ) ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Pipe 不存在时,执行创建命令,防止因尝试创建已存在的 Pipe 而导致报错。 + ### 开始任务 创建之后,任务不会立即被处理,需要启动任务。使用`START PIPE`语句来启动任务,从而开始处理数据: @@ -138,9 +140,11 @@ STOP PIPE 删除指定任务: ```SQL -DROP PIPE +DROP PIPE [IF EXISTS] ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Pipe 存在时,执行删除命令,防止因尝试删除不存在的 Pipe 而导致报错。 + 删除任务不需要先停止同步任务。 ### 查看任务 diff --git a/src/zh/UserGuide/Master/User-Manual/Data-Sync_timecho.md b/src/zh/UserGuide/Master/User-Manual/Data-Sync_timecho.md index 5d8fa9a91..02658280a 100644 --- a/src/zh/UserGuide/Master/User-Manual/Data-Sync_timecho.md +++ b/src/zh/UserGuide/Master/User-Manual/Data-Sync_timecho.md @@ -104,7 +104,7 @@ SQL 示例如下: ```SQL -CREATE PIPE -- PipeId 是能够唯一标定任务任务的名字 +CREATE PIPE [IF NOT EXISTS] -- PipeId 是能够唯一标定任务的名字 -- 数据抽取插件,可选插件 WITH SOURCE ( [ = ,], @@ -119,6 +119,8 @@ WITH SINK ( ) ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Pipe 不存在时,执行创建命令,防止因尝试创建已存在的 Pipe 而导致报错。 + ### 开始任务 创建之后,任务不会立即被处理,需要启动任务。使用`START PIPE`语句来启动任务,从而开始处理数据: @@ -140,9 +142,11 @@ STOP PIPE 删除指定任务: ```SQL -DROP PIPE +DROP PIPE [IF EXISTS] ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Pipe 存在时,执行删除命令,防止因尝试删除不存在的 Pipe 而导致报错。 + 删除任务不需要先停止同步任务。 ### 查看任务 diff --git a/src/zh/UserGuide/Master/User-Manual/Data-subscription.md b/src/zh/UserGuide/Master/User-Manual/Data-subscription.md index 345274d9e..e6fce18fe 100644 --- a/src/zh/UserGuide/Master/User-Manual/Data-subscription.md +++ b/src/zh/UserGuide/Master/User-Manual/Data-subscription.md @@ -44,11 +44,12 @@ IoTDB 支持通过 SQL 语句对 Topic 进行创建、删除、查看操作。To SQL 语句为: ```SQL - CREATE TOPIC + CREATE TOPIC [IF NOT EXISTS] WITH ( [ = ,], ); ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Topic 不存在时,执行创建命令,防止因尝试创建已存在的 Topic 而导致报错。 各参数详细解释如下: @@ -69,7 +70,7 @@ SQL 语句为: CREATE TOPIC root_all; -- 自定义订阅 -CREATE TOPIC db_timerange +CREATE TOPIC IF NOT EXISTS db_timerange WITH ( 'path' = 'root.db.**', 'start-time' = '2023-01-01', @@ -82,9 +83,11 @@ WITH ( Topic 在没有被订阅的情况下,才能被删除,Topic 被删除时,其相关的消费进度都会被清理 ```SQL -DROP TOPIC ; +DROP TOPIC [IF EXISTS] ; ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Topic 存在时,执行删除命令,防止因尝试删除不存在的 Topic 而导致报错。 + #### 3.1.3 查看 Topic ```SQL @@ -137,7 +140,7 @@ IoTDB 订阅客户端中的 `SubscriptionSession` 类提供了 Topic 管理的 #### 4.1.1 创建 Topic ```Java -Topic createTopic(String topicName, Properties properties) throws Exception; + void createTopicIfNotExists(String topicName, Properties properties) throws Exception; ``` 示例: @@ -154,7 +157,7 @@ try (final SubscriptionSession session = new SubscriptionSession(host, port)) { #### 4.1.2 删除 Topic ```Java -void dropTopic(String topicName) throws Exception; +void dropTopicIfExists(String topicName) throws Exception; ``` #### 4.1.3 查看 Topic diff --git a/src/zh/UserGuide/Master/User-Manual/Streaming_apache.md b/src/zh/UserGuide/Master/User-Manual/Streaming_apache.md index 0407a4d81..bef07327d 100644 --- a/src/zh/UserGuide/Master/User-Manual/Streaming_apache.md +++ b/src/zh/UserGuide/Master/User-Manual/Streaming_apache.md @@ -451,17 +451,19 @@ public interface PipeSink extends PipePlugin { 加载插件的管理语句的语法如图所示。 ```sql -CREATE PIPEPLUGIN <别名> +CREATE PIPEPLUGIN [IF NOT EXISTS] <别名> AS <全类名> USING ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Pipe Plugin 不存在时,执行创建命令,防止因尝试创建已存在的 Pipe Plugin 而导致报错。 + 例如,用户实现了一个全类名为 edu.tsinghua.iotdb.pipe.ExampleProcessor 的数据处理插件, 打包后的 jar 资源包存放到了 https://example.com:8080/iotdb/pipe-plugin.jar 上,用户希望在流处理引擎中使用这个插件, 将插件标记为 example。那么,这个数据处理插件的创建语句如图所示。 ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -471,9 +473,11 @@ USING URI '' 当用户不再想使用一个插件,需要将插件从系统中卸载时,可以使用如图所示的删除插件语句。 ```sql -DROP PIPEPLUGIN <别名> +DROP PIPEPLUGIN [IF EXISTS] <别名> ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Pipe Plugin 存在时,执行删除命令,防止因尝试删除不存在的 Pipe Plugin 而导致报错。 + ### 查看插件语句 用户也可以按需查看系统中的插件。查看插件的语句如图所示。 diff --git a/src/zh/UserGuide/Master/User-Manual/Streaming_timecho.md b/src/zh/UserGuide/Master/User-Manual/Streaming_timecho.md index 00a0aa932..0386f4e61 100644 --- a/src/zh/UserGuide/Master/User-Manual/Streaming_timecho.md +++ b/src/zh/UserGuide/Master/User-Manual/Streaming_timecho.md @@ -451,11 +451,13 @@ public interface PipeSink extends PipePlugin { 加载插件的管理语句的语法如图所示。 ```sql -CREATE PIPEPLUGIN <别名> +CREATE PIPEPLUGIN [IF NOT EXISTS] <别名> AS <全类名> USING ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Pipe Plugin 不存在时,执行创建命令,防止因尝试创建已存在的 Pipe Plugin 而导致报错。 + 示例:假如用户实现了一个全类名为edu.tsinghua.iotdb.pipe.ExampleProcessor 的数据处理插件,打包后的jar包为 pipe-plugin.jar ,用户希望在流处理引擎中使用这个插件,将插件标记为 example。插件包有两种使用方式,一种为上传到URI服务器,一种为上传到集群本地目录,两种方法任选一种即可。 【方式一】上传到URI服务器 @@ -465,7 +467,7 @@ USING 创建语句: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -477,7 +479,7 @@ USING URI '' 创建语句: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -487,9 +489,11 @@ USING URI '' 当用户不再想使用一个插件,需要将插件从系统中卸载时,可以使用如图所示的删除插件语句。 ```sql -DROP PIPEPLUGIN <别名> +DROP PIPEPLUGIN [IF EXISTS] <别名> ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Pipe Plugin 存在时,执行删除命令,防止因尝试删除不存在的 Pipe Plugin 而导致报错。 + ### 查看插件语句 用户也可以按需查看系统中的插件。查看插件的语句如图所示。 diff --git a/src/zh/UserGuide/latest/User-Manual/Data-Sync_apache.md b/src/zh/UserGuide/latest/User-Manual/Data-Sync_apache.md index 8a89c377e..d145609ce 100644 --- a/src/zh/UserGuide/latest/User-Manual/Data-Sync_apache.md +++ b/src/zh/UserGuide/latest/User-Manual/Data-Sync_apache.md @@ -102,7 +102,7 @@ SQL 示例如下: ```SQL -CREATE PIPE -- PipeId 是能够唯一标定任务任务的名字 +CREATE PIPE [IF NOT EXISTS] -- PipeId 是能够唯一标定任务的名字 -- 数据抽取插件,可选插件 WITH SOURCE ( [ = ,], @@ -117,6 +117,8 @@ WITH SINK ( ) ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Pipe 不存在时,执行创建命令,防止因尝试创建已存在的 Pipe 而导致报错。 + ### 开始任务 创建之后,任务不会立即被处理,需要启动任务。使用`START PIPE`语句来启动任务,从而开始处理数据: @@ -138,9 +140,11 @@ STOP PIPE 删除指定任务: ```SQL -DROP PIPE +DROP PIPE [IF EXISTS] ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Pipe 存在时,执行删除命令,防止因尝试删除不存在的 Pipe 而导致报错。 + 删除任务不需要先停止同步任务。 ### 查看任务 diff --git a/src/zh/UserGuide/latest/User-Manual/Data-Sync_timecho.md b/src/zh/UserGuide/latest/User-Manual/Data-Sync_timecho.md index 5d8fa9a91..02658280a 100644 --- a/src/zh/UserGuide/latest/User-Manual/Data-Sync_timecho.md +++ b/src/zh/UserGuide/latest/User-Manual/Data-Sync_timecho.md @@ -104,7 +104,7 @@ SQL 示例如下: ```SQL -CREATE PIPE -- PipeId 是能够唯一标定任务任务的名字 +CREATE PIPE [IF NOT EXISTS] -- PipeId 是能够唯一标定任务的名字 -- 数据抽取插件,可选插件 WITH SOURCE ( [ = ,], @@ -119,6 +119,8 @@ WITH SINK ( ) ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Pipe 不存在时,执行创建命令,防止因尝试创建已存在的 Pipe 而导致报错。 + ### 开始任务 创建之后,任务不会立即被处理,需要启动任务。使用`START PIPE`语句来启动任务,从而开始处理数据: @@ -140,9 +142,11 @@ STOP PIPE 删除指定任务: ```SQL -DROP PIPE +DROP PIPE [IF EXISTS] ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Pipe 存在时,执行删除命令,防止因尝试删除不存在的 Pipe 而导致报错。 + 删除任务不需要先停止同步任务。 ### 查看任务 diff --git a/src/zh/UserGuide/latest/User-Manual/Data-subscription.md b/src/zh/UserGuide/latest/User-Manual/Data-subscription.md index 345274d9e..e6fce18fe 100644 --- a/src/zh/UserGuide/latest/User-Manual/Data-subscription.md +++ b/src/zh/UserGuide/latest/User-Manual/Data-subscription.md @@ -44,11 +44,12 @@ IoTDB 支持通过 SQL 语句对 Topic 进行创建、删除、查看操作。To SQL 语句为: ```SQL - CREATE TOPIC + CREATE TOPIC [IF NOT EXISTS] WITH ( [ = ,], ); ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Topic 不存在时,执行创建命令,防止因尝试创建已存在的 Topic 而导致报错。 各参数详细解释如下: @@ -69,7 +70,7 @@ SQL 语句为: CREATE TOPIC root_all; -- 自定义订阅 -CREATE TOPIC db_timerange +CREATE TOPIC IF NOT EXISTS db_timerange WITH ( 'path' = 'root.db.**', 'start-time' = '2023-01-01', @@ -82,9 +83,11 @@ WITH ( Topic 在没有被订阅的情况下,才能被删除,Topic 被删除时,其相关的消费进度都会被清理 ```SQL -DROP TOPIC ; +DROP TOPIC [IF EXISTS] ; ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Topic 存在时,执行删除命令,防止因尝试删除不存在的 Topic 而导致报错。 + #### 3.1.3 查看 Topic ```SQL @@ -137,7 +140,7 @@ IoTDB 订阅客户端中的 `SubscriptionSession` 类提供了 Topic 管理的 #### 4.1.1 创建 Topic ```Java -Topic createTopic(String topicName, Properties properties) throws Exception; + void createTopicIfNotExists(String topicName, Properties properties) throws Exception; ``` 示例: @@ -154,7 +157,7 @@ try (final SubscriptionSession session = new SubscriptionSession(host, port)) { #### 4.1.2 删除 Topic ```Java -void dropTopic(String topicName) throws Exception; +void dropTopicIfExists(String topicName) throws Exception; ``` #### 4.1.3 查看 Topic diff --git a/src/zh/UserGuide/latest/User-Manual/Streaming_apache.md b/src/zh/UserGuide/latest/User-Manual/Streaming_apache.md index 0407a4d81..bef07327d 100644 --- a/src/zh/UserGuide/latest/User-Manual/Streaming_apache.md +++ b/src/zh/UserGuide/latest/User-Manual/Streaming_apache.md @@ -451,17 +451,19 @@ public interface PipeSink extends PipePlugin { 加载插件的管理语句的语法如图所示。 ```sql -CREATE PIPEPLUGIN <别名> +CREATE PIPEPLUGIN [IF NOT EXISTS] <别名> AS <全类名> USING ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Pipe Plugin 不存在时,执行创建命令,防止因尝试创建已存在的 Pipe Plugin 而导致报错。 + 例如,用户实现了一个全类名为 edu.tsinghua.iotdb.pipe.ExampleProcessor 的数据处理插件, 打包后的 jar 资源包存放到了 https://example.com:8080/iotdb/pipe-plugin.jar 上,用户希望在流处理引擎中使用这个插件, 将插件标记为 example。那么,这个数据处理插件的创建语句如图所示。 ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -471,9 +473,11 @@ USING URI '' 当用户不再想使用一个插件,需要将插件从系统中卸载时,可以使用如图所示的删除插件语句。 ```sql -DROP PIPEPLUGIN <别名> +DROP PIPEPLUGIN [IF EXISTS] <别名> ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Pipe Plugin 存在时,执行删除命令,防止因尝试删除不存在的 Pipe Plugin 而导致报错。 + ### 查看插件语句 用户也可以按需查看系统中的插件。查看插件的语句如图所示。 diff --git a/src/zh/UserGuide/latest/User-Manual/Streaming_timecho.md b/src/zh/UserGuide/latest/User-Manual/Streaming_timecho.md index 00a0aa932..0386f4e61 100644 --- a/src/zh/UserGuide/latest/User-Manual/Streaming_timecho.md +++ b/src/zh/UserGuide/latest/User-Manual/Streaming_timecho.md @@ -451,11 +451,13 @@ public interface PipeSink extends PipePlugin { 加载插件的管理语句的语法如图所示。 ```sql -CREATE PIPEPLUGIN <别名> +CREATE PIPEPLUGIN [IF NOT EXISTS] <别名> AS <全类名> USING ``` +**IF NOT EXISTS 语义**:用于创建操作中,确保当指定 Pipe Plugin 不存在时,执行创建命令,防止因尝试创建已存在的 Pipe Plugin 而导致报错。 + 示例:假如用户实现了一个全类名为edu.tsinghua.iotdb.pipe.ExampleProcessor 的数据处理插件,打包后的jar包为 pipe-plugin.jar ,用户希望在流处理引擎中使用这个插件,将插件标记为 example。插件包有两种使用方式,一种为上传到URI服务器,一种为上传到集群本地目录,两种方法任选一种即可。 【方式一】上传到URI服务器 @@ -465,7 +467,7 @@ USING 创建语句: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -477,7 +479,7 @@ USING URI '' 创建语句: ```sql -CREATE PIPEPLUGIN example +CREATE PIPEPLUGIN IF NOT EXISTS example AS 'edu.tsinghua.iotdb.pipe.ExampleProcessor' USING URI '' ``` @@ -487,9 +489,11 @@ USING URI '' 当用户不再想使用一个插件,需要将插件从系统中卸载时,可以使用如图所示的删除插件语句。 ```sql -DROP PIPEPLUGIN <别名> +DROP PIPEPLUGIN [IF EXISTS] <别名> ``` +**IF EXISTS 语义**:用于删除操作中,确保当指定 Pipe Plugin 存在时,执行删除命令,防止因尝试删除不存在的 Pipe Plugin 而导致报错。 + ### 查看插件语句 用户也可以按需查看系统中的插件。查看插件的语句如图所示。