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

MultiCfIterator - AttributeGroupIter Impl & CoalescingIter Optimization #12534

Closed
wants to merge 6 commits into from

Conversation

jaykorean
Copy link
Contributor

@jaykorean jaykorean commented Apr 12, 2024

Summary

Continuing from the previous MultiCfIterator Implementations - (#12422, #12480 #12465), this PR completes the AttributeGroupIterator by implementing AttributeGroupIteratorImpl::AddToAttributeGroups(). While implementing the AttributeGroupIterator, we had to make some changes in MultiCfIteratorImpl and found an opportunity to improve Coalesce() in CoalescingIterator.

Lifting UNDER CONSTRUCTION - DO NOT USE comment by replacing it with EXPERIMENTAL

Here are some implementation details:

  • IteratorAttributeGroups is introduced to avoid having to copy all WideColumn objects during iteration.
  • PopulateIterator() no longer advances non-top iterators that have the same key as the top iterator in the heap.
  • AdvanceIterator() needs to advance the non-top iterators when they have the same key as the top iterator in the heap.
  • Instead of populating one by one, PopulateIterator() now collects all items with the same key and calls populate_func(items) at once.
  • This allowed optimization in Coalesce() such that we no longer do K-1 rounds of 2-way merge, but do one K-way merge instead.

Test Plan

Uncommented the assertions in verifyAttributeGroupIterator()

./multi_cf_iterator_test

@jaykorean jaykorean changed the title AttributeGroupIteratorImpl and IterableAttributeGroups MultiCfIterator - AttributeGroupIter Impl & CoalescingIter Optimization Apr 12, 2024
@jaykorean jaykorean requested a review from ltamasi April 12, 2024 23:44
@jaykorean jaykorean marked this pull request as ready for review April 12, 2024 23:45
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@ltamasi ltamasi left a comment

Choose a reason for hiding this comment

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

Thanks for the patch @jaykorean ! Looks awesome!!! Just a couple of minor comments (see below)

// TODO - Implement AttributeGroup population
const autovector<MultiCfIteratorInfo>& items) {
for (const auto& item : items) {
attribute_groups_.emplace_back(item.cfh, &item.iterator->columns());
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to confirm, items here is in the expected order (i.e. any CFs are in the order specified during iterator creation) because that's the order they're popped off the heap, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct

db/multi_cf_iterator_impl.h Show resolved Hide resolved
include/rocksdb/attribute_groups.h Outdated Show resolved Hide resolved
include/rocksdb/attribute_groups.h Outdated Show resolved Hide resolved
@ltamasi
Copy link
Contributor

ltamasi commented Apr 15, 2024

Also, I don't recall if we've added any history entries for CoalescingIterator and AttributeGroupIterator ?

@jaykorean
Copy link
Contributor Author

jaykorean commented Apr 15, 2024

@ltamasi I was planning to add CoalescingIterator and AttributeGroupIterator in the history.md when lifting UNDER CONSTRUCTION comment, but let me add it now with "experimental" warning

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@jaykorean merged this pull request in d34712e.

@jaykorean jaykorean deleted the attribute_group_iterator branch April 16, 2024 16:19
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