1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-28592 disks plugin - getmntinfo (BSD) & getmntent (AIX)

Thanks to references from Brad Smith, BSDs use getmntinfo as
a system call for mounted filesystems.

Most BSDs return statfs structures, (and we use OSX's statfs64),
but NetBSD uses a statvfs structure.

Simplify Linux getmntent_r to just use getmntent.

AIX uses getmntent.

An attempt at writing Solaris compatibility with
a small bit of HPUX compatibility was made based on man page
entries only. Fixes welcome.

statvfs structures now use f_bsize for consistency with statfs

Test case adjusted as PATH_MAX is OS defined (e.g. 1023 on AIX)

Fixes: 0ee5cf837e

also fixes:

MDEV-27818: Disk plugin does not show zpool mounted devices

This is because zpool mounted point don't begin with /.

Due to the proliferation of multiple filesystem types since this
was written, we restrict the entries listed in the disks plugin
to excude:
* read only mount points (no point monitoring, and
  includes squash, snaps, sysfs, procfs, cgroups...)
* mount points that aren't directories (excludes /etc/hostname and
  similar mounts in containers). (getmntent (Linux/AIX) only)
* exclude systems where there is no capacity listed (excludes various
  virtual filesystem types).

Reviewer: Sergei Golubchik
This commit is contained in:
Daniel Black
2022-07-31 13:41:59 +10:00
parent 57739ae94a
commit 129616c70a
6 changed files with 211 additions and 55 deletions

View File

@ -1,8 +1,8 @@
show create table information_schema.disks;
Table Create Table
DISKS CREATE TEMPORARY TABLE `DISKS` (
`Disk` varchar(4096) NOT NULL,
`Path` varchar(4096) NOT NULL,
`Disk` varchar(pathlen) NOT NULL,
`Path` varchar(pathlen) NOT NULL,
`Total` bigint(32) NOT NULL,
`Used` bigint(32) NOT NULL,
`Available` bigint(32) NOT NULL

View File

@ -1,2 +1,3 @@
--replace_regex /varchar\([0-9]+\)/varchar(pathlen)/
show create table information_schema.disks;
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;