Modify the result json format of mini load (#1487)

Mini load is now using stream load framework. But we should keep the
mini load return behavior and result json format be same as old.
So PUBLISH_TIMEOUT error should be treated as OK in mini load.

Also add 2 counters for OlapTableSink profile:
SerializeBatchTime: time of serializing all row batch.
WaitInFlightPacketTime: time of waiting last send packet
This commit is contained in:
Mingyu Chen
2019-07-16 19:15:41 +08:00
committed by GitHub
parent a9e8113b82
commit 4e043e66e2
6 changed files with 70 additions and 6 deletions

View File

@ -810,12 +810,12 @@ void MiniLoadAction::_new_handle(HttpRequest* req) {
}
}
if (!ctx->status.ok()) {
// if failed to commit and status is not PUBLISH_TIMEOUT, rollback the txn.
// PUBLISH_TIMEOUT is treated as OK in mini load, because user will use show load stmt
// to see the final result.
if (!ctx->status.ok() && ctx->status.code() != TStatusCode::PUBLISH_TIMEOUT) {
if (ctx->need_rollback) {
_exec_env->stream_load_executor()->rollback_txn(ctx);
if (ctx->status.code() == TStatusCode::PUBLISH_TIMEOUT) {
ctx->status = Status::PublishTimeout("transation has been rollback because it was timeout in phase of publish");
}
ctx->need_rollback = false;
}
if (ctx->body_sink.get() != nullptr) {
@ -823,7 +823,7 @@ void MiniLoadAction::_new_handle(HttpRequest* req) {
}
}
std::string str = to_json(ctx->status);
std::string str = ctx->to_json_for_mini_load();
HttpChannel::send_reply(req, str);
}