Skip to content

[fix](compile) fix macOS compilation error due to missing f_frsize in statfs#60753

Open
airborne12 wants to merge 1 commit intoapache:masterfrom
airborne12:fix-compile-macos-statfs-frsize
Open

[fix](compile) fix macOS compilation error due to missing f_frsize in statfs#60753
airborne12 wants to merge 1 commit intoapache:masterfrom
airborne12:fix-compile-macos-statfs-frsize

Conversation

@airborne12
Copy link
Member

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

macOS statfs struct does not have the f_frsize member — it is Linux-specific (statvfs on Linux has f_frsize, but macOS statfs only has f_bsize). This causes a compilation error on macOS:

error: no member named 'f_frsize' in 'statfs'
    const auto block_size = stat.f_frsize ? stat.f_frsize : stat.f_bsize;
                            ~~~~ ^

The fix adds #ifdef __APPLE__ guards to use f_bsize directly on macOS, while keeping the original f_frsize logic on Linux.

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

… statfs

macOS statfs struct does not have f_frsize member (it is Linux-specific).
Use f_bsize directly on macOS via #ifdef __APPLE__ guard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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?

@airborne12
Copy link
Member Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
============================================
q1	17656	4400	4294	4294
q2	q3	10654	795	531	531
q4	4678	364	252	252
q5	7620	1221	1043	1043
q6	183	178	144	144
q7	806	854	670	670
q8	10415	1504	1348	1348
q9	6416	4745	4726	4726
q10	6860	1914	1656	1656
q11	484	266	259	259
q12	755	585	472	472
q13	17807	4244	3430	3430
q14	240	237	222	222
q15	961	793	790	790
q16	766	721	688	688
q17	748	877	409	409
q18	6063	5466	5267	5267
q19	1344	974	601	601
q20	510	546	614	546
q21	4720	1927	1468	1468
q22	420	383	299	299
Total cold run time: 100106 ms
Total hot run time: 29115 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4750	4605	4551	4551
q2	q3	1844	2216	1827	1827
q4	894	1212	799	799
q5	4088	4475	4352	4352
q6	181	180	138	138
q7	1762	1681	1571	1571
q8	2495	2750	2593	2593
q9	7518	7296	7262	7262
q10	2637	2845	2482	2482
q11	511	430	415	415
q12	501	598	509	509
q13	4161	4444	3539	3539
q14	274	285	284	284
q15	833	778	786	778
q16	724	787	724	724
q17	1200	1642	1376	1376
q18	7094	6723	6660	6660
q19	905	850	860	850
q20	2046	2170	2027	2027
q21	4083	3580	3420	3420
q22	494	464	423	423
Total cold run time: 48995 ms
Total hot run time: 46580 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 184499 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 9efba16c2444b838117d375715e927333de1ce54, data reload: false

query5	4354	634	523	523
query6	333	222	202	202
query7	4215	479	273	273
query8	342	239	251	239
query9	8721	2719	2707	2707
query10	507	374	335	335
query11	17105	17549	17419	17419
query12	188	138	137	137
query13	1309	509	384	384
query14	6674	3400	3102	3102
query14_1	2954	2910	2880	2880
query15	207	202	185	185
query16	4630	519	479	479
query17	1752	817	613	613
query18	2403	561	352	352
query19	209	209	189	189
query20	137	136	129	129
query21	226	143	130	130
query22	5391	5139	4737	4737
query23	17236	16882	16478	16478
query23_1	16622	16625	16715	16625
query24	7249	1625	1241	1241
query24_1	1252	1264	1215	1215
query25	564	483	474	474
query26	1210	265	158	158
query27	2772	477	291	291
query28	4498	1852	1840	1840
query29	776	565	472	472
query30	314	258	220	220
query31	911	752	677	677
query32	78	79	73	73
query33	503	332	279	279
query34	941	914	553	553
query35	634	691	608	608
query36	1066	1129	912	912
query37	133	95	87	87
query38	2950	2914	2907	2907
query39	895	877	838	838
query39_1	855	830	856	830
query40	236	150	136	136
query41	63	60	60	60
query42	109	102	100	100
query43	403	376	362	362
query44	
query45	193	186	183	183
query46	881	983	608	608
query47	2106	2141	2053	2053
query48	309	321	228	228
query49	638	484	387	387
query50	683	290	216	216
query51	4123	4085	4134	4085
query52	107	107	100	100
query53	296	338	276	276
query54	296	263	257	257
query55	92	80	82	80
query56	313	316	296	296
query57	1345	1337	1264	1264
query58	285	276	277	276
query59	2623	2744	2536	2536
query60	339	329	326	326
query61	181	150	148	148
query62	637	584	546	546
query63	307	289	283	283
query64	4500	1255	1035	1035
query65	
query66	1343	444	348	348
query67	16358	16459	16275	16275
query68	
query69	400	305	278	278
query70	992	909	952	909
query71	344	307	293	293
query72	2844	2676	2626	2626
query73	543	553	332	332
query74	10017	9995	9790	9790
query75	2879	2778	2515	2515
query76	1826	1043	706	706
query77	372	388	332	332
query78	11229	11569	10719	10719
query79	1127	795	596	596
query80	733	648	583	583
query81	501	287	260	260
query82	1357	153	118	118
query83	336	272	260	260
query84	251	121	121	121
query85	928	564	513	513
query86	393	349	295	295
query87	3119	3102	3002	3002
query88	3598	2670	2668	2668
query89	420	365	349	349
query90	1927	170	166	166
query91	165	158	142	142
query92	79	75	74	74
query93	963	816	518	518
query94	458	333	311	311
query95	573	331	309	309
query96	631	524	226	226
query97	2471	2504	2414	2414
query98	251	214	214	214
query99	1005	975	919	919
Total cold run time: 256245 ms
Total hot run time: 184499 ms

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