Skip to content

Commit c77bb57

Browse files
authored
Optimized the error message & prevented stack printing of information_schema selection when the cluster is closing (#16905)
* DL * ancient-IT
1 parent 2710cb3 commit c77bb57

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,12 @@ public void testTreeViewTable() throws Exception {
10981098
} catch (final SQLException e) {
10991099
assertEquals("701: The system view does not support show create.", e.getMessage());
11001100
}
1101+
try {
1102+
statement.execute("show create table information_schema.tables");
1103+
fail();
1104+
} catch (final SQLException e) {
1105+
assertEquals("701: The system view does not support show create.", e.getMessage());
1106+
}
11011107
try {
11021108
statement.execute("create or replace view a () as root.b.**");
11031109
fail();

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/distribute/TableDistributedPlanGenerator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
2424
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
2525
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
26+
import org.apache.iotdb.commons.exception.IoTDBRuntimeException;
2627
import org.apache.iotdb.commons.partition.DataPartition;
2728
import org.apache.iotdb.commons.partition.SchemaPartition;
2829
import org.apache.iotdb.commons.schema.table.TsTable;
@@ -100,6 +101,7 @@
100101
import org.apache.iotdb.db.queryengine.plan.statement.component.Ordering;
101102
import org.apache.iotdb.db.schemaengine.table.DataNodeTableCache;
102103
import org.apache.iotdb.db.schemaengine.table.DataNodeTreeViewSchemaUtils;
104+
import org.apache.iotdb.rpc.TSStatusCode;
103105

104106
import com.google.common.collect.ImmutableList;
105107
import com.google.common.collect.ImmutableListMultimap;
@@ -1004,7 +1006,11 @@ public List<PlanNode> visitInformationSchemaTableScan(
10041006
List<TDataNodeLocation> dataNodeLocations =
10051007
dataNodeLocationSupplier.getDataNodeLocations(
10061008
node.getQualifiedObjectName().getObjectName());
1007-
checkArgument(!dataNodeLocations.isEmpty(), "DataNodeLocations shouldn't be empty");
1009+
if (dataNodeLocations.isEmpty()) {
1010+
throw new IoTDBRuntimeException(
1011+
"No available dataNodes, may be the cluster is closing",
1012+
TSStatusCode.NO_AVAILABLE_REPLICA.getStatusCode());
1013+
}
10081014

10091015
List<PlanNode> resultTableScanNodeList = new ArrayList<>();
10101016
dataNodeLocations.forEach(

0 commit comments

Comments
 (0)