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:
@ -76,6 +76,49 @@ std::string StreamLoadContext::to_json() const {
|
||||
return s.GetString();
|
||||
}
|
||||
|
||||
/*
|
||||
* The old mini load result format is as followes:
|
||||
* (which defined in src/util/json_util.cpp)
|
||||
*
|
||||
* {
|
||||
* "status" : "Success"("Fail"),
|
||||
* "msg" : "xxxx"
|
||||
* }
|
||||
*
|
||||
*/
|
||||
std::string StreamLoadContext::to_json_for_mini_load() const {
|
||||
rapidjson::StringBuffer s;
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(s);
|
||||
writer.StartObject();
|
||||
|
||||
// status
|
||||
bool show_ok = true;
|
||||
writer.Key("status");
|
||||
switch (status.code()) {
|
||||
case TStatusCode::OK:
|
||||
writer.String("Success");
|
||||
break;
|
||||
case TStatusCode::PUBLISH_TIMEOUT:
|
||||
// treat PUBLISH_TIMEOUT as OK in mini load
|
||||
writer.String("Success");
|
||||
break;
|
||||
default:
|
||||
writer.String("Fail");
|
||||
show_ok = false;
|
||||
break;
|
||||
}
|
||||
// msg
|
||||
writer.Key("msg");
|
||||
if (status.ok() || show_ok) {
|
||||
writer.String("OK");
|
||||
} else {
|
||||
writer.String(status.get_error_msg().c_str());
|
||||
}
|
||||
writer.EndObject();
|
||||
return s.GetString();
|
||||
}
|
||||
|
||||
|
||||
std::string StreamLoadContext::brief(bool detail) const {
|
||||
std::stringstream ss;
|
||||
ss << "id=" << id << ", job id=" << job_id << ", txn id=" << txn_id << ", label=" << label;
|
||||
|
||||
Reference in New Issue
Block a user