From ca43fa49af45b6c24fa837de89a0633039a176c3 Mon Sep 17 00:00:00 2001 From: qinhao Date: Tue, 12 Dec 2023 11:44:44 +0800 Subject: [PATCH 01/25] [docs](debug point) fix document error --- .../docs/admin-manual/http-actions/fe/debug-point-action.md | 6 +++--- .../docs/admin-manual/http-actions/fe/debug-point-action.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index cac2afdcd25dac..6910bc573839f0 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -53,8 +53,8 @@ BE 桩子示例代码 ```c++ void Status foo() { // dbug_be_foo_do_nothing is the debug point name. - // When it's active,DEBUG_EXECUTE_IF will execute the code block. - DEBUG_EXECUTE_IF("dbug_be_foo_do_nothing", { return Status.Nothing; }); + // When it's active,DBUG_EXECUTE_IF will execute the code block. + DBUG_EXECUTE_IF("dbug_be_foo_do_nothing", { return Status.Nothing; }); do_foo_action(); @@ -182,4 +182,4 @@ None ``` curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" - ``` \ No newline at end of file + ``` diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index a1c9a59a35b7e8..660445261ca0fe 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -54,8 +54,8 @@ BE 桩子示例代码 void Status foo() { // dbug_be_foo_do_nothing 是一个木桩名字, - // 打开这个木桩之后,DEBUG_EXECUTE_IF 将会执行宏参数中的代码块 - DEBUG_EXECUTE_IF("dbug_be_foo_do_nothing", { return Status.Nothing; }); + // 打开这个木桩之后,DBUG_EXECUTE_IF 将会执行宏参数中的代码块 + DBUG_EXECUTE_IF("dbug_be_foo_do_nothing", { return Status.Nothing; }); do_foo_action(); From 19668b00629c7992b3f8ffb45402a7730aa93b80 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Tue, 12 Dec 2023 17:24:59 +0800 Subject: [PATCH 02/25] [docs](fix) Update debug-point-action.md fix typo and add info --- .../http-actions/fe/debug-point-action.md | 131 ++++++++++++++---- 1 file changed, 101 insertions(+), 30 deletions(-) diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index 660445261ca0fe..f03020a0c19ab5 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -75,7 +75,7 @@ void Status foo() { ### API ``` - POST /api/debug_point/add/{debug_point_name}[?timeout=&execute=] +POST /api/debug_point/add/{debug_point_name}[?timeout=&execute=] ``` @@ -85,10 +85,10 @@ void Status foo() { 木桩名字。必填。 * `timeout` - 超时时间,单位为秒。超时之后,木桩失活。默认值-1表示永远不超时。可填。 + 超时时间,单位为秒。超时之后,木桩失活。默认值-1表示永远不超时。可选。 * `execute` - 木桩最大激活次数。默认值-1表示不限激活次数。可填。 + 木桩最大激活次数。默认值-1表示不限激活次数。可选。 ### Request body @@ -97,12 +97,12 @@ void Status foo() { ### Response - ``` - { - msg: "OK", - code: 0 - } - ``` +``` +{ + msg: "OK", + code: 0 +} +``` ### Examples @@ -110,17 +110,88 @@ void Status foo() { 打开木桩 `foo`,最多激活5次。 - ``` - curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" +``` +curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" - ``` +``` +注意,要先激活木桩,然后再执行含有木桩的代码,代码中的木桩才会生效。 +## 向木桩传递参数 +激活木桩时,还可以向木桩传递参数。 +### API + +``` +POST /api/debug_point/add/{debug_point_name}[?key1=value1&key2=value2&key3=value3...] +``` +* `key1=value1` + 向木桩传递名为key1值为value1的参数,多个参数用&分隔,注意“&”前后没用空格。 + +### Examples + +向FE或BE传递参数的API格式是相同的,只是IP地址和端口不同。 + +假设FE的http_port=8030,则下面的请求激活FE中的木桩`foo`,并传递了两个参数: + +一个名称为percent值为0.5,另一个名称为duration值为3。 + +``` +curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5&duration=3" + +``` + +### 在FE、BE代码中使用参数 +激活FE中的木桩: +``` +curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" + +``` +在FE 代码中使用木桩OlapTableSink.write_random_choose_sink的参数needCatchUp和sinkNum: +```java +private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap bePathsMap) { + DebugPoint debugPoint = DebugPointUtil.getDebugPoint("OlapTableSink.write_random_choose_sink"); + if (debugPoint == null) { + return; + } + boolean needCatchup = debugPoint.param("needCatchUp", false); + int sinkNum = debugPoint.param("sinkNum", 0); + if (sinkNum == 0) { + sinkNum = new SecureRandom().nextInt() % bePathsMap.size() + 1; + } + ... +} +``` + +激活BE中的木桩: +``` +curl -X POST "http://127.0.0.1:8040/api/debug_point/add/TxnManager.prepare_txn.random_failed?percent=0.7 + +``` +在BE代码中使用木桩TxnManager.prepare_txn.random_failed的参数percent: +```c++ +Status TxnManager::prepare_txn(TPartitionId partition_id, TTransactionId transaction_id, + TTabletId tablet_id, TabletUid tablet_uid, const PUniqueId& load_id, + bool ingest) { + TxnKey key(partition_id, transaction_id); + TabletInfo tablet_info(tablet_id, tablet_uid); + std::lock_guard txn_wrlock(_get_txn_map_lock(transaction_id)); + txn_tablet_map_t& txn_tablet_map = _get_txn_tablet_map(transaction_id); + + DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", { + if (rand() % 100 < (100 * dp->param("percent", 0.5))) { + LOG_WARNING("TxnManager.prepare_txn.random_failed random failed"); + return Status::InternalError("debug prepare txn random failed"); + } + }); + ... +} +``` + ## 关闭木桩 ### API ``` - POST /api/debug_point/remove/{debug_point_name} +POST /api/debug_point/remove/{debug_point_name} ``` @@ -137,10 +208,10 @@ void Status foo() { ### Response ``` - { - msg: "OK", - code: 0 - } +{ + msg: "OK", + code: 0 +} ``` ### Examples @@ -149,17 +220,17 @@ void Status foo() { 关闭木桩`foo`。 - ``` - curl -X POST "http://127.0.0.1:8030/api/debug_point/remove/foo" +``` +curl -X POST "http://127.0.0.1:8030/api/debug_point/remove/foo" - ``` +``` ## 清除所有木桩 ### API ``` - POST /api/debug_point/clear +POST /api/debug_point/clear ``` @@ -170,18 +241,18 @@ void Status foo() { ### Response - ``` - { - msg: "OK", - code: 0 - } - ``` +``` +{ + msg: "OK", + code: 0 +} +``` ### Examples 清除所有木桩。 - ``` - curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" - ``` +``` +curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" +``` From 97fe2b74201e78e546e4106bf84d05f3a1b3d210 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 13 Dec 2023 09:59:14 +0800 Subject: [PATCH 03/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 61 +++++++++---------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index f03020a0c19ab5..04e62839a8f0d7 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -117,35 +117,47 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" 注意,要先激活木桩,然后再执行含有木桩的代码,代码中的木桩才会生效。 ## 向木桩传递参数 -激活木桩时,还可以向木桩传递参数。 + +除了 timeout 和 execute,激活木桩时,还可以传递其它自定义参数。 + ### API ``` POST /api/debug_point/add/{debug_point_name}[?key1=value1&key2=value2&key3=value3...] ``` * `key1=value1` - 向木桩传递名为key1值为value1的参数,多个参数用&分隔,注意“&”前后没用空格。 + 向木桩传递自定义参数,名称为 key1,值为 value1,多个参数用&分隔,“&”前后没有空格。 +### Request body + +无 + +### Response + +``` +{ + msg: "OK", + code: 0 +} +``` ### Examples -向FE或BE传递参数的API格式是相同的,只是IP地址和端口不同。 +向 FE 或 BE 传递参数的 REST API 格式相同,只是 IP 地址和端口不同。 -假设FE的http_port=8030,则下面的请求激活FE中的木桩`foo`,并传递了两个参数: +假设 FE 的 http_port=8030,则下面的请求激活 FE 中的木桩`foo`,并传递了两个参数: -一个名称为percent值为0.5,另一个名称为duration值为3。 +一个名称为 percent 值为 0.5,另一个名称为 duration 值为 3。 ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5&duration=3" - ``` ### 在FE、BE代码中使用参数 -激活FE中的木桩: +激活 FE 中的木桩并传递参数: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" - ``` -在FE 代码中使用木桩OlapTableSink.write_random_choose_sink的参数needCatchUp和sinkNum: +在 FE 代码中使用木桩 OlapTableSink.write_random_choose_sink 的参数 needCatchUp 和 sinkNum(区分大小写): ```java private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap bePathsMap) { DebugPoint debugPoint = DebugPointUtil.getDebugPoint("OlapTableSink.write_random_choose_sink"); @@ -154,36 +166,22 @@ private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap txn_wrlock(_get_txn_map_lock(transaction_id)); - txn_tablet_map_t& txn_tablet_map = _get_txn_tablet_map(transaction_id); - - DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", { - if (rand() % 100 < (100 * dp->param("percent", 0.5))) { - LOG_WARNING("TxnManager.prepare_txn.random_failed random failed"); - return Status::InternalError("debug prepare txn random failed"); - } - }); - ... -} +DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", + {if (rand() % 100 < (100 * dp->param("percent", 0.5))) { + LOG_WARNING("TxnManager.prepare_txn.random_failed random failed"); + return Status::InternalError("debug prepare txn random failed"); + }} +); ``` ## 关闭木桩 @@ -222,7 +220,6 @@ POST /api/debug_point/remove/{debug_point_name} ``` curl -X POST "http://127.0.0.1:8030/api/debug_point/remove/foo" - ``` ## 清除所有木桩 From a8e5fa8545906b090a55990b1bd2debf6c1bb30a Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 13 Dec 2023 10:26:19 +0800 Subject: [PATCH 04/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index 04e62839a8f0d7..fc08471628b047 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -170,6 +170,14 @@ private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap E param(String key, E defaultValue) +key 是传递来的参数名,defaultValue 是参数默认值,填写默认值可以帮助推导 param() 返回值的类型, +否则需要在调用时指定E的类型,例如 debugPoint.param("needCatchUp")。 +``` + 激活 BE 中的木桩并传递参数: ``` curl -X POST "http://127.0.0.1:8040/api/debug_point/add/TxnManager.prepare_txn.random_failed?percent=0.7 @@ -183,6 +191,13 @@ DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", }} ); ``` +``` +注意: +dp->param("percent", 0.5) 的原型为 +template T param(const std::string& key, T default_value = T()) +key 是传递来的参数名,default_value 是参数默认值,填写默认值可以帮助推导 param() 返回值的类型, +否则需要在调用时指定T的类型,例如 dp->param("percent", 0.5)。 +``` ## 关闭木桩 @@ -230,8 +245,6 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/remove/foo" POST /api/debug_point/clear ``` - - ### Request body 无 From 71dd254ff3cdc84818b785e61635dd0b95ddc432 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 13 Dec 2023 11:32:16 +0800 Subject: [PATCH 05/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 66 +++++++++++++------ 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index 6910bc573839f0..fbb99dca473275 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -26,7 +26,7 @@ under the License. # Debug Point -Debug point is used in code test. When enabling a debug point, it can run related code. +Debug point is used in code test, when enabled, it can run related code. Both FE and BE support debug points. @@ -37,7 +37,7 @@ FE example ```java private Status foo() { // dbug_fe_foo_do_nothing is the debug point name. - // When it's active,DebugPointUtil.isEnable("dbug_fe_foo_do_nothing") will return true. + // When activated,DebugPointUtil.isEnable("dbug_fe_foo_do_nothing") will return true. if (DebugPointUtil.isEnable("dbug_fe_foo_do_nothing")) { return Status.Nothing; } @@ -48,12 +48,12 @@ private Status foo() { } ``` -BE 桩子示例代码 +BE example ```c++ void Status foo() { // dbug_be_foo_do_nothing is the debug point name. - // When it's active,DBUG_EXECUTE_IF will execute the code block. + // When activated,DBUG_EXECUTE_IF will execute the code block. DBUG_EXECUTE_IF("dbug_be_foo_do_nothing", { return Status.Nothing; }); do_foo_action(); @@ -64,9 +64,9 @@ void Status foo() { ## Global config -To activate debug points, need set `enable_debug_points` to true. +To activate debug points, you need to set `enable_debug_points` to true. -`enable_debug_points` was located in FE's fe.conf and BE's be.conf。 +`enable_debug_points` is located in FE's fe.conf and BE's be.conf。 ## Enable Debug Point @@ -81,13 +81,13 @@ To activate debug points, need set `enable_debug_points` to true. ### Query Parameters * `debug_point_name` - Debug point name. Require. + Debug point name. Required. * `timeout` - Timeout in seconds. When timeout, the debug point will be disable. Default is -1, not timeout. Optional. + Timeout in seconds. When timeout, the debug point will be disable. Default is -1, never timeout. Optional. * `execute` - Max active times。Default is -1, unlimit active times. Optional. + After activating, the max times the debug point can be executed. Default is -1, unlimited times. Optional. ### Request body @@ -96,24 +96,50 @@ None ### Response - ``` - { - msg: "OK", - code: 0 - } - ``` +``` +{ + msg: "OK", + code: 0 +} +``` ### Examples -Enable debug point `foo`, activate no more than five times. +After enabling debug point `foo`, executed no more than five times. - ``` - curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" +``` +curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" + +``` +NOTE: You need to send the http request first, then run the code containing the debug point. + +## Passing custom parameters to debug point +Besides "timeout" and "execute" mentioned above, when activating debug point, you can also pass other parameters. + +### API + +``` +POST /api/debug_point/add/{debug_point_name}[?key1=value1&key2=value2&key3=value3...] +``` +* `key1=value1` + Passing a key-value pairs to debug point, key1 is the parameter name and value1 is the parameter value, + multiple key-value pairs are concatenated by '&'. +### Request body + +无 + +### Response + +``` +{ + msg: "OK", + code: 0 +} +``` + - ``` - ## Disable Debug Point ### API From 03d0d9798b27972836a75e331754fd6f7782092b Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 13 Dec 2023 14:43:39 +0800 Subject: [PATCH 06/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 107 ++++++++++++++---- 1 file changed, 86 insertions(+), 21 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index fbb99dca473275..5e2e60abea5196 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -116,19 +116,22 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" NOTE: You need to send the http request first, then run the code containing the debug point. ## Passing custom parameters to debug point -Besides "timeout" and "execute" mentioned above, when activating debug point, you can also pass other parameters. +Besides "timeout" and "execute" mentioned above, when enabling debug point, we can also pass other parameters. ### API ``` POST /api/debug_point/add/{debug_point_name}[?key1=value1&key2=value2&key3=value3...] ``` -* `key1=value1` - Passing a key-value pairs to debug point, key1 is the parameter name and value1 is the parameter value, +* `key1=value1`
+ key1 is parameter name and value1 is parameter value,
+ The parameters passed to debug points in FE or BE code are in key=value fashion,
multiple key-value pairs are concatenated by '&'. + + ### Request body -无 +None ### Response @@ -139,6 +142,68 @@ POST /api/debug_point/add/{debug_point_name}[?key1=value1&key2=value2&key3=value } ``` +### Examples +Assuming a FE node with configuration http_port=8030 in fe.conf, +the following http request enables a debug point named "foo" and passes two key-value pairs +to the FE node: key="percent" with value="0.5" and key="duration" with value="3", +they are taken as strings in FE and BE code. + +``` +curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5&duration=3" +``` + +FE and BE share the same url path, it's just their IPs and Ports are different. + +### Getting and Using debug point parameters in FE and BE code +Following request enables the debug point "OlapTableSink.write_random_choose_sink" in FE code and passes two parameters: +``` +curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" +``` + +The code in FE checks debug point "OlapTableSink.write_random_choose_sink" and gets parameters(parameter names are case sensitive): +```java +private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap bePathsMap) { + DebugPoint debugPoint = DebugPointUtil.getDebugPoint("OlapTableSink.write_random_choose_sink"); + if (debugPoint == null) { + return; + } + boolean needCatchup = debugPoint.param("needCatchUp", false); + int sinkNum = debugPoint.param("sinkNum", 0); + ... +} +``` + +``` +NOTE: +debugPoint.param("needCatchUp", false) is declared as +public E param(String key, E defaultValue) +in which "key" is parameter name, and defaultValue is default value, +set default value can help compiler induce the return type of param(), +otherwise, you have to explicitly specify value type E, e.g. debugPoint.param("needCatchUp"). +``` + +Following request enables the debug point "TxnManager.prepare_txn.random_failed" in BE code and passed one key-value pairs: +``` +curl -X POST "http://127.0.0.1:8040/api/debug_point/add/TxnManager.prepare_txn.random_failed?percent=0.7 +``` + +The code in BE checks debug point "TxnManager.prepare_txn.random_failed" and gets parameters(parameter names are case sensitive): +```c++ +DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", + {if (rand() % 100 < (100 * dp->param("percent", 0.5))) { + LOG_WARNING("TxnManager.prepare_txn.random_failed random failed"); + return Status::InternalError("debug prepare txn random failed"); + }} +); +``` +``` +NOTE: +dp->param("percent", 0.5) is declared as +template T param(const std::string& key, T default_value = T()) +in which "key" is parameter name, and defaultValue is default value, +set default value can help compiler induce the return type of param(), +otherwise, you have to explicitly specify value type T, e.g. dp->param("percent", 0.5). +``` ## Disable Debug Point @@ -163,10 +228,10 @@ None ### Response ``` - { - msg: "OK", - code: 0 - } +{ + msg: "OK", + code: 0 +} ``` ### Examples @@ -175,17 +240,17 @@ None Disable debug point `foo`。 - ``` - curl -X POST "http://127.0.0.1:8030/api/debug_point/remove/foo" +``` +curl -X POST "http://127.0.0.1:8030/api/debug_point/remove/foo" - ``` +``` ## Clear Debug Points ### API ``` - POST /api/debug_point/clear +POST /api/debug_point/clear ``` @@ -196,16 +261,16 @@ None ### Response - ``` - { - msg: "OK", - code: 0 - } - ``` +``` +{ + msg: "OK", + code: 0 +} +``` ### Examples - ``` - curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" - ``` +``` +curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" +``` From acc19bba4ec624a45cbd3daa966abd4c9222772a Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 13 Dec 2023 16:12:12 +0800 Subject: [PATCH 07/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 68 ++++++++----------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index 5e2e60abea5196..75b18827a0f147 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -37,7 +37,7 @@ FE example ```java private Status foo() { // dbug_fe_foo_do_nothing is the debug point name. - // When activated,DebugPointUtil.isEnable("dbug_fe_foo_do_nothing") will return true. + // When it's active,DebugPointUtil.isEnable("dbug_fe_foo_do_nothing") will return true. if (DebugPointUtil.isEnable("dbug_fe_foo_do_nothing")) { return Status.Nothing; } @@ -53,7 +53,7 @@ BE example ```c++ void Status foo() { // dbug_be_foo_do_nothing is the debug point name. - // When activated,DBUG_EXECUTE_IF will execute the code block. + // When it's active,DBUG_EXECUTE_IF will execute the code block. DBUG_EXECUTE_IF("dbug_be_foo_do_nothing", { return Status.Nothing; }); do_foo_action(); @@ -64,17 +64,21 @@ void Status foo() { ## Global config -To activate debug points, you need to set `enable_debug_points` to true. +To activate debug points globally, you need to set `enable_debug_points` to true. `enable_debug_points` is located in FE's fe.conf and BE's be.conf。 ## Enable Debug Point +After debug points are enabled globally, +we need to specify a debug point name we want to activate, by sending a http request to FE or BE node, +only after that, when program running into the specified debug point, related code can be executed. + ### API ``` - POST /api/debug_point/add/{debug_point_name}[?timeout=&execute=] +POST /api/debug_point/add/{debug_point_name}[?timeout=&execute=] ``` @@ -106,26 +110,25 @@ None ### Examples -After enabling debug point `foo`, executed no more than five times. +After activating debug point `foo`, executed no more than five times. ``` curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" ``` -NOTE: You need to send the http request first, then run the code containing the debug point. -## Passing custom parameters to debug point -Besides "timeout" and "execute" mentioned above, when enabling debug point, we can also pass other parameters. + +## Pass Custom Parameters +Besides "timeout" and "execute" mentioned above, when activating debug point, we can also pass our own parameters. ### API ``` -POST /api/debug_point/add/{debug_point_name}[?key1=value1&key2=value2&key3=value3...] +POST /api/debug_point/add/{debug_point_name}[?k1=v1&k2=v2&k3=v3...] ``` -* `key1=value1`
- key1 is parameter name and value1 is parameter value,
- The parameters passed to debug points in FE or BE code are in key=value fashion,
+* `k1=v1`
+ The parameters are in a key=value fasion, k1 is parameter name and v1 is parameter value,
multiple key-value pairs are concatenated by '&'. @@ -143,24 +146,27 @@ None ``` ### Examples -Assuming a FE node with configuration http_port=8030 in fe.conf, -the following http request enables a debug point named "foo" and passes two key-value pairs -to the FE node: key="percent" with value="0.5" and key="duration" with value="3", -they are taken as strings in FE and BE code. +Assuming a FE node with configuration http_port=8030 in fe.conf,
+the following http request activates a debug point named `foo` and passes two parameters to the FE node:
``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5&duration=3" ``` -FE and BE share the same url path, it's just their IPs and Ports are different. +``` +NOTE: +Inside FE and BE code, they are taken as strings. +Parameter names and values in http request and FE/BE code are case sensitive. +FE and BE share the same url path, it's just their IPs and Ports are different. +``` -### Getting and Using debug point parameters in FE and BE code -Following request enables the debug point "OlapTableSink.write_random_choose_sink" in FE code and passes two parameters: +### Using Parameters In FE and BE Code +Following request activates debug point "OlapTableSink.write_random_choose_sink" in FE and passes two parameters: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" ``` -The code in FE checks debug point "OlapTableSink.write_random_choose_sink" and gets parameters(parameter names are case sensitive): +The code in FE checks debug point "OlapTableSink.write_random_choose_sink" and gets values of parameter "needCatchUp" and "sinkNum": ```java private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap bePathsMap) { DebugPoint debugPoint = DebugPointUtil.getDebugPoint("OlapTableSink.write_random_choose_sink"); @@ -173,21 +179,12 @@ private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap E param(String key, E defaultValue) -in which "key" is parameter name, and defaultValue is default value, -set default value can help compiler induce the return type of param(), -otherwise, you have to explicitly specify value type E, e.g. debugPoint.param("needCatchUp"). -``` - -Following request enables the debug point "TxnManager.prepare_txn.random_failed" in BE code and passed one key-value pairs: +Following request activates debug point "TxnManager.prepare_txn.random_failed" in BE and passes one parameter: ``` curl -X POST "http://127.0.0.1:8040/api/debug_point/add/TxnManager.prepare_txn.random_failed?percent=0.7 ``` -The code in BE checks debug point "TxnManager.prepare_txn.random_failed" and gets parameters(parameter names are case sensitive): +The code in BE checks debug point "TxnManager.prepare_txn.random_failed" and gets value of parameter "percent": ```c++ DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", {if (rand() % 100 < (100 * dp->param("percent", 0.5))) { @@ -196,14 +193,7 @@ DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", }} ); ``` -``` -NOTE: -dp->param("percent", 0.5) is declared as -template T param(const std::string& key, T default_value = T()) -in which "key" is parameter name, and defaultValue is default value, -set default value can help compiler induce the return type of param(), -otherwise, you have to explicitly specify value type T, e.g. dp->param("percent", 0.5). -``` + ## Disable Debug Point From c01e664995e33c99c16ba79fb57422e872b5121b Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 13 Dec 2023 16:29:04 +0800 Subject: [PATCH 08/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index 75b18827a0f147..bf2fc7910f436c 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -62,14 +62,14 @@ void Status foo() { } ``` -## Global config +## Global Config -To activate debug points globally, you need to set `enable_debug_points` to true. +To enable debug points globally, we need to set `enable_debug_points` to true. `enable_debug_points` is located in FE's fe.conf and BE's be.conf。 -## Enable Debug Point +## Activate Specified Debug Point After debug points are enabled globally, we need to specify a debug point name we want to activate, by sending a http request to FE or BE node, @@ -120,7 +120,7 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" ## Pass Custom Parameters -Besides "timeout" and "execute" mentioned above, when activating debug point, we can also pass our own parameters. +When activating debug point, besides "timeout" and "execute" mentioned above, we can also pass our own parameters. ### API @@ -128,8 +128,8 @@ Besides "timeout" and "execute" mentioned above, when activating debug point, we POST /api/debug_point/add/{debug_point_name}[?k1=v1&k2=v2&k3=v3...] ``` * `k1=v1`
- The parameters are in a key=value fasion, k1 is parameter name and v1 is parameter value,
- multiple key-value pairs are concatenated by '&'. + The parameters are passed in a key=value fashion, k1 is parameter name and v1 is parameter value,
+ multiple key-value pairs are concatenated by `&`. ### Request body @@ -146,8 +146,7 @@ None ``` ### Examples -Assuming a FE node with configuration http_port=8030 in fe.conf,
-the following http request activates a debug point named `foo` and passes two parameters to the FE node:
+Assuming a FE node with configuration http_port=8030 in fe.conf, the following http request activates a debug point named `foo` in FE node, and passes two parameters: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5&duration=3" @@ -155,18 +154,18 @@ curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5 ``` NOTE: -Inside FE and BE code, they are taken as strings. -Parameter names and values in http request and FE/BE code are case sensitive. -FE and BE share the same url path, it's just their IPs and Ports are different. +1. Inside FE and BE code, names and values of parameters are taken as strings. +2. Parameter names and values in http request and FE/BE code are case sensitive. +3. FE and BE share the same url path, it's just their IPs and Ports are different. ``` -### Using Parameters In FE and BE Code -Following request activates debug point "OlapTableSink.write_random_choose_sink" in FE and passes two parameters: +### Using parameters in FE and BE code +Following request activates debug point `OlapTableSink.write_random_choose_sink` in FE and passes two parameters: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" ``` -The code in FE checks debug point "OlapTableSink.write_random_choose_sink" and gets values of parameter "needCatchUp" and "sinkNum": +The code in FE checks debug point `OlapTableSink.write_random_choose_sink` and gets values of parameter `needCatchUp` and `sinkNum`: ```java private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap bePathsMap) { DebugPoint debugPoint = DebugPointUtil.getDebugPoint("OlapTableSink.write_random_choose_sink"); @@ -179,12 +178,12 @@ private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimapparam("percent", 0.5))) { From 28d88822cee22d68fe6c3cf670abc5bbd50e6511 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 13 Dec 2023 16:39:23 +0800 Subject: [PATCH 09/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 44 +++++++------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index fc08471628b047..204169fe85dffc 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -118,15 +118,15 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" ## 向木桩传递参数 -除了 timeout 和 execute,激活木桩时,还可以传递其它自定义参数。 +激活木桩时,除了除了前文所述的 timeout 和 execute,还可以传递其它自定义参数。 ### API ``` -POST /api/debug_point/add/{debug_point_name}[?key1=value1&key2=value2&key3=value3...] +POST /api/debug_point/add/{debug_point_name}[?k1=v1&k2=v2&k3=v3...] ``` -* `key1=value1` - 向木桩传递自定义参数,名称为 key1,值为 value1,多个参数用&分隔,“&”前后没有空格。 +* `k1=v1` + 向木桩传递的自定义参数是key=value格式,k1为参数名称,v1为参数值,多个参数用&分隔。 ### Request body 无 @@ -142,22 +142,25 @@ POST /api/debug_point/add/{debug_point_name}[?key1=value1&key2=value2&key3=value ### Examples -向 FE 或 BE 传递参数的 REST API 格式相同,只是 IP 地址和端口不同。 - -假设 FE 的 http_port=8030,则下面的请求激活 FE 中的木桩`foo`,并传递了两个参数: - -一个名称为 percent 值为 0.5,另一个名称为 duration 值为 3。 +假设 FE 在 fe.conf 中有配置 http_port=8030,则下面的请求激活 FE 中的木桩`foo`,并传递了两个参数: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5&duration=3" ``` +``` +注意: +1、在FE或BE的代码中,参数名和参数值都是字符串。 +2、在FE或BE的代码中和http请求中的参数名称和值都是大小写敏感的。 +3、发给FE或BE的http请求,路径部分格式是相同的,只是IP地址和端口号不同。 +``` + ### 在FE、BE代码中使用参数 -激活 FE 中的木桩并传递参数: +激活 FE 中的木桩`OlapTableSink.write_random_choose_sink`并传递参数: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" ``` -在 FE 代码中使用木桩 OlapTableSink.write_random_choose_sink 的参数 needCatchUp 和 sinkNum(区分大小写): +在 FE 代码中使用木桩 OlapTableSink.write_random_choose_sink 的参数 `needCatchUp` 和 `sinkNum`: ```java private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap bePathsMap) { DebugPoint debugPoint = DebugPointUtil.getDebugPoint("OlapTableSink.write_random_choose_sink"); @@ -170,19 +173,12 @@ private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap E param(String key, E defaultValue) -key 是传递来的参数名,defaultValue 是参数默认值,填写默认值可以帮助推导 param() 返回值的类型, -否则需要在调用时指定E的类型,例如 debugPoint.param("needCatchUp")。 -``` -激活 BE 中的木桩并传递参数: +激活 BE 中的木桩`TxnManager.prepare_txn.random_failed`并传递参数: ``` curl -X POST "http://127.0.0.1:8040/api/debug_point/add/TxnManager.prepare_txn.random_failed?percent=0.7 ``` -在 BE 代码中使用木桩 TxnManager.prepare_txn.random_failed 的参数 percent(区分大小写): +在 BE 代码中使用木桩 `TxnManager.prepare_txn.random_failed` 的参数 `percent`: ```c++ DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", {if (rand() % 100 < (100 * dp->param("percent", 0.5))) { @@ -191,13 +187,7 @@ DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", }} ); ``` -``` -注意: -dp->param("percent", 0.5) 的原型为 -template T param(const std::string& key, T default_value = T()) -key 是传递来的参数名,default_value 是参数默认值,填写默认值可以帮助推导 param() 返回值的类型, -否则需要在调用时指定T的类型,例如 dp->param("percent", 0.5)。 -``` + ## 关闭木桩 From b352be6678cc02141aa356b4d14bd7c05dbe22db Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 13 Dec 2023 17:26:09 +0800 Subject: [PATCH 10/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index bf2fc7910f436c..d8915312ac1c4f 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -26,9 +26,17 @@ under the License. # Debug Point -Debug point is used in code test, when enabled, it can run related code. +Debug point is a piece of code, inserted into FE or BE code, when program running into this code, -Both FE and BE support debug points. +it can change variables or behaviors of the program. + +It is mainly used for unit test or regression test when it is impossible to trigger some exceptions through normal means. + +Each debug point has a name, we can name it whatever we want, there are swithes to enable and disable debug points, + +and we can also pass data to debug points. + +Both FE and BE support debug point, and after inserting the debug point code, we need to recompile FE or BE. ## Code Example @@ -62,6 +70,7 @@ void Status foo() { } ``` + ## Global Config To enable debug points globally, we need to set `enable_debug_points` to true. From 6b5c0c27775886c541bbe9e4825ce6302cd9c381 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 13 Dec 2023 17:26:14 +0800 Subject: [PATCH 11/25] Update debug-point-action.md --- .../admin-manual/http-actions/fe/debug-point-action.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index 204169fe85dffc..a29a014a395d8b 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -26,9 +26,13 @@ under the License. # 代码打桩 -代码打桩是代码测试使用的。激活木桩后,可以执行木桩代码。木桩的名字是任意取的。 +代码打桩,是指在 FE 或 BE 源码中插入一段代码,当程序执行到这里时,可以改变程序的变量或行为,这样的一段代码称为一个`木桩`。 -FE 和 BE 都支持代码打桩。 +主要用于单元测试或回归测试,用来构造正常方法无法实现的异常。 + +每一个木桩都有一个名称,可以随便取名,可以通过一些机制控制木桩的开关,还可以向木桩传递参数。 + +FE 和 BE 都支持代码打桩,打桩完后要重新编译 BE 或 FE。 ## 木桩代码示例 From e6a1d0305f8fd47c810468a3d16de0b793c9de6e Mon Sep 17 00:00:00 2001 From: HowardQin Date: Mon, 18 Dec 2023 11:55:03 +0800 Subject: [PATCH 12/25] Update debug-point-action.md Add debug point use case in regression --- .../http-actions/fe/debug-point-action.md | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index d8915312ac1c4f..bc0f65d895f14a 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -169,7 +169,7 @@ NOTE: ``` ### Using parameters in FE and BE code -Following request activates debug point `OlapTableSink.write_random_choose_sink` in FE and passes two parameters: +Following request activates debug point `OlapTableSink.write_random_choose_sink` in FE and passes two parameters, `needCatchUp` and `sinkNum`: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" ``` @@ -272,3 +272,43 @@ None ``` curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" ``` + +## Debug Points in Regression Test + +In regression test, the debug points are especially useful, and the framework provides methods to activate debug points. +We can also use debug points in regression tests, in the test suite context, we can use GetDebugPoint().enableDebugPointForAllBEs(), to activate debug points in BE and GetDebugPoint().enableDebugPointForAllFEs(), to activate debug points in FEs before executing the test action. + +### Examples + +```java +suite('debugpoint_action', 'nonConcurrent') { + try { + GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish') + GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss') + } finally { + GetDebugPoint().disableDebugPointForAllFEs('PublishVersionDaemon.stop_publish') + GetDebugPoint().disableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss') + } +} +``` +The enableDebugPointForAllFE/senableDebugPointForAllBEs is declared as : +def enableDebugPointForAllFEs(String name, Map params = null) +def enableDebugPointForAllBEs(String name, Map params = null) +where the first parameter is name of debug point to activate, the second parameter is a set of key-value pairs passed to the debug point. + +```java +suite('debugpoint_action', 'nonConcurrent') { + try { + GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish', [timeout:1]) + GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', [tablet_id:'12345', version_miss:true, timeout:1]) + } finally { + GetDebugPoint().disableDebugPointForAllFEs('PublishVersionDaemon.stop_publish') + GetDebugPoint().disableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss') + } +} +``` + + + + + From 1cdf8e7a6fe895799b7352e5b521b90ea71d822c Mon Sep 17 00:00:00 2001 From: HowardQin Date: Mon, 18 Dec 2023 17:25:59 +0800 Subject: [PATCH 13/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 98 +++++++++++-------- 1 file changed, 58 insertions(+), 40 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index bc0f65d895f14a..ea620722b0758a 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -36,7 +36,7 @@ Each debug point has a name, we can name it whatever we want, there are swithes and we can also pass data to debug points. -Both FE and BE support debug point, and after inserting the debug point code, we need to recompile FE or BE. +Both FE and BE support debug point, and after inserting debug point code, we need to recompile FE or BE. ## Code Example @@ -44,8 +44,8 @@ FE example ```java private Status foo() { - // dbug_fe_foo_do_nothing is the debug point name. - // When it's active,DebugPointUtil.isEnable("dbug_fe_foo_do_nothing") will return true. + // dbug_fe_foo_do_nothing is the debug point name, + // when it's active, DebugPointUtil.isEnable("dbug_fe_foo_do_nothing") returns true. if (DebugPointUtil.isEnable("dbug_fe_foo_do_nothing")) { return Status.Nothing; } @@ -60,8 +60,8 @@ BE example ```c++ void Status foo() { - // dbug_be_foo_do_nothing is the debug point name. - // When it's active,DBUG_EXECUTE_IF will execute the code block. + // dbug_be_foo_do_nothing is the debug point name, + // when it's active, DBUG_EXECUTE_IF will execute the code block. DBUG_EXECUTE_IF("dbug_be_foo_do_nothing", { return Status.Nothing; }); do_foo_action(); @@ -73,16 +73,16 @@ void Status foo() { ## Global Config -To enable debug points globally, we need to set `enable_debug_points` to true. +To enable debug points globally, we need to set `enable_debug_points` to true, -`enable_debug_points` is located in FE's fe.conf and BE's be.conf。 +`enable_debug_points` is located in FE's fe.conf and BE's be.conf. ## Activate Specified Debug Point -After debug points are enabled globally, -we need to specify a debug point name we want to activate, by sending a http request to FE or BE node, -only after that, when program running into the specified debug point, related code can be executed. +After debug points are enabled globally by setting `enable_debug_points` to true, +we need to specify the debug point name we want to activate, this is done by sending a http request to FE or BE node, +only after that, when the program running into the specified debug point, related code can be executed. ### API @@ -97,7 +97,7 @@ POST /api/debug_point/add/{debug_point_name}[?timeout=&execute=] Debug point name. Required. * `timeout` - Timeout in seconds. When timeout, the debug point will be disable. Default is -1, never timeout. Optional. + Timeout in seconds. When timeout, the debug point will be deactivated. Default is -1, never timeout. Optional. * `execute` After activating, the max times the debug point can be executed. Default is -1, unlimited times. Optional. @@ -137,8 +137,9 @@ When activating debug point, besides "timeout" and "execute" mentioned above, we POST /api/debug_point/add/{debug_point_name}[?k1=v1&k2=v2&k3=v3...] ``` * `k1=v1`
- The parameters are passed in a key=value fashion, k1 is parameter name and v1 is parameter value,
- multiple key-value pairs are concatenated by `&`. + The parameter passing is in key-value fashion, e.g. k1 is name and v1 is value,
+ multiple key-value pairs are concatenated by `&`,
+ ### Request body @@ -164,17 +165,17 @@ curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5 ``` NOTE: 1. Inside FE and BE code, names and values of parameters are taken as strings. -2. Parameter names and values in http request and FE/BE code are case sensitive. -3. FE and BE share the same url path, it's just their IPs and Ports are different. +2. Parameter names and values are case sensitive in http request and FE/BE code. +3. FE and BE share same url paths of REST API, it's just their IPs and Ports are different. ``` -### Using parameters in FE and BE code +### Use parameters in FE and BE code Following request activates debug point `OlapTableSink.write_random_choose_sink` in FE and passes two parameters, `needCatchUp` and `sinkNum`: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" ``` -The code in FE checks debug point `OlapTableSink.write_random_choose_sink` and gets values of parameter `needCatchUp` and `sinkNum`: +The code in FE checks debug point `OlapTableSink.write_random_choose_sink` and gets values: ```java private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap bePathsMap) { DebugPoint debugPoint = DebugPointUtil.getDebugPoint("OlapTableSink.write_random_choose_sink"); @@ -192,7 +193,7 @@ Following request activates debug point `TxnManager.prepare_txn.random_failed` i curl -X POST "http://127.0.0.1:8040/api/debug_point/add/TxnManager.prepare_txn.random_failed?percent=0.7 ``` -The code in BE checks debug point `TxnManager.prepare_txn.random_failed` and gets value of parameter `percent`: +The code in BE checks debug point `TxnManager.prepare_txn.random_failed` and gets value: ```c++ DBUG_EXECUTE_IF("TxnManager.prepare_txn.random_failed", {if (rand() % 100 < (100 * dp->param("percent", 0.5))) { @@ -275,32 +276,51 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" ## Debug Points in Regression Test -In regression test, the debug points are especially useful, and the framework provides methods to activate debug points. -We can also use debug points in regression tests, in the test suite context, we can use GetDebugPoint().enableDebugPointForAllBEs(), to activate debug points in BE and GetDebugPoint().enableDebugPointForAllFEs(), to activate debug points in FEs before executing the test action. +In community CI system, `enable_debug_points` configuration of FE and BE are set to true. +The Regression test framework also provides methods to activate and deactivate perticular debug point, they are declared as below: +```groovy +// name is the debug point to activate, params is a list key-value pairs passed to debug point +def enableDebugPointForAllFEs(String name, Map params = null); +def enableDebugPointForAllBEs(String name, Map params = null); +// name is the debug point to deactivate +def disableDebugPointForAllFEs(String name); +def disableDebugPointForAllFEs(String name); +``` +We need to call `enableDebugPointForAllFEs`/`enableDebugPointForAllBEs` before those test actions we want to generate error, +and call `disableDebugPointForAllFEs`/`disableDebugPointForAllBEs` afterward. -### Examples +### Concurrent Issue -```java -suite('debugpoint_action', 'nonConcurrent') { - try { - GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish') - GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss') - } finally { - GetDebugPoint().disableDebugPointForAllFEs('PublishVersionDaemon.stop_publish') - GetDebugPoint().disableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss') - } -} -``` -The enableDebugPointForAllFE/senableDebugPointForAllBEs is declared as : -def enableDebugPointForAllFEs(String name, Map params = null) -def enableDebugPointForAllBEs(String name, Map params = null) -where the first parameter is name of debug point to activate, the second parameter is a set of key-value pairs passed to the debug point. +Enabling debug points affects FE or BE globally, it could cause other concurrent tests of your pull request to fail unexpectly. +To avoid this, we has a convension that regression tests using debug points must be in directory regression-test/suites/fault_injection_p0, +and set group name to "nonConcurrent", because community CI system will run them serially. -```java +### Examples + +```groovy +// .groovy file of the test case must be in regression-test/suites/fault_injection_p0 +// and group name must be 'nonConcurrent' suite('debugpoint_action', 'nonConcurrent') { try { + // Activate debug point named "PublishVersionDaemon.stop_publish" in all FE, + // and pass argument timeout=1. + // Same as above, "execute" and "timeout" are pre-existing parameters. GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish', [timeout:1]) - GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', [tablet_id:'12345', version_miss:true, timeout:1]) + // Activate debug point named "Tablet.build_tablet_report_info.version_miss" in all BE, + // and pass argument: tablet_id='12345', version_miss=true and timeout=1 + GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', + [tablet_id:'12345', version_miss:true, timeout:1]) + + sql """CREATE TABLE tbl_1 (k1 INT, k2 INT) + DUPLICATE KEY (k1) + DISTRIBUTED BY HASH(k1) + BUCKETS 3 + PROPERTIES ("replication_allocation" = "tag.location.default: 1"); + """ + sql "INSERT INTO tbl_1 VALUES (1, 10)" + sql "INSERT INTO tbl_1 VALUES (2, 20)" + order_qt_select_1_1 'SELECT * FROM tbl_1' + } finally { GetDebugPoint().disableDebugPointForAllFEs('PublishVersionDaemon.stop_publish') GetDebugPoint().disableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss') @@ -310,5 +330,3 @@ suite('debugpoint_action', 'nonConcurrent') { - - From 299688220a2ef16b2990aa23ce38dbd4299a55aa Mon Sep 17 00:00:00 2001 From: HowardQin Date: Mon, 18 Dec 2023 17:55:57 +0800 Subject: [PATCH 14/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index ea620722b0758a..b65bbb59760cb5 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -32,11 +32,11 @@ it can change variables or behaviors of the program. It is mainly used for unit test or regression test when it is impossible to trigger some exceptions through normal means. -Each debug point has a name, we can name it whatever we want, there are swithes to enable and disable debug points, +Each debug point has a name, the name can be whatever we want, there are swithes to enable and disable debug points, and we can also pass data to debug points. -Both FE and BE support debug point, and after inserting debug point code, we need to recompile FE or BE. +Both FE and BE support debug point, and after inserting debug point code, recompilation of FE or BE is needed. ## Code Example @@ -80,7 +80,7 @@ To enable debug points globally, we need to set `enable_debug_points` to true, ## Activate Specified Debug Point -After debug points are enabled globally by setting `enable_debug_points` to true, +After debug points are enabled globally, we need to specify the debug point name we want to activate, this is done by sending a http request to FE or BE node, only after that, when the program running into the specified debug point, related code can be executed. @@ -276,8 +276,9 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" ## Debug Points in Regression Test -In community CI system, `enable_debug_points` configuration of FE and BE are set to true. -The Regression test framework also provides methods to activate and deactivate perticular debug point, they are declared as below: +In community CI system, `enable_debug_points` configuration of FE and BE are set to true.
+The Regression test framework also provides methods to activate and deactivate perticular debug point,
+they are declared as below: ```groovy // name is the debug point to activate, params is a list key-value pairs passed to debug point def enableDebugPointForAllFEs(String name, Map params = null); @@ -286,31 +287,32 @@ def enableDebugPointForAllBEs(String name, Map params = null); def disableDebugPointForAllFEs(String name); def disableDebugPointForAllFEs(String name); ``` -We need to call `enableDebugPointForAllFEs`/`enableDebugPointForAllBEs` before those test actions we want to generate error, -and call `disableDebugPointForAllFEs`/`disableDebugPointForAllBEs` afterward. +`enableDebugPointForAllFEs()` or `enableDebugPointForAllBEs()` needs to be called before test actions you want to generate error,
+and `disableDebugPointForAllFEs()` or `disableDebugPointForAllBEs()` needs to be called later. ### Concurrent Issue -Enabling debug points affects FE or BE globally, it could cause other concurrent tests of your pull request to fail unexpectly. -To avoid this, we has a convension that regression tests using debug points must be in directory regression-test/suites/fault_injection_p0, -and set group name to "nonConcurrent", because community CI system will run them serially. +Enabling debug points affects FE or BE globally, it could cause other concurrent tests of your pull request to fail unexpectly.
+To avoid this, there's a convension that regression tests using debug points must be in directory regression-test/suites/fault_injection_p0,
+and their group name must be "nonConcurrent", because community CI system will run them serially. ### Examples ```groovy // .groovy file of the test case must be in regression-test/suites/fault_injection_p0 -// and group name must be 'nonConcurrent' +// and the group name must be 'nonConcurrent' suite('debugpoint_action', 'nonConcurrent') { try { // Activate debug point named "PublishVersionDaemon.stop_publish" in all FE, - // and pass argument timeout=1. + // and pass timeout=1. // Same as above, "execute" and "timeout" are pre-existing parameters. GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish', [timeout:1]) // Activate debug point named "Tablet.build_tablet_report_info.version_miss" in all BE, - // and pass argument: tablet_id='12345', version_miss=true and timeout=1 + // and pass: tablet_id='12345', version_miss=true and timeout=1 GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', [tablet_id:'12345', version_miss:true, timeout:1]) + // Actions which will run into debug point and generate error sql """CREATE TABLE tbl_1 (k1 INT, k2 INT) DUPLICATE KEY (k1) DISTRIBUTED BY HASH(k1) From 7df94e4ac0b356fe5782fc5591b08569f2e67064 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Mon, 18 Dec 2023 18:26:40 +0800 Subject: [PATCH 15/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index b65bbb59760cb5..91eccbfea3bba6 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -44,8 +44,8 @@ FE example ```java private Status foo() { - // dbug_fe_foo_do_nothing is the debug point name, - // when it's active, DebugPointUtil.isEnable("dbug_fe_foo_do_nothing") returns true. + // dbug_fe_foo_do_nothing is the debug point name + // when it's active, DebugPointUtil.isEnable("dbug_fe_foo_do_nothing") returns true if (DebugPointUtil.isEnable("dbug_fe_foo_do_nothing")) { return Status.Nothing; } @@ -60,8 +60,8 @@ BE example ```c++ void Status foo() { - // dbug_be_foo_do_nothing is the debug point name, - // when it's active, DBUG_EXECUTE_IF will execute the code block. + // dbug_be_foo_do_nothing is the debug point name + // when it's active, DBUG_EXECUTE_IF will execute the code block DBUG_EXECUTE_IF("dbug_be_foo_do_nothing", { return Status.Nothing; }); do_foo_action(); @@ -303,11 +303,11 @@ and their group name must be "nonConcurrent", because community CI system will r // and the group name must be 'nonConcurrent' suite('debugpoint_action', 'nonConcurrent') { try { - // Activate debug point named "PublishVersionDaemon.stop_publish" in all FE, - // and pass timeout=1. - // Same as above, "execute" and "timeout" are pre-existing parameters. + // Activate debug point named "PublishVersionDaemon.stop_publish" in all FE + // and pass timeout=1 + // Same as above, "execute" and "timeout" are pre-existing parameters GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish', [timeout:1]) - // Activate debug point named "Tablet.build_tablet_report_info.version_miss" in all BE, + // Activate debug point named "Tablet.build_tablet_report_info.version_miss" in all BE // and pass: tablet_id='12345', version_miss=true and timeout=1 GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', [tablet_id:'12345', version_miss:true, timeout:1]) From fb516d20405a502fc5f071ec8a84dbd625059f76 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Mon, 18 Dec 2023 18:26:46 +0800 Subject: [PATCH 16/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index a29a014a395d8b..f7aebc2c85ba2c 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -260,3 +260,60 @@ POST /api/debug_point/clear ``` curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" ``` + +## 在回归测试中使用代码桩 + +社区的 CI 系统默认开启 FE 和 BE 的`enable_debug_points`配置。 +回归测试框架提供了开关指定代码桩的方法函数,它们声明如下: + +```groovy +// 打开代码桩,name 是代码桩名称,params是一个key-value列表,是传给代码桩的参数 +def enableDebugPointForAllFEs(String name, Map params = null); +def enableDebugPointForAllBEs(String name, Map params = null); +// 关闭代码桩,name 是代码桩的名称 +def disableDebugPointForAllFEs(String name); +def disableDebugPointForAllFEs(String name); +``` +需要在调用测试action之前调用 `enableDebugPointForAllFEs()` 或 `enableDebugPointForAllBEs()` 来开启代码桩,
+这样执行到代码桩代码时,相关代码才会被执行,
+然后在调用测试action之后调用 `disableDebugPointForAllFEs()` or `disableDebugPointForAllBEs()` 来关闭代码桩。 + +### 并发问题 + +FE 或 BE 中开启代码桩后会全局生效,提交了 Pull Request 后,可能并发跑的其它测试用例会受影响而意外失败。 +为了避免这种情况,我们规定,使用代码打桩的回归测试,必须放在 regression-test/suites/fault_injection_p0 目录下, +且组名必须设置为 `nonConcurrent`,社区 CI 系统对于这些用例,会串行运行。 + +### Examples + +```groovy +// 测试用例的.groovy 文件必须放在 regression-test/suites/fault_injection_p0 目录下, +// 且组名设置为 'nonConcurrent' +suite('debugpoint_action', 'nonConcurrent') { + try { + // 打开所有FE中,名为 "PublishVersionDaemon.stop_publish" 的代码桩 + // 传参数 timeout=1 + // execute 和 timeout 是预设的参数,作用和上面curl调用时一样 + GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish', [timeout:1]) + // 打开所有BE中,名为 "Tablet.build_tablet_report_info.version_miss" 的代码桩 + // 传参数 tablet_id='12345', version_miss=true and timeout=1 + GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', + [tablet_id:'12345', version_miss:true, timeout:1]) + + // 想要利用代码桩构造错误的测试用例 + sql """CREATE TABLE tbl_1 (k1 INT, k2 INT) + DUPLICATE KEY (k1) + DISTRIBUTED BY HASH(k1) + BUCKETS 3 + PROPERTIES ("replication_allocation" = "tag.location.default: 1"); + """ + sql "INSERT INTO tbl_1 VALUES (1, 10)" + sql "INSERT INTO tbl_1 VALUES (2, 20)" + order_qt_select_1_1 'SELECT * FROM tbl_1' + + } finally { + GetDebugPoint().disableDebugPointForAllFEs('PublishVersionDaemon.stop_publish') + GetDebugPoint().disableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss') + } +} +``` From b025bb0f3ce79ed71afb0c170e74da25189fbcbd Mon Sep 17 00:00:00 2001 From: HowardQin Date: Mon, 18 Dec 2023 18:45:12 +0800 Subject: [PATCH 17/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index f7aebc2c85ba2c..64aa9e5768da5f 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -75,6 +75,7 @@ void Status foo() { ## 打开木桩 +打开总开关后,还需要通过向 FE 或 BE 发送 http 请求的方式,打开或关闭指定名称的木桩,只有这样当代码执行到这个木桩时,相关代码才会被执行。 ### API @@ -92,7 +93,7 @@ POST /api/debug_point/add/{debug_point_name}[?timeout=&execute=] 超时时间,单位为秒。超时之后,木桩失活。默认值-1表示永远不超时。可选。 * `execute` - 木桩最大激活次数。默认值-1表示不限激活次数。可选。 + 木桩最大执行次数。默认值-1表示不限执行次数。可选。 ### Request body @@ -111,14 +112,14 @@ POST /api/debug_point/add/{debug_point_name}[?timeout=&execute=] ### Examples -打开木桩 `foo`,最多激活5次。 +打开木桩 `foo`,最多执行5次。 ``` curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" ``` -注意,要先激活木桩,然后再执行含有木桩的代码,代码中的木桩才会生效。 + ## 向木桩传递参数 @@ -154,9 +155,9 @@ curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5 ``` 注意: -1、在FE或BE的代码中,参数名和参数值都是字符串。 -2、在FE或BE的代码中和http请求中的参数名称和值都是大小写敏感的。 -3、发给FE或BE的http请求,路径部分格式是相同的,只是IP地址和端口号不同。 +1、在 FE 或 BE 的代码中,参数名和参数值都是字符串。 +2、在 FE 或 BE 的代码中和 http 请求中的参数名称和值都是大小写敏感的。 +3、发给 FE 或 BE 的 http 请求,路径部分格式是相同的,只是 IP 地址和端口号不同。 ``` ### 在FE、BE代码中使用参数 @@ -261,26 +262,26 @@ POST /api/debug_point/clear curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" ``` -## 在回归测试中使用代码桩 +## 在回归测试中使用木桩 -社区的 CI 系统默认开启 FE 和 BE 的`enable_debug_points`配置。 -回归测试框架提供了开关指定代码桩的方法函数,它们声明如下: +当提交PR时,社区的 CI 系统默认开启 FE 和 BE 的`enable_debug_points`配置。 +回归测试框架提供了开关指定木桩的方法函数,它们声明如下: ```groovy -// 打开代码桩,name 是代码桩名称,params是一个key-value列表,是传给代码桩的参数 +// 打开木桩,name 是木桩名称,params是一个key-value列表,是传给木桩的参数 def enableDebugPointForAllFEs(String name, Map params = null); def enableDebugPointForAllBEs(String name, Map params = null); -// 关闭代码桩,name 是代码桩的名称 +// 关闭木桩,name 是木桩的名称 def disableDebugPointForAllFEs(String name); def disableDebugPointForAllFEs(String name); ``` -需要在调用测试action之前调用 `enableDebugPointForAllFEs()` 或 `enableDebugPointForAllBEs()` 来开启代码桩,
-这样执行到代码桩代码时,相关代码才会被执行,
-然后在调用测试action之后调用 `disableDebugPointForAllFEs()` or `disableDebugPointForAllBEs()` 来关闭代码桩。 +需要在调用测试action之前调用 `enableDebugPointForAllFEs()` 或 `enableDebugPointForAllBEs()` 来开启木桩,
+这样执行到木桩代码时,相关代码才会被执行,
+然后在调用测试action之后调用 `disableDebugPointForAllFEs()` or `disableDebugPointForAllBEs()` 来关闭木桩。 ### 并发问题 -FE 或 BE 中开启代码桩后会全局生效,提交了 Pull Request 后,可能并发跑的其它测试用例会受影响而意外失败。 +FE 或 BE 中开启木桩后会全局生效,提交了 Pull Request 后,可能并发跑的其它测试用例会受影响而意外失败。 为了避免这种情况,我们规定,使用代码打桩的回归测试,必须放在 regression-test/suites/fault_injection_p0 目录下, 且组名必须设置为 `nonConcurrent`,社区 CI 系统对于这些用例,会串行运行。 @@ -291,16 +292,16 @@ FE 或 BE 中开启代码桩后会全局生效,提交了 Pull Request 后, // 且组名设置为 'nonConcurrent' suite('debugpoint_action', 'nonConcurrent') { try { - // 打开所有FE中,名为 "PublishVersionDaemon.stop_publish" 的代码桩 + // 打开所有FE中,名为 "PublishVersionDaemon.stop_publish" 的木桩 // 传参数 timeout=1 // execute 和 timeout 是预设的参数,作用和上面curl调用时一样 GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish', [timeout:1]) - // 打开所有BE中,名为 "Tablet.build_tablet_report_info.version_miss" 的代码桩 + // 打开所有BE中,名为 "Tablet.build_tablet_report_info.version_miss" 的木桩 // 传参数 tablet_id='12345', version_miss=true and timeout=1 GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', [tablet_id:'12345', version_miss:true, timeout:1]) - // 想要利用代码桩构造错误的测试用例 + // 想要利用木桩构造错误的测试用例 sql """CREATE TABLE tbl_1 (k1 INT, k2 INT) DUPLICATE KEY (k1) DISTRIBUTED BY HASH(k1) From c8b961ef6433f2ce92515a3fc73807a4a02a506d Mon Sep 17 00:00:00 2001 From: HowardQin Date: Mon, 18 Dec 2023 18:45:40 +0800 Subject: [PATCH 18/25] Update debug-point-action.md --- .../docs/admin-manual/http-actions/fe/debug-point-action.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index 91eccbfea3bba6..35790506998169 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -80,8 +80,8 @@ To enable debug points globally, we need to set `enable_debug_points` to true, ## Activate Specified Debug Point -After debug points are enabled globally, -we need to specify the debug point name we want to activate, this is done by sending a http request to FE or BE node, +After debug points are enabled globally,
+we need to specify the debug point name we want to activate, this is done by sending a http request to FE or BE node,
only after that, when the program running into the specified debug point, related code can be executed. ### API @@ -129,7 +129,7 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" ## Pass Custom Parameters -When activating debug point, besides "timeout" and "execute" mentioned above, we can also pass our own parameters. +When activating debug point, besides "timeout" and "execute" mentioned above, we can also pass custom parameters. ### API From 840928c7870214d37b6b12f0246d7582bdd385ac Mon Sep 17 00:00:00 2001 From: HowardQin Date: Tue, 19 Dec 2023 10:11:18 +0800 Subject: [PATCH 19/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index 64aa9e5768da5f..e0094f05f022f3 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -123,7 +123,8 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" ## 向木桩传递参数 -激活木桩时,除了除了前文所述的 timeout 和 execute,还可以传递其它自定义参数。 +激活木桩时,除了前文所述的 timeout 和 execute,还可以传递其它自定义参数。
+一个参数是一个形如 key=value 的 key-value 对,在 url 的路径部分,紧跟在木桩名称后,以字符 '?' 开头。 ### API @@ -131,7 +132,8 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" POST /api/debug_point/add/{debug_point_name}[?k1=v1&k2=v2&k3=v3...] ``` * `k1=v1` - 向木桩传递的自定义参数是key=value格式,k1为参数名称,v1为参数值,多个参数用&分隔。 + k1为参数名称,v1为参数值,多个参数用&分隔。 + ### Request body 无 @@ -147,7 +149,7 @@ POST /api/debug_point/add/{debug_point_name}[?k1=v1&k2=v2&k3=v3...] ### Examples -假设 FE 在 fe.conf 中有配置 http_port=8030,则下面的请求激活 FE 中的木桩`foo`,并传递了两个参数: +假设 FE 在 fe.conf 中有配置 http_port=8030,则下面的请求激活 FE 中的木桩`foo`,并传递了两个参数 `percent` 和 `duration`: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5&duration=3" @@ -156,15 +158,18 @@ curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5 ``` 注意: 1、在 FE 或 BE 的代码中,参数名和参数值都是字符串。 -2、在 FE 或 BE 的代码中和 http 请求中的参数名称和值都是大小写敏感的。 +2、在 FE 或 BE 的代码中和 http 请求中,参数名称和值都是大小写敏感的。 3、发给 FE 或 BE 的 http 请求,路径部分格式是相同的,只是 IP 地址和端口号不同。 ``` -### 在FE、BE代码中使用参数 -激活 FE 中的木桩`OlapTableSink.write_random_choose_sink`并传递参数: +### 在 FE 和 BE 代码中使用参数 + +激活 FE 中的木桩`OlapTableSink.write_random_choose_sink`并传递参数 `needCatchUp` 和 `sinkNum`: +>注意:可能需要用户名和密码 ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" ``` + 在 FE 代码中使用木桩 OlapTableSink.write_random_choose_sink 的参数 `needCatchUp` 和 `sinkNum`: ```java private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap bePathsMap) { @@ -179,7 +184,7 @@ private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap 提交PR时,社区 CI 系统默认开启 FE 和 BE 的`enable_debug_points`配置。 + +回归测试框架提供方法函数来开关指定的木桩,它们声明如下: ```groovy -// 打开木桩,name 是木桩名称,params是一个key-value列表,是传给木桩的参数 +// 打开木桩,name 是木桩名称,params 是一个key-value列表,是传给木桩的参数 def enableDebugPointForAllFEs(String name, Map params = null); def enableDebugPointForAllBEs(String name, Map params = null); // 关闭木桩,name 是木桩的名称 def disableDebugPointForAllFEs(String name); def disableDebugPointForAllFEs(String name); ``` -需要在调用测试action之前调用 `enableDebugPointForAllFEs()` 或 `enableDebugPointForAllBEs()` 来开启木桩,
+需要在调用测试 action 之前调用 `enableDebugPointForAllFEs()` 或 `enableDebugPointForAllBEs()` 来开启木桩,
这样执行到木桩代码时,相关代码才会被执行,
-然后在调用测试action之后调用 `disableDebugPointForAllFEs()` or `disableDebugPointForAllBEs()` 来关闭木桩。 +然后在调用测试 action 之后调用 `disableDebugPointForAllFEs()` 或 `disableDebugPointForAllBEs()` 来关闭木桩。 ### 并发问题 -FE 或 BE 中开启木桩后会全局生效,提交了 Pull Request 后,可能并发跑的其它测试用例会受影响而意外失败。 -为了避免这种情况,我们规定,使用代码打桩的回归测试,必须放在 regression-test/suites/fault_injection_p0 目录下, +FE 或 BE 中开启的木桩是全局生效的,同一个 Pull Request 中,并发跑的其它测试,可能会受影响而意外失败。 +为了避免这种情况,我们规定,使用木桩的回归测试,必须放在 regression-test/suites/fault_injection_p0 目录下, 且组名必须设置为 `nonConcurrent`,社区 CI 系统对于这些用例,会串行运行。 ### Examples @@ -293,15 +299,15 @@ FE 或 BE 中开启木桩后会全局生效,提交了 Pull Request 后,可 suite('debugpoint_action', 'nonConcurrent') { try { // 打开所有FE中,名为 "PublishVersionDaemon.stop_publish" 的木桩 - // 传参数 timeout=1 - // execute 和 timeout 是预设的参数,作用和上面curl调用时一样 + // 传参数 timeout + // 与上面curl调用时一样,execute 是执行次数,timeout 是超时秒数 GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish', [timeout:1]) // 打开所有BE中,名为 "Tablet.build_tablet_report_info.version_miss" 的木桩 - // 传参数 tablet_id='12345', version_miss=true and timeout=1 + // 传参数 tablet_id, version_miss 和 timeout GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', [tablet_id:'12345', version_miss:true, timeout:1]) - // 想要利用木桩构造错误的测试用例 + // 测试用例,会触发木桩代码的执行 sql """CREATE TABLE tbl_1 (k1 INT, k2 INT) DUPLICATE KEY (k1) DISTRIBUTED BY HASH(k1) From 3d0c50df7953e4621807d2cb12ee84f918d481bd Mon Sep 17 00:00:00 2001 From: HowardQin Date: Tue, 19 Dec 2023 10:14:16 +0800 Subject: [PATCH 20/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index 35790506998169..32498d1132fa88 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -32,9 +32,9 @@ it can change variables or behaviors of the program. It is mainly used for unit test or regression test when it is impossible to trigger some exceptions through normal means. -Each debug point has a name, the name can be whatever we want, there are swithes to enable and disable debug points, +Each debug point has a name, the name can be whatever you want, there are swithes to enable and disable debug points, -and we can also pass data to debug points. +and you can also pass data to debug points. Both FE and BE support debug point, and after inserting debug point code, recompilation of FE or BE is needed. @@ -78,10 +78,9 @@ To enable debug points globally, we need to set `enable_debug_points` to true, `enable_debug_points` is located in FE's fe.conf and BE's be.conf. -## Activate Specified Debug Point +## Activate A Specified Debug Point -After debug points are enabled globally,
-we need to specify the debug point name we want to activate, this is done by sending a http request to FE or BE node,
+After debug points are enabled globally, a http request with a debug point name should be send to FE or BE node,
only after that, when the program running into the specified debug point, related code can be executed. ### API @@ -129,7 +128,9 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" ## Pass Custom Parameters -When activating debug point, besides "timeout" and "execute" mentioned above, we can also pass custom parameters. +When activating debug point, besides "timeout" and "execute" mentioned above, passing custom parameters is also allowed.
+A parameter is a key-value pair in the form of "key=value" in url path, after debug point name glued by charactor '?'.
+See examples below. ### API @@ -137,7 +138,8 @@ When activating debug point, besides "timeout" and "execute" mentioned above, we POST /api/debug_point/add/{debug_point_name}[?k1=v1&k2=v2&k3=v3...] ``` * `k1=v1`
- The parameter passing is in key-value fashion, e.g. k1 is name and v1 is value,
+ k1 is parameter name,
+ v1 is parameter value,
multiple key-value pairs are concatenated by `&`,
@@ -156,8 +158,9 @@ None ``` ### Examples -Assuming a FE node with configuration http_port=8030 in fe.conf, the following http request activates a debug point named `foo` in FE node, and passes two parameters: - +Assuming a FE node with configuration http_port=8030 in fe.conf,
+the following http request activates a debug point named `foo` in FE node and passe parameter `percent` and `duration`: +>NOTE: User name and password may be needed. ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?percent=0.5&duration=3" ``` @@ -170,12 +173,12 @@ NOTE: ``` ### Use parameters in FE and BE code -Following request activates debug point `OlapTableSink.write_random_choose_sink` in FE and passes two parameters, `needCatchUp` and `sinkNum`: +Following request activates debug point `OlapTableSink.write_random_choose_sink` in FE and passes parameter `needCatchUp` and `sinkNum`: ``` curl -u root: -X POST "http://127.0.0.1:8030/api/debug_point/add/OlapTableSink.write_random_choose_sink?needCatchUp=true&sinkNum=3" ``` -The code in FE checks debug point `OlapTableSink.write_random_choose_sink` and gets values: +The code in FE checks debug point `OlapTableSink.write_random_choose_sink` and gets parameter values: ```java private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimap bePathsMap) { DebugPoint debugPoint = DebugPointUtil.getDebugPoint("OlapTableSink.write_random_choose_sink"); @@ -188,12 +191,12 @@ private void debugWriteRandomChooseSink(Tablet tablet, long version, Multimapparam("percent", 0.5))) { @@ -276,23 +279,24 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" ## Debug Points in Regression Test -In community CI system, `enable_debug_points` configuration of FE and BE are set to true.
+>In community CI system, `enable_debug_points` configuration of FE and BE are true by default. + The Regression test framework also provides methods to activate and deactivate perticular debug point,
they are declared as below: ```groovy -// name is the debug point to activate, params is a list key-value pairs passed to debug point +// "name" is the debug point to activate, "params" is a list of key-value pairs passed to debug point def enableDebugPointForAllFEs(String name, Map params = null); def enableDebugPointForAllBEs(String name, Map params = null); -// name is the debug point to deactivate +// "name" is the debug point to deactivate def disableDebugPointForAllFEs(String name); def disableDebugPointForAllFEs(String name); ``` -`enableDebugPointForAllFEs()` or `enableDebugPointForAllBEs()` needs to be called before test actions you want to generate error,
+`enableDebugPointForAllFEs()` or `enableDebugPointForAllBEs()` needs to be called before test actions to generate error,
and `disableDebugPointForAllFEs()` or `disableDebugPointForAllBEs()` needs to be called later. ### Concurrent Issue -Enabling debug points affects FE or BE globally, it could cause other concurrent tests of your pull request to fail unexpectly.
+Enabled debug points affects FE or BE globally, which could cause other concurrent tests of a pull request to fail unexpectly.
To avoid this, there's a convension that regression tests using debug points must be in directory regression-test/suites/fault_injection_p0,
and their group name must be "nonConcurrent", because community CI system will run them serially. @@ -304,15 +308,15 @@ and their group name must be "nonConcurrent", because community CI system will r suite('debugpoint_action', 'nonConcurrent') { try { // Activate debug point named "PublishVersionDaemon.stop_publish" in all FE - // and pass timeout=1 - // Same as above, "execute" and "timeout" are pre-existing parameters + // and pass timeout + // "execute" and "timeout" are pre-existing parameters, same as above GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish', [timeout:1]) // Activate debug point named "Tablet.build_tablet_report_info.version_miss" in all BE - // and pass: tablet_id='12345', version_miss=true and timeout=1 + // and pass: tablet_id, version_miss and timeout GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', [tablet_id:'12345', version_miss:true, timeout:1]) - // Actions which will run into debug point and generate error + // Test actions which will run into debug point and generate error sql """CREATE TABLE tbl_1 (k1 INT, k2 INT) DUPLICATE KEY (k1) DISTRIBUTED BY HASH(k1) From b4fc4a8566e3062b558ae51cf8c1f9578d905cd4 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 20 Dec 2023 11:10:28 +0800 Subject: [PATCH 21/25] Update debug-point-action.md --- docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index 32498d1132fa88..8aff2475c50abc 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -281,7 +281,7 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" >In community CI system, `enable_debug_points` configuration of FE and BE are true by default. -The Regression test framework also provides methods to activate and deactivate perticular debug point,
+The Regression test framework also provides methods to activate and deactivate a particular debug point,
they are declared as below: ```groovy // "name" is the debug point to activate, "params" is a list of key-value pairs passed to debug point From 0576beaf17ffa576934abc8e7d4cba83fa55c903 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Wed, 20 Dec 2023 11:26:29 +0800 Subject: [PATCH 22/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index 8aff2475c50abc..8faa3261d0f567 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -279,7 +279,7 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" ## Debug Points in Regression Test ->In community CI system, `enable_debug_points` configuration of FE and BE are true by default. +>In community's CI system, `enable_debug_points` configuration of FE and BE are true by default. The Regression test framework also provides methods to activate and deactivate a particular debug point,
they are declared as below: @@ -291,14 +291,14 @@ def enableDebugPointForAllBEs(String name, Map params = null); def disableDebugPointForAllFEs(String name); def disableDebugPointForAllFEs(String name); ``` -`enableDebugPointForAllFEs()` or `enableDebugPointForAllBEs()` needs to be called before test actions to generate error,
-and `disableDebugPointForAllFEs()` or `disableDebugPointForAllBEs()` needs to be called later. +`enableDebugPointForAllFEs()` or `enableDebugPointForAllBEs()` needs to be called before the test actions you want to generate error,
+and `disableDebugPointForAllFEs()` or `disableDebugPointForAllBEs()` needs to be called afterward. ### Concurrent Issue -Enabled debug points affects FE or BE globally, which could cause other concurrent tests of a pull request to fail unexpectly.
+Enabled debug points affects FE or BE globally, which could cause other concurrent tests to fail unexpectly in your pull request.
To avoid this, there's a convension that regression tests using debug points must be in directory regression-test/suites/fault_injection_p0,
-and their group name must be "nonConcurrent", because community CI system will run them serially. +and their group name must be "nonConcurrent", as these regression tests will be executed serially by pull request workflow. ### Examples @@ -308,11 +308,12 @@ and their group name must be "nonConcurrent", because community CI system will r suite('debugpoint_action', 'nonConcurrent') { try { // Activate debug point named "PublishVersionDaemon.stop_publish" in all FE - // and pass timeout - // "execute" and "timeout" are pre-existing parameters, same as above + // and pass parameter "timeout" + // "execute" and "timeout" are pre-existing parameters, usage is mentioned above GetDebugPoint().enableDebugPointForAllFEs('PublishVersionDaemon.stop_publish', [timeout:1]) + // Activate debug point named "Tablet.build_tablet_report_info.version_miss" in all BE - // and pass: tablet_id, version_miss and timeout + // and pass parameter "tablet_id", "version_miss" and "timeout" GetDebugPoint().enableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss', [tablet_id:'12345', version_miss:true, timeout:1]) @@ -328,6 +329,7 @@ suite('debugpoint_action', 'nonConcurrent') { order_qt_select_1_1 'SELECT * FROM tbl_1' } finally { + // Deactivate debug points GetDebugPoint().disableDebugPointForAllFEs('PublishVersionDaemon.stop_publish') GetDebugPoint().disableDebugPointForAllBEs('Tablet.build_tablet_report_info.version_miss') } From 9f6475cdfcc0acf48e3db6df5bbd40537acdd86c Mon Sep 17 00:00:00 2001 From: HowardQin Date: Thu, 21 Dec 2023 17:50:29 +0800 Subject: [PATCH 23/25] Update debug-point-action.md --- .../http-actions/fe/debug-point-action.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index 8faa3261d0f567..067094ccb95676 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -80,7 +80,7 @@ To enable debug points globally, we need to set `enable_debug_points` to true, ## Activate A Specified Debug Point -After debug points are enabled globally, a http request with a debug point name should be send to FE or BE node,
+After debug points are enabled globally, a http request with a debug point name should be send to FE or BE node,
only after that, when the program running into the specified debug point, related code can be executed. ### API @@ -128,8 +128,8 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" ## Pass Custom Parameters -When activating debug point, besides "timeout" and "execute" mentioned above, passing custom parameters is also allowed.
-A parameter is a key-value pair in the form of "key=value" in url path, after debug point name glued by charactor '?'.
+When activating debug point, besides "timeout" and "execute" mentioned above, passing custom parameters is also allowed.
+A parameter is a key-value pair in the form of "key=value" in url path, after debug point name glued by charactor '?'.
See examples below. ### API @@ -137,10 +137,10 @@ See examples below. ``` POST /api/debug_point/add/{debug_point_name}[?k1=v1&k2=v2&k3=v3...] ``` -* `k1=v1`
- k1 is parameter name,
- v1 is parameter value,
- multiple key-value pairs are concatenated by `&`,
+* `k1=v1`
+ k1 is parameter name
+ v1 is parameter value
+ multiple key-value pairs are concatenated by `&`
@@ -158,7 +158,7 @@ None ``` ### Examples -Assuming a FE node with configuration http_port=8030 in fe.conf,
+Assuming a FE node with configuration http_port=8030 in fe.conf,
the following http request activates a debug point named `foo` in FE node and passe parameter `percent` and `duration`: >NOTE: User name and password may be needed. ``` @@ -281,7 +281,7 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" >In community's CI system, `enable_debug_points` configuration of FE and BE are true by default. -The Regression test framework also provides methods to activate and deactivate a particular debug point,
+The Regression test framework also provides methods to activate and deactivate a particular debug point,
they are declared as below: ```groovy // "name" is the debug point to activate, "params" is a list of key-value pairs passed to debug point @@ -291,13 +291,13 @@ def enableDebugPointForAllBEs(String name, Map params = null); def disableDebugPointForAllFEs(String name); def disableDebugPointForAllFEs(String name); ``` -`enableDebugPointForAllFEs()` or `enableDebugPointForAllBEs()` needs to be called before the test actions you want to generate error,
+`enableDebugPointForAllFEs()` or `enableDebugPointForAllBEs()` needs to be called before the test actions you want to generate error,
and `disableDebugPointForAllFEs()` or `disableDebugPointForAllBEs()` needs to be called afterward. ### Concurrent Issue -Enabled debug points affects FE or BE globally, which could cause other concurrent tests to fail unexpectly in your pull request.
-To avoid this, there's a convension that regression tests using debug points must be in directory regression-test/suites/fault_injection_p0,
+Enabled debug points affects FE or BE globally, which could cause other concurrent tests to fail unexpectly in your pull request.
+To avoid this, there's a convension that regression tests using debug points must be in directory regression-test/suites/fault_injection_p0,
and their group name must be "nonConcurrent", as these regression tests will be executed serially by pull request workflow. ### Examples From 9bbe99ba6379ebd2b223b39b34951b4e2999e282 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Thu, 21 Dec 2023 17:52:00 +0800 Subject: [PATCH 24/25] Update debug-point-action.md --- docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md index 067094ccb95676..84ad9bf324a3f1 100644 --- a/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/en/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -281,7 +281,7 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/clear" >In community's CI system, `enable_debug_points` configuration of FE and BE are true by default. -The Regression test framework also provides methods to activate and deactivate a particular debug point,
+The Regression test framework also provides methods to activate and deactivate a particular debug point,
they are declared as below: ```groovy // "name" is the debug point to activate, "params" is a list of key-value pairs passed to debug point From 2644542827a2547f70fdf5657fbe57a8baed2ad3 Mon Sep 17 00:00:00 2001 From: HowardQin Date: Thu, 21 Dec 2023 17:54:10 +0800 Subject: [PATCH 25/25] Update debug-point-action.md --- .../docs/admin-manual/http-actions/fe/debug-point-action.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md index e0094f05f022f3..df68ac003c804f 100644 --- a/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md +++ b/docs/zh-CN/docs/admin-manual/http-actions/fe/debug-point-action.md @@ -123,7 +123,7 @@ curl -X POST "http://127.0.0.1:8030/api/debug_point/add/foo?execute=5" ## 向木桩传递参数 -激活木桩时,除了前文所述的 timeout 和 execute,还可以传递其它自定义参数。
+激活木桩时,除了前文所述的 timeout 和 execute,还可以传递其它自定义参数。
一个参数是一个形如 key=value 的 key-value 对,在 url 的路径部分,紧跟在木桩名称后,以字符 '?' 开头。 ### API @@ -281,8 +281,8 @@ def enableDebugPointForAllBEs(String name, Map params = null); def disableDebugPointForAllFEs(String name); def disableDebugPointForAllFEs(String name); ``` -需要在调用测试 action 之前调用 `enableDebugPointForAllFEs()` 或 `enableDebugPointForAllBEs()` 来开启木桩,
-这样执行到木桩代码时,相关代码才会被执行,
+需要在调用测试 action 之前调用 `enableDebugPointForAllFEs()` 或 `enableDebugPointForAllBEs()` 来开启木桩,
+这样执行到木桩代码时,相关代码才会被执行,
然后在调用测试 action 之后调用 `disableDebugPointForAllFEs()` 或 `disableDebugPointForAllBEs()` 来关闭木桩。 ### 并发问题