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

[fix](merge-on-write) segcompaction should process delete bitmap if necessary #38369

Merged
merged 5 commits into from
Aug 1, 2024

Conversation

zhannngchen
Copy link
Contributor

@zhannngchen zhannngchen commented Jul 25, 2024

Proposed changes

Issue Number: close #xxx

When loading data to a unique key table with sequence column, some data in current load job might be marked as delete due to a lower sequence value.
If there's many segments in such load job, segcompaction might be triggered, which don't process the delete bitmap currently, will cause data correctness issue

For example:

  1. we have 4 segments in current load job initially, and due to seq column, some rows are marked as deleted
  2. after segcompaction, if we don't process the delete bitmap, it's content is still corresponding to the old segment layout, and row 7,14,15 is not mark deleted correctly on new generated segment 1.
  3. in this PR, we convert old delete bitmap to fit new segment layout, it use similar way as base/cumulative compaction to convert delete bitmaps on old layout to new one, but the rowid conversion is simpler

whiteboard_exported_image-2

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

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

be/test/olap/segcompaction_mow_test.cpp Show resolved Hide resolved
be/test/olap/segcompaction_mow_test.cpp Outdated Show resolved Hide resolved
be/test/olap/segcompaction_mow_test.cpp Show resolved Hide resolved
be/test/olap/segcompaction_mow_test.cpp Show resolved Hide resolved
@zhannngchen
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

be/test/olap/segcompaction_mow_test.cpp Show resolved Hide resolved
be/test/olap/segcompaction_mow_test.cpp Show resolved Hide resolved
be/test/olap/segcompaction_mow_test.cpp Show resolved Hide resolved
@zhannngchen
Copy link
Contributor Author

run buildall

@zhannngchen zhannngchen force-pushed the fix-segcompaction-dup-key-1 branch from 6865700 to 7759455 Compare July 25, 2024 11:27
@zhannngchen
Copy link
Contributor Author

run buildall

@zhannngchen
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17650	4282	4278	4278
q2	2013	197	200	197
q3	10429	1204	1182	1182
q4	10206	741	753	741
q5	7646	2760	2726	2726
q6	233	140	138	138
q7	984	600	600	600
q8	9297	1889	1901	1889
q9	8589	6524	6541	6524
q10	8685	3745	3722	3722
q11	445	244	249	244
q12	394	220	222	220
q13	17776	2988	2984	2984
q14	286	243	245	243
q15	525	491	496	491
q16	518	389	383	383
q17	963	713	690	690
q18	7950	7512	7431	7431
q19	5838	997	998	997
q20	665	340	328	328
q21	4951	3285	3191	3191
q22	355	296	288	288
Total cold run time: 116398 ms
Total hot run time: 39487 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4403	4254	4180	4180
q2	383	270	264	264
q3	2992	2764	2773	2764
q4	1879	1586	1628	1586
q5	5291	5285	5309	5285
q6	217	130	132	130
q7	2144	1740	1766	1740
q8	3164	3332	3305	3305
q9	8313	8314	8346	8314
q10	3873	3710	3703	3703
q11	635	499	483	483
q12	784	600	622	600
q13	17533	2966	3005	2966
q14	305	273	281	273
q15	509	475	485	475
q16	473	421	430	421
q17	1765	1484	1468	1468
q18	7655	7378	7448	7378
q19	1669	1555	1569	1555
q20	2023	1774	1808	1774
q21	4844	4714	4664	4664
q22	578	506	531	506
Total cold run time: 71432 ms
Total hot run time: 53834 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 171977 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 c58d61b12a2bd92f3f6f767b5897b75f8781b4f9, data reload: false

