You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by er...@apache.org on 2022/06/23 04:54:49 UTC

[iotdb] branch improve/iotdb-3622 updated (6697c3eab2 -> 98caaed08b)

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

ericpai pushed a change to branch improve/iotdb-3622
in repository https://gitbox.apache.org/repos/asf/iotdb.git


 discard 6697c3eab2 [IOTDB-3622] Use symlink of shared libs to decrease the copied file size in IT test
     add 70f6d6fe37 [IOTDB-3467] Add IT for Nested Expressions (#6385)
     add ff996f9098 [IOTDB-3484] Modify user docs about how to use udf api (#6387)
     add 074b37f5fe [IOTDB-3558] Dump node stacks if IT test request timeout (#6382)
     add 346ed83119 delete tsfiles when recovering data region (#6388)
     new 98caaed08b [IOTDB-3622] Use symlink of shared libs to decrease the copied file size in IT test

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (6697c3eab2)
            \
             N -- N -- N   refs/heads/improve/iotdb-3622 (98caaed08b)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 docs/Download/README.md                            |   1 +
 .../Process-Data/UDF-User-Defined-Function.md      |  58 ++---
 docs/zh/Download/README.md                         |   1 +
 .../Process-Data/UDF-User-Defined-Function.md      |  61 ++---
 integration-test/pom.xml                           |   2 +-
 .../java/org/apache/iotdb/it/env/AbstractEnv.java  | 145 +++++++----
 .../apache/iotdb/it/env/AbstractNodeWrapper.java   | 257 +++++++++++++------
 .../org/apache/iotdb/it/env/ConfigNodeWrapper.java |  49 ++--
 .../org/apache/iotdb/it/env/DataNodeWrapper.java   |  35 +--
 .../org/apache/iotdb/it/env/IoTDBTestRunner.java   |   2 +-
 .../org/apache/iotdb/it/env/RemoteServerEnv.java   |   7 +-
 .../iotdb/it/env/StandaloneDataNodeWrapper.java    |   5 +-
 .../apache/iotdb/it/env/StandaloneOnMppEnv.java    |  34 +--
 .../java/org/apache/iotdb/itbase/env/BaseEnv.java  |   4 +-
 .../apache/iotdb/itbase/env/BaseNodeWrapper.java   |   4 +
 .../itbase/runtime/InconsistentDataException.java  |   2 +-
 .../itbase/runtime/ParallelRequestDelegate.java    |   3 +
 .../iotdb/itbase/runtime/RequestDelegate.java      |   5 +-
 integration-test/src/script/append-to-env.sh       |  32 ---
 .../apache/iotdb/db/it}/IoTDBNestedQueryIT.java    | 283 ++++++++++-----------
 .../org/apache/iotdb/db/it/env/StandaloneEnv.java  |   6 +-
 .../db/conf/directories/DirectoryManager.java      |   6 +
 .../iotdb/db/engine/storagegroup/DataRegion.java   |  25 +-
 23 files changed, 556 insertions(+), 471 deletions(-)
 delete mode 100644 integration-test/src/script/append-to-env.sh
 copy {integration/src/test/java/org/apache/iotdb/db/integration => integration-test/src/test/java/org/apache/iotdb/db/it}/IoTDBNestedQueryIT.java (71%)


[iotdb] 01/01: [IOTDB-3622] Use symlink of shared libs to decrease the copied file size in IT test

Posted by er...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ericpai pushed a commit to branch improve/iotdb-3622
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 98caaed08bde3efe13008b54e4fece7e1a1372fd
Author: ericpai <er...@hotmail.com>
AuthorDate: Thu Jun 23 10:11:14 2022 +0800

    [IOTDB-3622] Use symlink of shared libs to decrease the copied file size in IT test
---
 integration-test/pom.xml                           | 35 ++++++++++++++++++++
 integration-test/src/assembly/mpp-share.xml        | 33 +++++++++++++++++++
 integration-test/src/assembly/mpp-test.xml         |  7 +---
 .../apache/iotdb/it/env/AbstractNodeWrapper.java   | 38 ++++++++++++++++------
 integration-test/src/script/append-to-env.sh       | 32 ------------------
 5 files changed, 97 insertions(+), 48 deletions(-)

diff --git a/integration-test/pom.xml b/integration-test/pom.xml
index 4ba31b5ffd..688d83483e 100644
--- a/integration-test/pom.xml
+++ b/integration-test/pom.xml
@@ -126,6 +126,41 @@
                             <appendAssemblyId>false</appendAssemblyId>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>cluster-test-assembly-share</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/assembly/mpp-share.xml</descriptor>
+                            </descriptors>
+                            <finalName>template-node-share</finalName>
+                            <appendAssemblyId>false</appendAssemblyId>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>3.1.0</version>
+                <configuration>
+                    <skip>${integrationTest.launchNodeInSameJVM}</skip>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <configuration>
+                            <target>
+                                <symlink link="${project.build.directory}/template-node/lib" resource="${project.build.directory}/template-node-share/lib"/>
+                            </target>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
                 </executions>
             </plugin>
             <!-- If the test starts separate processes, we can set maximum-heap and new-heap size -->
diff --git a/integration-test/src/assembly/mpp-share.xml b/integration-test/src/assembly/mpp-share.xml
new file mode 100644
index 0000000000..01fce3555d
--- /dev/null
+++ b/integration-test/src/assembly/mpp-share.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<assembly>
+    <id>mpp-share</id>
+    <formats>
+        <format>dir</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <dependencySets>
+        <dependencySet>
+            <outputDirectory>lib</outputDirectory>
+        </dependencySet>
+    </dependencySets>
+</assembly>
diff --git a/integration-test/src/assembly/mpp-test.xml b/integration-test/src/assembly/mpp-test.xml
index d73c45de4b..4e0f21cefc 100644
--- a/integration-test/src/assembly/mpp-test.xml
+++ b/integration-test/src/assembly/mpp-test.xml
@@ -20,16 +20,11 @@
 
 -->
 <assembly>
-    <id>cluster-test</id>
+    <id>mpp-test</id>
     <formats>
         <format>dir</format>
     </formats>
     <includeBaseDirectory>false</includeBaseDirectory>
-    <dependencySets>
-        <dependencySet>
-            <outputDirectory>lib</outputDirectory>
-        </dependencySet>
-    </dependencySets>
     <fileSets>
         <fileSet>
             <outputDirectory>datanode/conf</outputDirectory>
diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/AbstractNodeWrapper.java b/integration-test/src/main/java/org/apache/iotdb/it/env/AbstractNodeWrapper.java
index 3cd791767c..22b53e2ab9 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/env/AbstractNodeWrapper.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/env/AbstractNodeWrapper.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.it.env;
 import org.apache.iotdb.itbase.env.BaseNodeWrapper;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.file.PathUtils;
 import org.apache.commons.lang3.SystemUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,14 +44,17 @@ import java.lang.management.ThreadMXBean;
 import java.net.MalformedURLException;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
+import java.nio.file.LinkOption;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
 import java.time.LocalDateTime;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
 
 import static org.junit.Assert.fail;
 
@@ -79,14 +83,32 @@ public abstract class AbstractNodeWrapper implements BaseNodeWrapper {
   @Override
   public void createDir() {
     // Copy templateNodePath to nodePath
+    String destPath = getNodePath();
     try {
-      File nodeDir = new File(getNodePath());
+      File nodeDir = new File(destPath);
       try {
         FileUtils.forceDelete(nodeDir);
       } catch (FileNotFoundException e) {
         // ignored
       }
-      FileUtils.copyDirectoryToDirectory(new File(this.templateNodePath), nodeDir);
+      // Here we need to copy without follow symbolic links, so we can't use FileUtils directly.
+      try (Stream<Path> s = Files.walk(Paths.get(this.templateNodePath))) {
+        s.forEach(
+            source -> {
+              Path destination =
+                  Paths.get(destPath, source.toString().substring(this.templateNodePath.length()));
+              try {
+                Files.copy(
+                    source,
+                    destination,
+                    LinkOption.NOFOLLOW_LINKS,
+                    StandardCopyOption.COPY_ATTRIBUTES);
+              } catch (IOException e) {
+                throw new RuntimeException(e);
+              }
+            });
+      }
+
       String startScriptPath = getStartScriptPath();
       String stopScriptPath = getStopScriptPath();
       if (!new File(startScriptPath).setExecutable(true)) {
@@ -106,7 +128,9 @@ public abstract class AbstractNodeWrapper implements BaseNodeWrapper {
   public void destroyDir() {
     for (int i = 0; i < 3; i++) {
       try {
-        FileUtils.forceDelete(new File(getNodePath()));
+        // DO NOT use FileUtils.forceDelete, as it will follow the symbolic link to make libs
+        // read-only, which causes permission denied in deletion.
+        PathUtils.deleteDirectory(Paths.get(getNodePath()));
         return;
       } catch (IOException ex) {
         logger.warn("Delete node dir failed. RetryTimes={}", i + 1, ex);
@@ -215,13 +239,7 @@ public abstract class AbstractNodeWrapper implements BaseNodeWrapper {
   }
 
   protected String workDirFilePath(String dirName, String fileName) {
-    return getNodePath()
-        + File.separator
-        + "template-node"
-        + File.separator
-        + dirName
-        + File.separator
-        + fileName;
+    return getNodePath() + File.separator + dirName + File.separator + fileName;
   }
 
   protected abstract String getConfigPath();
diff --git a/integration-test/src/script/append-to-env.sh b/integration-test/src/script/append-to-env.sh
deleted file mode 100644
index 3192433d13..0000000000
--- a/integration-test/src/script/append-to-env.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-if [ "$(uname)" == "Darwin" ]
-then
-  sed -i '' "s/^#MAX_HEAP_SIZE=.*/MAX_HEAP_SIZE=\"200m\"/" target/template-node/datanode/conf/iotdb-env.sh
-  sed -i '' "s/^#HEAP_NEWSIZE=.*/HEAP_NEWSIZE=\"200m\"/" target/template-node/datanode/conf/iotdb-env.sh
-  sed -i '' "s/^#MAX_HEAP_SIZE=.*/MAX_HEAP_SIZE=\"200m\"/" target/template-node/confignode/conf/confignode-env.sh
-  sed -i '' "s/^#HEAP_NEWSIZE=.*/HEAP_NEWSIZE=\"200m\"/" target/template-node/confignode/conf/confignode-env.sh
-else
-  sed -i "s/^#MAX_HEAP_SIZE=.*/MAX_HEAP_SIZE=\"200m\"/" target/template-node/datanode/conf/iotdb-env.sh
-  sed -i "s/^#HEAP_NEWSIZE=.*/HEAP_NEWSIZE=\"200m\"/" target/template-node/datanode/conf/iotdb-env.sh
-  sed -i "s/^#MAX_HEAP_SIZE=.*/MAX_HEAP_SIZE=\"200m\"/" target/template-node/confignode/conf/confignode-env.sh
-  sed -i "s/^#HEAP_NEWSIZE=.*/HEAP_NEWSIZE=\"200m\"/" target/template-node/confignode/conf/confignode-env.sh
-fi
-