简体   繁体   English

MySQL使用什么文件系统?

[英]What file system does MySQL use?

Does MySQL use fread, read, mmap, or another file system when saving database data to the disk on a Linux OS? 将数据库数据保存到Linux OS上的磁盘时,MySQL是否使用fread,read,mmap或其他文件系统? Or is MySQL doing a test to see which one to use? 还是MySQL正在进行测试以查看使用哪个? This is not in reference to saving config data. 这与保存配置数据无关。 I'm interested in the actual database, preferably InnoDB. 我对实际的数据库感兴趣,最好是InnoDB。

Thanks for any help. 谢谢你的帮助。

Edit: To be more specific, I'm interested in the c/c++ source code in MySQL that does the actual calls that saves data to a InnoDB database. 编辑:更具体地说,我对MySQL中的c / c ++源代码感兴趣,该源代码执行将数据保存到InnoDB数据库的实际调用。 Possible options are fread, read, mmap, among others. 可能的选项包括fread,read,mmap等。

What file system does MySQL use? MySQL使用什么文件系统?

The MySQL access method code (InnoDB, MyISAM, AriaDB and the rest) uses the native file system of the host volume on the host operating system. MySQL访问方法代码(InnoDB,MyISAM,AriaDB和其他代码)使用主机操作系统上主机卷的本机文件系统。 NTFS on Windows, ext4fs on U**X systems, etc. The competent platform ports use a variety of I/O techniques including memory mapping, scatter/gather and ordinary read and write system calls, and integrate with the file systems' journaling features. Windows上的NTFS,U ** X系统上的ext4fs等。有效的平台端口使用各种I / O技术,包括内存映射,分散/聚集以及普通的读写系统调用,并与文件系统的日记功能集成在一起。 The exact techniques used depend on the kind of query, the access method, and the state of caches. 使用的确切技术取决于查询的类型,访问方法和缓存的状态。

Pro tip: Don't worry about this for performance reasons unless your server is running on an old 32-bit 486 machine you found in a storeroom (or unless you have millions of users and billions of rows of data). 专家提示:出于性能原因,请不要为此担心,除非您的服务器运行在仓库中发现的旧32位486计算机上(或者除非您有数百万用户和数十亿行数据)。

On Linux systems all POSIX fileystems will work. 在Linux系统上,所有POSIX文件系统都可以使用。 fread is a libc construct that will translate to underlying syscalls like read , mmap , write etc. fread是一个libc构造,它将转换为底层的系统调用,例如readmmapwrite等。

The read, mmap, write operations are implemented in a Linux VFS (virtual file system) layer before those map to specific operations in the filesystem code. 读取,mmap,写入操作在Linux VFS(虚拟文件系统)层中实现,然后映射到文件系统代码中的特定操作。 So any POSIX filesystem will work with MySQL. 因此,任何POSIX文件系统都可以与MySQL一起使用。

The only filesystem test I've seen in the MySQL code is a fallocate syscall which isn't implemented on all filesystems (especially when it was first added, its probably significantly available now). 我在MySQL代码中看到的唯一文件系统测试是fallocate syscall,它并非在所有文件系统上都实现(尤其是在首次添加时,现在可能已经可以使用)。 There is an implementation workaround when fallocate isn't available. 当不能使用fallocate时,有一个解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM