Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor](cloud) Extract SyncPoint to common cpp #37165

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

platoneko
Copy link
Contributor

@platoneko platoneko commented Jul 2, 2024

Proposed changes

Extract SyncPoint to common cpp directory. Some code shared between BE and Cloud will gradually be extracted to the $repo_root/common/cpp directory in the future.

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

@platoneko
Copy link
Contributor Author

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

@@ -18,10 +18,10 @@
#include <gtest/gtest.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'gtest/gtest.h' file not found [clang-diagnostic-error]

#include <gtest/gtest.h>
         ^

@@ -18,13 +18,13 @@
#include <chrono>

#include "common/logging.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'common/logging.h' file not found [clang-diagnostic-error]

#include "common/logging.h"
         ^

@@ -17,7 +17,7 @@

#include "recycler/obj_storage_client.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'recycler/obj_storage_client.h' file not found [clang-diagnostic-error]

#include "recycler/obj_storage_client.h"
         ^

@@ -71,22 +71,26 @@ int main(int argc, char** argv) {
cloud::config::fdb_cluster_file_path = "fdb.cluster";
cloud::config::write_schema_kv = true;

auto sp = cloud::SyncPoint::get_instance();
auto sp = SyncPoint::get_instance();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto]

Suggested change
auto sp = SyncPoint::get_instance();
auto *sp = SyncPoint::get_instance();

@@ -163,7 +163,7 @@ TEST(MetaServerTest, StartAndStop) {
options.num_threads = 1;
brpc::Server brpc_server;

auto sp = cloud::SyncPoint::get_instance();
auto sp = SyncPoint::get_instance();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto]

Suggested change
auto sp = SyncPoint::get_instance();
auto *sp = SyncPoint::get_instance();

[](void* p) { *reinterpret_cast<int*>(p) = 0; });
sp->set_call_back("decrypt_ak_sk:get_encryption_key",
[](void* p) { *reinterpret_cast<std::string*>(p) = "test"; });
auto sp = SyncPoint::get_instance();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto]

Suggested change
auto sp = SyncPoint::get_instance();
auto *sp = SyncPoint::get_instance();

@@ -58,7 +58,7 @@ void foo() {
}

void test_foo_single_thread() {
auto sp = doris::cloud::SyncPoint::get_instance();
auto sp = doris::SyncPoint::get_instance();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto]

Suggested change
auto sp = doris::SyncPoint::get_instance();
auto *sp = doris::SyncPoint::get_instance();

@@ -108,7 +108,7 @@

std::mutex mtx;
std::condition_variable cv;
auto sp = doris::cloud::SyncPoint::get_instance();
auto sp = doris::SyncPoint::get_instance();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto]

Suggested change
auto sp = doris::SyncPoint::get_instance();
auto *sp = doris::SyncPoint::get_instance();

@@ -266,7 +266,7 @@
}

void test_return_point() {
auto sp = doris::cloud::SyncPoint::get_instance();
auto sp = doris::SyncPoint::get_instance();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto]

Suggested change
auto sp = doris::SyncPoint::get_instance();
auto *sp = doris::SyncPoint::get_instance();