query1	916	371	368	368
query2	6455	1886	1883	1883
query3	6651	209	219	209
query4	28842	17470	17367	17367
query5	4183	479	492	479
query6	255	176	171	171
query7	4592	290	298	290
query8	243	194	195	194
query9	8481	2426	2396	2396
query10	452	288	262	262
query11	11614	10075	9957	9957
query12	149	87	85	85
query13	1639	370	369	369
query14	9355	7642	7769	7642
query15	227	168	167	167
query16	7765	520	448	448
query17	1595	555	544	544
query18	1966	285	279	279
query19	185	139	140	139
query20	95	87	88	87
query21	202	104	98	98
query22	4328	4101	4059	4059
query23	33737	33075	33426	33075
query24	11969	2884	2863	2863
query25	673	365	371	365
query26	1846	156	147	147
query27	2972	271	274	271
query28	7753	2012	1998	1998
query29	1157	427	394	394
query30	289	147	149	147
query31	966	725	743	725
query32	96	52	54	52
query33	781	313	319	313
query34	900	461	471	461
query35	871	742	739	739
query36	1064	947	896	896
query37	214	83	84	83
query38	2870	2743	2733	2733
query39	876	822	811	811
query40	270	117	112	112
query41	49	44	44	44
query42	114	97	96	96
query43	527	476	473	473
query44	1230	726	721	721
query45	210	176	174	174
query46	1085	736	690	690
query47	1868	1741	1739	1739
query48	367	294	304	294
query49	1207	416	424	416
query50	795	402	402	402
query51	6738	6645	6616	6616
query52	100	89	90	89
query53	248	179	176	176
query54	953	437	437	437
query55	75	77	73	73
query56	295	269	282	269
query57	1148	1064	1030	1030
query58	271	256	259	256
query59	2779	2578	2771	2578
query60	304	280	287	280
query61	96	94	93	93
query62	846	653	656	653
query63	225	179	178	178
query64	10560	2232	1680	1680
query65	3170	3155	3117	3117
query66	1363	339	337	337
query67	15223	14694	14783	14694
query68	4635	542	543	542
query69	453	308	294	294
query70	1107	1132	1081	1081
query71	403	274	282	274
query72	7526	5587	5698	5587
query73	767	330	332	330
query74	6168	5649	5683	5649
query75	3440	2674	2667	2667
query76	2765	943	888	888
query77	475	307	302	302
query78	9659	9770	8997	8997
query79	1476	520	522	520
query80	2277	561	503	503
query81	592	221	215	215
query82	790	136	134	134
query83	301	176	176	176
query84	254	84	81	81
query85	1340	315	300	300
query86	453	298	284	284
query87	3228	3056	3120	3056
query88	3443	2395	2389	2389
query89	397	288	290	288
query90	1807	191	196	191
query91	127	104	100	100
query92	73	50	51	50
query93	1731	537	547	537
query94	957	293	300	293
query95	355	262	264	262
query96	605	272	273	272
query97	3177	3007	3015	3007
query98	226	194	193	193
query99	1660	1232	1258	1232
Total cold run time: 284007 ms
Total hot run time: 171977 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.03
query2	0.08	0.03	0.04
query3	0.23	0.05	0.06
query4	1.69	0.09	0.08
query5	0.51	0.50	0.49
query6	1.13	0.72	0.73
query7	0.02	0.02	0.01
query8	0.05	0.04	0.04
query9	0.55	0.48	0.48
query10	0.55	0.54	0.54
query11	0.15	0.12	0.11
query12	0.15	0.12	0.12
query13	0.59	0.60	0.59
query14	0.76	0.78	0.81
query15	0.86	0.82	0.82
query16	0.38	0.36	0.37
query17	1.05	1.00	1.02
query18	0.23	0.22	0.20
query19	1.78	1.74	1.69
query20	0.01	0.01	0.01
query21	15.39	0.76	0.66
query22	4.51	6.56	2.34
query23	18.29	1.29	1.25
query24	2.15	0.23	0.22
query25	0.17	0.08	0.08
query26	0.29	0.21	0.21
query27	0.46	0.23	0.23
query28	13.25	1.01	0.99
query29	12.62	3.28	3.24
query30	0.26	0.06	0.05
query31	2.86	0.39	0.38
query32	3.26	0.46	0.48
query33	2.90	2.92	2.95
query34	17.03	4.33	4.32
query35	4.40	4.39	4.41
query36	0.65	0.46	0.47
query37	0.18	0.15	0.16
query38	0.15	0.15	0.16
query39	0.04	0.04	0.04
query40	0.16	0.12	0.12
query41	0.09	0.05	0.05
query42	0.05	0.04	0.05
query43	0.04	0.04	0.04
Total cold run time: 110.02 s
Total hot run time: 30.94 s

