luoluoyuyu commented on code in PR #14386:
URL: https://github.com/apache/iotdb/pull/14386#discussion_r1903634860
##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/pipe/coordinator/task/PipeTaskCoordinator.java:
##########
@@ -130,6 +132,17 @@ public TSStatus createPipe(TCreatePipeReq req) {
/** Caller should ensure that the method is called in the lock {@link
#lock()}. */
public TSStatus alterPipe(TAlterPipeReq req) {
+ final String pipeName = req.getPipeName();
+ final boolean isSetIfExistsCondition =
+ req.isSetIfExistsCondition() && req.isIfExistsCondition();
+ if (!pipeTaskInfo.isPipeExisted(pipeName, req.isTableModel)) {
+ return isSetIfExistsCondition
+ ? RpcUtils.getStatus(TSStatusCode.SUCCESS_STATUS)
+ : RpcUtils.getStatus(
+ TSStatusCode.PIPE_NOT_EXIST_ERROR,
+ String.format(
+ "Failed to alter pipe %s. Failures: %s does not exist.",
pipeName, pipeName));
Review Comment:
Why do we change here to check whether Pipe exists? It seems that this
judgment exists in `checkAndUpdateRequestBeforeAlterPipeInternal`. I think it
may be better to check whether Pipe exists in
`checkAndUpdateRequestBeforeAlterPipeInternal`.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/dataregion/IoTDBDataRegionExtractor.java:
##########
@@ -134,22 +135,37 @@ public void validate(final PipeParameterValidator
validator) throws Exception {
.getStringOrDefault(
SystemConstant.SQL_DIALECT_KEY,
SystemConstant.SQL_DIALECT_TREE_VALUE)
.equals(SystemConstant.SQL_DIALECT_TREE_VALUE);
- final boolean isTreeModelDataAllowedToBeCaptured =
+ final boolean isCaptureTree =
validator
.getParameters()
.getBooleanOrDefault(
Arrays.asList(
PipeExtractorConstant.EXTRACTOR_CAPTURE_TREE_KEY,
PipeExtractorConstant.SOURCE_CAPTURE_TREE_KEY),
isTreeDialect);
- final boolean isTableModelDataAllowedToBeCaptured =
+ final boolean isCaptureTable =
validator
.getParameters()
.getBooleanOrDefault(
Arrays.asList(
PipeExtractorConstant.EXTRACTOR_CAPTURE_TABLE_KEY,
PipeExtractorConstant.SOURCE_CAPTURE_TABLE_KEY),
!isTreeDialect);
+ if (!isCaptureTree && !isCaptureTable) {
+ throw new PipeParameterNotValidException(
+ "capture.tree and capture.table can not both be specified as false");
+ }
Review Comment:
Is the behavior uniform here? If both parameters are missing, the Tree model
is captured by default.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/dataregion/IoTDBDataRegionExtractor.java:
##########
@@ -134,22 +135,37 @@ public void validate(final PipeParameterValidator
validator) throws Exception {
.getStringOrDefault(
SystemConstant.SQL_DIALECT_KEY,
SystemConstant.SQL_DIALECT_TREE_VALUE)
.equals(SystemConstant.SQL_DIALECT_TREE_VALUE);
- final boolean isTreeModelDataAllowedToBeCaptured =
+ final boolean isCaptureTree =
validator
.getParameters()
.getBooleanOrDefault(
Arrays.asList(
PipeExtractorConstant.EXTRACTOR_CAPTURE_TREE_KEY,
PipeExtractorConstant.SOURCE_CAPTURE_TREE_KEY),
isTreeDialect);
- final boolean isTableModelDataAllowedToBeCaptured =
+ final boolean isCaptureTable =
validator
.getParameters()
.getBooleanOrDefault(
Arrays.asList(
PipeExtractorConstant.EXTRACTOR_CAPTURE_TABLE_KEY,
PipeExtractorConstant.SOURCE_CAPTURE_TABLE_KEY),
!isTreeDialect);
+ if (!isCaptureTree && !isCaptureTable) {
+ throw new PipeParameterNotValidException(
+ "capture.tree and capture.table can not both be specified as false");
+ }
+
+ final boolean isDoubleLiving =
+ validator
+ .getParameters()
+ .getBooleanOrDefault(
+ Arrays.asList(
+ PipeExtractorConstant.EXTRACTOR_MODE_DOUBLE_LIVING_KEY,
+ PipeExtractorConstant.SOURCE_MODE_DOUBLE_LIVING_KEY),
+
PipeExtractorConstant.EXTRACTOR_MODE_DOUBLE_LIVING_DEFAULT_VALUE);
+ final boolean isTreeModelDataAllowedToBeCaptured = isDoubleLiving ||
isCaptureTree;
+ final boolean isTableModelDataAllowedToBeCaptured = isDoubleLiving ||
isCaptureTable;
Review Comment:
Does the parsing of `isDoubleLiving` parameter need to take precedence over
`isCaptureTree` and `isCaptureTable`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]