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

Tests for filter compatibility #9773

Closed
wants to merge 7 commits into from

Conversation

pdillinger
Copy link
Contributor

Summary: This change adds two unit tests that would each catch the
regression fixed in #9736

  • TableMetaIndexKeys - detects any churn in metaindex block keys
    generated by SST files using standard db_test_util configurations.
  • BloomFilterCompatibility - this detects if any common built-in
    FilterPolicy configurations fail to read filters generated by another.
    (The regression bug caused NewRibbonFilterPolicy not to read filters
    from NewBloomFilterPolicy and vice-versa.) This replaces some previous
    tests that didn't really appear to be testing much of anything except
    basic data correctness, which doesn't tell you a filter is being used.

Light refactoring in meta_blocks.cc/h to support inspecting metaindex
keys.

Test Plan: this is the test. Verified that 7.0.2 fails both tests and 7.0.3 passes.
With backporting for intentional API changes in 7.0, 6.29 also passes.

@facebook-github-bot
Copy link
Contributor

@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Summary: This change adds two unit tests that would each catch the
regression fixed in facebook#9736

* TableMetaIndexKeys - detects any churn in metaindex block keys
generated by SST files using standard db_test_util configurations.
* BloomFilterCompatibility - this detects if any common built-in
FilterPolicy configurations fail to read filters generated by another.
(The regression bug caused NewRibbonFilterPolicy not to read filters
from NewBloomFilterPolicy and vice-versa.) This replaces some previous
tests that didn't really appear to be testing much of anything except
basic data correctness, which doesn't tell you a filter is being used.

Light refactoring in meta_blocks.cc/h to support inspecting metaindex
keys.

Test Plan: this is the test
@facebook-github-bot
Copy link
Contributor

@pdillinger has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@pdillinger has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

table_options.filter_policy.reset(NewBloomFilterPolicy(10, false));
options.table_factory.reset(NewBlockBasedTableFactory(table_options));
ReopenWithColumnFamilies({"default", "pikachu"}, options);
namespace {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that GitHub makes the diff on this file look super complicated. It's just complete replacement of some tests.

Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

std::vector<CompatibilityConfig> kCompatibilityConfigs = {
{Create(20, kDeprecatedBlock), false, test::kDefaultFormatVersion},
{kCompatibilityBloomPolicy, false, test::kDefaultFormatVersion},
{kCompatibilityBloomPolicy, true, test::kDefaultFormatVersion},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs BlockBasedTableOptions::kTwoLevelIndexSearch, otherwise partition_filters gets reset silently.

@@ -463,11 +463,10 @@ Status FindMetaBlock(InternalIterator* meta_index_iter,
}
}

Status FindMetaBlockInFile(RandomAccessFileReader* file, uint64_t file_size,
Status ReadMetaBlockInFile(RandomAccessFileReader* file, uint64_t file_size,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be ReadMetaIndexBlockInFile()? IIUC this is a distinct block from what FindMetaBlockInFile() and ReadMetaBlock() could return.

@facebook-github-bot
Copy link
Contributor

@pdillinger has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants