• I
    Make VersionSet::ReduceNumberOfLevels() static · 677fee27
    Igor Canadi 提交于
    Summary:
    A lot of our code implicitly assumes number_levels to be static. ReduceNumberOfLevels() breaks that assumption. For example, after calling ReduceNumberOfLevels(), DBImpl::NumberLevels() will be different from VersionSet::NumberLevels(). This is dangerous. Thankfully, it's not in public headers and is only used from LDB cmd tool. LDB tool is only using it statically, i.e. it never calls it with running DB instance. With this diff, we make it explicitly static. This way, we can assume number_levels to be immutable and not break assumption that lot of our code is relying upon. LDB tool can still use the method.
    
    Also, I removed the method from a separate file since it breaks filename completition. version_se<TAB> now completes to "version_set." instead of "version_set" (without the dot). I don't see a big reason that the function should be in a different file.
    
    Test Plan: reduce_levels_test
    
    Reviewers: dhruba, haobo, kailiu, sdong
    
    Reviewed By: kailiu
    
    CC: leveldb
    
    Differential Revision: https://reviews.facebook.net/D15303
    677fee27
version_set.cc 71.9 KB