This is an automated email from the ASF dual-hosted git repository.
jihao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 6300558 [TE] fix detection config DTO revert in yaml alert creation
(#3662)
6300558 is described below
commit 6300558a69ceb4175c4a517d5d2386eac01a0d12
Author: Jihao Zhang <[email protected]>
AuthorDate: Tue Jan 8 10:11:24 2019 -0800
[TE] fix detection config DTO revert in yaml alert creation (#3662)
This PR fixes the detection config DTO revert in YAML alert creation.
---
.../com/linkedin/thirdeye/detection/yaml/YamlResource.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git
a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/yaml/YamlResource.java
b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/yaml/YamlResource.java
index 9db98a9..5dc9bdb 100644
---
a/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/yaml/YamlResource.java
+++
b/thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/detection/yaml/YamlResource.java
@@ -144,20 +144,23 @@ public class YamlResource {
}
detectionConfig.setYaml(detectionYaml);
Long detectionConfigId = this.detectionConfigDAO.save(detectionConfig);
+ if (detectionConfigId == null){
+ return Response.serverError().entity(ImmutableMap.of("message", "Save
detection config failed")).build();
+ }
Preconditions.checkNotNull(detectionConfigId, "Save detection config
failed");
// notification
// TODO: Inject detectionConfigId into detection alert config
DetectionAlertConfigDTO alertConfig =
createDetectionAlertConfig(yamls.get("notification"), responseMessage);
if (alertConfig == null) {
- // revert
- this.detectionAlertConfigDAO.deleteById(detectionConfigId);
+ // revert detection DTO
+ this.detectionConfigDAO.deleteById(detectionConfigId);
return
Response.status(Response.Status.BAD_REQUEST).entity(responseMessage).build();
}
Long detectionAlertConfigId =
this.detectionAlertConfigDAO.save(alertConfig);
if (detectionAlertConfigId == null){
- // revert
- this.detectionAlertConfigDAO.deleteById(detectionConfigId);
+ // revert detection DTO
+ this.detectionConfigDAO.deleteById(detectionConfigId);
return Response.serverError().entity(ImmutableMap.of("message", "Save
detection alert config failed")).build();
}
LOG.info("saved detection alert config id {}", detectionAlertConfigId);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]