Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix es_scan_reader_test in debug mode #1905

Merged
merged 1 commit into from
Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions be/src/exec/es/es_scan_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ Status ESScanReader::get_next(bool* scan_eos, std::unique_ptr<ScrollParser>& scr
LOG(WARNING) << "request scroll search failure["
<< "http status" << status
<< ", response: " << (response.empty() ? "empty response" : response);
if (status == 404) {
imay marked this conversation as resolved.
Show resolved Hide resolved
return Status::InternalError("No search context found for " + _scroll_id);
}
return Status::InternalError("request scroll search failure: " + (response.empty() ? "empty response" : response));
}
}
Expand All @@ -125,11 +122,7 @@ Status ESScanReader::get_next(bool* scan_eos, std::unique_ptr<ScrollParser>& scr
return Status::OK();
}

if (scroll_parser->get_size() < _batch_size) {
_eos = true;
} else {
_eos = false;
}
_eos = scroll_parser->get_size() < _batch_size;

*scan_eos = false;
return Status::OK();
Expand Down
7 changes: 4 additions & 3 deletions be/test/exec/es_scan_reader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class RestSearchScrollAction : public HttpHandler {
end_search_result.AddMember("_scroll_id", scroll_id_value, allocator);

rapidjson::Value outer_hits(rapidjson::kObjectType);
outer_hits.AddMember("total", 10, allocator);
outer_hits.AddMember("total", 0, allocator);
end_search_result.AddMember("hits", outer_hits, allocator);
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
Expand All @@ -130,7 +130,7 @@ class RestSearchScrollAction : public HttpHandler {
search_result.AddMember("_scroll_id", scroll_id_value, allocator);

rapidjson::Value outer_hits(rapidjson::kObjectType);
outer_hits.AddMember("total", 10, allocator);
outer_hits.AddMember("total", 1, allocator);
rapidjson::Value inner_hits(rapidjson::kArrayType);
rapidjson::Value source_docuement(rapidjson::kObjectType);
source_docuement.AddMember("id", start, allocator);
Expand Down Expand Up @@ -225,11 +225,12 @@ TEST_F(MockESServerTest, workflow) {
props[ESScanReader::KEY_QUERY] = ESScrollQueryBuilder::build(props, fields, predicates);
ESScanReader reader(target, props);
auto st = reader.open();
// ASSERT_TRUE(st.ok());
ASSERT_TRUE(st.ok());
bool eos = false;
std::unique_ptr<ScrollParser> parser = nullptr;
while(!eos){
st = reader.get_next(&eos, parser);
ASSERT_TRUE(st.ok());
if(eos) {
break;
}
Expand Down