From e7ac7363b44163b9b59cd86b639cc05841196d4e Mon Sep 17 00:00:00 2001 From: Peter Dillinger Date: Fri, 21 Jan 2022 13:03:15 -0800 Subject: [PATCH] Add to HISTORY and minor loose ends from #9294, #9254 (#9386) Summary: Loose ends relate to mmap on 32-bit systems. (Testing is more complicated when the feature was completely disabled on 32-bit.) Pull Request resolved: https://github.com/facebook/rocksdb/pull/9386 Test Plan: CI Reviewed By: ajkr Differential Revision: D33590715 Pulled By: pdillinger fbshipit-source-id: f2637036a538a552200adee65b6765fce8cae27b --- HISTORY.md | 5 +++++ env/io_posix.cc | 2 +- include/rocksdb/env.h | 3 ++- include/rocksdb/options.h | 4 +++- port/win/env_win.cc | 6 +++--- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index b0ab026fb..26d324276 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,10 +6,12 @@ * Made the Env class extend the Customizable class. Implementations need to be registered with the ObjectRegistry and to implement a Name() method in order to be created via this method. * `Options::OldDefaults` is marked deprecated, as it is no longer maintained. * Add ObjectLibrary::AddFactory and ObjectLibrary::PatternEntry classes. This method and associated class are the preferred mechanism for registering factories with the ObjectLibrary going forward. The ObjectLibrary::Register method, which uses regular expressions and may be problematic, is deprecated and will be in a future release. +* Changed `BlockBasedTableOptions::block_size` from `size_t` to `uint64_t`. * Added API warning against using `Iterator::Refresh()` together with `DB::DeleteRange()`, which are incompatible and have always risked causing the refreshed iterator to return incorrect results. ### Behavior Changes * `DB::DestroyColumnFamilyHandle()` will return Status::InvalidArgument() if called with `DB::DefaultColumnFamily()`. +* On 32-bit platforms, mmap reads are no longer quietly disabled, just discouraged. ### New Features * Added `Options::DisableExtraChecks()` that can be used to improve peak write performance by disabling checks that should not be necessary in the absence of software logic errors or CPU+memory hardware errors. (Default options are slowly moving toward some performance overheads for extra correctness checking.) @@ -22,6 +24,9 @@ * Fixed a bug of Sync() and Fsync() not using `fcntl(F_FULLFSYNC)` on OS X and iOS. * Fixed a significant performance regression in version 6.26 when a prefix extractor is used on the read path (Seek, Get, MultiGet). (Excessive time was spent in SliceTransform::AsString().) +### New Features +* Added RocksJava support for MacOS universal binary (ARM+x86) + ## 6.28.0 (2021-12-17) ### New Features * Introduced 'CommitWithTimestamp' as a new tag. Currently, there is no API for user to trigger a write with this tag to the WAL. This is part of the efforts to support write-commited transactions with user-defined timestamps. diff --git a/env/io_posix.cc b/env/io_posix.cc index 3e519dce4..56494d565 100644 --- a/env/io_posix.cc +++ b/env/io_posix.cc @@ -558,7 +558,7 @@ PosixRandomAccessFile::PosixRandomAccessFile( #endif { assert(!options.use_direct_reads || !options.use_mmap_reads); - assert(!options.use_mmap_reads || sizeof(void*) < 8); + assert(!options.use_mmap_reads); } PosixRandomAccessFile::~PosixRandomAccessFile() { close(fd_); } diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index aaa6b8d9f..abb634dfa 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -84,7 +84,8 @@ struct EnvOptions { // Construct from Options explicit EnvOptions(const DBOptions& options); - // If true, then use mmap to read data + // If true, then use mmap to read data. + // Not recommended for 32-bit OS. bool use_mmap_reads = false; // If true, then use mmap to write data diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index e3c7d8ead..e14b3253e 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -772,7 +772,9 @@ struct DBOptions { // large amounts of data (such as xfs's allocsize option). size_t manifest_preallocation_size = 4 * 1024 * 1024; - // Allow the OS to mmap file for reading sst tables. Default: false + // Allow the OS to mmap file for reading sst tables. + // Not recommended for 32-bit OS. + // Default: false bool allow_mmap_reads = false; // Allow the OS to mmap file for writing. diff --git a/port/win/env_win.cc b/port/win/env_win.cc index ac069d7f1..3108cf6e7 100644 --- a/port/win/env_win.cc +++ b/port/win/env_win.cc @@ -297,9 +297,9 @@ IOStatus WinFileSystem::NewRandomAccessFile( UniqueCloseHandlePtr fileGuard(hFile, CloseHandleFunc); - // CAUTION! This will map the entire file into the process address space - if (options.use_mmap_reads && sizeof(void*) >= 8) { - // Use mmap when virtual address-space is plentiful. + // CAUTION! This will map the entire file into the process address space. + // Not recommended for 32-bit platforms. + if (options.use_mmap_reads) { uint64_t fileSize; s = GetFileSize(fname, IOOptions(), &fileSize, dbg);