diff --git a/distribution/src/assembly/all.xml b/distribution/src/assembly/all.xml
index 028af358eac4..9a236d5725a1 100644
--- a/distribution/src/assembly/all.xml
+++ b/distribution/src/assembly/all.xml
@@ -57,6 +57,15 @@
conf
${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/src/assembly/resources/conf
+
+ **/*.sh
+ **/*.bat
+ **/iotdb-system.properties
+
+
+
+ conf
+ ${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/target/conf
sbin
diff --git a/distribution/src/assembly/confignode.xml b/distribution/src/assembly/confignode.xml
index 502b90758cae..3944c62325ef 100644
--- a/distribution/src/assembly/confignode.xml
+++ b/distribution/src/assembly/confignode.xml
@@ -54,6 +54,15 @@
conf
${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/src/assembly/resources/conf
+
+ **/*.sh
+ **/*.bat
+ **/iotdb-system.properties
+
+
+
+ conf
+ ${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/target/conf
diff --git a/distribution/src/assembly/datanode.xml b/distribution/src/assembly/datanode.xml
index 84697fda6d74..9b0ae34a2bbb 100644
--- a/distribution/src/assembly/datanode.xml
+++ b/distribution/src/assembly/datanode.xml
@@ -45,6 +45,15 @@
conf
${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/src/assembly/resources/conf
+
+ **/*.sh
+ **/*.bat
+ **/iotdb-system.properties
+
+
+
+ conf
+ ${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/target/conf
sbin
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRepairDataIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRepairDataIT.java
index 25d2935b9447..15ad2983ca87 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRepairDataIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBRepairDataIT.java
@@ -60,7 +60,7 @@ public static void setUp() throws Exception {
@AfterClass
public static void tearDown() throws Exception {
- EnvFactory.getEnv().initClusterEnvironment();
+ EnvFactory.getEnv().cleanClusterEnvironment();
}
@Test
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
new file mode 100644
index 000000000000..3ab24dd94f70
--- /dev/null
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSetConfigurationIT.java
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+package org.apache.iotdb.db.it;
+
+import org.apache.iotdb.commons.conf.CommonConfig;
+import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.env.cluster.node.ConfigNodeWrapper;
+import org.apache.iotdb.it.env.cluster.node.DataNodeWrapper;
+import org.apache.iotdb.it.framework.IoTDBTestRunner;
+import org.apache.iotdb.itbase.category.LocalStandaloneIT;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.sql.Connection;
+import java.sql.Statement;
+
+@RunWith(IoTDBTestRunner.class)
+@Category({LocalStandaloneIT.class})
+public class IoTDBSetConfigurationIT {
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvFactory.getEnv().initClusterEnvironment();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ EnvFactory.getEnv().cleanClusterEnvironment();
+ }
+
+ @Test
+ public void testSetConfiguration() throws Exception {
+ try (Connection connection = EnvFactory.getEnv().getConnection();
+ Statement statement = connection.createStatement()) {
+ statement.execute("set configuration \"enable_seq_space_compaction\"=\"false\"");
+ statement.execute("set configuration \"enable_unseq_space_compaction\"=\"false\" on 0");
+ statement.execute("set configuration \"enable_cross_space_compaction\"=\"false\" on 1");
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ for (ConfigNodeWrapper configNodeWrapper : EnvFactory.getEnv().getConfigNodeWrapperList()) {
+ String systemPropertiesPath =
+ configNodeWrapper.getNodePath()
+ + File.separator
+ + "conf"
+ + File.separator
+ + CommonConfig.SYSTEM_CONFIG_NAME;
+ File f = new File(systemPropertiesPath);
+ String content = new String(Files.readAllBytes(f.toPath()));
+ Assert.assertTrue(content.contains("enable_seq_space_compaction=false"));
+ Assert.assertTrue(content.contains("enable_unseq_space_compaction=false"));
+ }
+ for (DataNodeWrapper dataNodeWrapper : EnvFactory.getEnv().getDataNodeWrapperList()) {
+ String systemPropertiesPath =
+ dataNodeWrapper.getNodePath()
+ + File.separator
+ + "conf"
+ + File.separator
+ + CommonConfig.SYSTEM_CONFIG_NAME;
+ File f = new File(systemPropertiesPath);
+ String content = new String(Files.readAllBytes(f.toPath()));
+ Assert.assertTrue(content.contains("enable_seq_space_compaction=false"));
+ Assert.assertTrue(content.contains("enable_cross_space_compaction=false"));
+ }
+ }
+}
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSettleIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSettleIT.java
index f173e2ff9d60..d800bb8a054a 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSettleIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSettleIT.java
@@ -56,7 +56,7 @@ public static void setUp() throws Exception {
@AfterClass
public static void tearDown() throws Exception {
close();
- EnvFactory.getEnv().initClusterEnvironment();
+ EnvFactory.getEnv().cleanClusterEnvironment();
}
@Test
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java
index fe8c9c6c39e4..19b487193834 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBSimpleQueryIT.java
@@ -39,7 +39,6 @@
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
-import java.sql.Timestamp;
import java.sql.Types;
import java.time.LocalDate;
import java.util.ArrayList;
@@ -1173,13 +1172,13 @@ public void testNewDataType() {
while (resultSet.next()) {
long time = resultSet.getLong(1);
Date date = resultSet.getDate(2);
- Timestamp timestamp = resultSet.getTimestamp(3);
+ long timestamp = resultSet.getLong(3);
byte[] blob = resultSet.getBytes(4);
String text = resultSet.getString(5);
assertEquals(2024 - 1900, date.getYear());
assertEquals(5 - 1, date.getMonth());
assertEquals(time % 31 + 1, date.getDate());
- assertEquals(time, timestamp.getTime());
+ assertEquals(time, timestamp);
assertArrayEquals(byteArray, blob);
assertEquals(String.valueOf(time), text);
}
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java
index bb2b1d539bff..8eb1026121aa 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/IoTDBAggregationIT.java
@@ -348,8 +348,8 @@ public void countTest() {
public void firstTest() {
String[] retArray =
new String[] {
- "0,2000,2000,2000.0,2000,2000,0x2000,2000-01-01,1970-01-01T00:00:02.000Z",
- "0,500,500,500.0,500,500,0x0500,1500-01-01,1970-01-01T00:00:00.500Z"
+ "0,2000,2000,2000.0,2000,2000,0x2000,2000-01-01,2000",
+ "0,500,500,500.0,500,500,0x0500,1500-01-01,500"
};
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
@@ -453,9 +453,9 @@ public void firstTest() {
public void lastTest() {
String[] retArray =
new String[] {
- "0,8499,8499.0,8499,0x8499,8499-01-01,1970-01-01T00:00:08.499Z",
- "0,1499,1499.0,1499,0x1499,1499-01-01,1970-01-01T00:00:01.499Z",
- "0,2200,2200.0,2200,0x2200,2200-01-01,1970-01-01T00:00:02.200Z"
+ "0,8499,8499.0,8499,0x8499,8499-01-01,8499",
+ "0,1499,1499.0,1499,0x1499,1499-01-01,1499",
+ "0,2200,2200.0,2200,0x2200,2200-01-01,2200"
};
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
@@ -727,10 +727,7 @@ public void firstLastValueTest() throws SQLException {
@Test
public void maxminValueTest() {
String[] retArray =
- new String[] {
- "0,8499,500.0,999,1000,8499-01-01,1000-01-01,1970-01-01T00:00:08.499Z,1970-01-01T00:00:00.500Z",
- "0,2499,500.0"
- };
+ new String[] {"0,8499,500.0,999,1000,8499-01-01,1000-01-01,8499,500", "0,2499,500.0"};
try (Connection connection = EnvFactory.getEnv().getConnection();
Statement statement = connection.createStatement()) {
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java
index 1ccdc8c1195e..ccf435f83620 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/maxby/IoTDBMaxByIT.java
@@ -210,8 +210,7 @@ public void testMaxByWithDifferentXAndYInputTypes() {
"root.db.d1",
new String[] {"x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10"},
new String[] {"y1", "y2", "y3", "y4", "y7", "y9", "y10"});
- String[] retArray =
- new String[] {"3,3,3.0,3.0,false,3,3,0x33,2024-01-03,1970-01-01T00:00:00.003Z,"};
+ String[] retArray = new String[] {"3,3,3.0,3.0,false,3,3,0x33,2024-01-03,3,"};
for (Map.Entry expectedHeader : expectedHeaders.entrySet()) {
String y = expectedHeader.getKey();
resultSetEqualTest(
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/minby/IoTDBMinByIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/minby/IoTDBMinByIT.java
index 82867e782ccd..77cb86e62d4d 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/minby/IoTDBMinByIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/aggregation/minby/IoTDBMinByIT.java
@@ -210,8 +210,7 @@ public void testMaxByWithDifferentXAndYInputTypes() {
"root.db.d1",
new String[] {"x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10"},
new String[] {"y1", "y2", "y3", "y4", "y7", "y9", "y10"});
- String[] retArray =
- new String[] {"3,3,3.0,3.0,false,3,3,0x33,2024-01-03,1970-01-01T00:00:00.003Z,"};
+ String[] retArray = new String[] {"3,3,3.0,3.0,false,3,3,0x33,2024-01-03,3,"};
for (Map.Entry expectedHeader : expectedHeaders.entrySet()) {
String y = expectedHeader.getKey();
resultSetEqualTest(
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java
new file mode 100644
index 000000000000..c2a2db78b36d
--- /dev/null
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDFWindowQuery2IT.java
@@ -0,0 +1,216 @@
+/*
+ * 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.
+ */
+
+package org.apache.iotdb.db.it.udf;
+
+import org.apache.iotdb.it.env.EnvFactory;
+import org.apache.iotdb.it.framework.IoTDBTestRunner;
+import org.apache.iotdb.itbase.category.ClusterIT;
+import org.apache.iotdb.itbase.constant.UDFTestConstant;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+@RunWith(IoTDBTestRunner.class)
+@Category({ClusterIT.class})
+public class IoTDBUDFWindowQuery2IT {
+ @BeforeClass
+ public static void setUp() throws Exception {
+ EnvFactory.getEnv()
+ .getConfig()
+ .getCommonConfig()
+ .setEnableSeqSpaceCompaction(false)
+ .setEnableUnseqSpaceCompaction(false)
+ .setEnableCrossSpaceCompaction(false)
+ .setUdfMemoryBudgetInMB(5);
+ EnvFactory.getEnv().initClusterEnvironment();
+ createTimeSeries();
+ generateData();
+ registerUDF();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ EnvFactory.getEnv().cleanClusterEnvironment();
+ }
+
+ private static void createTimeSeries() {
+ try (Connection connection = EnvFactory.getEnv().getConnection();
+ Statement statement = connection.createStatement()) {
+ statement.execute("CREATE DATABASE root.sg");
+ statement.execute("CREATE TIMESERIES root.sg.d1.s1 with datatype=INT32,encoding=PLAIN");
+ statement.execute("CREATE TIMESERIES root.sg.d1.s2 with datatype=INT32,encoding=PLAIN");
+ } catch (SQLException throwable) {
+ fail(throwable.getMessage());
+ }
+ }
+
+ private static void generateData() {
+ // SessionWindow
+ try (Connection connection = EnvFactory.getEnv().getConnection();
+ Statement statement = connection.createStatement()) {
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (1, 1, 1)");
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (2, 2, 2)");
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (3, 3, 3)");
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (9, 9, 9)");
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (5, 5, 5)");
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (12, 12, 12)");
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (14, 14, 14)");
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (18, 18, 18)");
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (21, 21, 21)");
+ statement.execute("INSERT INTO root.sg.d1(time, s1, s2) VALUES (24, 24, 24)");
+ } catch (SQLException throwable) {
+ fail(throwable.getMessage());
+ }
+ }
+
+ private static void registerUDF() {
+ try (Connection connection = EnvFactory.getEnv().getConnection();
+ Statement statement = connection.createStatement()) {
+ statement.execute(
+ "CREATE FUNCTION window_start_end AS 'org.apache.iotdb.db.query.udf.example.WindowStartEnd'");
+ } catch (SQLException throwable) {
+ fail(throwable.getMessage());
+ }
+ }
+
+ @Test
+ public void testSessionTimeWindow1() {
+ long[] windowStart = new long[] {12, 18};
+ long[] windowEnd = new long[] {14, 21};
+ testSessionTimeWindowSS("3", windowStart, windowEnd, 12L, 24L);
+ }
+
+ @Test
+ public void testSessionTimeWindow2() {
+ long[] windowStart = new long[] {12, 18};
+ long[] windowEnd = new long[] {14, 24};
+ testSessionTimeWindowSS("3", windowStart, windowEnd, 12L, Long.MAX_VALUE);
+ }
+
+ @Test
+ public void testStateTimeWindow() {
+ long[] windowStart = new long[] {12, 18};
+ long[] windowEnd = new long[] {14, 21};
+ testStateWindowSS("3", windowStart, windowEnd, 12L, 24L);
+ }
+
+ private void testSessionTimeWindowSS(
+ String sessionGap, long[] windowStart, long[] windowEnd, Long displayBegin, Long displayEnd) {
+ String sql;
+ if (displayBegin == null) {
+ sql =
+ String.format(
+ "select window_start_end(s1, '%s'='%s', '%s'='%s') from root.sg.d1",
+ UDFTestConstant.ACCESS_STRATEGY_KEY,
+ UDFTestConstant.ACCESS_STRATEGY_SESSION,
+ UDFTestConstant.SESSION_GAP_KEY,
+ sessionGap);
+ } else {
+ sql =
+ String.format(
+ "select window_start_end(s1, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.sg.d1",
+ UDFTestConstant.ACCESS_STRATEGY_KEY,
+ UDFTestConstant.ACCESS_STRATEGY_SESSION,
+ UDFTestConstant.DISPLAY_WINDOW_BEGIN_KEY,
+ displayBegin,
+ UDFTestConstant.DISPLAY_WINDOW_END_KEY,
+ displayEnd,
+ UDFTestConstant.SESSION_GAP_KEY,
+ sessionGap);
+ }
+
+ try (Connection conn = EnvFactory.getEnv().getConnection();
+ Statement statement = conn.createStatement();
+ ResultSet resultSet = statement.executeQuery(sql)) {
+ assertEquals(2, resultSet.getMetaData().getColumnCount());
+ int cnt = 0;
+ while (resultSet.next()) {
+ Assert.assertEquals(resultSet.getLong(1), windowStart[cnt]);
+ Assert.assertEquals(resultSet.getLong(2), windowEnd[cnt]);
+ cnt++;
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+ private void testStateWindowSS(
+ String delta, long[] windowStart, long[] windowEnd, Long displayBegin, Long displayEnd) {
+ String sql;
+ if (displayBegin == null) {
+ if (delta == null) {
+ sql =
+ String.format(
+ "select window_start_end(%s, '%s'='%s') from root.sg.d1",
+ "s2", UDFTestConstant.ACCESS_STRATEGY_KEY, UDFTestConstant.ACCESS_STRATEGY_STATE);
+ } else {
+ sql =
+ String.format(
+ "select window_start_end(%s, '%s'='%s', '%s'='%s') from root.sg.d1",
+ "s2",
+ UDFTestConstant.ACCESS_STRATEGY_KEY,
+ UDFTestConstant.ACCESS_STRATEGY_STATE,
+ UDFTestConstant.STATE_DELTA_KEY,
+ delta);
+ }
+ } else {
+ sql =
+ String.format(
+ "select window_start_end(%s, '%s'='%s', '%s'='%s', '%s'='%s', '%s'='%s') from root.sg.d1",
+ "s2",
+ UDFTestConstant.ACCESS_STRATEGY_KEY,
+ UDFTestConstant.ACCESS_STRATEGY_STATE,
+ UDFTestConstant.DISPLAY_WINDOW_BEGIN_KEY,
+ displayBegin,
+ UDFTestConstant.DISPLAY_WINDOW_END_KEY,
+ displayEnd,
+ UDFTestConstant.STATE_DELTA_KEY,
+ delta);
+ }
+
+ try (Connection conn = EnvFactory.getEnv().getConnection();
+ Statement statement = conn.createStatement();
+ ResultSet resultSet = statement.executeQuery(sql)) {
+ assertEquals(2, resultSet.getMetaData().getColumnCount());
+ int cnt = 0;
+ while (resultSet.next()) {
+ Assert.assertEquals(resultSet.getLong(1), windowStart[cnt]);
+ Assert.assertEquals(resultSet.getLong(2), windowEnd[cnt]);
+ cnt++;
+ }
+ } catch (SQLException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+}
diff --git a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java
index 61de72829ccc..2ddc99f6ead5 100644
--- a/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java
+++ b/integration-test/src/test/java/org/apache/iotdb/db/it/udf/IoTDBUDTFBuiltinFunctionIT.java
@@ -205,7 +205,7 @@ public void testSelectorFunctions() {
} else if (j == 5) {
assertEquals("2024-01-0" + (i + 1), resultSet.getString(7));
} else if (j == 6) {
- assertEquals(String.format("1970-01-01T00:00:00.00%dZ", i), resultSet.getString(8));
+ assertEquals(String.valueOf(i), resultSet.getString(8));
}
}
}
@@ -251,7 +251,7 @@ public void testSelectorFunctions() {
} else if (j == 5) {
assertEquals("2024-01-0" + (i + 1), resultSet.getString(7));
} else if (j == 6) {
- assertEquals(String.format("1970-01-01T00:00:00.00%dZ", i), resultSet.getString(8));
+ assertEquals(String.valueOf(i), resultSet.getString(8));
}
}
}
diff --git a/iotdb-client/cli/src/main/java/org/apache/iotdb/cli/AbstractCli.java b/iotdb-client/cli/src/main/java/org/apache/iotdb/cli/AbstractCli.java
index bb1d2a2e25ea..88425f7e474a 100644
--- a/iotdb-client/cli/src/main/java/org/apache/iotdb/cli/AbstractCli.java
+++ b/iotdb-client/cli/src/main/java/org/apache/iotdb/cli/AbstractCli.java
@@ -32,6 +32,9 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.lang3.ArrayUtils;
+import org.apache.tsfile.enums.TSDataType;
+import org.apache.tsfile.utils.BytesUtils;
+import org.apache.tsfile.utils.DateUtils;
import java.io.BufferedReader;
import java.io.IOException;
@@ -679,7 +682,7 @@ private static List> cacheResult(
RpcUtils.formatDatetime(
timeFormat, timestampPrecision, resultSet.getLong(i), zoneId);
} else {
- tmp = resultSet.getString(i);
+ tmp = getStringByColumnIndex(ioTDBJDBCResultSet, i, zoneId);
}
if (tmp == null) {
tmp = NULL;
@@ -729,6 +732,35 @@ private static List> cacheResult(
return lists;
}
+ private static String getStringByColumnIndex(
+ IoTDBJDBCResultSet resultSet, int columnIndex, ZoneId zoneId) throws SQLException {
+ TSDataType type = TSDataType.valueOf(resultSet.getColumnTypeByIndex(columnIndex));
+ switch (type) {
+ case BOOLEAN:
+ return String.valueOf(resultSet.getBoolean(columnIndex));
+ case INT32:
+ return String.valueOf(resultSet.getInt(columnIndex));
+ case INT64:
+ return String.valueOf(resultSet.getLong(columnIndex));
+ case FLOAT:
+ return String.valueOf(resultSet.getFloat(columnIndex));
+ case DOUBLE:
+ return String.valueOf(resultSet.getDouble(columnIndex));
+ case TEXT:
+ case STRING:
+ return resultSet.getString(columnIndex);
+ case BLOB:
+ return BytesUtils.parseBlobByteArrayToString(resultSet.getBytes(columnIndex));
+ case DATE:
+ return DateUtils.formatDate(resultSet.getInt(columnIndex));
+ case TIMESTAMP:
+ return RpcUtils.formatDatetime(
+ timeFormat, timestampPrecision, resultSet.getLong(columnIndex), zoneId);
+ default:
+ return null;
+ }
+ }
+
private static List> cacheTracingInfo(ResultSet resultSet, List maxSizeList)
throws Exception {
List> lists = new ArrayList<>(2);
diff --git a/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBJDBCResultSet.java b/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBJDBCResultSet.java
index ab6009343aa5..269d6ec7c267 100644
--- a/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBJDBCResultSet.java
+++ b/iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBJDBCResultSet.java
@@ -1338,4 +1338,12 @@ public List getColumns() {
public List getSgColumns() {
return sgColumns;
}
+
+ public String getColumnTypeByIndex(int columnIndex) {
+ if (!isIgnoreTimeStamp() && columnIndex == 1) {
+ return TSDataType.TIMESTAMP.name();
+ }
+
+ return ioTDBRpcDataSet.columnTypeList.get(columnIndex - 1);
+ }
}
diff --git a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBJDBCDataSet.java b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBJDBCDataSet.java
index cca84cc8c330..5bba6d0ea718 100644
--- a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBJDBCDataSet.java
+++ b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBJDBCDataSet.java
@@ -587,6 +587,7 @@ public String getString(int index, TSDataType tsDataType, byte[][] values) {
case INT32:
return String.valueOf(BytesUtils.bytesToInt(values[index]));
case INT64:
+ case TIMESTAMP:
return String.valueOf(BytesUtils.bytesToLong(values[index]));
case FLOAT:
return String.valueOf(BytesUtils.bytesToFloat(values[index]));
@@ -597,9 +598,6 @@ public String getString(int index, TSDataType tsDataType, byte[][] values) {
return new String(values[index], StandardCharsets.UTF_8);
case BLOB:
return BytesUtils.parseBlobByteArrayToString(values[index]);
- case TIMESTAMP:
- return RpcUtils.formatDatetime(
- RpcUtils.DEFAULT_TIME_FORMAT, "ms", BytesUtils.bytesToLong(values[index]), zoneId);
case DATE:
return DateUtils.formatDate(BytesUtils.bytesToInt(values[index]));
default:
diff --git a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBRpcDataSet.java b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBRpcDataSet.java
index 014c5eedae1f..9eb33fc36b2e 100644
--- a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBRpcDataSet.java
+++ b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/IoTDBRpcDataSet.java
@@ -562,6 +562,7 @@ public String getString(int index, TSDataType tsDataType) {
case INT32:
return String.valueOf(curTsBlock.getColumn(index).getInt(tsBlockIndex));
case INT64:
+ case TIMESTAMP:
return String.valueOf(curTsBlock.getColumn(index).getLong(tsBlockIndex));
case FLOAT:
return String.valueOf(curTsBlock.getColumn(index).getFloat(tsBlockIndex));
@@ -576,9 +577,6 @@ public String getString(int index, TSDataType tsDataType) {
case BLOB:
return BytesUtils.parseBlobByteArrayToString(
curTsBlock.getColumn(index).getBinary(tsBlockIndex).getValues());
- case TIMESTAMP:
- return RpcUtils.formatDatetime(
- timeFormat, "ms", curTsBlock.getColumn(index).getLong(tsBlockIndex), zoneId);
case DATE:
return DateUtils.formatDate(curTsBlock.getColumn(index).getInt(tsBlockIndex));
default:
diff --git a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4 b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
index c2086e8de891..6d3ffe0b837d 100644
--- a/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
+++ b/iotdb-core/antlr/src/main/antlr4/org/apache/iotdb/db/qp/sql/IoTDBSqlParser.g4
@@ -82,7 +82,7 @@ dclStatement
;
utilityStatement
- : flush | clearCache | settle | startRepairData | stopRepairData | explain
+ : flush | clearCache | setConfiguration | settle | startRepairData | stopRepairData | explain
| setSystemStatus | showVersion | showFlushInfo | showLockInfo | showQueryResource
| showQueries | showCurrentTimestamp | killQuery | grantWatermarkEmbedding
| revokeWatermarkEmbedding | loadConfiguration | loadTimeseries | loadFile
@@ -973,6 +973,15 @@ clearCache
: CLEAR CACHE (ON (LOCAL | CLUSTER))?
;
+// Set Configuration
+setConfiguration
+ : SET CONFIGURATION setConfigurationEntry+ (ON INTEGER_LITERAL)?
+ ;
+
+setConfigurationEntry
+ : STRING_LITERAL OPERATOR_SEQ STRING_LITERAL
+ ;
+
// Settle
settle
: SETTLE (prefixPath|tsFilePath=STRING_LITERAL)
diff --git a/iotdb-core/confignode/src/assembly/resources/sbin/stop-confignode.bat b/iotdb-core/confignode/src/assembly/resources/sbin/stop-confignode.bat
index e69764266887..8c0e392f71bd 100644
--- a/iotdb-core/confignode/src/assembly/resources/sbin/stop-confignode.bat
+++ b/iotdb-core/confignode/src/assembly/resources/sbin/stop-confignode.bat
@@ -22,10 +22,15 @@
set current_dir=%~dp0
set superior_dir=%current_dir%\..\
-IF EXIST "%superior%\conf\iotdb-system.properties" (
+IF EXIST "%superior_dir%\conf\iotdb-system.properties" (
set config_file="%superior_dir%\conf\iotdb-system.properties"
) ELSE (
- set config_file="%superior_dir%\conf\iotdb-confignode.properties"
+ IF EXIST "%superior_dir%\conf\iotdb-confignode.properties" (
+ set config_file="%superior_dir%\conf\iotdb-confignode.properties"
+ ) ELSE (
+ echo "No configuration file found. Exiting."
+ exit /b 1
+ )
)
for /f "eol=; tokens=2,2 delims==" %%i in ('findstr /i "^cn_internal_port"
@@ -33,6 +38,11 @@ for /f "eol=; tokens=2,2 delims==" %%i in ('findstr /i "^cn_internal_port"
set cn_internal_port=%%i
)
+if not defined cn_internal_port (
+ echo "cn_internal_port not found in the configuration file. Exiting."
+ exit /b 1
+)
+
echo "check whether the cn_internal_port is used..., port is %cn_internal_port%"
for /f "eol=; tokens=2,2 delims==" %%i in ('findstr /i "cn_internal_address"
@@ -40,6 +50,11 @@ for /f "eol=; tokens=2,2 delims==" %%i in ('findstr /i "cn_internal_address"
set cn_internal_address=%%i
)
+if not defined cn_internal_address (
+ echo "cn_internal_address not found in the configuration file. Exiting."
+ exit /b 1
+)
+
for /f "tokens=5" %%a in ('netstat /ano ^| findstr %cn_internal_address%:%cn_internal_port% ^| findstr LISTENING ') do (
taskkill /f /pid %%a
echo "close ConfigNode, PID:" %%a
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/ConfigNodeRequestType.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/ConfigNodeRequestType.java
index e9aa1e93f9d7..5f3064b4eed7 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/ConfigNodeRequestType.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/ConfigNodeRequestType.java
@@ -27,5 +27,7 @@ public enum ConfigNodeRequestType {
REMOVE_CONFIG_NODE,
DELETE_CONFIG_NODE_PEER,
REPORT_CONFIG_NODE_SHUTDOWN,
- STOP_CONFIG_NODE
+ STOP_CONFIG_NODE,
+ SET_CONFIGURATION,
+ SHOW_CONFIGURATION,
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/DataNodeRequestType.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/DataNodeRequestType.java
index 398b0e3557b8..b53035b29d5a 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/DataNodeRequestType.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/DataNodeRequestType.java
@@ -32,6 +32,8 @@ public enum DataNodeRequestType {
STOP_REPAIR_DATA,
LOAD_CONFIGURATION,
SET_SYSTEM_STATUS,
+ SET_CONFIGURATION,
+ SHOW_CONFIGURATION,
// Region Maintenance
CREATE_DATA_REGION,
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/AsyncDataNodeClientPool.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/AsyncDataNodeClientPool.java
index fe7a7ebfad31..31bc4074701c 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/AsyncDataNodeClientPool.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/AsyncDataNodeClientPool.java
@@ -23,6 +23,7 @@
import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TFlushReq;
+import org.apache.iotdb.common.rpc.thrift.TSetConfigurationReq;
import org.apache.iotdb.common.rpc.thrift.TSetSpaceQuotaReq;
import org.apache.iotdb.common.rpc.thrift.TSetTTLReq;
import org.apache.iotdb.common.rpc.thrift.TSetThrottleQuotaReq;
@@ -342,6 +343,12 @@ private void sendAsyncRequestToDataNode(
(AsyncTSStatusRPCHandler)
clientHandler.createAsyncRPCHandler(requestId, targetDataNode));
break;
+ case SET_CONFIGURATION:
+ client.setConfiguration(
+ (TSetConfigurationReq) clientHandler.getRequest(requestId),
+ (AsyncTSStatusRPCHandler)
+ clientHandler.createAsyncRPCHandler(requestId, targetDataNode));
+ break;
case START_REPAIR_DATA:
client.startRepairData(
(AsyncTSStatusRPCHandler)
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncConfigNodeClientPool.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncConfigNodeClientPool.java
index 04d2c0917698..ab85a9badcb9 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncConfigNodeClientPool.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncConfigNodeClientPool.java
@@ -22,6 +22,7 @@
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
+import org.apache.iotdb.common.rpc.thrift.TSetConfigurationReq;
import org.apache.iotdb.commons.client.ClientPoolFactory;
import org.apache.iotdb.commons.client.IClientManager;
import org.apache.iotdb.commons.client.exception.ClientManagerException;
@@ -88,6 +89,8 @@ public Object sendSyncRequestToConfigNodeWithRetry(
case STOP_CONFIG_NODE:
// Only use stopConfigNode when the ConfigNode is removed.
return client.stopConfigNode((TConfigNodeLocation) req);
+ case SET_CONFIGURATION:
+ return client.setConfiguration((TSetConfigurationReq) req);
default:
return RpcUtils.getStatus(
TSStatusCode.EXECUTE_STATEMENT_ERROR, "Unknown request type: " + requestType);
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java
index 67a018faa703..86afa20d6acc 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java
@@ -65,7 +65,7 @@ private SyncDataNodeClientPool() {
new ClientPoolFactory.SyncDataNodeInternalServiceClientPoolFactory());
}
- public TSStatus sendSyncRequestToDataNodeWithRetry(
+ public Object sendSyncRequestToDataNodeWithRetry(
TEndPoint endPoint, Object req, DataNodeRequestType requestType) {
Throwable lastException = new TException();
for (int retry = 0; retry < DEFAULT_RETRY_NUM; retry++) {
@@ -84,7 +84,7 @@ public TSStatus sendSyncRequestToDataNodeWithRetry(
.setMessage("All retry failed due to: " + lastException.getMessage());
}
- public TSStatus sendSyncRequestToDataNodeWithGivenRetry(
+ public Object sendSyncRequestToDataNodeWithGivenRetry(
TEndPoint endPoint, Object req, DataNodeRequestType requestType, int retryNum) {
Throwable lastException = new TException();
for (int retry = 0; retry < retryNum; retry++) {
@@ -103,7 +103,7 @@ public TSStatus sendSyncRequestToDataNodeWithGivenRetry(
.setMessage("All retry failed due to: " + lastException.getMessage());
}
- private TSStatus executeSyncRequest(
+ private Object executeSyncRequest(
DataNodeRequestType requestType, SyncDataNodeInternalServiceClient client, Object req)
throws TException {
switch (requestType) {
@@ -141,6 +141,8 @@ private TSStatus executeSyncRequest(
return client.deleteOldRegionPeer((TMaintainPeerReq) req);
case RESET_PEER_LIST:
return client.resetPeerList((TResetPeerListReq) req);
+ case SHOW_CONFIGURATION:
+ return client.showConfiguration();
default:
return RpcUtils.getStatus(
TSStatusCode.EXECUTE_STATEMENT_ERROR, "Unknown request type: " + requestType);
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeDescriptor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeDescriptor.java
index 94ed04849ecc..e73ab25debe4 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeDescriptor.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeDescriptor.java
@@ -21,7 +21,7 @@
import org.apache.iotdb.commons.conf.CommonConfig;
import org.apache.iotdb.commons.conf.CommonDescriptor;
-import org.apache.iotdb.commons.conf.ConfigFileAutoUpdateTool;
+import org.apache.iotdb.commons.conf.ConfigurationFileUtils;
import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.exception.BadNodeUrlException;
import org.apache.iotdb.commons.schema.SchemaConstant;
@@ -55,13 +55,13 @@ public class ConfigNodeDescriptor {
private final ConfigNodeConfig conf = new ConfigNodeConfig();
static {
- ConfigFileAutoUpdateTool updateTool = new ConfigFileAutoUpdateTool();
URL systemConfigUrl = getPropsUrl(CommonConfig.SYSTEM_CONFIG_NAME);
URL configNodeUrl = getPropsUrl(CommonConfig.OLD_CONFIG_NODE_CONFIG_NAME);
URL dataNodeUrl = getPropsUrl(CommonConfig.OLD_DATA_NODE_CONFIG_NAME);
URL commonConfigUrl = getPropsUrl(CommonConfig.OLD_COMMON_CONFIG_NAME);
try {
- updateTool.checkAndMayUpdate(systemConfigUrl, configNodeUrl, dataNodeUrl, commonConfigUrl);
+ ConfigurationFileUtils.checkAndMayUpdate(
+ systemConfigUrl, configNodeUrl, dataNodeUrl, commonConfigUrl);
} catch (Exception e) {
LOGGER.error("Failed to update config file", e);
}
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
index 5b6caf403af9..4a3a0f7cf3b3 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
@@ -28,14 +28,17 @@
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.common.rpc.thrift.TSchemaNode;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
+import org.apache.iotdb.common.rpc.thrift.TSetConfigurationReq;
import org.apache.iotdb.common.rpc.thrift.TSetSpaceQuotaReq;
import org.apache.iotdb.common.rpc.thrift.TSetThrottleQuotaReq;
+import org.apache.iotdb.common.rpc.thrift.TShowConfigurationResp;
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
import org.apache.iotdb.commons.auth.AuthException;
import org.apache.iotdb.commons.cluster.NodeStatus;
import org.apache.iotdb.commons.cluster.NodeType;
import org.apache.iotdb.commons.conf.CommonConfig;
import org.apache.iotdb.commons.conf.CommonDescriptor;
+import org.apache.iotdb.commons.conf.ConfigurationFileUtils;
import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.commons.exception.MetadataException;
@@ -210,7 +213,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
import java.io.IOException;
+import java.net.URL;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
@@ -221,6 +226,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -1498,6 +1504,33 @@ public TSStatus clearCache() {
: status;
}
+ @Override
+ public TSStatus setConfiguration(TSetConfigurationReq req) {
+ TSStatus tsStatus = new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
+ int currentNodeId = CONF.getConfigNodeId();
+ if (req.getNodeId() < 0 || currentNodeId == req.getNodeId()) {
+ URL url = ConfigNodeDescriptor.getPropsUrl(CommonConfig.SYSTEM_CONFIG_NAME);
+ if (url == null || !new File(url.getFile()).exists()) {
+ return tsStatus;
+ }
+ File file = new File(url.getFile());
+ Properties properties = new Properties();
+ properties.putAll(req.getConfigs());
+ try {
+ ConfigurationFileUtils.updateConfigurationFile(file, properties);
+ } catch (Exception e) {
+ return RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, e.getMessage());
+ }
+ if (CONF.getConfigNodeId() == req.getNodeId()) {
+ return tsStatus;
+ }
+ }
+ tsStatus = confirmLeader();
+ return tsStatus.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()
+ ? RpcUtils.squashResponseStatusList(nodeManager.setConfiguration(req))
+ : tsStatus;
+ }
+
@Override
public TSStatus startRepairData() {
TSStatus status = confirmLeader();
@@ -1522,6 +1555,25 @@ public TSStatus loadConfiguration() {
: status;
}
+ @Override
+ public TShowConfigurationResp showConfiguration(int nodeId) {
+ if (ConfigNodeDescriptor.getInstance().getConf().getConfigNodeId() == nodeId) {
+ TShowConfigurationResp resp =
+ new TShowConfigurationResp(RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS), "");
+ try {
+ URL propsUrl = ConfigNodeDescriptor.getPropsUrl(CommonConfig.SYSTEM_CONFIG_NAME);
+ resp.setContent(ConfigurationFileUtils.readConfigFileContent(propsUrl));
+ } catch (Exception e) {
+ resp.setStatus(RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR, e.getMessage()));
+ }
+ return resp;
+ }
+ TSStatus status = confirmLeader();
+ return status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()
+ ? nodeManager.showConfiguration(nodeId)
+ : new TShowConfigurationResp(status, "");
+ }
+
@Override
public TSStatus setSystemStatus(String systemStatus) {
TSStatus status = confirmLeader();
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
index 3ac0ee6ade41..919e876bac21 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java
@@ -23,7 +23,9 @@
import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TFlushReq;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
+import org.apache.iotdb.common.rpc.thrift.TSetConfigurationReq;
import org.apache.iotdb.common.rpc.thrift.TSetSpaceQuotaReq;
+import org.apache.iotdb.common.rpc.thrift.TShowConfigurationResp;
import org.apache.iotdb.commons.cluster.NodeStatus;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.commons.path.PathPatternTree;
@@ -479,6 +481,9 @@ TDataPartitionTableResp getOrCreateDataPartition(
/** Clear cache on all DataNodes. */
TSStatus clearCache();
+ /** Set Configuration. */
+ TSStatus setConfiguration(TSetConfigurationReq req);
+
/** Check and repair unsorted tsfile by compaction. */
TSStatus startRepairData();
@@ -488,6 +493,9 @@ TDataPartitionTableResp getOrCreateDataPartition(
/** Load configuration on all DataNodes. */
TSStatus loadConfiguration();
+ /** Show content of configuration file on specified node */
+ TShowConfigurationResp showConfiguration(int nodeId);
+
/** Set system status on all DataNodes. */
TSStatus setSystemStatus(String status);
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/NodeManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/NodeManager.java
index 664fd6b2cd5d..a0af5578b59b 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/NodeManager.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/NodeManager.java
@@ -26,6 +26,8 @@
import org.apache.iotdb.common.rpc.thrift.TFlushReq;
import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
+import org.apache.iotdb.common.rpc.thrift.TSetConfigurationReq;
+import org.apache.iotdb.common.rpc.thrift.TShowConfigurationResp;
import org.apache.iotdb.commons.cluster.NodeStatus;
import org.apache.iotdb.commons.cluster.NodeType;
import org.apache.iotdb.commons.cluster.RegionRoleType;
@@ -33,9 +35,11 @@
import org.apache.iotdb.commons.conf.CommonDescriptor;
import org.apache.iotdb.commons.consensus.ConsensusGroupId;
import org.apache.iotdb.commons.service.metric.MetricService;
+import org.apache.iotdb.confignode.client.ConfigNodeRequestType;
import org.apache.iotdb.confignode.client.DataNodeRequestType;
import org.apache.iotdb.confignode.client.async.AsyncDataNodeClientPool;
import org.apache.iotdb.confignode.client.async.handlers.AsyncClientHandler;
+import org.apache.iotdb.confignode.client.sync.SyncConfigNodeClientPool;
import org.apache.iotdb.confignode.client.sync.SyncDataNodeClientPool;
import org.apache.iotdb.confignode.conf.ConfigNodeConfig;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
@@ -727,6 +731,54 @@ public List clearCache() {
return clientHandler.getResponseList();
}
+ public List setConfiguration(TSetConfigurationReq req) {
+ List responseList = new ArrayList<>();
+
+ Map dataNodeLocationMap =
+ configManager.getNodeManager().getRegisteredDataNodeLocations();
+ Map targetDataNodes = new HashMap<>();
+ int nodeId = req.getNodeId();
+ // send to datanode
+ if (dataNodeLocationMap.containsKey(nodeId)) {
+ targetDataNodes.put(nodeId, dataNodeLocationMap.get(nodeId));
+ } else if (nodeId < 0) {
+ targetDataNodes.putAll(dataNodeLocationMap);
+ }
+ if (!targetDataNodes.isEmpty()) {
+ AsyncClientHandler