@@ -11,7 +11,6 @@ import shutil
1111import sys
1212import os
1313import os .path
14- import platform
1514import signal
1615import re
1716import copy
@@ -534,6 +533,27 @@ def get_localzone():
534533 return os .getenv ("TZ" , "/" .join (os .readlink ("/etc/localtime" ).split ("/" )[- 2 :]))
535534
536535
536+ def supports_io_uring ():
537+ return not subprocess .call (
538+ [
539+ args .binary ,
540+ "-q" ,
541+ "select * from file('/dev/null', 'LineAsString')" ,
542+ "--storage_file_read_method" ,
543+ "io_uring" ,
544+ ],
545+ stdout = subprocess .DEVNULL ,
546+ stderr = subprocess .DEVNULL ,
547+ )
548+
549+
550+ def get_local_filesystem_methods ():
551+ methods = ["read" , "pread" , "mmap" , "pread_threadpool" ]
552+ if supports_io_uring ():
553+ methods .append ("io_uring" )
554+ return methods
555+
556+
537557class SettingsRandomizer :
538558 settings = {
539559 "max_insert_threads" : lambda : 0
@@ -570,10 +590,7 @@ class SettingsRandomizer:
570590 0.2 , 0.5 , 1 , 10 * 1024 * 1024 * 1024
571591 ),
572592 "local_filesystem_read_method" : lambda : random .choice (
573- # Allow to use uring only when running on Linux
574- ["read" , "pread" , "mmap" , "pread_threadpool" , "io_uring" ]
575- if platform .system ().lower () == "linux"
576- else ["read" , "pread" , "mmap" , "pread_threadpool" ]
593+ get_local_filesystem_methods ()
577594 ),
578595 "remote_filesystem_read_method" : lambda : random .choice (["read" , "threadpool" ]),
579596 "local_filesystem_read_prefetch" : lambda : random .randint (0 , 1 ),
0 commit comments