From a85fbf69e0461bb8d909dbf764a587eb22fd3135 Mon Sep 17 00:00:00 2001 From: Torrie Fischer Date: Wed, 1 Oct 2014 11:21:46 -0700 Subject: [PATCH] Update rocksdb --- Builds/VisualStudio2013/RippleD.vcxproj | 65 +++++++++++++-- .../VisualStudio2013/RippleD.vcxproj.filters | 81 ++++++++++++++++--- .../nodestore/backend/RocksDBFactory.cpp | 23 +++--- src/ripple/unity/rocksdb.cpp | 13 ++- 4 files changed, 152 insertions(+), 30 deletions(-) diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index d86bbb6da6..3eebf8abd5 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -3578,6 +3578,11 @@ + + True + + + True @@ -3637,11 +3642,6 @@ - - True - - - True @@ -3662,6 +3662,16 @@ + + True + + + + + True + + + @@ -3680,6 +3690,8 @@ + + @@ -3760,6 +3772,11 @@ + + True + + + True @@ -3800,14 +3817,16 @@ + + True + + + True - - True - @@ -3818,6 +3837,16 @@ + + True + + + + + True + + + True @@ -3883,6 +3912,11 @@ True + + True + + + True @@ -3969,6 +4003,9 @@ + + True + True @@ -4041,6 +4078,11 @@ + + True + + + @@ -4049,6 +4091,11 @@ True + + True + + + True @@ -4063,6 +4110,8 @@ + + True diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index a95233105b..f28c4cf335 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -535,6 +535,9 @@ {9127B497-2610-2304-EEC9-8BEFBE9EA84E} + + {15F05867-678D-11FA-A5FA-EC735FAA0DC7} + {54BB5EB5-AAE6-285E-E486-052F58B9C667} @@ -4875,6 +4878,12 @@ rocksdb2\db + + rocksdb2\db + + + rocksdb2\db + rocksdb2\db @@ -4947,12 +4956,6 @@ rocksdb2\db - - rocksdb2\db - - - rocksdb2\db - rocksdb2\db @@ -4977,6 +4980,18 @@ rocksdb2\db + + rocksdb2\db + + + rocksdb2\db + + + rocksdb2\db + + + rocksdb2\db + rocksdb2\hdfs @@ -5004,6 +5019,9 @@ rocksdb2\include\rocksdb + + rocksdb2\include\rocksdb + rocksdb2\include\rocksdb @@ -5118,6 +5136,12 @@ rocksdb2\table + + rocksdb2\table + + + rocksdb2\table + rocksdb2\table @@ -5166,15 +5190,18 @@ rocksdb2\table + + rocksdb2\table + + + rocksdb2\table + rocksdb2\table rocksdb2\table - - rocksdb2\table - rocksdb2\table @@ -5187,6 +5214,18 @@ rocksdb2\table + + rocksdb2\table + + + rocksdb2\table + + + rocksdb2\table + + + rocksdb2\table + rocksdb2\table @@ -5268,6 +5307,12 @@ rocksdb2\utilities\backupable + + rocksdb2\utilities\compacted_db + + + rocksdb2\utilities\compacted_db + rocksdb2\utilities\document @@ -5370,6 +5415,9 @@ rocksdb2\util + + rocksdb2\util + rocksdb2\util @@ -5454,6 +5502,12 @@ rocksdb2\util + + rocksdb2\util + + + rocksdb2\util + rocksdb2\util @@ -5463,6 +5517,12 @@ rocksdb2\util + + rocksdb2\util + + + rocksdb2\util + rocksdb2\util @@ -5481,6 +5541,9 @@ rocksdb2\util + + rocksdb2\util + rocksdb2\util diff --git a/src/ripple/nodestore/backend/RocksDBFactory.cpp b/src/ripple/nodestore/backend/RocksDBFactory.cpp index 85c249d342..26fc886a34 100644 --- a/src/ripple/nodestore/backend/RocksDBFactory.cpp +++ b/src/ripple/nodestore/backend/RocksDBFactory.cpp @@ -85,7 +85,6 @@ public: Scheduler& m_scheduler; BatchWriter m_batch; std::string m_name; - std::unique_ptr m_filter_policy; std::unique_ptr m_db; RocksDBBackend (int keyBytes, Parameters const& keyValues, @@ -100,28 +99,28 @@ public: throw std::runtime_error ("Missing path in RocksDBFactory backend"); rocksdb::Options options; + rocksdb::BlockBasedTableOptions table_options; options.create_if_missing = true; options.env = env; if (keyValues["cache_mb"].isEmpty()) { - options.block_cache = rocksdb::NewLRUCache (getConfig ().getSize (siHashNodeDBCache) * 1024 * 1024); + table_options.block_cache = rocksdb::NewLRUCache (getConfig ().getSize (siHashNodeDBCache) * 1024 * 1024); } else { - options.block_cache = rocksdb::NewLRUCache (keyValues["cache_mb"].getIntValue() * 1024L * 1024L); + table_options.block_cache = rocksdb::NewLRUCache (keyValues["cache_mb"].getIntValue() * 1024L * 1024L); } if (keyValues["filter_bits"].isEmpty()) { if (getConfig ().NODE_SIZE >= 2) - m_filter_policy.reset (rocksdb::NewBloomFilterPolicy (10)); + table_options.filter_policy.reset (rocksdb::NewBloomFilterPolicy (10)); } else if (keyValues["filter_bits"].getIntValue() != 0) { - m_filter_policy.reset (rocksdb::NewBloomFilterPolicy (keyValues["filter_bits"].getIntValue())); + table_options.filter_policy.reset (rocksdb::NewBloomFilterPolicy (keyValues["filter_bits"].getIntValue())); } - options.filter_policy = m_filter_policy.get(); if (! keyValues["open_files"].isEmpty()) { @@ -167,7 +166,7 @@ public: if (! keyValues["block_size"].isEmpty ()) { - options.block_size = keyValues["block_size"].getIntValue (); + table_options.block_size = keyValues["block_size"].getIntValue (); } if (! keyValues["universal_compaction"].isEmpty ()) @@ -181,6 +180,8 @@ public: } } + options.table_factory.reset(NewBlockBasedTableFactory(table_options)); + rocksdb::DB* db = nullptr; rocksdb::Status status = rocksdb::DB::Open (options, m_name, &db); if (!status.ok () || !db) @@ -344,12 +345,12 @@ public: RocksDBFactory () { - rocksdb::Options options; - options.create_if_missing = true; - options.block_cache = rocksdb::NewLRUCache ( + rocksdb::BlockBasedTableOptions table_options; + + table_options.block_cache = rocksdb::NewLRUCache ( getConfig ().getSize (siHashNodeDBCache) * 1024 * 1024); - m_lruCache = options.block_cache; + m_lruCache = table_options.block_cache; } ~RocksDBFactory () diff --git a/src/ripple/unity/rocksdb.cpp b/src/ripple/unity/rocksdb.cpp index 58cd4dfd41..5ed717e2fe 100644 --- a/src/ripple/unity/rocksdb.cpp +++ b/src/ripple/unity/rocksdb.cpp @@ -61,6 +61,7 @@ #include #include #include +#include #include #include #include @@ -72,12 +73,14 @@ #include #include #include -#include #include #include #include #include +#include +#include #include +#include #include #include #include @@ -87,10 +90,12 @@ #include #include #include +#include #include -#include #include #include +#include +#include #include #include #include @@ -109,6 +114,7 @@ #include #include #include +#include #include #include #include @@ -120,7 +126,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -136,6 +144,7 @@ #include #include #include +#include #include #include #include