This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new c1c68698e5 Print concrete bytes while validation error happened (#7459)
c1c68698e5 is described below
commit c1c68698e5b95d2eb4171ba15f0688b34788a2d7
Author: Jackie Tien <[email protected]>
AuthorDate: Wed Sep 28 15:02:58 2022 +0800
Print concrete bytes while validation error happened (#7459)
---
.../org/apache/iotdb/db/mpp/execution/driver/Driver.java | 1 -
.../mpp/execution/fragment/FragmentInstanceExecution.java | 8 +++++---
.../apache/iotdb/db/mpp/execution/memory/MemoryPool.java | 12 ++++++++----
.../db/mpp/execution/schedule/AbstractDriverThread.java | 13 +++++++++++--
.../apache/iotdb/db/mpp/plan/execution/QueryExecution.java | 2 +-
5 files changed, 25 insertions(+), 11 deletions(-)
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/driver/Driver.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/driver/Driver.java
index 3462b0fc7a..086234fa12 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/driver/Driver.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/driver/Driver.java
@@ -190,7 +190,6 @@ public abstract class Driver implements IDriver {
}
return NOT_BLOCKED;
} catch (Throwable t) {
- LOGGER.error("Failed to execute fragment instance {}",
driverContext.getId(), t);
List<StackTraceElement> interrupterStack =
exclusiveLock.getInterrupterStack();
if (interrupterStack == null) {
driverContext.failed(t);
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/fragment/FragmentInstanceExecution.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/fragment/FragmentInstanceExecution.java
index 678f5cadce..f2dd3605b0 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/fragment/FragmentInstanceExecution.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/fragment/FragmentInstanceExecution.java
@@ -104,9 +104,6 @@ public class FragmentInstanceExecution {
failedInstances.update(1);
}
- driver.close();
- // help for gc
- driver = null;
if (newState.isFailed()) {
sinkHandle.abort();
} else {
@@ -114,6 +111,11 @@ public class FragmentInstanceExecution {
}
// help for gc
sinkHandle = null;
+ // close the driver after sinkHandle is aborted or closed because
in driver.close() it
+ // will try to call ISinkHandle.setNoMoreTsBlocks()
+ driver.close();
+ // help for gc
+ driver = null;
if (newState.isFailed()) {
scheduler.abortFragmentInstance(instanceId);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java
index 08a5482138..11de85f863 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/memory/MemoryPool.java
@@ -75,11 +75,13 @@ public class MemoryPool {
public MemoryPool(String id, long maxBytes, long maxBytesPerQuery) {
this.id = Validate.notNull(id);
- Validate.isTrue(maxBytes > 0L, "max bytes should be greater than zero.");
+ Validate.isTrue(maxBytes > 0L, "max bytes should be greater than zero:
%d", maxBytes);
this.maxBytes = maxBytes;
Validate.isTrue(
maxBytesPerQuery > 0L && maxBytesPerQuery <= maxBytes,
- "max bytes per query should be greater than zero while less than or
equal to max bytes.");
+ "max bytes per query should be greater than zero while less than or
equal to max bytes. maxBytesPerQuery: %d, maxBytes: %d",
+ maxBytesPerQuery,
+ maxBytes);
this.maxBytesPerQuery = maxBytesPerQuery;
}
@@ -96,7 +98,8 @@ public class MemoryPool {
Validate.notNull(queryId);
Validate.isTrue(
bytes > 0L && bytes <= maxBytesPerQuery,
- "bytes should be greater than zero while less than or equal to max
bytes per query.");
+ "bytes should be greater than zero while less than or equal to max
bytes per query: %d",
+ bytes);
ListenableFuture<Void> result;
synchronized (this) {
@@ -118,7 +121,8 @@ public class MemoryPool {
Validate.notNull(queryId);
Validate.isTrue(
bytes > 0L && bytes <= maxBytesPerQuery,
- "bytes should be greater than zero while less than or equal to max
bytes per query.");
+ "bytes should be greater than zero while less than or equal to max
bytes per query: %d",
+ bytes);
if (maxBytes - reservedBytes < bytes
|| maxBytesPerQuery - queryMemoryReservations.getOrDefault(queryId,
0L) < bytes) {
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/AbstractDriverThread.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/AbstractDriverThread.java
index 148b688e0d..b5608a7115 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/AbstractDriverThread.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/schedule/AbstractDriverThread.java
@@ -59,12 +59,21 @@ public abstract class AbstractDriverThread extends Thread
implements Closeable {
Thread.currentThread().interrupt();
break;
}
+
+ if (next == null) {
+ logger.error("DriverTask should never be null");
+ continue;
+ }
+
try (SetThreadName fragmentInstanceName =
new SetThreadName(next.getFragmentInstance().getInfo().getFullId()))
{
execute(next);
} catch (Throwable t) {
- logger.error("[ExecuteFailed]", t);
- if (next != null) {
+ // try-with-resource syntax will call close once after try block is
done, so we need to
+ // reset the thread name here
+ try (SetThreadName fragmentInstanceName =
+ new
SetThreadName(next.getFragmentInstance().getInfo().getFullId())) {
+ logger.error("[ExecuteFailed]", t);
next.setAbortCause(FragmentInstanceAbortedException.BY_INTERNAL_ERROR_SCHEDULED);
scheduler.toAborted(next);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
index a6e7afa979..160b702b3c 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
@@ -367,7 +367,7 @@ public class QueryExecution implements IQueryExecution {
return Optional.empty();
}
} catch (ExecutionException | CancellationException e) {
- stateMachine.transitionToFailed(e);
+ stateMachine.transitionToFailed(e.getCause() != null ? e.getCause() :
e);
if (stateMachine.getFailureStatus() != null) {
throw new IoTDBException(
stateMachine.getFailureStatus().getMessage(),
stateMachine.getFailureStatus().code);