Skip to content

Commit

Permalink
fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
TangSiyang2001 committed Aug 29, 2024
1 parent f81b475 commit 9a37230
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 1 addition & 3 deletions be/src/http/action/compaction_score_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <iterator>
#include <limits>
#include <memory>
#include <ranges>
#include <span>
#include <stdexcept>
#include <string>
Expand Down Expand Up @@ -215,10 +214,9 @@ Status CompactionScoreAction::_handle(size_t top_n, bool sync_meta, std::string*
rapidjson::Document root;
root.SetArray();
auto& allocator = root.GetAllocator();
std::ranges::for_each(scores | std::views::take(top_n), [&root, &allocator](const auto& score) {
std::for_each(scores.begin(), scores.begin() + top_n, [&](const auto& score) {
root.PushBack(jsonfy_tablet_compaction_score(score, allocator), allocator);
});

rapidjson::StringBuffer str_buf;
rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(str_buf);
root.Accept(writer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ suite("test_compaction_score_action") {
for (int i=0;i<backendId_to_backendIP.size();i++){
def beHttpAddress =backendId_to_backendIP.entrySet()[i].getValue()+":"+backendId_to_backendHttpPort.entrySet()[i].getValue()
if (isCloudMode()) {
def (code, text, err) = curl("GET",beHttpAddress+"/api/compaction_score?top_n=1&sync_meta=true")
def (code, text, err) = curl("GET",beHttpAddress+"/api/compaction_score?top_n=1\\&sync_meta=false")
def score_str = parseJson(text).get(0).get("compaction_score")
def score = Integer.parseInt(score_str)
assertTrue(score >= 90)
} else {
def (code, text, err) = curl("GET",beHttpAddress+"/api/compaction_score?top_n=1")
def score_str = parseJson(text).get(0).get("compaction_score")
def score = Integer.parseInt(score_str)
assertTrue(score >= 90)
}
def (code, text, err) = curl("GET",beHttpAddress+"/api/compaction_score?top_n=1")
def score_str = parseJson(text).get(0).get("compaction_score")
def score = Integer.parseInt(score_str)
assertTrue(score >= 90)
}

}

0 comments on commit 9a37230

Please sign in to comment.