You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ya...@apache.org on 2021/07/15 03:14:56 UTC
[incubator-doris] branch master updated: [Compatibility] Change the
response body of load info api in httpv2. (#6208)
This is an automated email from the ASF dual-hosted git repository.
yangzhg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
The following commit(s) were added to refs/heads/master by this push:
new d5cd3ae [Compatibility] Change the response body of load info api in httpv2. (#6208)
d5cd3ae is described below
commit d5cd3ae5ee617ff696e19b2b01fc02a6d571362d
Author: Mingyu Chen <mo...@gmail.com>
AuthorDate: Thu Jul 15 11:14:45 2021 +0800
[Compatibility] Change the response body of load info api in httpv2. (#6208)
1. To be compatible with response body of GetLoadInfoAction in httpv1.
2. Not drop partition by force in dynamic partition scheduler.
Change-Id: I50864ddadf1a1c25efa16a465940a1129f937d3d
Co-authored-by: chenmingyu <ch...@baidu.com>
---
.../doris/clone/DynamicPartitionScheduler.java | 2 ++
.../doris/httpv2/rest/GetLoadInfoAction.java | 37 ++++++++++++++++++----
2 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java b/fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java
index 9d10469..0162bc7 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java
@@ -285,6 +285,8 @@ public class DynamicPartitionScheduler extends MasterDaemon {
RangeUtils.checkRangeIntersect(reservePartitionKeyRange, checkDropPartitionKey);
if (checkDropPartitionKey.upperEndpoint().compareTo(reservePartitionKeyRange.lowerEndpoint()) <= 0) {
String dropPartitionName = olapTable.getPartition(checkDropPartitionId).getName();
+ // Do not drop the partition "by force", or the partition will be dropped directly instread of being in
+ // catalog recycle bin. This is for safe reason.
dropPartitionClauses.add(new DropPartitionClause(false, dropPartitionName, false, false));
}
} catch (DdlException e) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/GetLoadInfoAction.java b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/GetLoadInfoAction.java
index de83bc1..d79cd5b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/GetLoadInfoAction.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/GetLoadInfoAction.java
@@ -20,7 +20,7 @@ package org.apache.doris.httpv2.rest;
import org.apache.doris.catalog.Catalog;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.MetaNotFoundException;
-import org.apache.doris.httpv2.entity.ResponseEntityBuilder;
+import org.apache.doris.http.rest.RestBaseResult;
import org.apache.doris.load.Load;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.qe.ConnectContext;
@@ -37,6 +37,20 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
// Get load information of one load job
+// To be compatible with old api, we return like this:
+// {
+// "status": "OK",
+// "msg": "Success",
+// "jobInfo": {
+// "dbName": "default_cluster:db1",
+// "tblNames": ["tbl1"],
+// "label": "abc",
+// "clusterName": "default_cluster",
+// "state": "FINISHED",
+// "failMsg": "",
+// "trackingUrl": "\\N"
+// }
+// }
@RestController
public class GetLoadInfoAction extends RestBaseController {
@@ -55,13 +69,13 @@ public class GetLoadInfoAction extends RestBaseController {
request.getParameter(LABEL_KEY),
ConnectContext.get().getClusterName());
if (Strings.isNullOrEmpty(info.dbName)) {
- return ResponseEntityBuilder.badRequest("No database selected");
+ return new RestBaseResult("No database selected");
}
if (Strings.isNullOrEmpty(info.label)) {
- return ResponseEntityBuilder.badRequest("No label selected");
+ return new RestBaseResult("No label selected");
}
if (Strings.isNullOrEmpty(info.clusterName)) {
- return ResponseEntityBuilder.badRequest("No cluster selected");
+ return new RestBaseResult("No cluster selected");
}
RedirectView redirectView = redirectToMaster(request, response);
@@ -83,9 +97,20 @@ public class GetLoadInfoAction extends RestBaseController {
try {
catalog.getLoadManager().getLoadJobInfo(info);
} catch (DdlException e1) {
- return ResponseEntityBuilder.okWithCommonError(e1.getMessage());
+ return new RestBaseResult(e.getMessage());
}
}
- return ResponseEntityBuilder.ok(info);
+ return new Result(info);
+ }
+
+ // This is just same as Result in http/rest/GetLoadInfoAction.java
+ // for compatibility.
+ private static class Result extends RestBaseResult {
+ public Load.JobInfo jobInfo;
+
+ public Result(Load.JobInfo info) {
+ jobInfo = info;
+ }
}
}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org