Skip to content

Conversation

@yiguolei
Copy link
Contributor

@yiguolei yiguolei commented May 5, 2024

The problem

Currently, BE use error code in status.h to do error handling. While FE use TStatusCode to do error handling. Sometimes BE will convert status to TStatus and pass to FE. And FE will convert it to TStatusCode, but it may fail because the error code in BE is an int number, and it could not be convert to an ENUM. But we ignore this failure and this is very dangerous. And also FE will send error code to BE such as cancel reason, but be could not get the correct error code.

Proposed changes

  1. thrift , pb, status.h share the same error code space. If error code > 0, then it is defined in TStatus.
  2. Add DCHECK in Status's to_thrift method to make sure FE could get the correct error code.
  3. Add check in main, to ensure error_states are inited successfully and correctly.
  4. Add an unit test to make sure TStatusCode is defined in status.h with error code > 0 and also the error code in status.h > 0 also defined in TStatusCode.

In this way, the developer could define an error code in status.h with error code > 0, it could be passed to FE and FE could convert it to TStatusCode. And also FE could set an error code using TStatusCode and pass to BE, and BE could convert it to status.

In next PR, I will remove PFragmentCancelReason.

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...

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@yiguolei
Copy link
Contributor Author

yiguolei commented May 5, 2024

run buildall

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@yiguolei
Copy link
Contributor Author

yiguolei commented May 5, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.62% (8966/25174)
Line Coverage: 27.24% (73972/271551)
Region Coverage: 26.46% (38205/144393)
Branch Coverage: 23.22% (19460/83802)
Coverage Report: http://coverage.selectdb-in.cc/coverage/29cddd1d00138d1949741116c6b27fe3cff8ab28_29cddd1d00138d1949741116c6b27fe3cff8ab28/report/index.html

@yiguolei
Copy link
Contributor Author

yiguolei commented May 5, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.61% (8965/25175)
Line Coverage: 27.24% (73972/271515)
Region Coverage: 26.46% (38203/144381)
Branch Coverage: 23.23% (19461/83792)
Coverage Report: http://coverage.selectdb-in.cc/coverage/b34538732f4c019eb62e475f3d87f96d4b69081f_b34538732f4c019eb62e475f3d87f96d4b69081f/report/index.html

@yiguolei
Copy link
Contributor Author

yiguolei commented May 6, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.61% (8966/25175)
Line Coverage: 27.24% (73971/271515)
Region Coverage: 26.47% (38213/144381)
Branch Coverage: 23.23% (19462/83792)
Coverage Report: http://coverage.selectdb-in.cc/coverage/7cda265b7188e82b70176a94769a6051605d759c_7cda265b7188e82b70176a94769a6051605d759c/report/index.html

@yiguolei
Copy link
Contributor Author

yiguolei commented May 6, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.61% (8964/25175)
Line Coverage: 27.23% (73945/271514)
Region Coverage: 26.46% (38198/144380)
Branch Coverage: 23.21% (19450/83792)
Coverage Report: http://coverage.selectdb-in.cc/coverage/d48fa4924727038a130a7cad4a2a55f3ed54a3fb_d48fa4924727038a130a7cad4a2a55f3ed54a3fb/report/index.html

@yiguolei
Copy link
Contributor Author

yiguolei commented May 6, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.61% (8965/25175)
Line Coverage: 27.25% (73993/271521)
Region Coverage: 26.47% (38223/144386)
Branch Coverage: 23.23% (19465/83796)
Coverage Report: http://coverage.selectdb-in.cc/coverage/8010566b5bdd3207da18bccc0df9eb50a93fa698_8010566b5bdd3207da18bccc0df9eb50a93fa698/report/index.html

@yiguolei
Copy link
Contributor Author

yiguolei commented May 6, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.63% (8968/25171)
Line Coverage: 27.30% (74014/271163)
Region Coverage: 26.52% (38232/144156)
Branch Coverage: 23.32% (19484/83538)
Coverage Report: http://coverage.selectdb-in.cc/coverage/76b37c591fd801e9aaba2d4afa57351696cbd128_76b37c591fd801e9aaba2d4afa57351696cbd128/report/index.html

@yiguolei
Copy link
Contributor Author

yiguolei commented May 7, 2024

run buildall

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 35.64% (8971/25171)
Line Coverage: 27.28% (74030/271348)
Region Coverage: 26.51% (38238/144247)
Branch Coverage: 23.31% (19492/83612)
Coverage Report: http://coverage.selectdb-in.cc/coverage/22fbd981860d543ab954b8afe955b04e34026f7c_22fbd981860d543ab954b8afe955b04e34026f7c/report/index.html

@gavinchou gavinchou requested a review from platoneko May 7, 2024 07:17
Copy link
Member

@mrhhsg mrhhsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label May 7, 2024
@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2024

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2024

PR approved by anyone and no changes requested.

@gavinchou
Copy link
Contributor

LGTM

@yiguolei yiguolei merged commit 91701dd into apache:master May 7, 2024
yiguolei added a commit that referenced this pull request May 10, 2024
morningman pushed a commit that referenced this pull request May 15, 2024
Because #34397 changed error code of ARITHMETIC_OVERFLOW_ERRROR, so the error msg is not expected in the test.
yiguolei pushed a commit that referenced this pull request May 15, 2024
Because #34397 changed error code of ARITHMETIC_OVERFLOW_ERRROR, so the error msg is not expected in the test.
ByteYue pushed a commit to ByteYue/doris that referenced this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/3.0.0-merged meta-change reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants