8000 backport rocksdb diskspace bugfix (#14354) · arangodb/arangodb@2181a66 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2181a66

Browse files
jsteemannKVS85
andauthored
backport rocksdb diskspace bugfix (#14354)
* backport rocksdb diskspace bugfix * Backport bugfix from upstream rocksdb repository for calculating the free disk space for the database directory. Before the bugfix, rocksdb could overestimate the amount of free space when the arangod process was run as non-privileged users. * Update CHANGELOG Co-authored-by: Vadim <vadim@arangodb.com>
1 parent 4779240 commit 2181a66

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

3rdParty/rocksdb/6.8/env/fs_posix.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,17 @@ class PosixFileSystem : public FileSystem {
832832
return IOError("While doing statvfs", fname, errno);
833833
}
834834

835-
*free_space = ((uint64_t)sbuf.f_bsize * sbuf.f_bfree);
835+
// sbuf.bfree is total free space available to root
836+
// sbuf.bavail is total free space available to unprivileged user
837+
// sbuf.bavail <= sbuf.bfree ... pick correct based upon effective user id
838+
if (geteuid()) {
839+
// non-zero user is unprivileged, or -1 if error. take more conservative
840+
// size
841+
*free_space = ((uint64_t)sbuf.f_bsize * sbuf.f_bavail);
842+
} else {
843+
// root user can access all disk space
844+
*free_space = ((uint64_t)sbuf.f_bsize * sbuf.f_bfree);
845+
}
836846
return IOStatus::OK();
837847
}
838848

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
v3.7.13 (XXXX-XX-XX)
22
--------------------
33

4+
* Backport bugfix from upstream rocksdb repository for calculating the free disk
5+
space for the database directory. Before the bugfix, rocksdb could
6+
overestimate the amount of free space when the arangod process was run as
7+
non-privileged users.
8+
49
* Fixed a problem with active failover, where a failover could take 5 mins
510
because the follower was caught in a bad state during replication. This fixes
611
BTS-425.

0 commit comments

Comments
 (0)
0