This is an automated email from the ASF dual-hosted git repository.
JackieTien97 pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new fa8efc20e90 Reduce query execution warning log size (#18415)
fa8efc20e90 is described below
commit fa8efc20e906feca56438fe46c80c30afeae92b0
Author: Jackie Tien <[email protected]>
AuthorDate: Fri Aug 7 16:09:54 2026 +0800
Reduce query execution warning log size (#18415)
---
.../execution/schedule/AbstractDriverThread.java | 26 ++++++++--
.../schemaregion/utils/ResourceByPathUtils.java | 12 ++++-
.../schedule/AbstractDriverThreadTest.java | 60 ++++++++++++++++++++++
.../utils/ResourceByPathUtilsTest.java | 19 +++++++
4 files changed, 110 insertions(+), 7 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/schedule/AbstractDriverThread.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/schedule/AbstractDriverThread.java
index ce30549c78d..f07cb647ad4 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/schedule/AbstractDriverThread.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/schedule/AbstractDriverThread.java
@@ -19,6 +19,8 @@
package org.apache.iotdb.db.queryengine.execution.schedule;
+import org.apache.iotdb.commons.exception.IoTDBException;
+import org.apache.iotdb.commons.exception.IoTDBRuntimeException;
import org.apache.iotdb.commons.utils.ErrorHandlingCommonUtils;
import org.apache.iotdb.db.queryengine.exception.MemoryNotEnoughException;
import
org.apache.iotdb.db.queryengine.execution.schedule.queue.IndexedBlockingQueue;
@@ -30,6 +32,7 @@ import org.slf4j.LoggerFactory;
import java.io.Closeable;
import java.io.IOException;
+import java.time.format.DateTimeParseException;
/** An abstract executor for {@link DriverTask}. */
public abstract class AbstractDriverThread extends Thread implements Closeable
{
@@ -78,8 +81,13 @@ public abstract class AbstractDriverThread extends Thread
implements Closeable {
// reset the thread name here
try (SetThreadName driverTaskName =
new
SetThreadName(next.getDriver().getDriverTaskId().getFullId())) {
- logger.warn("[ExecuteFailed]", e);
- next.setAbortCause(getAbortCause(e));
+ Throwable rootCause = ErrorHandlingCommonUtils.getRootCause(e);
+ if (isExpectedException(rootCause)) {
+ next.setAbortCause(getAbortCause(rootCause));
+ } else {
+ logger.warn("[ExecuteFailed]", rootCause);
+
next.setAbortCause(DriverTaskAbortedException.BY_INTERNAL_ERROR_SCHEDULED);
+ }
scheduler.toAborted(next);
}
} finally {
@@ -116,11 +124,19 @@ public abstract class AbstractDriverThread extends Thread
implements Closeable {
closed = true;
}
- private String getAbortCause(final Exception e) {
- Throwable rootCause = ErrorHandlingCommonUtils.getRootCause(e);
+ static boolean isExpectedException(Throwable rootCause) {
+ return rootCause instanceof MemoryNotEnoughException
+ || rootCause instanceof IoTDBRuntimeException
+ || rootCause instanceof IoTDBException
+ || rootCause instanceof DateTimeParseException;
+ }
+
+ static String getAbortCause(final Throwable rootCause) {
if (rootCause instanceof MemoryNotEnoughException) {
return DriverTaskAbortedException.BY_MEMORY_NOT_ENOUGH;
}
- return DriverTaskAbortedException.BY_INTERNAL_ERROR_SCHEDULED;
+ return rootCause.getMessage() == null
+ ? rootCause.getClass().getSimpleName()
+ : rootCause.getMessage();
}
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/ResourceByPathUtils.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/ResourceByPathUtils.java
index 6a3f7f23ab6..5fdc0e2df1b 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/ResourceByPathUtils.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/ResourceByPathUtils.java
@@ -87,6 +87,14 @@ public abstract class ResourceByPathUtils {
throw new UnsupportedOperationException("Should call exact sub class!");
}
+ static Map<TSDataType, Integer> countDataTypes(List<TSDataType> dataTypes) {
+ Map<TSDataType, Integer> dataTypeCounts = new LinkedHashMap<>();
+ for (TSDataType dataType : dataTypes) {
+ dataTypeCounts.merge(dataType, 1, Integer::sum);
+ }
+ return dataTypeCounts;
+ }
+
public abstract ITimeSeriesMetadata generateTimeSeriesMetadata(
List<ReadOnlyMemChunk> readOnlyMemChunk,
List<IChunkMetadata> chunkMetadataList,
@@ -372,12 +380,12 @@ public abstract class ResourceByPathUtils {
} catch (MemoryNotEnoughException ex) {
if (listRamInfo != null) {
LOGGER.warn(
- "Failed to reserve memory for TVList: ramSize {}, timestampsSize
{}, arrayMemCost {}, rowCount {}, dataTypes {}",
+ "Failed to reserve memory for TVList: ramSize {}, timestampsSize
{}, arrayMemCost {}, rowCount {}, dataTypeCounts {}",
listRamInfo.getRamSize(),
listRamInfo.getTimestampsSize(),
listRamInfo.getArrayMemCost(),
listRamInfo.getRowCount(),
- listRamInfo.getDataTypes());
+ countDataTypes(listRamInfo.getDataTypes()));
}
throw ex;
} finally {
diff --git
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/schedule/AbstractDriverThreadTest.java
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/schedule/AbstractDriverThreadTest.java
new file mode 100644
index 00000000000..8a86134a07b
--- /dev/null
+++
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/schedule/AbstractDriverThreadTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.queryengine.execution.schedule;
+
+import org.apache.iotdb.commons.exception.IoTDBException;
+import org.apache.iotdb.commons.exception.IoTDBRuntimeException;
+import org.apache.iotdb.db.queryengine.exception.MemoryNotEnoughException;
+
+import org.junit.Test;
+
+import java.time.format.DateTimeParseException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class AbstractDriverThreadTest {
+
+ @Test
+ public void testExpectedExceptionClassification() {
+ assertTrue(AbstractDriverThread.isExpectedException(new
MemoryNotEnoughException("no memory")));
+ assertTrue(AbstractDriverThread.isExpectedException(new
IoTDBRuntimeException("known", 500)));
+ assertTrue(AbstractDriverThread.isExpectedException(new
IoTDBException("known", 500)));
+ assertTrue(
+ AbstractDriverThread.isExpectedException(
+ new DateTimeParseException("invalid date", "invalid", 0)));
+
+ assertFalse(AbstractDriverThread.isExpectedException(new
IllegalStateException("unknown")));
+ }
+
+ @Test
+ public void testAbortCauseForExpectedException() {
+ assertEquals(
+ DriverTaskAbortedException.BY_MEMORY_NOT_ENOUGH,
+ AbstractDriverThread.getAbortCause(new MemoryNotEnoughException("no
memory")));
+ assertEquals(
+ "known error",
+ AbstractDriverThread.getAbortCause(new IoTDBRuntimeException("known
error", 500)));
+ assertEquals(
+ "IoTDBException",
+ AbstractDriverThread.getAbortCause(new IoTDBException((String) null,
500)));
+ }
+}
diff --git
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/ResourceByPathUtilsTest.java
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/ResourceByPathUtilsTest.java
index cd1ece64f08..70f4a49e6f3 100644
---
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/ResourceByPathUtilsTest.java
+++
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/schemaregion/utils/ResourceByPathUtilsTest.java
@@ -27,6 +27,7 @@ import org.apache.tsfile.enums.TSDataType;
import org.junit.Assert;
import org.junit.Test;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
@@ -41,6 +42,24 @@ import static org.mockito.Mockito.when;
public class ResourceByPathUtilsTest {
+ @Test
+ public void testCountDataTypes() {
+ Map<TSDataType, Integer> dataTypeCounts =
+ ResourceByPathUtils.countDataTypes(
+ Arrays.asList(
+ TSDataType.INT64,
+ TSDataType.INT32,
+ TSDataType.INT64,
+ TSDataType.BOOLEAN,
+ TSDataType.INT32,
+ TSDataType.INT64));
+
+ Assert.assertEquals(3, dataTypeCounts.size());
+ Assert.assertEquals(Integer.valueOf(3),
dataTypeCounts.get(TSDataType.INT64));
+ Assert.assertEquals(Integer.valueOf(2),
dataTypeCounts.get(TSDataType.INT32));
+ Assert.assertEquals(Integer.valueOf(1),
dataTypeCounts.get(TSDataType.BOOLEAN));
+ }
+
@Test
public void testFlushingQueryLocksTemporaryTVListBeforeRegistration() throws
Exception {
TVList candidate = TVList.newList(TSDataType.INT64);