-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Refactor] Change ALL OLAPStatus to Status #8855
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
Conversation
jackwener
left a comment
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.
TL;DR
|
We should separate this PR |
e70fdbe to
c513b19
Compare
| # Set boost/stacktrace use backtrace api to unwind | ||
| add_definitions(-DBOOST_STACKTRACE_USE_BACKTRACE) | ||
| add_definitions(-DPRINT_ALL_ERR_STATUS_STACKTRACE) | ||
| #add_definitions(-DPRINT_ALL_ERR_STATUS_STACKTRACE) |
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.
why comment out this config?
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.
If this marco is enabled, BE will print all error status to log, it may cause performance problem. So that I disabled it by default. Should enable it manually if it is needed.
| Status err_code = | ||
| SnapshotManager::instance()->make_snapshot(snapshot_request, &snapshot_path, &allow_incremental_clone); | ||
| if (err_code != OLAP_SUCCESS) { | ||
| if (!err_code) { |
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.
why not err_code.ok()? !err_code is same with !err_code.ok() ??
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 maybe ret_code is better.
err_code is not a good name.It seems like !error_code means no error.
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 we should not modify variable name in this PR. Because there maybe multiple status variable in same function. Modify the variable name may cause logic bug. And also, there are too many variables, it may take lot of time.
We may refactor the status variable name in other PRs.
c513b19 to
54bbc8b
Compare
51bd540 to
df40099
Compare
| if (res == OLAP_ERR_BE_NO_SUITABLE_VERSION) { | ||
| res = base_compaction.compact(); | ||
| if (!res) { | ||
| if (res == Status::OLAPInternalError(OLAP_ERR_BE_NO_SUITABLE_VERSION)) { |
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.
Here you call Status::OLAPInternalError only for checking the error code?
Why not do thing like if (res.err_code == OLAP_ERR_BE_NO_SUITABLE_VERSION)
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.
Yes. We'd better not change logic here. And there are many code like this because I use search and replace to change the code. Maybe we could use some code like isNoSuitableVersionError here to check it.
| Status s = memtable->flush(); | ||
| LOG(WARNING) << "Flush memtable failed with res = " << s; | ||
| // If s is not ok, ignore the code, just use other code is ok | ||
| _flush_status.store(s.ok() ? OLAP_SUCCESS : OLAP_ERR_OTHER_ERROR); |
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.
Why not using the code from s?
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.
Error code in S is int16_t, it may not be converted to ErrorCode. And I find we did not justify the errorcode in other code. So that I print the error stack in LOG(WARNING) and using OTHER_ERROR here.
| beta_rowset_reader.cpp | ||
| beta_rowset_writer.cpp) | ||
|
|
||
| target_compile_options(Rowset PUBLIC "-Wno-error=maybe-uninitialized") |
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.
Why adding this?
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.
Some variables in rowset is not initialized, so that I has to add this option to compile successfully. I will add another PR to init all variables and remove this option.
Co-authored-by: Mingyu Chen <morningman.cmy@gmail.com>
| if (largest_segment_group->find_short_key(end_key, &helper_cursor, false, &end_pos) != | ||
| OLAP_SUCCESS) { | ||
| if (largest_segment_group->find_last_row_block(&end_pos) != OLAP_SUCCESS) { | ||
| if (!largest_segment_group->find_short_key(end_key, &helper_cursor, false, &end_pos)) { |
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.
| if (!largest_segment_group->find_short_key(end_key, &helper_cursor, false, &end_pos)) { | |
| if (largest_segment_group->find_short_key(end_key, &helper_cursor, false, &end_pos) != Status::OK()) { |
| OLAP_SUCCESS) { | ||
| if (largest_segment_group->find_last_row_block(&end_pos) != OLAP_SUCCESS) { | ||
| if (!largest_segment_group->find_short_key(end_key, &helper_cursor, false, &end_pos)) { | ||
| if (!largest_segment_group->find_last_row_block(&end_pos)) { |
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.
| if (!largest_segment_group->find_last_row_block(&end_pos)) { | |
| if (largest_segment_group->find_last_row_block(&end_pos) != Status::OK()) { |
|
|
||
| if (_byte_reader->has_next()) { | ||
| if (OLAP_SUCCESS != (res = _byte_reader->next(&_current))) { | ||
| if (!(res = _byte_reader->next(&_current))) { |
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.
| if (!(res = _byte_reader->next(&_current))) { | |
| if (_byte_reader->next(&_current) != Status::OK()) { |
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 suggest we do not modify logic here, it will make the refactor work very difficult and may import bugs. For example, in this case, the res value maybe used in the latter code.
|
|
||
| if (0 == _bits_left) { | ||
| if (OLAP_SUCCESS != (res = _read_byte())) { | ||
| if (!(res = _read_byte())) { |
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.
| if (!(res = _read_byte())) { | |
| if (_read_byte() != res) { |
| Status res = Status::OK(); | ||
|
|
||
| if (OLAP_SUCCESS != (res = _byte_reader->seek(position))) { | ||
| if (!(res = _byte_reader->seek(position))) { |
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.
| if (!(res = _byte_reader->seek(position))) { | |
| if (_byte_reader->seek(position) != res) { |
| if (OLAP_SUCCESS != res) { | ||
| OLAP_LOG_WARNING("fail to init segment reader. [res=%d]", res); | ||
| if (!res.ok()) { | ||
| LOG(WARNING) << "fail to init segment reader. res = " << res; |
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.
Why not using OLAP_LOG_WARNING?
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.
OLAP_LOG_XXXX will be replaced with LOG(WARNING) in the future. LOGGING SYSTEM should also be uniformed.
caiconghui
left a comment
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 logic LGTM, but we need to keep one check status style in the future.
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
|
Add some performance test: class Status { public: Status() { Status(int i) { static Status OK() { static Status ERROR(int i) { bool operator == (const Status& st) { return _precise_code == st._precise_code; } union { }; }; static void newstatus(benchmark::State& state) { static void olapstatus(benchmark::State& state) { new status is slower than olapstatus about 3.6%. Since there are lot of other work during query and the status is returned batch by batch, so that the impact could be ignored. |
|
Add SSB benchmark:
It is very curious new status is a litter better than olapstatus. |
|
I tested with jmeter, 50 concurrency, 1 FE, 1 BE The avg qps decreased from 1400/s to 1300/s, about 7% performance impact at high concurrency senario. But I think this PR can be merged first, and improve it later |
Currently, there are 2 status code in BE, one is common/Status.h, and the other is olap/olap_define.h called OLAPStatus. OLAPStatus is just an enum type, it is very simple and could not save many informations, I will unify these code to common/Status.
1. The compile bug is introduced from apache#8855 2. FE ut bug is introduced from apache#8848 and apache#8770
Currently, there are 2 status code in BE, one is common/Status.h, and the other is olap/olap_define.h called OLAPStatus. OLAPStatus is just an enum type, it is very simple and could not save many informations, I will unify these code to common/Status.
1. The compile bug is introduced from apache#8855 2. FE ut bug is introduced from apache#8848 and apache#8770
Currently, there are 2 status code in BE, one is common/Status.h, and the other is olap/olap_define.h called OLAPStatus. OLAPStatus is just an enum type, it is very simple and could not save many informations, I will unify these code to common/Status.
1. The compile bug is introduced from apache#8855 2. FE ut bug is introduced from apache#8848 and apache#8770
1. The compile bug is introduced from apache#8855 2. FE ut bug is introduced from apache#8848 and apache#8770


Currently, there are 2 status code in BE, one is common/Status.h, and the other is olap/olap_define.h called OLAPStatus.
OLAPStatus is just an enum type, it is very simple and could not save many informations, I will unify these code to common/Status.
Proposed changes
Issue Number: close #xxx
Problem Summary:
Describe the overview of changes.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...