Skip to content

[fix](auth) delete command improperly detects the LOAD permission of non target tables#60837

Open
liutang123 wants to merge 7 commits intoapache:masterfrom
liutang123:fix-delete-auth-master
Open

[fix](auth) delete command improperly detects the LOAD permission of non target tables#60837
liutang123 wants to merge 7 commits intoapache:masterfrom
liutang123:fix-delete-auth-master

Conversation

@liutang123
Copy link
Contributor

What problem does this PR solve?

If we have tow tables: delete_target and delete_from.
we delete delete_target by delete_from as follows:

create table delete_target (id int)  unique key (id) DISTRIBUTED BY HASH (id)  PROPERTIES ("replication_allocation" = "tag.location.default: 1");

insert into delete_target values (1);

 create table delete_from (id int, t datetime) PROPERTIES ("replication_allocation" = "tag.location.default: 1");

 insert into delete_from values (1, '2024-01-01 00:00:00');
 insert into delete_from select * from  delete_from; -- 2
 insert into delete_from select * from  delete_from; -- 4
 insert into delete_from select * from  delete_from; -- 8
 insert into delete_from select * from  delete_from; -- 16
 insert into delete_from select * from  delete_from; -- 32
 insert into delete_from select * from  delete_from; -- 64
analyze table delete_from;
-- wait some time for tablet report. fe will detect delete_from has more rows than delete_target. fe will choose delete_from ritht anti join delete_target
create user delete_test;
GRANT SELECT_PRIV ON test.delete_from to delete_test;

GRANT LOAD_PRIV ON test.delete_target to delete_test;

SET PASSWORD FOR delete_test = PASSWORD('123');

mysql -h 127.0.0.1 -u delete_test -p123 -P 9030 -A -c  test

delete from delete_target a where not EXISTS ( SELECT 1 FROM delete_from  WHERE id = a.id and t >'2023-01-01 00:00' );

The error is:

LOAD command denied to user 'delete_test'@'172.19.0.1' for table 'test: delete_from'

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • [*] Regression test
    • Unit Test
    • [*] Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • [*] No.
    • [] Yes.
  • Does this need documentation?

    • [*] No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen
Copy link
Contributor

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

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@liutang123
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
============================================
q1	17598	4452	4266	4266
q2	q3	10666	781	516	516
q4	4681	359	250	250
q5	7552	1172	1037	1037
q6	178	177	148	148
q7	784	864	663	663
q8	9289	1454	1353	1353
q9	4809	4704	4713	4704
q10	6853	1945	1699	1699
q11	480	264	240	240
q12	707	583	464	464
q13	18983	4286	3489	3489
q14	240	229	213	213
q15	946	796	813	796
q16	752	734	672	672
q17	724	884	417	417
q18	6065	5330	5305	5305
q19	1109	1004	640	640
q20	531	513	398	398
q21	5080	1927	1418	1418
q22	367	314	273	273
Total cold run time: 98394 ms
Total hot run time: 28961 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4697	4654	4587	4587
q2	q3	1792	2217	1750	1750
q4	877	1186	763	763
q5	4036	4355	4405	4355
q6	189	178	138	138
q7	1818	1697	1521	1521
q8	2494	2741	2569	2569
q9	7488	7369	7310	7310
q10	2609	2813	2461	2461
q11	510	442	415	415
q12	555	626	519	519
q13	4038	4444	3573	3573
q14	298	302	285	285
q15	899	836	835	835
q16	724	763	707	707
q17	1191	1525	1317	1317
q18	7340	6801	6748	6748
q19	881	873	913	873
q20	2040	2131	2014	2014
q21	3959	3481	3369	3369
q22	507	445	390	390
Total cold run time: 48942 ms
Total hot run time: 46499 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 183544 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 70fad142b56f8d3715c4ef6a4b55e7dd5c902a7d, data reload: false

