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

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


The following commit(s) were added to refs/heads/master by this push:
     new 000891f  fix bug where IOTDB_HOME is misused (#184)
000891f is described below

commit 000891f128a70294e15d55a042568a97c8513f97
Author: RUI, LEI <[email protected]>
AuthorDate: Mon May 27 16:06:20 2019 +0800

    fix bug where IOTDB_HOME is misused (#184)
---
 README.md                                          |  9 +++
 docs/Documentation/QuickStart.md                   | 10 +++
 .../UserGuideV0.7.0/4-Deployment and Management.md | 71 +++++++++++++++++++---
 iotdb-cli/cli/bin/export-csv.bat                   | 10 +--
 iotdb-cli/cli/bin/export-csv.sh                    |  8 +--
 iotdb-cli/cli/bin/import-csv.bat                   | 10 +--
 iotdb-cli/cli/bin/import-csv.sh                    |  8 +--
 iotdb-cli/cli/bin/start-client.bat                 |  8 +--
 iotdb-cli/cli/bin/start-client.sh                  |  6 +-
 .../java/org/apache/iotdb/cli/tool/ImportCsv.java  |  4 +-
 10 files changed, 108 insertions(+), 36 deletions(-)

diff --git a/README.md b/README.md
index a418329..d412168 100644
--- a/README.md
+++ b/README.md
@@ -99,6 +99,15 @@ Let $IOTDB_HOME = /workspace/incubator-iotdb/iotdb/iotdb/
 
 Let $IOTDB_CLI_HOME = /workspace/incubator-iotdb/iotdb-cli/cli
 
+Note:
+* if `IOTDB_HOME` is not explicitly assigned, 
+then by default `IOTDB_HOME` is the direct parent directory of 
`bin/start-server.sh` on Unix/OS X 
+(or that of `bin\start-server.bat` on Windows).
+
+* if `IOTDB_CLI_HOME` is not explicitly assigned, 
+then by default `IOTDB_CLI_HOME` is the direct parent directory of 
`bin/start-client.sh` on 
+Unix/OS X (or that of `bin\start-client.bat` on Windows).
+
 If you are not the first time that building IoTDB, remember deleting the 
following files:
 
 ```
diff --git a/docs/Documentation/QuickStart.md b/docs/Documentation/QuickStart.md
index 0fea0c6..afa75ae 100755
--- a/docs/Documentation/QuickStart.md
+++ b/docs/Documentation/QuickStart.md
@@ -89,6 +89,16 @@ incubator-iotdb/     <-- root path
 
 Let $IOTDB_HOME = /workspace/incubator-iotdb/iotdb/iotdb/
 Let $IOTDB_CLI_HOME = /workspace/incubator-iotdb/iotdb-cli/cli/
+
+Note:
+* if `IOTDB_HOME` is not explicitly assigned, 
+then by default `IOTDB_HOME` is the direct parent directory of 
`bin/start-server.sh` on Unix/OS X 
+(or that of `bin\start-server.bat` on Windows).
+
+* if `IOTDB_CLI_HOME` is not explicitly assigned, 
+then by default `IOTDB_CLI_HOME` is the direct parent directory of 
`bin/start-client.sh` on 
+Unix/OS X (or that of `bin\start-client.bat` on Windows).
+
 If you are not the first time that building IoTDB, remember deleting the 
following files:
 
 ```
diff --git a/docs/Documentation/UserGuideV0.7.0/4-Deployment and Management.md 
b/docs/Documentation/UserGuideV0.7.0/4-Deployment and Management.md
index 53066f8..d38a2dd 100644
--- a/docs/Documentation/UserGuideV0.7.0/4-Deployment and Management.md 
+++ b/docs/Documentation/UserGuideV0.7.0/4-Deployment and Management.md 
@@ -107,44 +107,95 @@ iotdb/     <-- root path
 Use git to get IoTDB source code:
 
 ```
-Shell > git clone https://github.com/thulab/iotdb.git
+Shell > git clone https://github.com/apache/incubator-iotdb.git
 ```
 
+Or:
+
+```
+Shell > git clone [email protected]:apache/incubator-iotdb.git
+```
+
+Now suppose your directory is like this:
+
+```
+> pwd
+/workspace/incubator-iotdb
+
+> ls -l
+incubator-iotdb/     <-- root path
+|
++- iotdb/
+|
++- jdbc/
+|
++- iotdb-cli/
+|
+...
+|
++- pom.xml
+```
+
+Let $IOTDB_HOME = /workspace/incubator-iotdb/iotdb/iotdb/
+Let $IOTDB_CLI_HOME = /workspace/incubator-iotdb/iotdb-cli/cli/
+
+Note:
+* if `IOTDB_HOME` is not explicitly assigned, 
+then by default `IOTDB_HOME` is the direct parent directory of 
`bin/start-server.sh` on Unix/OS X 
+(or that of `bin\start-server.bat` on Windows).
+
+* if `IOTDB_CLI_HOME` is not explicitly assigned, 
+then by default `IOTDB_CLI_HOME` is the direct parent directory of 
`bin/start-client.sh` on 
+Unix/OS X (or that of `bin\start-client.bat` on Windows).
+
 If you are not the first time that building IoTDB, remember deleting the 
following files:
 
 ```
-rm -rf iotdb/data/
-rm -rf iotdb/lib/
+> rm -rf $IOTDB_HOME/data/
+> rm -rf $IOTDB_HOME/lib/
 ```
 
-Then under the IoTDB path, you can build IoTDB using Maven:
+Then under the root path of incubator-iotdb, you can build IoTDB using Maven:
 
 ```
-mvn clean package -Dmaven.test.skip=true
+> pwd
+/workspace/incubator-iotdb
+
+> mvn clean package -pl iotdb -am -Dmaven.test.skip=true
 ```
 
 If successful, you will see the the following text in the terminal:
 
 ```
+[INFO] ------------------------------------------------------------------------
+[INFO] Reactor Summary:
+[INFO]
+[INFO] IoTDB Root ......................................... SUCCESS [  7.020 s]
+[INFO] TsFile ............................................. SUCCESS [ 10.486 s]
+[INFO] Service-rpc ........................................ SUCCESS [  3.717 s]
+[INFO] IoTDB Jdbc ......................................... SUCCESS [  3.076 s]
+[INFO] IoTDB .............................................. SUCCESS [  8.258 s]
+[INFO] ------------------------------------------------------------------------
 [INFO] BUILD SUCCESS
+[INFO] ------------------------------------------------------------------------
 ```
-Otherwise, you may need to check the error statements and fix the problems.
 
-After build, the IoTDB project will be at the subfolder named iotdb. The 
folder will include the following contents:
+Otherwise, you may need to check the error statements and fix the problems.
 
+After building, the IoTDB project will be at the subfolder named iotdb. The 
folder will include the following contents:
 
 ```
-iotdb/     <-- root path
+$IOTDB_HOME/
 |
 +- bin/       <-- script files
 |
 +- conf/      <-- configuration files
 |
 +- lib/       <-- project dependencies
-|
-+- LICENSE    <-- LICENSE
 ```
 
+<!-- > NOTE: We also provide already built JARs and project at 
[http://tsfile.org/download](http://tsfile.org/download) instead of build the 
jar package yourself. -->
+
 ### Installation by Docker (Dockerfile)
 
 You can build and run a IoTDB docker image by following the guide of 
[Deployment by Docker](#build-and-use-iotdb-by-dockerfile)
diff --git a/iotdb-cli/cli/bin/export-csv.bat b/iotdb-cli/cli/bin/export-csv.bat
index 23c3158..a5c1ce2 100644
--- a/iotdb-cli/cli/bin/export-csv.bat
+++ b/iotdb-cli/cli/bin/export-csv.bat
@@ -25,7 +25,7 @@ echo ````````````````````````````````````````````````
 if "%OS%" == "Windows_NT" setlocal
 
 pushd %~dp0..
-if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%CD%
+if NOT DEFINED IOTDB_CLI_HOME set IOTDB_CLI_HOME=%CD%
 popd
 
 if NOT DEFINED MAIN_CLASS set MAIN_CLASS=org.apache.iotdb.cli.tool.ExportCsv
@@ -34,14 +34,14 @@ if NOT DEFINED JAVA_HOME goto :err
 @REM 
-----------------------------------------------------------------------------
 @REM JVM Opts we'll use in legacy run or installation
 set JAVA_OPTS=-ea^
- -DIOTDB_HOME=%IOTDB_HOME%
+ -DIOTDB_CLI_HOME=%IOTDB_CLI_HOME%
 
 @REM ***** CLASSPATH library setting *****
 @REM Ensure that any user defined CLASSPATH variables are not used on startup
 set CLASSPATH=""
 
-REM For each jar in the IOTDB_HOME lib directory call append to build the 
CLASSPATH variable.
-for %%i in ("%IOTDB_HOME%\lib\*.jar") do call :append "%%i"
+REM For each jar in the IOTDB_CLI_HOME lib directory call append to build the 
CLASSPATH variable.
+for %%i in ("%IOTDB_CLI_HOME%\lib\*.jar") do call :append "%%i"
 goto okClasspath
 
 :append
@@ -51,7 +51,7 @@ goto :eof
 REM 
-----------------------------------------------------------------------------
 :okClasspath
 
-"%JAVA_HOME%\bin\java" -DIOTDB_HOME=%IOTDB_HOME% %JAVA_OPTS% -cp %CLASSPATH% 
%MAIN_CLASS% %*
+"%JAVA_HOME%\bin\java" -DIOTDB_CLI_HOME=%IOTDB_CLI_HOME% %JAVA_OPTS% -cp 
%CLASSPATH% %MAIN_CLASS% %*
 
 goto finally
 
diff --git a/iotdb-cli/cli/bin/export-csv.sh b/iotdb-cli/cli/bin/export-csv.sh
index a2f400c..940e241 100755
--- a/iotdb-cli/cli/bin/export-csv.sh
+++ b/iotdb-cli/cli/bin/export-csv.sh
@@ -22,8 +22,8 @@ echo ------------------------------------------
 echo Starting IoTDB Client Export Script
 echo ------------------------------------------
 
-if [ -z "${IOTDB_HOME}" ]; then
-    export IOTDB_HOME="$(cd "`dirname "$0"`"/..; pwd)"
+if [ -z "${IOTDB_CLI_HOME}" ]; then
+    export IOTDB_CLI_HOME="$(cd "`dirname "$0"`"/..; pwd)"
 fi
 
 if [ -n "$JAVA_HOME" ]; then
@@ -43,11 +43,11 @@ if [ -z $JAVA ] ; then
 fi
 
 CLASSPATH=""
-for f in ${IOTDB_HOME}/lib/*.jar; do
+for f in ${IOTDB_CLI_HOME}/lib/*.jar; do
     CLASSPATH=${CLASSPATH}":"$f
 done
 
 MAIN_CLASS=org.apache.iotdb.cli.tool.ExportCsv
 
-"$JAVA" -DIOTDB_HOME=${IOTDB_HOME} -cp "$CLASSPATH" "$MAIN_CLASS" "$@"
+"$JAVA" -DIOTDB_CLI_HOME=${IOTDB_CLI_HOME} -cp "$CLASSPATH" "$MAIN_CLASS" "$@"
 exit $?
\ No newline at end of file
diff --git a/iotdb-cli/cli/bin/import-csv.bat b/iotdb-cli/cli/bin/import-csv.bat
index 4dfcdd2..1d4cab7 100644
--- a/iotdb-cli/cli/bin/import-csv.bat
+++ b/iotdb-cli/cli/bin/import-csv.bat
@@ -25,7 +25,7 @@ echo ````````````````````````````````````````````````
 if "%OS%" == "Windows_NT" setlocal
 
 pushd %~dp0..
-if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%CD%
+if NOT DEFINED IOTDB_CLI_HOME set IOTDB_CLI_HOME=%CD%
 popd
 
 if NOT DEFINED MAIN_CLASS set MAIN_CLASS=org.apache.iotdb.cli.tool.ImportCsv
@@ -34,14 +34,14 @@ if NOT DEFINED JAVA_HOME goto :err
 @REM 
-----------------------------------------------------------------------------
 @REM JVM Opts we'll use in legacy run or installation
 set JAVA_OPTS=-ea^
- -DIOTDB_HOME=%IOTDB_HOME%
+ -DIOTDB_CLI_HOME=%IOTDB_CLI_HOME%
 
 @REM ***** CLASSPATH library setting *****
 @REM Ensure that any user defined CLASSPATH variables are not used on startup
 set CLASSPATH=""
 
-REM For each jar in the IOTDB_HOME lib directory call append to build the 
CLASSPATH variable.
-for %%i in ("%IOTDB_HOME%\lib\*.jar") do call :append "%%i"
+REM For each jar in the IOTDB_CLI_HOME lib directory call append to build the 
CLASSPATH variable.
+for %%i in ("%IOTDB_CLI_HOME%\lib\*.jar") do call :append "%%i"
 goto okClasspath
 
 :append
@@ -51,7 +51,7 @@ goto :eof
 REM 
-----------------------------------------------------------------------------
 :okClasspath
 
-"%JAVA_HOME%\bin\java" -DIOTDB_HOME=%IOTDB_HOME% %JAVA_OPTS% -cp %CLASSPATH% 
%MAIN_CLASS% %*
+"%JAVA_HOME%\bin\java" -DIOTDB_CLI_HOME=%IOTDB_CLI_HOME% %JAVA_OPTS% -cp 
%CLASSPATH% %MAIN_CLASS% %*
 
 goto finally
 
diff --git a/iotdb-cli/cli/bin/import-csv.sh b/iotdb-cli/cli/bin/import-csv.sh
index e56868e..80b700b 100755
--- a/iotdb-cli/cli/bin/import-csv.sh
+++ b/iotdb-cli/cli/bin/import-csv.sh
@@ -22,8 +22,8 @@ echo ------------------------------------------
 echo Starting IoTDB Client Import Script
 echo ------------------------------------------
 
-if [ -z "${IOTDB_HOME}" ]; then
-    export IOTDB_HOME="$(cd "`dirname "$0"`"/..; pwd)"
+if [ -z "${IOTDB_CLI_HOME}" ]; then
+    export IOTDB_CLI_HOME="$(cd "`dirname "$0"`"/..; pwd)"
 fi
 
 if [ -n "$JAVA_HOME" ]; then
@@ -43,11 +43,11 @@ if [ -z $JAVA ] ; then
 fi
 
 CLASSPATH=""
-for f in ${IOTDB_HOME}/lib/*.jar; do
+for f in ${IOTDB_CLI_HOME}/lib/*.jar; do
     CLASSPATH=${CLASSPATH}":"$f
 done
 
 MAIN_CLASS=org.apache.iotdb.cli.tool.ImportCsv
 
-"$JAVA" -DIOTDB_HOME=${IOTDB_HOME} -cp "$CLASSPATH" "$MAIN_CLASS" "$@"
+"$JAVA" -DIOTDB_CLI_HOME=${IOTDB_CLI_HOME} -cp "$CLASSPATH" "$MAIN_CLASS" "$@"
 exit $?
\ No newline at end of file
diff --git a/iotdb-cli/cli/bin/start-client.bat 
b/iotdb-cli/cli/bin/start-client.bat
index d691235..e129869 100755
--- a/iotdb-cli/cli/bin/start-client.bat
+++ b/iotdb-cli/cli/bin/start-client.bat
@@ -25,7 +25,7 @@ echo ````````````````````````
 if "%OS%" == "Windows_NT" setlocal
 
 pushd %~dp0..
-if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%CD%
+if NOT DEFINED IOTDB_CLI_HOME set IOTDB_CLI_HOME=%CD%
 popd
 
 if NOT DEFINED MAIN_CLASS set MAIN_CLASS=org.apache.iotdb.cli.client.Client
@@ -34,10 +34,10 @@ if NOT DEFINED JAVA_HOME goto :err
 @REM 
-----------------------------------------------------------------------------
 @REM JVM Opts we'll use in legacy run or installation
 set JAVA_OPTS=-ea^
- -DIOTDB_HOME=%IOTDB_HOME%
+ -DIOTDB_CLI_HOME=%IOTDB_CLI_HOME%
 
-REM For each jar in the IOTDB_HOME lib directory call append to build the 
CLASSPATH variable.
-for %%i in ("%IOTDB_HOME%\lib\*.jar") do call :append "%%i"
+REM For each jar in the IOTDB_CLI_HOME lib directory call append to build the 
CLASSPATH variable.
+for %%i in ("%IOTDB_CLI_HOME%\lib\*.jar") do call :append "%%i"
 goto okClasspath
 
 :append
diff --git a/iotdb-cli/cli/bin/start-client.sh 
b/iotdb-cli/cli/bin/start-client.sh
index 7105b15..76c340b 100755
--- a/iotdb-cli/cli/bin/start-client.sh
+++ b/iotdb-cli/cli/bin/start-client.sh
@@ -23,8 +23,8 @@ echo ---------------------
 echo Starting IoTDB Client
 echo ---------------------
 
-if [ -z "${IOTDB_HOME}" ]; then
-  export IOTDB_HOME="$(cd "`dirname "$0"`"/..; pwd)"
+if [ -z "${IOTDB_CLI_HOME}" ]; then
+  export IOTDB_CLI_HOME="$(cd "`dirname "$0"`"/..; pwd)"
 fi
 
 
@@ -32,7 +32,7 @@ MAIN_CLASS=org.apache.iotdb.cli.client.Client
 
 
 CLASSPATH=""
-for f in ${IOTDB_HOME}/lib/*.jar; do
+for f in ${IOTDB_CLI_HOME}/lib/*.jar; do
   CLASSPATH=${CLASSPATH}":"$f
 done
 
diff --git a/iotdb-cli/src/main/java/org/apache/iotdb/cli/tool/ImportCsv.java 
b/iotdb-cli/src/main/java/org/apache/iotdb/cli/tool/ImportCsv.java
index c805c5e..498af0c 100644
--- a/iotdb-cli/src/main/java/org/apache/iotdb/cli/tool/ImportCsv.java
+++ b/iotdb-cli/src/main/java/org/apache/iotdb/cli/tool/ImportCsv.java
@@ -73,6 +73,8 @@ public class ImportCsv extends AbstractCsvTool {
   private static String errorInsertInfo = "";
   private static boolean errorFlag;
 
+  private static String IOTDB_CLI_HOME = "IOTDB_CLI_HOME";
+
   private static int count;
   private static Statement statement;
 
@@ -437,7 +439,7 @@ public class ImportCsv extends AbstractCsvTool {
   public static void importCsvFromFile(String ip, String port, String username,
       String password, String filename,
       String timeZone) throws SQLException {
-    String property = System.getProperty("IOTDB_HOME");
+    String property = System.getProperty(IOTDB_CLI_HOME);
     if (property == null) {
       errorInsertInfo = ERROR_INFO_STR;
     } else {

Reply via email to