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

add Xorfilter #324

Closed
wants to merge 4 commits into from
Closed

add Xorfilter #324

wants to merge 4 commits into from

Conversation

GKCY
Copy link

@GKCY GKCY commented Aug 23, 2021

What changes were proposed in this pull request?

Add support for xorfilter.

Why are the changes needed?

xorfilter is smaller and faster than bloomfilter, but the build time is slower.

Will break the compatibility? How if so?

No.

Does this PR introduce any user-facing change?

Yes. The user can decide to use bloomfilter or xorfilter by adjusting the parameters is_xor using command ALTER SYSTEM SET is_xor = XXX(True or False)

How was this patch tested?

unittest(test_bloom_filter_cache.cpp) and sysbench.

Checklist

  • I've run the tests to see all new and existing tests pass.
  • If this Pull Request resolves an issue, I linked to the issue in the text above.
  • I've informed the technical writer about the documentation change if necessary.

LIB_LOG(WARN, "the number of keys is not equal to the size_, ", K_(nbit), K(ret));
return ret;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

miss else?

uint32_t* counting = (uint32_t*)tmp_allocator.alloc(sizeof(uint32_t) * array_length_);
uint64_t* buckets = (uint64_t*)tmp_allocator.alloc(sizeof(uint64_t) * array_length_);
int* queue = (int*)tmp_allocator.alloc(sizeof(int) * array_length_);

Copy link
Contributor

Choose a reason for hiding this comment

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

alloc once and assign to each pointer?

int max_try = 20;
while (max_try-- > 0) {
seed_++;
memset(stack_hash, 0, sizeof(uint64_t) * size_);
Copy link
Contributor

Choose a reason for hiding this comment

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

alloc once and memset once

if (key_pos_ >= size_) {
ret = OB_SIZE_OVERFLOW;
STORAGE_LOG(WARN, "rowkeys is already full", K(ret));
} else if (OB_FAIL(rowkey.deep_copy(rowkeys_[key_pos_], *allocator))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we can also support insert single rowkey for xor filter builder, then the big space to keep all the rowkeys is no longer needed

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.

None yet

3 participants