首页 > 解决方案 > MySQL 使用什么文件系统?

问题描述

在 Linux 操作系统上将数据库数据保存到磁盘时,MySQL 是否使用 fread、read、mmap 或其他文件系统?或者 MySQL 是否正在做一个测试以查看使用哪一个?这与保存配置数据无关。我对实际的数据库感兴趣,最好是 InnoDB。

谢谢你的帮助。

编辑:更具体地说,我对 MySQL 中的 c/c++ 源代码感兴趣,它执行将数据保存到 InnoDB 数据库的实际调用。可能的选项包括 fread、read、mmap 等。

标签: mysqlfilesystemsdisk

解决方案


On Linux systems all POSIX fileystems will work. fread is a libc construct that will translate to underlying syscalls like read, mmap, write etc.

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. So any POSIX filesystem will work with 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). There is an implementation workaround when fallocate isn't available.


推荐阅读