Skip to content

Commit 90289f6

Browse files
committed
Merge origin/master into cli-auto-reconnect; resolve receiveCommands conflict (keep reconnection logic)
2 parents ba46ce3 + 7e0837b commit 90289f6

File tree

117 files changed

+1611
-858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1611
-858
lines changed

distribution/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
<descriptor>src/assembly/confignode.xml</descriptor>
8787
<descriptor>src/assembly/cli.xml</descriptor>
8888
<descriptor>src/assembly/library-udf.xml</descriptor>
89-
<descriptor>src/assembly/external-service-impl.xml</descriptor>
9089
</descriptors>
9190
<finalName>apache-iotdb-${project.version}</finalName>
9291
</configuration>

external-service-impl/rest/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@
153153
<dependency>
154154
<groupId>jakarta.ws.rs</groupId>
155155
<artifactId>jakarta.ws.rs-api</artifactId>
156-
<scope>provided</scope>
157156
</dependency>
158157
<dependency>
159158
<groupId>org.apache.iotdb</groupId>

external-service-impl/rest/src/main/java/org/apache/iotdb/rest/protocol/v2/impl/RestApiServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public Response executeFastLastQueryStatement(
239239
contentOfQuerySupplier,
240240
clientSession.getUsername(),
241241
clientSession.getClientAddress());
242-
recordQueries(() -> costTime, contentOfQuerySupplier, t);
242+
recordQueries(() -> costTime, contentOfQuerySupplier, t, false);
243243
}
244244
}
245245
}

integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/AbstractNodeWrapper.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import java.nio.file.Path;
5858
import java.nio.file.Paths;
5959
import java.nio.file.StandardCopyOption;
60+
import java.nio.file.StandardOpenOption;
6061
import java.time.LocalDateTime;
6162
import java.util.ArrayList;
6263
import java.util.Arrays;
@@ -834,4 +835,18 @@ public Process getInstance() {
834835
public int[] getPortList() {
835836
return portList;
836837
}
838+
839+
public void clearLogContent() throws IOException {
840+
Files.newOutputStream(Paths.get(getLogPath()), StandardOpenOption.TRUNCATE_EXISTING).close();
841+
}
842+
843+
public boolean logContains(String content) throws IOException {
844+
List<String> lines = Files.readAllLines(Paths.get(getLogPath()), StandardCharsets.UTF_8);
845+
for (String line : lines) {
846+
if (line.contains(content)) {
847+
return true;
848+
}
849+
}
850+
return false;
851+
}
837852
}

integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAlterTimeSeriesTypeIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import org.apache.iotdb.isession.SessionDataSet;
2727
import org.apache.iotdb.it.env.EnvFactory;
2828
import org.apache.iotdb.it.framework.IoTDBTestRunner;
29-
import org.apache.iotdb.itbase.category.TableClusterIT;
30-
import org.apache.iotdb.itbase.category.TableLocalStandaloneIT;
29+
import org.apache.iotdb.itbase.category.ClusterIT;
30+
import org.apache.iotdb.itbase.category.LocalStandaloneIT;
3131
import org.apache.iotdb.rpc.IoTDBConnectionException;
3232
import org.apache.iotdb.rpc.StatementExecutionException;
3333

@@ -87,7 +87,7 @@
8787

8888
@SuppressWarnings("ResultOfMethodCallIgnored")
8989
@RunWith(IoTDBTestRunner.class)
90-
@Category({TableLocalStandaloneIT.class, TableClusterIT.class})
90+
@Category({LocalStandaloneIT.class, ClusterIT.class})
9191
public class IoTDBAlterTimeSeriesTypeIT {
9292

9393
private static final Logger log = LoggerFactory.getLogger(IoTDBAlterTimeSeriesTypeIT.class);

integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/enhanced/IoTDBPipeIdempotentIT.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,6 @@ public void testDropRoleIdempotent() throws Exception {
400400
Collections.singleton("2,"));
401401
}
402402

403-
// Table model
404-
405403
private void testIdempotent(
406404
final List<String> beforeSqlList,
407405
final String testSql,
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.iotdb.relational.it.query.recent;
21+
22+
import org.apache.iotdb.it.env.EnvFactory;
23+
import org.apache.iotdb.it.env.cluster.node.DataNodeWrapper;
24+
import org.apache.iotdb.it.framework.IoTDBTestRunner;
25+
import org.apache.iotdb.itbase.category.TableLocalStandaloneIT;
26+
27+
import org.junit.AfterClass;
28+
import org.junit.BeforeClass;
29+
import org.junit.Test;
30+
import org.junit.experimental.categories.Category;
31+
import org.junit.runner.RunWith;
32+
33+
import java.io.IOException;
34+
35+
import static org.apache.iotdb.db.it.utils.TestUtils.prepareData;
36+
import static org.apache.iotdb.db.it.utils.TestUtils.prepareTableData;
37+
import static org.apache.iotdb.db.it.utils.TestUtils.resultSetEqualTest;
38+
import static org.apache.iotdb.db.it.utils.TestUtils.tableResultSetEqualTest;
39+
import static org.junit.Assert.assertTrue;
40+
41+
@RunWith(IoTDBTestRunner.class)
42+
@Category({TableLocalStandaloneIT.class})
43+
public class IoTDBDebugQueryIT {
44+
private static final String DATABASE_NAME = "test_db";
45+
private static final String[] createTableSqls =
46+
new String[] {
47+
"CREATE DATABASE " + DATABASE_NAME,
48+
"USE " + DATABASE_NAME,
49+
"create table table1(device string tag, value int32 field)",
50+
"insert into table1(time,device,value) values(2020-01-01 00:00:01.000,'d1',1)",
51+
"FLUSH",
52+
};
53+
private static final String[] createTreeSqls =
54+
new String[] {
55+
"create timeseries root.test.departments.department_id TEXT",
56+
"create timeseries root.test.departments.dep_name TEXT",
57+
"insert into root.test.departments(time, department_id, dep_name) values(1, 'D001', '研发部')",
58+
"FLUSH",
59+
};
60+
private static DataNodeWrapper dataNodeWrapper;
61+
62+
@BeforeClass
63+
public static void setUp() throws Exception {
64+
EnvFactory.getEnv().initClusterEnvironment();
65+
dataNodeWrapper = EnvFactory.getEnv().getDataNodeWrapperList().get(0);
66+
prepareTableData(createTableSqls);
67+
prepareData(createTreeSqls);
68+
}
69+
70+
@AfterClass
71+
public static void tearDown() throws Exception {
72+
EnvFactory.getEnv().cleanClusterEnvironment();
73+
}
74+
75+
@Test
76+
public void tableTest() throws IOException {
77+
// clear log content to reduce lines spanned in logContains check
78+
dataNodeWrapper.clearLogContent();
79+
80+
String[] expectedHeader = new String[] {"time", "device", "value"};
81+
String[] retArray = new String[] {"2020-01-01T00:00:01.000Z,d1,1,"};
82+
String sql = "debug select time,device,value from table1";
83+
tableResultSetEqualTest(sql, expectedHeader, retArray, DATABASE_NAME);
84+
85+
assertTrue(dataNodeWrapper.logContains("Cache miss: table1.d1"));
86+
assertTrue(dataNodeWrapper.logContains(sql));
87+
}
88+
89+
@Test
90+
public void treeTest() throws IOException {
91+
// clear log content to reduce lines spanned in logContains check
92+
dataNodeWrapper.clearLogContent();
93+
94+
String[] expectedHeader =
95+
new String[] {
96+
"Time", "root.test.departments.department_id", "root.test.departments.dep_name"
97+
};
98+
String[] retArray = new String[] {"1,D001,研发部,"};
99+
String sql = "debug select department_id, dep_name from root.test.departments";
100+
resultSetEqualTest(sql, expectedHeader, retArray);
101+
102+
assertTrue(dataNodeWrapper.logContains("Cache miss: root.test.departments"));
103+
assertTrue(dataNodeWrapper.logContains(sql));
104+
}
105+
}

iotdb-client/cli/src/main/java/org/apache/iotdb/cli/AbstractCli.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ private static boolean matchesSessionOrStatementFailure(String msg) {
141141
static final int CODE_ERROR = 1;
142142

143143
static final String ISO8601_ARGS = "disableISO8601";
144-
static final List<String> AGGREGRATE_TIME_LIST = new ArrayList<>();
145144
static final String RPC_COMPRESS_ARGS = "c";
146145
private static final String RPC_COMPRESS_NAME = "rpcCompressed";
147146
static final String TIMEOUT_ARGS = "timeout";

iotdb-client/cli/src/main/java/org/apache/iotdb/cli/Cli.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ private static void executeSql(CliContext ctx) throws TException {
237237
connection.setQueryTimeout(queryTimeout);
238238
properties = connection.getServerProperties();
239239
timestampPrecision = properties.getTimestampPrecision();
240-
AGGREGRATE_TIME_LIST.addAll(properties.getSupportedTimeAggregationOperations());
241240
processCommand(ctx, execute, connection);
242241
ctx.exit(lastProcessStatus);
243242
} catch (SQLException e) {
244-
ctx.getPrinter().println(IOTDB_ERROR_PREFIX + "Can't execute sql because" + e.getMessage());
243+
ctx.getPrinter()
244+
.println(IOTDB_ERROR_PREFIX + ": Can't execute sql because " + e.getMessage());
245245
ctx.exit(CODE_ERROR);
246246
}
247247
}

iotdb-client/cli/src/main/java/org/apache/iotdb/tool/tsfile/ImportTsFileRemotely.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public void sendHandshake() {
164164
"Handshake error with target server ip: %s, port: %s, because: %s.",
165165
client.getIpAddress(), client.getPort(), resp.getStatus()));
166166
} else {
167-
client.setTimeout(PipeConfig.getInstance().getPipeConnectorTransferTimeoutMs());
167+
client.setTimeout(PipeConfig.getInstance().getPipeSinkTransferTimeoutMs());
168168
IOT_PRINTER.println(
169169
String.format(
170170
"Handshake success. Target server ip: %s, port: %s",
@@ -232,7 +232,7 @@ public void doTransfer(final File tsFile, final File modFile) throws PipeExcepti
232232

233233
private void transferFilePieces(final File file, final boolean isMultiFile)
234234
throws PipeException, IOException {
235-
final int readFileBufferSize = PipeConfig.getInstance().getPipeConnectorReadFileBufferSize();
235+
final int readFileBufferSize = PipeConfig.getInstance().getPipeSinkReadFileBufferSize();
236236
final byte[] readBuffer = new byte[readFileBufferSize];
237237
long position = 0;
238238
try (final RandomAccessFile reader = new RandomAccessFile(file, "r")) {
@@ -299,10 +299,9 @@ private void initClient() {
299299
this.client =
300300
new IoTDBSyncClient(
301301
new ThriftClientProperty.Builder()
302-
.setConnectionTimeoutMs(
303-
PipeConfig.getInstance().getPipeConnectorHandshakeTimeoutMs())
302+
.setConnectionTimeoutMs(PipeConfig.getInstance().getPipeSinkHandshakeTimeoutMs())
304303
.setRpcThriftCompressionEnabled(
305-
PipeConfig.getInstance().isPipeConnectorRPCThriftCompressionEnabled())
304+
PipeConfig.getInstance().isPipeSinkRPCThriftCompressionEnabled())
306305
.build(),
307306
getEndPoint().getIp(),
308307
getEndPoint().getPort(),

0 commit comments

Comments
 (0)