@@ -283,9 +283,9 @@ TEST(TxnKvTest, CompatibleGetTest) {
TEST(TxnKvTest, PutLargeValueTest) {
auto txn_kv = std::make_shared<MemTxnKv>();

auto sp = SyncPoint::get_instance();
auto sp = doris::SyncPoint::get_instance();
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'auto sp' can be declared as 'auto *sp' [readability-qualified-auto]

Suggested change
auto sp = doris::SyncPoint::get_instance();
auto *sp = doris::SyncPoint::get_instance();

# define TEST_INJECTION_POINT_SINGLETON() if (doris::config::enable_injection_point) { LOG_INFO("enter inject point {}", x); SYNC_POINT_SINGLETON(); }
# define TEST_INJECTION_POINT_RETURN_WITH_VALUE(x, default_ret_val, ...) if (doris::config::enable_injection_point) { LOG_INFO("enter inject point {}", x); SYNC_POINT_RETURN_WITH_VALUE(x, default_ret_val, __VA_ARGS__); }
# define TEST_INJECTION_POINT_RETURN_WITH_VOID(x, ...) if (doris::config::enable_injection_point) { LOG_INFO("enter inject point {}", x); SYNC_POINT_RETURN_WITH_VOID(x, __VA_ARGS__); }
# define TEST_INJECTION_POINT(x) SYNC_POINT(x);
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems all injection points are not functioning any more?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Injection points will be enabled via http api

Copy link
Contributor

Choose a reason for hiding this comment

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

name the folder "common" or "common/cpp" or "cpp-common"?
and add a README.md to it.

Copy link
Contributor

@w41ter w41ter Jul 3, 2024

Choose a reason for hiding this comment

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

How about naming it as common/rock and setting the include directory to common, then the user would locate and identify the included files by #include "rock/sync_point.h".

The word rock is just an example, it could be other words.

@doris-robot
Copy link

TPC-H: Total hot run time: 40765 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 97a82d6a5dcb52d3eeea1c35ada6ea35d27157ae, data reload: false

------ Round 1 ----------------------------------
q1	17607	4593	4266	4266
q2	2018	193	192	192
q3	10449	1278	1180	1180
q4	10181	815	890	815
q5	7513	2659	2665	2659
q6	217	136	137	136
q7	955	603	603	603
q8	9228	2110	2085	2085
q9	8893	6486	6493	6486
q10	9074	3691	3731	3691
q11	461	233	239	233
q12	437	243	228	228
q13	17765	3007	3003	3003
q14	260	228	230	228
q15	528	500	490	490
q16	528	386	378	378
q17	982	703	712	703
q18	8072	7426	7356	7356
q19	7962	1488	1523	1488
q20	676	331	336	331
q21	4895	3869	3935	3869
q22	404	345	348	345
Total cold run time: 119105 ms
Total hot run time: 40765 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4430	4237	4239	4237
q2	368	272	271	271
q3	3209	2902	2922	2902
q4	1975	1704	1707	1704
q5	5552	5553	5442	5442
q6	228	138	133	133
q7	2291	1845	1809	1809
q8	3298	3454	3451	3451
q9	8728	8880	8757	8757
q10	4064	3699	3862	3699
q11	621	497	522	497
q12	827	612	620	612
q13	15964	3169	3124	3124
q14	314	282	294	282
q15	529	510	485	485
q16	513	421	445	421
q17	1835	1553	1490	1490
q18	8191	8086	7829	7829
q19	1784	1553	1665	1553
q20	2548	1881	1866	1866
q21	5117	4881	4815	4815
q22	640	564	570	564
Total cold run time: 73026 ms
Total hot run time: 55943 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 174542 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 97a82d6a5dcb52d3eeea1c35ada6ea35d27157ae, data reload: false

query1	921	388	379	379
query2	6437	2449	2368	2368
query3	6633	206	211	206
query4	20264	17440	17333	17333
query5	3686	495	477	477
query6	250	164	172	164
query7	4599	301	288	288
query8	305	293	292	292
query9	8677	2465	2457	2457
query10	576	306	287	287
query11	10680	9873	10022	9873
query12	109	82	82	82
query13	1652	368	357	357
query14	10054	7782	7701	7701
query15	246	186	188	186
query16	7835	263	262	262
query17	1897	555	528	528
query18	1906	279	277	277
query19	194	146	154	146
query20	88	83	81	81
query21	205	143	126	126
query22	4454	4018	4090	4018
query23	33999	33457	33523	33457
query24	11065	2852	2891	2852
query25	643	411	401	401
query26	1055	160	192	160
query27	2297	323	328	323
query28	6214	2205	2189	2189
query29	895	623	645	623
query30	273	155	159	155
query31	981	765	742	742
query32	94	53	55	53
query33	766	287	287	287
query34	1024	488	497	488
query35	757	651	646	646
query36	1162	994	971	971
query37	140	75	75	75
query38	2927	2795	2810	2795
query39	882	838	845	838
query40	213	128	128	128
query41	52	54	50	50
query42	115	95	97	95
query43	561	549	556	549
query44	1244	733	717	717
query45	194	160	163	160
query46	1104	747	718	718
query47	1836	1783	1755	1755
query48	370	295	296	295
query49	882	401	414	401
query50	778	389	384	384
query51	6966	6769	6720	6720
query52	107	91	94	91
query53	364	287	297	287
query54	889	470	452	452
query55	74	73	75	73
query56	283	262	263	262
query57	1109	1053	1043	1043
query58	247	256	243	243
query59	3674	3251	3167	3167
query60	298	266	278	266
query61	92	114	94	94
query62	608	442	456	442
query63	314	288	291	288
query64	8690	2243	1749	1749
query65	3167	3101	3093	3093
query66	745	340	347	340
query67	15495	14977	14963	14963
query68	4456	534	541	534
query69	474	307	336	307
query70	1203	1104	1135	1104
query71	391	292	278	278
query72	7255	5451	5954	5451
query73	747	330	333	330
query74	5947	5561	5462	5462
query75	3378	2642	2703	2642
query76	2476	943	905	905
query77	496	299	300	299
query78	10609	9969	9869	9869
query79	2374	510	520	510
query80	2702	462	459	459
query81	594	217	220	217
query82	753	104	107	104
query83	304	167	173	167
query84	255	85	85	85
query85	2097	351	276	276
query86	486	287	305	287
query87	3269	3057	3097	3057
query88	3778	2453	2439	2439
query89	459	375	396	375
query90	1901	186	182	182
query91	127	99	98	98
query92	57	47	47	47
query93	2386	495	502	495
query94	1256	192	183	183
query95	408	308	313	308
query96	598	271	265	265
query97	3227	3006	3003	3003
query98	226	203	195	195
query99	1117	841	848	841
Total cold run time: 273119 ms
Total hot run time: 174542 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.16 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 97a82d6a5dcb52d3eeea1c35ada6ea35d27157ae, data reload: false

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.23	0.06	0.05
query4	1.67	0.08	0.07
query5	0.50	0.47	0.48
query6	1.13	0.72	0.72
query7	0.02	0.02	0.01
query8	0.06	0.04	0.04
query9	0.55	0.48	0.48
query10	0.54	0.55	0.54
query11	0.15	0.12	0.12
query12	0.15	0.12	0.12
query13	0.59	0.59	0.60
query14	0.77	0.79	0.78
query15	0.85	0.82	0.82
query16	0.37	0.36	0.36
query17	1.01	0.98	1.03
query18	0.22	0.27	0.23
query19	1.81	1.70	1.74
query20	0.02	0.01	0.01
query21	15.44	0.76	0.64
query22	4.26	7.68	1.50
query23	18.27	1.43	1.22
query24	2.10	0.24	0.23
query25	0.14	0.08	0.08
query26	0.27	0.18	0.18
query27	0.08	0.08	0.08
query28	13.28	1.03	1.01
query29	12.64	3.33	3.30
query30	0.26	0.06	0.06
query31	2.86	0.38	0.38
query32	3.29	0.48	0.46
query33	2.87	2.90	2.91
query34	16.94	4.45	4.38
query35	4.45	4.50	4.49
query36	0.66	0.47	0.49
query37	0.19	0.17	0.16
query38	0.16	0.15	0.15
query39	0.04	0.03	0.03
query40	0.17	0.14	0.15
query41	0.09	0.05	0.05
query42	0.06	0.05	0.06
query43	0.05	0.04	0.04
Total cold run time: 109.33 s
Total hot run time: 30.16 s

@@ -118,6 +118,7 @@ set(BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(ENV{DORIS_HOME} "${BASE_DIR}/..")
set(BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}")
set(GENSRC_DIR "${BASE_DIR}/../gensrc/build/")
set(COMMON_CPP_DIR "${BASE_DIR}/../common_cpp/")
Copy link
Contributor

Choose a reason for hiding this comment

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

common/cpp/xxxx.h

#inlucde "common/cpp/xxx.h"
#include "cpp/xxx.h"

INC_DIR="./common"
INC_DIR="./"

@platoneko
Copy link
Contributor Author

run buildall

@dataroaring
Copy link
Contributor

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 39939 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 5bce84c9be90de0171920b960fe3616ab2be5757, data reload: false

------ Round 1 ----------------------------------
q1	17601	4483	4280	4280
q2	2022	188	186	186
q3	10446	1199	1098	1098
q4	10200	863	746	746
q5	7478	2681	2644	2644
q6	224	140	136	136
q7	952	581	605	581
q8	9230	2114	2071	2071
q9	8909	6508	6527	6508
q10	8958	3737	3740	3737
q11	452	237	238	237
q12	473	247	220	220
q13	18678	3008	2981	2981
q14	275	225	232	225
q15	531	485	492	485
q16	505	391	377	377
q17	959	605	604	604
q18	8121	7477	7504	7477
q19	4901	1516	1497	1497
q20	675	329	326	326
q21	5069	3190	3906	3190
q22	388	333	339	333
Total cold run time: 117047 ms
Total hot run time: 39939 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4513	4234	4265	4234
q2	370	265	265	265
q3	2952	2880	2916	2880
q4	1987	1717	1838	1717
q5	5678	5520	5477	5477
q6	225	133	135	133
q7	2249	1888	1846	1846
q8	3248	3437	3441	3437
q9	8748	8711	8759	8711
q10	4097	3899	3811	3811
q11	600	526	490	490
q12	814	625	630	625
q13	15938	3168	3152	3152
q14	306	278	282	278
q15	528	488	487	487
q16	473	432	428	428
q17	1804	1512	1517	1512
q18	8309	8281	7890	7890
q19	1837	1653	1456	1456
q20	2161	1834	1848	1834
q21	7815	4952	4737	4737
q22	664	521	547	521
Total cold run time: 75316 ms
Total hot run time: 55921 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 170447 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 5bce84c9be90de0171920b960fe3616ab2be5757, data reload: false

query1	927	379	368	368
query2	6453	2394	2395	2394
query3	6633	204	217	204
query4	25777	17592	17240	17240
query5	3679	468	475	468
query6	265	173	164	164
query7	4578	299	300	299
query8	321	293	297	293
query9	8363	2408	2391	2391
query10	585	310	283	283
query11	10993	10072	9907	9907
query12	117	83	84	83
query13	1640	374	379	374
query14	10031	7579	7809	7579
query15	243	177	188	177
query16	7701	318	314	314
query17	1810	560	536	536
query18	1902	282	288	282
query19	199	154	159	154
query20	95	83	85	83
query21	220	138	128	128
query22	4320	4142	4039	4039
query23	34004	33978	33549	33549
query24	10674	2871	2838	2838
query25	606	432	408	408
query26	711	158	155	155
query27	2230	325	335	325
query28	6249	2140	2132	2132
query29	898	678	651	651
query30	250	156	153	153
query31	973	752	780	752
query32	98	55	60	55
query33	681	321	314	314
query34	911	486	506	486
query35	783	633	668	633
query36	1156	978	966	966
query37	144	85	83	83
query38	3059	2815	2838	2815
query39	844	800	797	797
query40	202	125	123	123
query41	53	50	51	50
query42	120	96	100	96
query43	548	539	554	539
query44	1069	720	733	720
query45	190	159	156	156
query46	1061	757	708	708
query47	1880	1793	1782	1782
query48	367	300	285	285
query49	856	409	420	409
query50	762	383	387	383
query51	6772	6850	6721	6721
query52	108	90	95	90
query53	373	285	297	285
query54	953	437	441	437
query55	78	71	74	71
query56	298	278	262	262
query57	1154	1064	1064	1064
query58	256	238	247	238
query59	3188	3177	3006	3006
query60	294	265	272	265
query61	111	93	93	93
query62	610	444	454	444
query63	322	297	286	286
query64	9448	2184	1655	1655
query65	3262	3094	3098	3094
query66	765	320	332	320
query67	15751	14914	15005	14914
query68	8386	524	525	524
query69	740	422	366	366
query70	1274	1081	1138	1081
query71	539	284	283	283
query72	9086	2814	2597	2597
query73	1940	315	325	315
query74	6047	5497	5488	5488
query75	5100	2608	2687	2608
query76	4803	943	943	943
query77	733	298	301	298
query78	12511	9461	8939	8939
query79	11245	514	517	514
query80	1445	481	484	481
query81	590	222	215	215
query82	376	112	106	106
query83	354	167	164	164
query84	280	86	87	86
query85	755	305	288	288
query86	397	311	316	311
query87	3341	3103	3103	3103
query88	4786	2368	2360	2360
query89	490	367	388	367
query90	2077	188	183	183
query91	185	100	102	100
query92	60	46	49	46
query93	3894	496	494	494
query94	1245	207	213	207
query95	397	308	315	308
query96	599	267	268	267
query97	3183	2992	3001	2992
query98	230	200	216	200
query99	1159	852	845	845
Total cold run time: 300221 ms
Total hot run time: 170447 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.92 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 5bce84c9be90de0171920b960fe3616ab2be5757, data reload: false

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.22	0.06	0.06
query4	1.65	0.07	0.07
query5	0.48	0.47	0.49
query6	1.12	0.72	0.72
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.55	0.48	0.49
query10	0.54	0.52	0.54
query11	0.15	0.11	0.11
query12	0.15	0.12	0.12
query13	0.58	0.58	0.58
query14	0.75	0.79	0.78
query15	0.84	0.80	0.81
query16	0.37	0.35	0.37
query17	0.92	0.98	0.95
query18	0.25	0.22	0.26
query19	1.85	1.75	1.69
query20	0.01	0.01	0.01
query21	15.40	0.75	0.64
query22	3.82	7.37	2.30
query23	18.30	1.33	1.21
query24	2.17	0.24	0.22
query25	0.16	0.08	0.08
query26	0.30	0.22	0.21
query27	0.46	0.23	0.23
query28	13.16	1.01	1.00
query29	12.66	3.33	3.34
query30	0.25	0.06	0.06
query31	2.87	0.38	0.38
query32	3.29	0.47	0.47
query33	2.88	2.92	2.90
query34	17.02	4.39	4.42
query35	4.40	4.41	4.46
query36	0.64	0.46	0.47
query37	0.18	0.15	0.15
query38	0.15	0.14	0.15
query39	0.04	0.04	0.04
query40	0.14	0.12	0.12
query41	0.09	0.04	0.04
query42	0.05	0.05	0.05
query43	0.04	0.04	0.04
Total cold run time: 109.09 s
Total hot run time: 30.92 s

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

github-actions bot commented Jul 8, 2024

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

Copy link
Contributor

github-actions bot commented Jul 8, 2024

PR approved by anyone and no changes requested.

@dataroaring dataroaring merged commit bca8b07 into apache:master Jul 9, 2024
26 of 30 checks passed
hello-stephen pushed a commit that referenced this pull request Jul 9, 2024
dataroaring pushed a commit that referenced this pull request Jul 17, 2024
## Proposed changes

Extract SyncPoint to common cpp directory. Some code shared between BE
and Cloud will gradually be extracted to the `$repo_root/common/cpp`
directory in the future.
dataroaring pushed a commit that referenced this pull request Jul 17, 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.1-merged reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants