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

Accelerate reference walk when determining relevant obliterates #4

Conversation

jzaffiro
Copy link
Collaborator

Make use of the moveSeqs and localMoveSeqs field on mergeTree to avoid walking all of the segments during block insert. Tests are not passing at the moment, I think #3 is needed before they will pass.

undefined,
false,
);
}
return true;
Copy link
Owner

Choose a reason for hiding this comment

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

can we do anything about this true to end the walk earlier? same thing below

) {
seg.localRefs?.walkReferences((ref) => {
const obliterate = ref.properties?.obliterate as ObliterateInfo | undefined;
if (obliterate?.end === ref && starts.has(obliterate)) {
Copy link
Owner

Choose a reason for hiding this comment

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

i think we can remove the start when we find a match, and when starts are empty, we can stop looking

false,
);
if (
(seg.movedSeq !== undefined &&
Copy link
Owner

Choose a reason for hiding this comment

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

this won't work once we have expansion, as the segment that has the ref won't be moved, so i'm not sure we should add this.

Copy link
Owner

@anthony-murphy anthony-murphy Sep 10, 2024

Choose a reason for hiding this comment

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

an idea could be to put all the obliterate refs in a stored segment set, and do that scan on that, rather than the tree. something like that should probably be a pr of its own. maybe even two sets, one for starts, and one for ends, so we can quickly find all the starts, then fine corresponding ends.

this.moveSeqs.includes(seg.movedSeq)) ||
(seg.localMovedSeq !== undefined && this.localMoveSeqs.has(seg.localMovedSeq))
) {
seg.localRefs?.walkReferences(
Copy link
Owner

Choose a reason for hiding this comment

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

i think it would be safe to only check the first and last position of the segment, rather than scan the whole thing, as we shouldn't merge segments above the min seq, so the obliterate refs should always stay on the ends of the segments

@jzaffiro
Copy link
Collaborator Author

Closing in favor of #6

@jzaffiro jzaffiro closed this Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants