zhannngchen commented on code in PR #22984:
URL: https://github.com/apache/doris/pull/22984#discussion_r1294318533


##########
be/src/olap/tablet.cpp:
##########
@@ -1479,6 +1479,129 @@ void Tablet::get_compaction_status(std::string* 
json_result) {
     *json_result = std::string(strbuf.GetString());
 }
 
+// for printing debug info only
+void Tablet::get_compaction_status_without_lock(std::string* json_result) {
+    rapidjson::Document root;
+    root.SetObject();
+
+    rapidjson::Document path_arr;
+    path_arr.SetArray();
+
+    std::vector<RowsetSharedPtr> rowsets;
+    std::vector<RowsetSharedPtr> stale_rowsets;
+    std::vector<bool> delete_flags;
+
+    rowsets.reserve(_rs_version_map.size());
+    for (auto& it : _rs_version_map) {
+        rowsets.push_back(it.second);
+    }
+    std::sort(rowsets.begin(), rowsets.end(), Rowset::comparator);
+
+    stale_rowsets.reserve(_stale_rs_version_map.size());
+    for (auto& it : _stale_rs_version_map) {
+        stale_rowsets.push_back(it.second);
+    }
+    std::sort(stale_rowsets.begin(), stale_rowsets.end(), Rowset::comparator);
+
+    delete_flags.reserve(rowsets.size());
+    for (auto& rs : rowsets) {
+        delete_flags.push_back(rs->rowset_meta()->has_delete_predicate());
+    }
+    // get snapshot version path json_doc
+    _timestamped_version_tracker.get_stale_version_path_json_doc(path_arr);
+
+    rapidjson::Value cumulative_policy_type;
+    std::string policy_type_str = "cumulative compaction policy not 
initializied";
+    if (_cumulative_compaction_policy != nullptr) {
+        policy_type_str = _cumulative_compaction_policy->name();
+    }
+    cumulative_policy_type.SetString(policy_type_str.c_str(), 
policy_type_str.length(),
+                                     root.GetAllocator());
+    root.AddMember("cumulative policy type", cumulative_policy_type, 
root.GetAllocator());
+    root.AddMember("cumulative point", _cumulative_point.load(), 
root.GetAllocator());
+    rapidjson::Value cumu_value;
+    std::string format_str = 
ToStringFromUnixMillis(_last_cumu_compaction_failure_millis.load());
+    cumu_value.SetString(format_str.c_str(), format_str.length(), 
root.GetAllocator());
+    root.AddMember("last cumulative failure time", cumu_value, 
root.GetAllocator());
+    rapidjson::Value base_value;
+    format_str = 
ToStringFromUnixMillis(_last_base_compaction_failure_millis.load());
+    base_value.SetString(format_str.c_str(), format_str.length(), 
root.GetAllocator());
+    root.AddMember("last base failure time", base_value, root.GetAllocator());
+    rapidjson::Value full_value;
+    format_str = 
ToStringFromUnixMillis(_last_full_compaction_failure_millis.load());
+    base_value.SetString(format_str.c_str(), format_str.length(), 
root.GetAllocator());
+    root.AddMember("last full failure time", full_value, root.GetAllocator());
+    rapidjson::Value cumu_success_value;
+    format_str = 
ToStringFromUnixMillis(_last_cumu_compaction_success_millis.load());
+    cumu_success_value.SetString(format_str.c_str(), format_str.length(), 
root.GetAllocator());
+    root.AddMember("last cumulative success time", cumu_success_value, 
root.GetAllocator());
+    rapidjson::Value base_success_value;
+    format_str = 
ToStringFromUnixMillis(_last_base_compaction_success_millis.load());
+    base_success_value.SetString(format_str.c_str(), format_str.length(), 
root.GetAllocator());
+    root.AddMember("last base success time", base_success_value, 
root.GetAllocator());
+    rapidjson::Value full_success_value;
+    format_str = 
ToStringFromUnixMillis(_last_full_compaction_success_millis.load());
+    full_success_value.SetString(format_str.c_str(), format_str.length(), 
root.GetAllocator());
+    root.AddMember("last full success time", full_success_value, 
root.GetAllocator());
+
+    // print all rowsets' version as an array
+    rapidjson::Document versions_arr;

Review Comment:
   Log with json is too costive



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to