From 1ac6b47c7f8be98182112e18d0f1de35d880a199 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 9 Nov 2011 11:43:21 -0800 Subject: [PATCH] os: rename and make use of the split_threshold parameter. This was accidentally left out of the must_split calculation. Put it in, and rename it to split_multiplier (as that is a much better name for how it's used). In the default case this won't actually change behavior, but it makes the behavior configurable as it's supposed to be. Signed-off-by: Greg Farnum --- src/os/HashIndex.cc | 2 +- src/os/HashIndex.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/os/HashIndex.cc b/src/os/HashIndex.cc index 540cb4c9270ff..cfbd9bf0cf452 100644 --- a/src/os/HashIndex.cc +++ b/src/os/HashIndex.cc @@ -207,7 +207,7 @@ bool HashIndex::must_merge(const subdir_info_s &info) { bool HashIndex::must_split(const subdir_info_s &info) { return (info.hash_level < (unsigned)MAX_HASH_LEVEL && - info.objs > ((unsigned)merge_threshold * 32)); + info.objs > ((unsigned)merge_threshold * 16 * split_multiplier)); } diff --git a/src/os/HashIndex.h b/src/os/HashIndex.h index bbcbc9904adca..a4256e3fd24d4 100644 --- a/src/os/HashIndex.h +++ b/src/os/HashIndex.h @@ -56,10 +56,10 @@ private: /** * Merges occur when the number of object drops below * merge_threshold and splits occur when the number of objects - * exceeds 16 * merge_threshold * split_threshold. + * exceeds 16 * merge_threshold * split_multiplier. */ int merge_threshold; - int split_threshold; + int split_multiplier; /// Encodes current subdir state for determining when to split/merge. struct subdir_info_s { @@ -128,10 +128,10 @@ public: HashIndex( const char *base_path, ///< [in] Path to the index root. int merge_at, ///< [in] Merge threshhold. - int split_at, ///< [in] Split threshhold. + int split_multiple, ///< [in] Split threshhold. uint32_t index_version)///< [in] Index version : LFNIndex(base_path, index_version), merge_threshold(merge_at), - split_threshold(split_at) {} + split_multiplier(split_multiple) {} /// @see CollectionIndex uint32_t collection_version() { return index_version; } -- 2.39.5