From 62384ebe9c76c640eb3655d8bc4dfcb77079d33c Mon Sep 17 00:00:00 2001 From: Anirban Rahut Date: Wed, 11 Jan 2017 14:08:47 -0800 Subject: [PATCH] =?UTF-8?q?Guarding=20extra=20fallocate=20call=20with=20TR?= =?UTF-8?q?AVIS=20because=20its=20not=20working=20pro=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: …perly on travis There is some old code in PosixWritableFile::Close(), which truncates the file to the measured size and then does an extra fallocate with KEEP_SIZE. This is commented as a failsafe because in some cases ftruncate doesn't do the right job (I don't know of an instance of this btw). However doing an fallocate with KEEP_SIZE should not increase the file size. However on Travis Worker which is Docker (likely AUFS ) its not working. There are comments on web that show that the AUFS author had initially not implemented fallocate, and then did it later. So not sure what is the quality of the implementation. Closes https://github.com/facebook/rocksdb/pull/1765 Differential Revision: D4401340 Pulled By: anirbanr-fb fbshipit-source-id: e2d8100 --- util/io_posix.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/io_posix.cc b/util/io_posix.cc index 60d96aa64..299de8984 100644 --- a/util/io_posix.cc +++ b/util/io_posix.cc @@ -737,7 +737,7 @@ Status PosixWritableFile::Close() { // but it will be nice to log these errors. int dummy __attribute__((unused)); dummy = ftruncate(fd_, filesize_); -#ifdef ROCKSDB_FALLOCATE_PRESENT +#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 @@ -749,6 +749,11 @@ Status PosixWritableFile::Close() { // 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_,