@@ -12,7 +12,6 @@ import itertools
1212import sys
1313import os
1414import os .path
15- import platform
1615import signal
1716import re
1817import copy
@@ -563,6 +562,27 @@ def get_localzone():
563562 return os .getenv ("TZ" , "/" .join (os .readlink ("/etc/localtime" ).split ("/" )[- 2 :]))
564563
565564
565+ def supports_io_uring ():
566+ return not subprocess .call (
567+ [
568+ args .binary ,
569+ "-q" ,
570+ "select * from file('/dev/null', 'LineAsString')" ,
571+ "--storage_file_read_method" ,
572+ "io_uring" ,
573+ ],
574+ stdout = subprocess .DEVNULL ,
575+ stderr = subprocess .DEVNULL ,
576+ )
577+
578+
579+ def get_local_filesystem_methods ():
580+ methods = ["read" , "pread" , "mmap" , "pread_threadpool" ]
581+ if supports_io_uring ():
582+ methods .append ("io_uring" )
583+ return methods
584+
585+
566586class SettingsRandomizer :
567587 settings = {
568588 "max_insert_threads" : lambda : 0
@@ -603,10 +623,7 @@ class SettingsRandomizer:
603623 0.2 , 0.5 , 1 , 10 * 1024 * 1024 * 1024
604624 ),
605625 "local_filesystem_read_method" : lambda : random .choice (
606- # Allow to use uring only when running on Linux
607- ["read" , "pread" , "mmap" , "pread_threadpool" , "io_uring" ]
608- if platform .system ().lower () == "linux"
609- else ["read" , "pread" , "mmap" , "pread_threadpool" ]
626+ get_local_filesystem_methods ()
610627 ),
611628 "remote_filesystem_read_method" : lambda : random .choice (["read" , "threadpool" ]),
612629 "local_filesystem_read_prefetch" : lambda : random .randint (0 , 1 ),
0 commit comments