yujun777 opened a new pull request, #24502:
URL: https://github.com/apache/doris/pull/24502
## Proposed changes
Debug point is a code switch used for debug development.When a debug point
is opened, the corresponding code can be executed.
Both fe and be support debug points.
For example, we want to debug publish version with TOO_MANY_VERSIONS error.
Then we can add debug code in BE:
```
Status StorageEngine::do_publish_version() {
.....
//"test_too_many_versions" is a debug point,
// if it's enabled, then it will return error TOO_MANY_VERSIONS
DBUG_EXECUTE_IF("test_too_many_versions", { return
Err(TOO_MANY_VERSIONS); });
......
}
```
for fe, no macro DBUG_EXECUTE_IF, but just use function
`DebugPointUtil.isEnable(debug_point)` to test if enable a debug point;
To enable a debug point, we need two steps:
1. start fe or be with `config.enable_debug_points = true`;
2. post a http request `/api/debug_point/add/{debug_point_name}` to the fe
or be;
Http API:
1. add a debug point: post
`/api/debug_point/add/{debug_point_name}[?execute=times&timeout=seconds]`.
`execute` is optional, indicates the maximum number of times the debug point
can take effect. `timeout` is optional, indicates the maximum number of seconds
the debug point takes effect;
2. remove a debug point: post `/api/debug_point/remove/{debug_point_name}`;
3. clear all the debug points: post `/api/debug_point/clear`.
## Further comments
If this is a relatively large or complex change, kick off the discussion at
[[email protected]](mailto:[email protected]) by explaining why you
chose the solution you did and what alternatives you considered, etc...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]