Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible for FileStore to be in a state which never do merge but keep it backward compatible #1444

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/os/HashIndex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,14 @@ int HashIndex::set_info(const vector<string> &path, const subdir_info_s &info) {

bool HashIndex::must_merge(const subdir_info_s &info) {
return (info.hash_level > 0 &&
merge_threshold > 0 &&
info.objs < (unsigned)merge_threshold &&
info.subdirs == 0);
}

bool HashIndex::must_split(const subdir_info_s &info) {
return (info.hash_level < (unsigned)MAX_HASH_LEVEL &&
info.objs > ((unsigned)merge_threshold * 16 * split_multiplier));
info.objs > ((unsigned)(abs(merge_threshold)) * 16 * split_multiplier));

}

Expand Down
5 changes: 3 additions & 2 deletions src/os/HashIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* would be located in (root)/2/D/0/
*
* Subdirectories are created when the number of objects in a directory
* exceed 32*merge_threshhold. The number of objects in a directory
* exceed (abs(merge_threshhold)) * 16 * split_multiplier. The number of objects in a directory
* is encoded as subdir_info_s in an xattr on the directory.
*/
class HashIndex : public LFNIndex {
Expand All @@ -60,7 +60,8 @@ class HashIndex : public LFNIndex {
/**
* Merges occur when the number of object drops below
* merge_threshold and splits occur when the number of objects
* exceeds 16 * merge_threshold * split_multiplier.
* exceeds 16 * abs(merge_threshold) * split_multiplier.
* Please note if merge_threshold is less than zero, it will never do merging
*/
int merge_threshold;
int split_multiplier;
Expand Down