Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5a5856d
merge all config file to iotdb-system.properties
shuwenwei May 17, 2024
2dab0a2
modify loadHotModifiedProps
shuwenwei May 17, 2024
da41d83
check old version config files exist
shuwenwei May 17, 2024
6b1e85d
modify docker
shuwenwei May 17, 2024
0a2b4b9
modify scripts
shuwenwei May 20, 2024
930994b
modify auto update tool
shuwenwei May 20, 2024
ae88211
fix config update tool
shuwenwei May 20, 2024
de2128d
fix ut
shuwenwei May 22, 2024
f08b91b
fix bug
shuwenwei May 22, 2024
ae8e574
fix cli scripts
shuwenwei May 22, 2024
13cf9ad
fix it
shuwenwei May 24, 2024
2d08666
Update client-go.yml
HTHou May 24, 2024
eb3f24a
Update client-go.yml
HTHou May 24, 2024
c30b8af
Update client-go.yml
HTHou May 24, 2024
989953e
Update client-go.yml
HTHou May 24, 2024
7e56c2c
Update client-go.yml
HTHou May 24, 2024
907e5d3
fix it
shuwenwei May 27, 2024
3c67e8e
fix conflict
shuwenwei May 27, 2024
a479b0c
Merge branch 'iotdb_master' into mergeConfigFiles
shuwenwei May 27, 2024
573a7b1
fix metric it
shuwenwei May 28, 2024
5e2e02e
Merge branch 'iotdb_master' into mergeConfigFiles
shuwenwei May 30, 2024
750a478
set configuration on node id
shuwenwei May 30, 2024
06f01ba
Merge branch 'iotdb_master' into setConfigurationOnNodeId
shuwenwei May 30, 2024
9929c4f
impl showConfiguration and showConfigurationTemplate
shuwenwei Jun 4, 2024
c6a77e9
add ConfigurationFileUtils
shuwenwei Jun 4, 2024
0f03643
configuration template file
shuwenwei Jun 4, 2024
5ec9fea
add template configuration file to distribution
shuwenwei Jun 5, 2024
924b9ac
modify script for windows
shuwenwei Jun 5, 2024
0253411
Merge branch 'iotdb_master' into setConfigurationOnNodeId
shuwenwei Jun 5, 2024
5476846
fix bug
shuwenwei Jun 5, 2024
b0fbfd5
fix bug
shuwenwei Jun 5, 2024
715af83
fix bug
shuwenwei Jun 5, 2024
68073e8
fix bug
shuwenwei Jun 5, 2024
f78ff9e
fix update file
shuwenwei Jun 5, 2024
9c62b0e
add it
shuwenwei Jun 5, 2024
5854ecc
fix bug
shuwenwei Jun 5, 2024
661dd2c
fix it
shuwenwei Jun 5, 2024
9f94c51
fix it
shuwenwei Jun 5, 2024
ee5cda6
filter immutable config items
shuwenwei Jun 5, 2024
80f734a
fix bug
shuwenwei Jun 5, 2024
dfa0803
fix error msg
shuwenwei Jun 5, 2024
42a5652
add template configuration file to jar
shuwenwei Jun 6, 2024
1f9c532
add license
shuwenwei Jun 6, 2024
2a8722e
add license in generated file
shuwenwei Jun 6, 2024
a1d57c9
fix pom.xml
shuwenwei Jun 6, 2024
5bd5ffa
fix pom.xml
shuwenwei Jun 6, 2024
0319367
fix scripts
shuwenwei Jun 7, 2024
9f50026
fix format
shuwenwei Jun 7, 2024
f654717
fix spell
shuwenwei Jun 7, 2024
8d80e59
fix windows script
shuwenwei Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions distribution/src/assembly/all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/src/assembly/resources/conf</directory>
<excludes>
<exclude>**/*.sh</exclude>
<exclude>**/*.bat</exclude>
<exclude>**/iotdb-system.properties</exclude>
</excludes>
</fileSet>
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/target/conf</directory>
</fileSet>
<fileSet>
<outputDirectory>sbin</outputDirectory>
Expand Down
9 changes: 9 additions & 0 deletions distribution/src/assembly/confignode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/src/assembly/resources/conf</directory>
<excludes>
<exclude>**/*.sh</exclude>
<exclude>**/*.bat</exclude>
<exclude>**/iotdb-system.properties</exclude>
</excludes>
</fileSet>
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/target/conf</directory>
</fileSet>
<!-- <fileSet>-->
<!-- <directory>${maven.multiModuleProjectDirectory}/confignode/src/assembly/resources/tools</directory>-->
Expand Down
9 changes: 9 additions & 0 deletions distribution/src/assembly/datanode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/src/assembly/resources/conf</directory>
<excludes>
<exclude>**/*.sh</exclude>
<exclude>**/*.bat</exclude>
<exclude>**/iotdb-system.properties</exclude>
</excludes>
</fileSet>
<fileSet>
<outputDirectory>conf</outputDirectory>
<directory>${maven.multiModuleProjectDirectory}/iotdb-core/node-commons/target/conf</directory>
</fileSet>
<fileSet>
<outputDirectory>sbin</outputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static void setUp() throws Exception {

@AfterClass
public static void tearDown() throws Exception {
EnvFactory.getEnv().initClusterEnvironment();
EnvFactory.getEnv().cleanClusterEnvironment();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -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"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,39 @@
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"
"%config_file%"') do (
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"
"%config_file%"') do (
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public enum DataNodeRequestType {
STOP_REPAIR_DATA,
LOAD_CONFIGURATION,
SET_SYSTEM_STATUS,
SET_CONFIGURATION,
SHOW_CONFIGURATION,

// Region Maintenance
CREATE_DATA_REGION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -341,6 +342,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,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++) {
Expand All @@ -83,7 +83,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++) {
Expand All @@ -102,7 +102,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) {
Expand Down Expand Up @@ -138,6 +138,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Loading