From 51d7340364305b35ca50b09610c0a985cc39324f Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sat, 11 May 2013 14:41:11 -0700 Subject: [PATCH] Avoid the creation of large numbers of small LDB files. --- src/cpp/ripple/Application.cpp | 1 + src/cpp/ripple/Config.cpp | 3 ++- src/cpp/ripple/Config.h | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/Application.cpp b/src/cpp/ripple/Application.cpp index 49581d466..4fd2bbd11 100644 --- a/src/cpp/ripple/Application.cpp +++ b/src/cpp/ripple/Application.cpp @@ -180,6 +180,7 @@ void Application::setup() options.filter_policy = leveldb::NewBloomFilterPolicy(10); if (theConfig.LDB_IMPORT) options.write_buffer_size = 32 << 20; + options.write_buffer_size = std::max(options.write_buffer_size, theConfig.getSize(siLDBWriteSize) << 20); leveldb::Status status = leveldb::DB::Open(options, (theConfig.DATA_DIR / "hashnode").string(), &mHashNodeLDB); if (!status.ok() || !mHashNodeLDB) { diff --git a/src/cpp/ripple/Config.cpp b/src/cpp/ripple/Config.cpp index 0d33383ad..15115dc42 100644 --- a/src/cpp/ripple/Config.cpp +++ b/src/cpp/ripple/Config.cpp @@ -515,7 +515,8 @@ int Config::getSize(SizedItemName item) { siLineCacheAge, { 500, 600, 1800, 3600, 7200 } }, { siHashNodeDBCache, { 24, 48, 64, 128, 256 } }, { siTxnDBCache, { 4, 12, 48, 96, 192 } }, - { siLgrDBCache, { 4, 8, 32, 64, 128 } } + { siLgrDBCache, { 4, 8, 32, 64, 128 } }, + { siLDBWriteSize, { 8, 16, 32, 64, 128 } } }; for (int i = 0; i < (sizeof(sizeTable) / sizeof(SizedItem)); ++i) diff --git a/src/cpp/ripple/Config.h b/src/cpp/ripple/Config.h index b662aec3d..d8b884c97 100644 --- a/src/cpp/ripple/Config.h +++ b/src/cpp/ripple/Config.h @@ -67,7 +67,8 @@ enum SizedItemName siLineCacheAge, siHashNodeDBCache, siTxnDBCache, - siLgrDBCache + siLgrDBCache, + siLDBWriteSize }; struct SizedItem