You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2021/01/02 04:04:09 UTC

[iotdb] branch master updated: change udf and tracing ut root path to target (#2411)

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

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new e28208c  change udf and tracing ut root path to target (#2411)
e28208c is described below

commit e28208cc0487dea3375da9374f2a1b1ae95bdcb3
Author: Dawei Liu <li...@apache.org>
AuthorDate: Sat Jan 2 12:03:46 2021 +0800

    change udf and tracing ut root path to target (#2411)
---
 .../Operation Manual/UDF User Defined Function.md          |  1 +
 .../Operation Manual/UDF User Defined Function.md          |  3 ++-
 server/src/assembly/resources/conf/iotdb-engine.properties | 14 ++++++++++++++
 .../java/org/apache/iotdb/db/conf/IoTDBDescriptor.java     |  6 +++++-
 server/src/test/resources/iotdb-engine.properties          |  2 ++
 5 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/docs/UserGuide/Operation Manual/UDF User Defined Function.md b/docs/UserGuide/Operation Manual/UDF User Defined Function.md
index 6678847..76269d1 100644
--- a/docs/UserGuide/Operation Manual/UDF User Defined Function.md	
+++ b/docs/UserGuide/Operation Manual/UDF User Defined Function.md	
@@ -389,6 +389,7 @@ The process of registering a UDF in IoTDB is as follows:
 1. Implement a complete UDF class, assuming the full class name of this class is `org.apache.iotdb.udf.ExampleUDTF`.
 2. Package your project into a JAR. If you use Maven to manage your project, you can refer to the Maven project example above.
 3. Place the JAR package in the directory `iotdb-server-0.12.0-SNAPSHOT/ext/udf` or in a subdirectory of `iotdb-server-0.12.0-SNAPSHOT/ext/udf`.
+    > You can specify the root path for the UDF to load the Jar by modifying the 'udf_root_dir' in the configuration file.
 4. Register the UDF with the SQL statement, assuming that the name given to the UDF is `example`.
 
 The following shows the SQL syntax of how to register a UDF.
diff --git a/docs/zh/UserGuide/Operation Manual/UDF User Defined Function.md b/docs/zh/UserGuide/Operation Manual/UDF User Defined Function.md
index 8e860ab..fa9f3e2 100644
--- a/docs/zh/UserGuide/Operation Manual/UDF User Defined Function.md	
+++ b/docs/zh/UserGuide/Operation Manual/UDF User Defined Function.md	
@@ -387,7 +387,8 @@ UDTF的结束方法,您可以在此方法中进行一些资源释放等的操
 
 1. 实现一个完整的UDF类,假定这个类的全类名为`org.apache.iotdb.udf.ExampleUDTF`
 2. 将项目打成JAR包,如果您使用Maven管理项目,可以参考上述Maven项目示例的写法
-3. 将JAR包放置到目录 `iotdb-server-0.12.0-SNAPSHOT/ext/udf` (也可以是`iotdb-server-0.12.0-SNAPSHOT/ext/udf`的子目录)下
+3. 将JAR包放置到目录 `iotdb-server-0.12.0-SNAPSHOT/ext/udf` (也可以是`iotdb-server-0.12.0-SNAPSHOT/ext/udf`的子目录)下。
+    > 您可以通过修改配置文件中的`udf_root_dir`来指定UDF加载Jar的根路径。
 4. 使用SQL语句注册该UDF,假定赋予该UDF的名字为`example`
 
 注册UDF的SQL语法如下:
diff --git a/server/src/assembly/resources/conf/iotdb-engine.properties b/server/src/assembly/resources/conf/iotdb-engine.properties
index 5e2fe20..dee4fd1 100644
--- a/server/src/assembly/resources/conf/iotdb-engine.properties
+++ b/server/src/assembly/resources/conf/iotdb-engine.properties
@@ -440,6 +440,12 @@ performance_stat_memory_in_kb=20
 # Is performance tracing enable
 enable_performance_tracing=false
 
+# Uncomment following fields to configure the tracing root directory.
+# For Window platform, the index is as follows:
+# tracing_dir=data\\tracing
+# For Linux platform
+# If its prefix is "/", then the path is absolute. Otherwise, it is relative.
+# tracing_dir=data/tracing
 
 ####################
 ### Configurations for watermark module
@@ -599,6 +605,14 @@ udf_memory_budget_in_mb=300.0
 # The parameter form is a:b:c, where a, b, and c are integers.
 udf_reader_transformer_collector_memory_proportion=1:1:1
 
+# Uncomment following fields to configure the udf root directory.
+# For Window platform, the index is as follows:
+# udf_root_dir=ext\\udf
+# For Linux platform
+# If its prefix is "/", then the path is absolute. Otherwise, it is relative.
+# index_root_dir=ext/udf
+
+
 # Uncomment following fields to configure the index root directory.
 # For Window platform, the index is as follows:
 # index_root_dir=data\\index
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
index 00d5b1d..669a200 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java
@@ -228,6 +228,8 @@ public class IoTDBDescriptor {
       conf.setQueryDir(
           FilePathUtils.regularizePath(conf.getSystemDir() + IoTDBConstant.QUERY_FOLDER_NAME));
 
+      conf.setTracingDir(properties.getProperty("tracing_dir", conf.getTracingDir()));
+
       conf.setDataDirs(properties.getProperty("data_dirs", conf.getDataDirs()[0])
           .split(","));
 
@@ -240,7 +242,7 @@ public class IoTDBDescriptor {
       }
 
       int mlogBufferSize = Integer.parseInt(properties.getProperty("mlog_buffer_size",
-        Integer.toString(conf.getMlogBufferSize())));
+          Integer.toString(conf.getMlogBufferSize())));
       if (mlogBufferSize > 0) {
         conf.setMlogBufferSize(mlogBufferSize);
       }
@@ -863,6 +865,8 @@ public class IoTDBDescriptor {
           Integer.parseInt(initialByteArrayLengthForMemoryControl));
     }
 
+    conf.setUdfDir(properties.getProperty("udf_root_dir", conf.getUdfDir()));
+
     String memoryBudgetInMb = properties.getProperty("udf_memory_budget_in_mb");
     if (memoryBudgetInMb != null) {
       conf.setUdfMemoryBudgetInMB((float) Math
diff --git a/server/src/test/resources/iotdb-engine.properties b/server/src/test/resources/iotdb-engine.properties
index e66de81..960aa13 100644
--- a/server/src/test/resources/iotdb-engine.properties
+++ b/server/src/test/resources/iotdb-engine.properties
@@ -20,3 +20,5 @@ base_dir=target/tmp
 data_dirs=target/data
 wal_dir=target/wal
 index_root_dir=target/index
+udf_root_dir=target/ext
+tracing_dir=target/data/tracing
\ No newline at end of file