Skip to content

Commit 50563b6

Browse files
authored
Pipe: Fixed the bug of missing parallel conflict check and receiver log (#16814) (#16820)
1 parent 9ec13a8 commit 50563b6

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/thrift/IoTDBDataNodeReceiver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,10 +707,10 @@ private TSStatus executeStatementAndClassifyExceptions(
707707
} catch (final Exception e) {
708708
PipeLogger.log(
709709
LOGGER::warn,
710+
e,
710711
"Receiver id = %s: Exception encountered while executing statement %s: ",
711712
receiverId.get(),
712-
statement.getPipeLoggingString(),
713-
e);
713+
statement.getPipeLoggingString());
714714
return statement.accept(STATEMENT_EXCEPTION_VISITOR, e);
715715
} finally {
716716
if (Objects.nonNull(allocatedMemoryBlock)) {

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementExceptionVisitor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import org.apache.iotdb.db.queryengine.plan.statement.metadata.template.BatchActivateTemplateStatement;
3939
import org.apache.iotdb.rpc.TSStatusCode;
4040

41+
import java.util.Objects;
42+
4143
/**
4244
* This visitor translated some exceptions to pipe related {@link TSStatus} to help sender classify
4345
* them and apply different error handling tactics. Please DO NOT modify the exceptions returned by
@@ -125,7 +127,11 @@ public TSStatus visitBatchActivateTemplate(
125127
private TSStatus visitGeneralActivateTemplate(
126128
final Statement activateTemplateStatement, final Exception context) {
127129
if (context instanceof MetadataException || context instanceof StatementAnalyzeException) {
128-
return new TSStatus(TSStatusCode.PIPE_RECEIVER_USER_CONFLICT_EXCEPTION.getStatusCode())
130+
return (Objects.nonNull(context.getMessage())
131+
&& context.getMessage().contains("has not been set any template")
132+
? new TSStatus(
133+
TSStatusCode.PIPE_RECEIVER_PARALLEL_OR_USER_CONFLICT_EXCEPTION.getStatusCode())
134+
: new TSStatus(TSStatusCode.PIPE_RECEIVER_USER_CONFLICT_EXCEPTION.getStatusCode()))
129135
.setMessage(context.getMessage());
130136
} else if (isAutoCreateConflict(context)) {
131137
return new TSStatus(TSStatusCode.PIPE_RECEIVER_USER_CONFLICT_EXCEPTION.getStatusCode())

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/visitor/PipeStatementTSStatusVisitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ private TSStatus visitGeneralActivateTemplate(
269269
if (context.getCode() == TSStatusCode.METADATA_ERROR.getStatusCode()
270270
&& context.isSetMessage()
271271
&& context.getMessage().contains("has not been set any template")) {
272-
return new TSStatus(TSStatusCode.PIPE_RECEIVER_USER_CONFLICT_EXCEPTION.getStatusCode())
272+
return new TSStatus(
273+
TSStatusCode.PIPE_RECEIVER_PARALLEL_OR_USER_CONFLICT_EXCEPTION.getStatusCode())
273274
.setMessage(context.getMessage());
274275
}
275276
return visitStatement(activateTemplateStatement, context);

0 commit comments

Comments
 (0)