Skip to content

Commit 423e52c

Browse files
author
Ankit Gupta
committed
Merge branch 'master' of https://github.com/facebook/rocksdb
2 parents bfeef94 + 32f2532 commit 423e52c

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

build_tools/build_detect_platform

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ PLATFORM_CXXFLAGS="-std=c++11"
4646
COMMON_FLAGS="-DROCKSDB_PLATFORM_POSIX"
4747

4848
# Default to fbcode gcc on internal fb machines
49-
if [ -d /mnt/gvfs/third-party -a -z "$CXX" ]; then
49+
if [ -z "$ROCKSDB_NO_FBCODE" -a -d /mnt/gvfs/third-party ]; then
5050
FBCODE_BUILD="true"
5151
if [ -z "$USE_CLANG" ]; then
5252
CENTOS_VERSION=`rpm -q --qf "%{VERSION}" \

db/db_impl.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -2356,10 +2356,11 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress,
23562356

23572357
Version::LevelSummaryStorage tmp;
23582358
LogToBuffer(
2359-
log_buffer, "[%s] Moved #%lld to level-%d %lld bytes %s: %s\n",
2359+
log_buffer,
2360+
"[%s] Moved #%" PRIu64 " to level-%d %" PRIu64 " bytes %s: %s\n",
23602361
c->column_family_data()->GetName().c_str(),
2361-
static_cast<unsigned long long>(f->fd.GetNumber()), c->level() + 1,
2362-
static_cast<unsigned long long>(f->fd.GetFileSize()),
2362+
f->fd.GetNumber(), c->level() + 1,
2363+
f->fd.GetFileSize(),
23632364
status.ToString().c_str(), c->input_version()->LevelSummary(&tmp));
23642365
c->ReleaseCompactionFiles(status);
23652366
*madeProgress = true;

util/env_test.cc

+30
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
#include <unistd.h>
1818
#endif
1919

20+
#ifdef ROCKSDB_FALLOCATE_PRESENT
21+
#include <errno.h>
22+
#include <fcntl.h>
23+
#endif
24+
2025
#include "rocksdb/env.h"
2126
#include "port/port.h"
2227
#include "util/coding.h"
@@ -478,6 +483,31 @@ TEST(EnvPosixTest, RandomAccessUniqueID) {
478483
#ifdef ROCKSDB_FALLOCATE_PRESENT
479484
TEST(EnvPosixTest, AllocateTest) {
480485
std::string fname = GetOnDiskTestDir() + "/preallocate_testfile";
486+
487+
// Try fallocate in a file to see whether the target file system supports it.
488+
// Skip the test if fallocate is not supported.
489+
std::string fname_test_fallocate =
490+
GetOnDiskTestDir() + "/preallocate_testfile_2";
491+
int fd = -1;
492+
do {
493+
fd = open(fname_test_fallocate.c_str(), O_CREAT | O_RDWR | O_TRUNC, 0644);
494+
} while (fd < 0 && errno == EINTR);
495+
ASSERT_GT(fd, 0);
496+
497+
int alloc_status = fallocate(fd, 0, 0, 1);
498+
499+
int err_number = 0;
500+
if (alloc_status != 0) {
501+
err_number = errno;
502+
fprintf(stderr, "Warning: fallocate() fails, %s\n", strerror(err_number));
503+
}
504+
close(fd);
505+
ASSERT_OK(env_->DeleteFile(fname_test_fallocate));
506+
if (alloc_status != 0 && err_number == EOPNOTSUPP) {
507+
// The filesystem containing the file does not support fallocate
508+
return;
509+
}
510+
481511
EnvOptions soptions;
482512
soptions.use_mmap_writes = false;
483513
unique_ptr<WritableFile> wfile;

util/options.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ void ColumnFamilyOptions::Dump(Logger* log) const {
419419
"max_size_amplification_percent: %u",
420420
compaction_options_universal.max_size_amplification_percent);
421421
Log(log,
422-
"Options.compaction_options_universal.compression_size_percent: %u",
422+
"Options.compaction_options_universal.compression_size_percent: %d",
423423
compaction_options_universal.compression_size_percent);
424424
Log(log, "Options.compaction_options_fifo.max_table_files_size: %" PRIu64,
425425
compaction_options_fifo.max_table_files_size);

0 commit comments

Comments
 (0)