@zhannngchen
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17626	4313	4424	4313
q2	2014	198	195	195
q3	10452	1157	1109	1109
q4	10151	729	701	701
q5	7671	2744	2711	2711
q6	219	139	139	139
q7	947	597	593	593
q8	9222	1894	1934	1894
q9	8783	6592	6644	6592
q10	8817	3821	3834	3821
q11	442	245	241	241
q12	433	223	218	218
q13	18976	3077	2995	2995
q14	284	237	234	234
q15	522	491	480	480
q16	499	397	380	380
q17	974	732	724	724
q18	7967	7534	7576	7534
q19	6177	1047	1086	1047
q20	659	325	332	325
q21	5016	3197	4086	3197
q22	357	303	299	299
Total cold run time: 118208 ms
Total hot run time: 39742 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4645	4369	4385	4369
q2	382	268	284	268
q3	3264	3073	3139	3073
q4	2002	1867	1784	1784
q5	5695	5682	5486	5486
q6	236	139	141	139
q7	2305	1844	1901	1844
q8	3345	3455	3442	3442
q9	8751	8839	8768	8768
q10	4164	3846	3795	3795
q11	600	498	496	496
q12	861	627	644	627
q13	17614	3129	3279	3129
q14	323	294	293	293
q15	520	494	490	490
q16	496	435	436	435
q17	1809	1564	1501	1501
q18	8228	8108	7855	7855
q19	1807	1621	1531	1531
q20	2866	1889	1868	1868
q21	9300	4724	4934	4724
q22	731	528	499	499
Total cold run time: 79944 ms
Total hot run time: 56416 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 174282 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 0bd78968fe4063713f8faf9c53e2ca4d64080626, data reload: false

query1	911	384	370	370
query2	6368	1869	1788	1788
query3	6633	212	228	212
query4	28590	17546	17382	17382
query5	3777	479	477	477
query6	258	171	175	171
query7	4576	292	292	292
query8	244	189	200	189
query9	8580	2449	2403	2403
query10	460	286	269	269
query11	10816	10290	10183	10183
query12	120	94	87	87
query13	1638	375	392	375
query14	9564	8054	7736	7736
query15	224	165	170	165
query16	7564	483	507	483
query17	1147	556	552	552
query18	1745	280	296	280
query19	185	147	143	143
query20	96	83	82	82
query21	204	104	100	100
query22	4252	4063	3891	3891
query23	34288	33752	33808	33752
query24	8172	3002	2943	2943
query25	612	408	395	395
query26	707	156	154	154
query27	2309	292	284	284
query28	5262	2084	2066	2066
query29	782	444	419	419
query30	298	159	157	157
query31	1000	762	792	762
query32	104	57	57	57
query33	578	330	336	330
query34	885	518	511	511
query35	880	820	790	790
query36	1084	966	933	933
query37	146	84	81	81
query38	2951	2832	2867	2832
query39	916	854	831	831
query40	198	116	111	111
query41	45	46	44	44
query42	118	96	98	96
query43	486	459	484	459
query44	1092	727	728	727
query45	208	175	181	175
query46	1084	725	773	725
query47	1852	1749	1749	1749
query48	361	287	294	287
query49	893	413	420	413
query50	804	405	411	405
query51	6801	6745	6652	6652
query52	106	88	91	88
query53	257	180	177	177
query54	647	442	451	442
query55	80	74	74	74
query56	308	286	326	286
query57	1174	1032	1045	1032
query58	272	256	279	256
query59	3050	2810	2730	2730
query60	319	288	291	288
query61	97	98	98	98
query62	781	656	651	651
query63	212	180	181	180
query64	9260	2252	1722	1722
query65	3169	3129	3137	3129
query66	770	344	340	340
query67	15323	14916	14924	14916
query68	4516	568	568	568
query69	459	314	327	314
query70	1109	1065	1142	1065
query71	377	281	272	272
query72	7198	5541	5732	5541
query73	754	340	378	340
query74	6130	5658	5677	5658
query75	3374	2709	2728	2709
query76	2113	1000	949	949
query77	472	307	291	291
query78	9859	9313	9255	9255
query79	3089	535	526	526
query80	2039	488	485	485
query81	595	227	222	222
query82	891	137	133	133
query83	294	177	173	173
query84	272	83	78	78
query85	1981	332	306	306
query86	487	291	299	291
query87	3258	3053	3094	3053
query88	4863	2413	2420	2413
query89	423	285	285	285
query90	1791	194	193	193
query91	125	167	99	99
query92	58	50	46	46
query93	5522	545	545	545
query94	857	294	293	293
query95	359	258	263	258
query96	605	276	275	275
query97	3166	3026	2997	2997
query98	223	206	204	204
query99	1547	1275	1266	1266
Total cold run time: 277499 ms
Total hot run time: 174282 ms

