mirror of
https://github.com/Amulet-Team/leveldb-mcpe.git
synced 2024-11-21 20:06:23 +00:00
646c3588de
Background compaction can create an unbounded number of leveldb::RandomAccessFile instances. On 64-bit systems mmap is used and file descriptors are only used beyond a certain number of mmap's. 32-bit systems to not use mmap at all. leveldb::RandomAccessFile does not observe Options.max_open_files so compaction could exhaust the file descriptor limit. This change uses getrlimit to determine the maximum number of open files and limits RandomAccessFile to approximately 20% of that value. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143505556
29 lines
896 B
C++
29 lines
896 B
C++
// Copyright 2017 The LevelDB Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
#ifndef STORAGE_LEVELDB_UTIL_ENV_POSIX_TEST_HELPER_H_
|
|
#define STORAGE_LEVELDB_UTIL_ENV_POSIX_TEST_HELPER_H_
|
|
|
|
namespace leveldb {
|
|
|
|
class EnvPosixTest;
|
|
|
|
// A helper for the POSIX Env to facilitate testing.
|
|
class EnvPosixTestHelper {
|
|
private:
|
|
friend class EnvPosixTest;
|
|
|
|
// Set the maximum number of read-only files that will be opened.
|
|
// Must be called before creating an Env.
|
|
static void SetReadOnlyFDLimit(int limit);
|
|
|
|
// Set the maximum number of read-only files that will be mapped via mmap.
|
|
// Must be called before creating an Env.
|
|
static void SetReadOnlyMMapLimit(int limit);
|
|
};
|
|
|
|
} // namespace leveldb
|
|
|
|
#endif // STORAGE_LEVELDB_UTIL_ENV_POSIX_TEST_HELPER_H_
|