query5	4437	638	520	520
query6	325	209	210	209
query7	4235	490	278	278
query8	344	241	250	241
query9	8743	2733	2709	2709
query10	521	371	328	328
query11	16961	17478	17170	17170
query12	216	140	144	140
query13	1422	506	369	369
query14	6964	3307	3058	3058
query14_1	2918	2951	2853	2853
query15	224	210	223	210
query16	1098	472	479	472
query17	1285	757	662	662
query18	3237	475	374	374
query19	246	220	217	217
query20	139	134	140	134
query21	228	153	128	128
query22	5160	4866	4902	4866
query23	17184	16832	16540	16540
query23_1	16695	16684	16643	16643
query24	7303	1633	1229	1229
query24_1	1243	1232	1216	1216
query25	554	479	433	433
query26	827	262	154	154
query27	2759	480	288	288
query28	4469	1833	1833	1833
query29	775	563	457	457
query30	305	255	216	216
query31	851	715	628	628
query32	78	70	73	70
query33	509	332	284	284
query34	916	908	561	561
query35	616	670	580	580
query36	1090	1144	974	974
query37	131	90	78	78
query38	2944	2946	2941	2941
query39	888	872	852	852
query39_1	832	817	823	817
query40	224	148	133	133
query41	62	63	57	57
query42	107	101	100	100
query43	384	380	344	344
query44	
query45	198	197	185	185
query46	879	981	595	595
query47	2129	2172	2031	2031
query48	307	311	225	225
query49	612	454	370	370
query50	673	277	217	217
query51	4097	4081	4038	4038
query52	103	108	96	96
query53	293	338	281	281
query54	287	277	254	254
query55	91	83	81	81
query56	309	340	327	327
query57	1346	1344	1274	1274
query58	285	294	273	273
query59	2623	2739	2628	2628
query60	337	337	320	320
query61	149	148	150	148
query62	632	597	533	533
query63	316	272	270	270
query64	4282	1286	1018	1018
query65	
query66	1365	454	351	351
query67	16299	16521	16305	16305
query68	
query69	396	307	292	292
query70	1017	1006	962	962
query71	348	307	291	291
query72	2873	2696	2446	2446
query73	538	546	320	320
query74	10012	9965	9717	9717
query75	2843	2742	2444	2444
query76	2305	1027	693	693
query77	358	427	310	310
query78	11236	11382	10707	10707
query79	3012	759	599	599
query80	1758	623	541	541
query81	569	297	248	248
query82	1014	151	118	118
query83	336	262	241	241
query84	252	111	100	100
query85	880	496	438	438
query86	422	288	295	288
query87	3086	3070	2975	2975
query88	3544	2635	2629	2629
query89	433	373	357	357
query90	1992	178	160	160
query91	171	151	130	130
query92	73	80	65	65
query93	1194	829	498	498
query94	632	308	306	306
query95	585	395	317	317
query96	623	516	232	232
query97	2460	2551	2375	2375
query98	244	219	215	215
query99	1038	1010	916	916
Total cold run time: 255724 ms
Total hot run time: 183544 ms

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 0.00% (0/22) 🎉
Increment coverage report
Complete coverage report

@liutang123
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
============================================
q1	17591	4503	4329	4329
q2	q3	10642	825	527	527
q4	4681	367	250	250
q5	7536	1203	1035	1035
q6	176	177	146	146
q7	774	833	670	670
q8	9296	1456	1327	1327
q9	4858	4769	4740	4740
q10	6815	1867	1637	1637
q11	480	261	242	242
q12	705	556	470	470
q13	17774	4214	3443	3443
q14	230	235	217	217
q15	937	788	794	788
q16	758	713	675	675
q17	735	833	442	442
q18	5920	5418	5211	5211
q19	1109	985	613	613
q20	502	489	388	388
q21	4649	2015	1471	1471
q22	394	311	274	274
Total cold run time: 96562 ms
Total hot run time: 28895 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4772	4630	4597	4597
q2	q3	1819	2249	1749	1749
q4	874	1176	760	760
q5	4015	4376	4357	4357
q6	188	196	141	141
q7	1747	1623	1548	1548
q8	2435	2718	2943	2718
q9	7645	7333	7347	7333
q10	2754	2823	2427	2427
q11	498	438	409	409
q12	501	595	443	443
q13	4157	4378	3571	3571
q14	279	288	276	276
q15	836	819	790	790
q16	745	767	698	698
q17	1227	1663	1293	1293
q18	7001	6889	6525	6525
q19	881	845	955	845
q20	2066	2204	2011	2011
q21	3945	3586	3298	3298
q22	478	413	381	381
Total cold run time: 48863 ms
Total hot run time: 46170 ms

