summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Gao <gzh@fb.com>2017-03-28 15:47:54 -0700
committerAndrew Kryczka <andrewkr@fb.com>2017-03-30 11:14:14 -0700
commit76979d84bfad26421ed23203400db1eadee21d90 (patch)
treeafc345daec0e59ef288472c750173f747aed3d36
parentbae811fca0190c5c2ee273df4c07bbc04176b165 (diff)
delete fallocate with punch_hole
Summary: As discuss in this thread: https://www.facebook.com/groups/rocksdb.dev/permalink/1218043868294125/ We remove fallocate with FALLOC_FL_PUNCH_HOLE because the recent bug on xfs in kernel 4.x+ that align file size to page size even with FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE. Closes https://github.com/facebook/rocksdb/pull/2038 Differential Revision: D4779974 Pulled By: siying fbshipit-source-id: 5f54625
-rw-r--r--HISTORY.md3
-rw-r--r--util/io_posix.cc23
2 files changed, 3 insertions, 23 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 54c15f1ae..4125087e0 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -9,6 +9,9 @@
### New Features
* Memtable flush can be avoided during checkpoint creation if total log file size is smaller than a threshold specified by the user.
+### Bug Fixes
+* Remove calling fallocate with FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE flag to circumvent a kernel bug that changes file size after this call on XFS
+
## 5.2.0 (02/08/2017)
### Public API Change
* NewLRUCache() will determine number of shard bits automatically based on capacity, if the user doesn't pass one. This also impacts the default block cache when the user doesn't explict provide one.
diff --git a/util/io_posix.cc b/util/io_posix.cc
index b61f4b38f..00ceb38db 100644
--- a/util/io_posix.cc
+++ b/util/io_posix.cc
@@ -751,29 +751,6 @@ Status PosixWritableFile::Close() {
// but it will be nice to log these errors.
int dummy __attribute__((unused));
dummy = ftruncate(fd_, filesize_);
-#if defined(ROCKSDB_FALLOCATE_PRESENT) && !defined(TRAVIS)
- // in some file systems, ftruncate only trims trailing space if the
- // new file size is smaller than the current size. Calling fallocate
- // with FALLOC_FL_PUNCH_HOLE flag to explicitly release these unused
- // blocks. FALLOC_FL_PUNCH_HOLE is supported on at least the following
- // filesystems:
- // XFS (since Linux 2.6.38)
- // ext4 (since Linux 3.0)
- // Btrfs (since Linux 3.7)
- // tmpfs (since Linux 3.5)
- // We ignore error since failure of this operation does not affect
- // correctness.
- // TRAVIS - this code does not work on TRAVIS filesystems.
- // the FALLOC_FL_KEEP_SIZE option is expected to not change the size
- // of the file, but it does. Simple strace report will show that.
- // While we work with Travis-CI team to figure out if this is a
- // quirk of Docker/AUFS, we will comment this out.
- IOSTATS_TIMER_GUARD(allocate_nanos);
- if (allow_fallocate_) {
- fallocate(fd_, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, filesize_,
- block_size * last_allocated_block - filesize_);
- }
-#endif
}
if (close(fd_) < 0) {