From cb8014dbdd17c2b30c52bce0631cb87cbe970e8a Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 22 Jun 2017 12:32:08 +0200 Subject: [PATCH] use correct column families for size estimates (#2624) --- arangod/RocksDBEngine/RocksDBCollection.cpp | 4 ++-- arangod/RocksDBEngine/RocksDBEdgeIndex.cpp | 4 ++-- arangod/RocksDBEngine/RocksDBFulltextIndex.cpp | 4 ++-- arangod/RocksDBEngine/RocksDBGeoIndex.cpp | 6 ++++-- arangod/RocksDBEngine/RocksDBPrimaryIndex.cpp | 4 ++-- arangod/RocksDBEngine/RocksDBVPackIndex.cpp | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/arangod/RocksDBEngine/RocksDBCollection.cpp b/arangod/RocksDBEngine/RocksDBCollection.cpp index 24f130f28f..b9afd587f4 100644 --- a/arangod/RocksDBEngine/RocksDBCollection.cpp +++ b/arangod/RocksDBEngine/RocksDBCollection.cpp @@ -1136,7 +1136,7 @@ void RocksDBCollection::figuresSpecific( rocksdb::Range r(bounds.start(), bounds.end()); uint64_t out = 0; - db->GetApproximateSizes(&r, 1, &out, true); + db->GetApproximateSizes(RocksDBColumnFamily::documents(), &r, 1, &out, static_cast(rocksdb::DB::SizeApproximationFlags::INCLUDE_MEMTABLES | rocksdb::DB::SizeApproximationFlags::INCLUDE_FILES)); builder->add("documentsSize", VPackValue(out)); } @@ -1727,7 +1727,7 @@ void RocksDBCollection::estimateSize(velocypack::Builder& builder) { RocksDBKeyBounds bounds = RocksDBKeyBounds::CollectionDocuments(_objectId); rocksdb::Range r(bounds.start(), bounds.end()); uint64_t out = 0, total = 0; - db->GetApproximateSizes(&r, 1, &out, true); + db->GetApproximateSizes(RocksDBColumnFamily::documents(), &r, 1, &out, static_cast(rocksdb::DB::SizeApproximationFlags::INCLUDE_MEMTABLES | rocksdb::DB::SizeApproximationFlags::INCLUDE_FILES)); total += out; builder.openObject(); diff --git a/arangod/RocksDBEngine/RocksDBEdgeIndex.cpp b/arangod/RocksDBEngine/RocksDBEdgeIndex.cpp index 094124cbde..2cbb233235 100644 --- a/arangod/RocksDBEngine/RocksDBEdgeIndex.cpp +++ b/arangod/RocksDBEngine/RocksDBEdgeIndex.cpp @@ -417,8 +417,8 @@ size_t RocksDBEdgeIndex::memory() const { RocksDBKeyBounds bounds = RocksDBKeyBounds::EdgeIndex(_objectId); rocksdb::Range r(bounds.start(), bounds.end()); uint64_t out; - db->GetApproximateSizes(&r, 1, &out, true); - return (size_t)out; + db->GetApproximateSizes(RocksDBColumnFamily::edge(), &r, 1, &out, static_cast(rocksdb::DB::SizeApproximationFlags::INCLUDE_MEMTABLES | rocksdb::DB::SizeApproximationFlags::INCLUDE_FILES)); + return static_cast(out); } /// @brief return a VelocyPack representation of the index diff --git a/arangod/RocksDBEngine/RocksDBFulltextIndex.cpp b/arangod/RocksDBEngine/RocksDBFulltextIndex.cpp index 1c3f077ddb..273014b186 100644 --- a/arangod/RocksDBEngine/RocksDBFulltextIndex.cpp +++ b/arangod/RocksDBEngine/RocksDBFulltextIndex.cpp @@ -101,8 +101,8 @@ size_t RocksDBFulltextIndex::memory() const { RocksDBKeyBounds::FulltextIndexPrefix(_objectId, StringRef()); rocksdb::Range r(bounds.start(), bounds.end()); uint64_t out; - db->GetApproximateSizes(&r, 1, &out, true); - return (size_t)out; + db->GetApproximateSizes(RocksDBColumnFamily::fulltext(), &r, 1, &out, static_cast(rocksdb::DB::SizeApproximationFlags::INCLUDE_MEMTABLES | rocksdb::DB::SizeApproximationFlags::INCLUDE_FILES)); + return static_cast(out); } /// @brief return a VelocyPack representation of the index diff --git a/arangod/RocksDBEngine/RocksDBGeoIndex.cpp b/arangod/RocksDBEngine/RocksDBGeoIndex.cpp index a52b2bb6ac..f7bf9588e7 100644 --- a/arangod/RocksDBEngine/RocksDBGeoIndex.cpp +++ b/arangod/RocksDBEngine/RocksDBGeoIndex.cpp @@ -34,6 +34,8 @@ #include "RocksDBEngine/RocksDBMethods.h" #include "RocksDBEngine/RocksDBToken.h" +#include + using namespace arangodb; using namespace arangodb::rocksdbengine; @@ -317,8 +319,8 @@ size_t RocksDBGeoIndex::memory() const { RocksDBKeyBounds bounds = RocksDBKeyBounds::GeoIndex(_objectId); rocksdb::Range r(bounds.start(), bounds.end()); uint64_t out; - db->GetApproximateSizes(&r, 1, &out, true); - return (size_t)out; + db->GetApproximateSizes(RocksDBColumnFamily::geo(), &r, 1, &out, static_cast(rocksdb::DB::SizeApproximationFlags::INCLUDE_MEMTABLES | rocksdb::DB::SizeApproximationFlags::INCLUDE_FILES)); + return static_cast(out); } /// @brief return a JSON representation of the index diff --git a/arangod/RocksDBEngine/RocksDBPrimaryIndex.cpp b/arangod/RocksDBEngine/RocksDBPrimaryIndex.cpp index 65f4367c0f..6c6e94cce3 100644 --- a/arangod/RocksDBEngine/RocksDBPrimaryIndex.cpp +++ b/arangod/RocksDBEngine/RocksDBPrimaryIndex.cpp @@ -146,8 +146,8 @@ size_t RocksDBPrimaryIndex::memory() const { RocksDBKeyBounds bounds = RocksDBKeyBounds::PrimaryIndex(_objectId); rocksdb::Range r(bounds.start(), bounds.end()); uint64_t out; - db->GetApproximateSizes(&r, 1, &out, true); - return (size_t)out; + db->GetApproximateSizes(RocksDBColumnFamily::primary(), &r, 1, &out, static_cast(rocksdb::DB::SizeApproximationFlags::INCLUDE_MEMTABLES | rocksdb::DB::SizeApproximationFlags::INCLUDE_FILES)); + return static_cast(out); } int RocksDBPrimaryIndex::cleanup() { diff --git a/arangod/RocksDBEngine/RocksDBVPackIndex.cpp b/arangod/RocksDBEngine/RocksDBVPackIndex.cpp index 7479a7368e..498acafc81 100644 --- a/arangod/RocksDBEngine/RocksDBVPackIndex.cpp +++ b/arangod/RocksDBEngine/RocksDBVPackIndex.cpp @@ -215,8 +215,8 @@ size_t RocksDBVPackIndex::memory() const { : RocksDBKeyBounds::IndexEntries(_objectId); rocksdb::Range r(bounds.start(), bounds.end()); uint64_t out; - db->GetApproximateSizes(&r, 1, &out, true); - return (size_t)out; + db->GetApproximateSizes(_unique ? RocksDBColumnFamily::uniqueIndex() : RocksDBColumnFamily::index(), &r, 1, &out, static_cast(rocksdb::DB::SizeApproximationFlags::INCLUDE_MEMTABLES | rocksdb::DB::SizeApproximationFlags::INCLUDE_FILES)); + return static_cast(out); } /// @brief return a VelocyPack representation of the index