@doris-robot
Copy link

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

query5	4457	653	526	526
query6	327	218	237	218
query7	4220	459	269	269
query8	329	234	232	232
query9	8734	2707	2697	2697
query10	518	370	334	334
query11	16936	17606	17221	17221
query12	226	141	140	140
query13	1292	478	368	368
query14	7264	3314	3106	3106
query14_1	2909	2903	2934	2903
query15	211	200	181	181
query16	1214	485	452	452
query17	1321	810	649	649
query18	2855	475	375	375
query19	269	209	186	186
query20	140	134	129	129
query21	221	142	121	121
query22	5669	5102	4936	4936
query23	17233	16906	16631	16631
query23_1	16756	16669	16743	16669
query24	7246	1596	1228	1228
query24_1	1232	1236	1221	1221
query25	537	463	401	401
query26	1228	303	148	148
query27	2727	479	285	285
query28	4435	1875	1857	1857
query29	802	554	467	467
query30	313	251	207	207
query31	870	727	655	655
query32	76	73	70	70
query33	520	337	285	285
query34	919	894	561	561
query35	640	671	586	586
query36	1105	1150	1010	1010
query37	129	98	87	87
query38	2973	2898	2818	2818
query39	890	868	831	831
query39_1	830	833	812	812
query40	230	153	135	135
query41	64	60	56	56
query42	107	102	103	102
query43	373	388	342	342
query44	
query45	201	185	179	179
query46	881	974	611	611
query47	2138	2142	2036	2036
query48	319	313	239	239
query49	624	456	387	387
query50	682	280	212	212
query51	4070	4093	4038	4038
query52	105	106	97	97
query53	291	345	280	280
query54	293	267	264	264
query55	84	83	83	83
query56	310	323	316	316
query57	1366	1340	1278	1278
query58	295	282	277	277
query59	2587	2658	2573	2573
query60	338	327	322	322
query61	148	145	151	145
query62	630	589	546	546
query63	312	284	274	274
query64	4838	1293	1002	1002
query65	
query66	1379	458	352	352
query67	16245	16378	16288	16288
query68	
query69	406	303	289	289
query70	1006	935	971	935
query71	350	302	293	293
query72	2907	2614	2423	2423
query73	537	541	318	318
query74	9959	9948	9716	9716
query75	2871	2760	2438	2438
query76	2287	1021	675	675
query77	367	386	313	313
query78	11192	11343	10703	10703
query79	2670	794	603	603
query80	1788	617	548	548
query81	562	272	246	246
query82	1013	146	116	116
query83	333	262	244	244
query84	252	123	103	103
query85	873	481	429	429
query86	409	311	274	274
query87	3114	3080	2954	2954
query88	3580	2654	2640	2640
query89	422	369	347	347
query90	2029	173	171	171
query91	164	157	141	141
query92	80	76	70	70
query93	1056	817	513	513
query94	622	308	309	308
query95	579	400	313	313
query96	639	511	227	227
query97	2480	2486	2424	2424
query98	237	216	231	216
query99	1025	994	914	914
Total cold run time: 256906 ms
Total hot run time: 183693 ms

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 0.00% (0/21) 🎉
Increment coverage report
Complete coverage report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants