OK I was wrong: I can use io_uring_get_probe() if postgres has been
built with liburing flag.
So I have replaced uname() call by io_uring_get_probe() call and I have
modified the error messages: Linux kernel version is neither directly
used nor mentioned.
Le 14/01/2026 à 11:18, Pierre a écrit :
>
> Le 14/01/2026 à 08:31, Steven Niu a écrit :
>> From: Andreas Karlsson <andreas@proxel.se>
>> Sent: Wednesday, January 14, 2026 15:27
>> To: Steven Niu <niushiji@gmail.com>; Pierre
>> <pierre.forstmann@gmail.com>; pgsql-hackers@lists.postgresql.org
>> <pgsql-hackers@lists.postgresql.org>
>> Subject: Re: [PATCH] check kernel version for io_method
>>
>>
>> On 1/14/26 8:22 AM, Steven Niu wrote:
>>> I agree that you are correct for now. But in future, the IoMethod
>>> may have new member. Then we have to process it.
>>>
>>> How about change to like this:
>>> + #else
>>> + if (*newval == IOMETHOD_IO_URING)
>>> + {
>>> + GUC_check_errdetail("io_uring not enabled.");
>>> + return false;
>>> + }
>> No, that would be incorrect. It would not even compile.
>> IOMETHOD_IO_URING is not even defined if we do not compile with liburing
>> enabled. You can try it out yourself by compiling PostgreSQL without
>> io_uring support and then try to enable it. You will get an error and
>> that code will never be reached.
>>
>> Andreas
>>
>>
>>
>>
>> ________________________________________
>>
>>
>> Yes, you are definitely correct.
>> I'd like to withdwar my proposal.
>
> Hello,
>
> I have modified message in case io_uring is not enabled when building
> PG. But currently I cannot test it, GUC parameter is rejected in
> earlier steps:
>
> pg_ctl start
> waiting for server to start....2026-01-14 09:35:37.046 GMT [16336]
> LOG: invalid value for parameter "io_method": "io_uring"
> 2026-01-14 09:35:37.046 GMT [16336] HINT: Available values: sync,
> worker.
> 2026-01-14 10:35:37.047 CET [16336] FATAL: configuration file
> "/home/pierre/pgdata/postgresql.conf" contains errors
> stopped waiting
> pg_ctl: could not start server
>
> I don't know how to test io_uring features in code because if io_uring
> is not enabled at compilation time, I don't think it is possible to
> compile code calling io_uring_get_probe_ring() or
> io_uring_opcode_supported() ?
>
>
> Thanks.
>