@doris-robot
Copy link

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

query1	0.05	0.03	0.03
query2	0.08	0.04	0.04
query3	0.22	0.05	0.05
query4	1.69	0.07	0.08
query5	0.50	0.49	0.49
query6	1.13	0.75	0.74
query7	0.02	0.02	0.01
query8	0.05	0.04	0.04
query9	0.55	0.49	0.48
query10	0.56	0.55	0.55
query11	0.15	0.11	0.11
query12	0.15	0.13	0.12
query13	0.60	0.59	0.58
query14	0.76	0.77	0.78
query15	0.85	0.81	0.81
query16	0.37	0.36	0.37
query17	0.97	0.94	0.99
query18	0.23	0.21	0.21
query19	1.82	1.80	1.68
query20	0.01	0.01	0.01
query21	15.40	0.75	0.64
query22	3.96	8.25	1.59
query23	18.27	1.40	1.28
query24	2.19	0.22	0.21
query25	0.15	0.09	0.10
query26	0.29	0.21	0.22
query27	0.45	0.22	0.23
query28	13.24	1.03	1.00
query29	12.63	3.38	3.32
query30	0.25	0.05	0.06
query31	2.90	0.39	0.38
query32	3.27	0.48	0.47
query33	2.82	2.87	2.94
query34	17.09	4.36	4.36
query35	4.43	4.36	4.44
query36	0.64	0.46	0.47
query37	0.18	0.16	0.15
query38	0.16	0.16	0.15
query39	0.04	0.04	0.04
query40	0.16	0.13	0.13
query41	0.09	0.05	0.05
query42	0.06	0.04	0.04
query43	0.04	0.04	0.04
Total cold run time: 109.47 s
Total hot run time: 30.2 s

Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

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

LGTM

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

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

Copy link
Contributor

PR approved by anyone and no changes requested.

Copy link
Contributor

@hust-hhb hust-hhb left a comment

Choose a reason for hiding this comment

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

LGTM

@zhannngchen zhannngchen merged commit c03b564 into apache:master Aug 1, 2024
32 of 35 checks passed
dataroaring pushed a commit that referenced this pull request Aug 3, 2024
## Proposed changes

Issue Number: close #xxx

