Skip to content

Commit

Permalink
check crossQueue length (apache#363)
Browse files Browse the repository at this point in the history
* fix cross queue length

* fix cross rule logs
  • Loading branch information
lemonjuicelove authored Dec 4, 2023
1 parent a078cb2 commit 1cda946
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class AcrossClusterRuleKeys {

public static final String KEY_CROSS_QUEUE = "crossQueue";

public static final int KEY_CROSS_QUEUE_LENGTH = 25;

public static final String KEY_START_TIME = "startTime";

public static final String KEY_END_TIME = "endTime";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.apache.linkis.configuration.conf.AcrossClusterRuleKeys.KEY_CROSS_QUEUE_LENGTH;

@Api(tags = "across cluster rule api")
@RestController
@RequestMapping(path = "/configuration/acrossClusterRule")
Expand Down Expand Up @@ -223,7 +225,8 @@ public Message updateAcrossClusterRule(
|| StringUtils.isBlank(CPUThreshold)
|| StringUtils.isBlank(MemoryThreshold)
|| StringUtils.isBlank(CPUPercentageThreshold)
|| StringUtils.isBlank(MemoryPercentageThreshold)) {
|| StringUtils.isBlank(MemoryPercentageThreshold)
|| crossQueue.length() > KEY_CROSS_QUEUE_LENGTH) {
return Message.error("Failed to add acrossClusterRule: Illegal Input Param");
}

Expand All @@ -248,7 +251,7 @@ public Message updateAcrossClusterRule(
acrossClusterRuleService.updateAcrossClusterRule(acrossClusterRule);
} catch (Exception e) {
log.info("update acrossClusterRule failed:" + e.getMessage());
return Message.error("update acrossClusterRule failed:history already exist");
return Message.error("update acrossClusterRule failed, rule already exits");
}
return Message.ok();
}
Expand Down Expand Up @@ -307,7 +310,8 @@ public Message insertAcrossClusterRule(
|| StringUtils.isBlank(CPUThreshold)
|| StringUtils.isBlank(MemoryThreshold)
|| StringUtils.isBlank(CPUPercentageThreshold)
|| StringUtils.isBlank(MemoryPercentageThreshold)) {
|| StringUtils.isBlank(MemoryPercentageThreshold)
|| crossQueue.length() > KEY_CROSS_QUEUE_LENGTH) {
return Message.error("Failed to add acrossClusterRule: Illegal Input Param");
}

Expand All @@ -332,7 +336,7 @@ public Message insertAcrossClusterRule(
acrossClusterRuleService.insertAcrossClusterRule(acrossClusterRule);
} catch (Exception e) {
log.info("add acrossClusterRule failed:" + e.getMessage());
return Message.error("add acrossClusterRule failed:history already exist");
return Message.error("add acrossClusterRule failed, rule already exits");
}

return Message.ok();
Expand Down

0 comments on commit 1cda946

Please sign in to comment.