-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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](deltawriter) Enhance file_size validation in _request_slave_tablet_pull_rowset method #48866
base: master
Are you sure you want to change the base?
Conversation
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
run buildall |
TPC-H: Total hot run time: 32580 ms
|
be/src/olap/delta_writer.cpp
Outdated
(*(request->mutable_inverted_indices_size()))[segment_id]; | ||
// Add the new index size to the map value. | ||
*index_size_map_value.mutable_index_sizes()->Add() = std::move(index_size); | ||
int64_t size = safe_get_file_size(inverted_index_file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should return directly instead of not executing the logic if there is an exception?
TPC-DS: Total hot run time: 185736 ms
|
ClickBench: Total hot run time: 30.79 s
|
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
run buildall |
run buildall |
TPC-H: Total hot run time: 32752 ms
|
TPC-DS: Total hot run time: 186036 ms
|
ClickBench: Total hot run time: 30.94 s
|
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
run buildall |
be/src/olap/delta_writer.cpp
Outdated
for (auto&& node_info : slave_tablet_nodes.slave_nodes()) { | ||
_request_slave_tablet_pull_rowset(node_info); | ||
Status status = _request_slave_tablet_pull_rowset(node_info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RETURN_IF_ERROR(_request_slave_tablet_pull_rowset(node_info))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx
be/src/olap/delta_writer.cpp
Outdated
@@ -231,7 +239,26 @@ int64_t BaseDeltaWriter::mem_consumption(MemType mem) { | |||
return _memtable_writer->mem_consumption(mem); | |||
} | |||
|
|||
void DeltaWriter::_request_slave_tablet_pull_rowset(const PNodeInfo& node_info) { | |||
Status safe_get_file_size(const std::string& file_path, int64_t* file_size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you simplify it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already simplify
TPC-H: Total hot run time: 32983 ms
|
TPC-DS: Total hot run time: 186255 ms
|
ClickBench: Total hot run time: 30.76 s
|
be/src/olap/delta_writer.h
Outdated
@@ -144,7 +144,9 @@ class DeltaWriter final : public BaseDeltaWriter { | |||
private: | |||
void _init_profile(RuntimeProfile* profile) override; | |||
|
|||
void _request_slave_tablet_pull_rowset(const PNodeInfo& node_info); | |||
int64_t safe_get_filesize(const std::string& file_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int64_t safe_get_filesize(const std::string& file_path); | |
int64_t _safe_get_filesize(const std::string& file_path); |
be/src/olap/delta_writer.cpp
Outdated
void DeltaWriter::_request_slave_tablet_pull_rowset(const PNodeInfo& node_info) { | ||
Status safe_get_file_size(const std::string& file_path, int64_t* file_size) { | ||
if (file_size == nullptr) { | ||
return Status::InvalidArgument("Null output parameter in safe_get_file_size"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just use CHECK(file_size != nullptr) << "Null output parameter in safe_get_file_size"
run buildall |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
run buildall |
PR approved by at least one committer and no changes requested. |
be/src/olap/delta_writer.cpp
Outdated
CHECK(file_size != nullptr) << "Null output parameter in safe_get_file_size"; | ||
|
||
try { | ||
if (!std::filesystem::exists(file_path)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to check if the file exists. If the file does not exist, the file_size function will throw an exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue has been fixed
be/src/olap/delta_writer.cpp
Outdated
@@ -281,7 +299,9 @@ void DeltaWriter::_request_slave_tablet_pull_rowset(const PNodeInfo& node_info) | |||
for (int segment_id = 0; segment_id < cur_rowset->rowset_meta()->num_segments(); segment_id++) { | |||
auto seg_path = | |||
local_segment_path(tablet_path, cur_rowset->rowset_id().to_string(), segment_id); | |||
int64_t segment_size = std::filesystem::file_size(seg_path); | |||
int64_t segment_size = 0; | |||
RETURN_IF_ERROR(safe_get_file_size(seg_path, &segment_size)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RETURN_IF_ERROR(safe_get_file_size(seg_path, &segment_size)); | |
RETURN_IF_ERROR(_safe_get_file_size(seg_path, &segment_size)); |
compile error.
run buildall |
TPC-H: Total hot run time: 32645 ms
|
TPC-DS: Total hot run time: 192548 ms
|
ClickBench: Total hot run time: 30.82 s
|
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
PR approved by at least one committer and no changes requested. |
What problem does this PR solve?
Issue Number: close
Related PR:
Problem Summary:Enhance file_size validation when synchronizing tablet replicas to other slave nodes check in _request_slave_tablet_pull_rowset on BE.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)