introduced by #38369
feiniaofeiafei pushed a commit to feiniaofeiafei/doris that referenced this pull request Aug 9, 2024
…ecessary (apache#38369)

## Proposed changes

Issue Number: close #xxx

When loading data to a unique key table with sequence column, some data
in current load job might be marked as delete due to a lower sequence
value.
If there's many segments in such load job, segcompaction might be
triggered, which don't process the delete bitmap currently, will cause
data correctness issue

For example:
1. we have 4 segments in current load job initially, and due to seq
column, some rows are marked as deleted
2. after segcompaction, if we don't process the delete bitmap, it's
content is still corresponding to the old segment layout, and row
7,14,15 is not mark deleted correctly on new generated segment 1.
3. in this PR, we convert old delete bitmap to fit new segment layout,
it use similar way as base/cumulative compaction to convert delete
bitmaps on old layout to new one, but the rowid conversion is simpler


![whiteboard_exported_image-2](https://github.com/user-attachments/assets/a419b6a4-e583-457a-bf4e-56d9bd2a3544)
dataroaring pushed a commit that referenced this pull request Aug 11, 2024
…ecessary (#38369)

## Proposed changes

Issue Number: close #xxx

When loading data to a unique key table with sequence column, some data
in current load job might be marked as delete due to a lower sequence
value.
If there's many segments in such load job, segcompaction might be
triggered, which don't process the delete bitmap currently, will cause
data correctness issue

For example:
1. we have 4 segments in current load job initially, and due to seq
column, some rows are marked as deleted
2. after segcompaction, if we don't process the delete bitmap, it's
content is still corresponding to the old segment layout, and row
7,14,15 is not mark deleted correctly on new generated segment 1.
3. in this PR, we convert old delete bitmap to fit new segment layout,
it use similar way as base/cumulative compaction to convert delete
bitmaps on old layout to new one, but the rowid conversion is simpler


![whiteboard_exported_image-2](https://github.com/user-attachments/assets/a419b6a4-e583-457a-bf4e-56d9bd2a3544)
dataroaring pushed a commit that referenced this pull request Aug 11, 2024
## Proposed changes

Issue Number: close #xxx

introduced by #38369
dataroaring pushed a commit that referenced this pull request Aug 16, 2024
…ecessary (#38369)

## Proposed changes

Issue Number: close #xxx

When loading data to a unique key table with sequence column, some data
in current load job might be marked as delete due to a lower sequence
value.
If there's many segments in such load job, segcompaction might be
triggered, which don't process the delete bitmap currently, will cause
data correctness issue

For example:
1. we have 4 segments in current load job initially, and due to seq
column, some rows are marked as deleted
2. after segcompaction, if we don't process the delete bitmap, it's
content is still corresponding to the old segment layout, and row
7,14,15 is not mark deleted correctly on new generated segment 1.
3. in this PR, we convert old delete bitmap to fit new segment layout,
it use similar way as base/cumulative compaction to convert delete
bitmaps on old layout to new one, but the rowid conversion is simpler


![whiteboard_exported_image-2](https://github.com/user-attachments/assets/a419b6a4-e583-457a-bf4e-56d9bd2a3544)
dataroaring pushed a commit that referenced this pull request Aug 16, 2024
## Proposed changes

Issue Number: close #xxx

introduced by #38369
zhannngchen added a commit to zhannngchen/incubator-doris that referenced this pull request Aug 21, 2024
…ecessary (apache#38369)

Issue Number: close #xxx

When loading data to a unique key table with sequence column, some data
in current load job might be marked as delete due to a lower sequence
value.
If there's many segments in such load job, segcompaction might be
triggered, which don't process the delete bitmap currently, will cause
data correctness issue

For example:
1. we have 4 segments in current load job initially, and due to seq
column, some rows are marked as deleted
2. after segcompaction, if we don't process the delete bitmap, it's
content is still corresponding to the old segment layout, and row
7,14,15 is not mark deleted correctly on new generated segment 1.
3. in this PR, we convert old delete bitmap to fit new segment layout,
it use similar way as base/cumulative compaction to convert delete
bitmaps on old layout to new one, but the rowid conversion is simpler

![whiteboard_exported_image-2](https://github.com/user-attachments/assets/a419b6a4-e583-457a-bf4e-56d9bd2a3544)
zhannngchen added a commit to zhannngchen/incubator-doris that referenced this pull request Aug 21, 2024
## Proposed changes

Issue Number: close #xxx

introduced by apache#38369
yiguolei pushed a commit that referenced this pull request Aug 21, 2024
…ecessary (#38369) (#39707)

## Proposed changes

Issue Number: close #xxx

cherry-pick #38369 and #38800
zhannngchen added a commit to zhannngchen/incubator-doris that referenced this pull request Aug 22, 2024
zhannngchen added a commit that referenced this pull request Aug 22, 2024
mongo360 pushed a commit to mongo360/doris that referenced this pull request Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants