Skip to content

mtca: calculate covering subtrees and store in DB. - #9153

Merged
jsha merged 17 commits into
mainfrom
ezekiel/covering-subtrees
Nov 11, 2026
Merged

jsha merged 17 commits into
mainfrom
ezekiel/covering-subtrees

Conversation

@ezekiel

@ezekiel ezekiel commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Fixes: #9038

@aarongable aarongable left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this TileHashReader-based approach is clear and obviously correct, and we shouldn't try to do a Frontier-based optimization yet. We can do that as an optional improvement later.

Comment thread trees/subtree/subtree.go Resolved
Comment thread trees/subtree/subtree.go Resolved
Comment thread trees/subtree/subtree.go Resolved
Comment thread trees/subtree/subtree.go Resolved
Comment thread mtca/mtca.go Resolved
Comment thread mtca/mtca.go Resolved
Comment thread mtca/mtca.go Resolved
Comment thread mtca/mtca.go Resolved
Comment thread mtca/mtca.go Resolved
Comment thread mtca/mtca.go Resolved
@ezekiel ezekiel self-assigned this Nov 5, 2026
@ezekiel
ezekiel marked this pull request as ready for review November 5, 2026 17:30
@ezekiel
ezekiel requested a review from a team as a code owner November 5, 2026 17:30
@ezekiel
ezekiel requested a review from aarongable November 5, 2026 17:30
aarongable
aarongable previously approved these changes Nov 5, 2026

@aarongable aarongable left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with nits. I think it would be fine to break out the GetCheckpointSubtree -> GetSubtree change into a separate PR, but I also don't think it's necessary. Happy to defer to other reviewers on that.

Comment thread mtca/mtca.go Resolved
Comment thread mtca/mtca.go Resolved
@aarongable
aarongable requested review from a team and beautifulentropy and removed request for a team November 5, 2026 22:50
Comment thread trees/subtree/subtree.go Resolved
Comment thread trees/treedb/treedb.go Resolved
Comment thread trees/subtree/subtree.go Resolved
Comment thread mtca/mtca.go Resolved
Comment thread mtca/mtca.go Resolved
Comment thread mtcb/mtcb.go Resolved
Comment thread trees/subtree/subtree.go Resolved
Comment thread mtca/mtca.go Resolved
jsha
jsha previously approved these changes Nov 10, 2026

@jsha jsha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. As an FYI: dbStoredSubtree winds up looking a lot like treedb.SubtreeModel. And note the comment on treedb.InsertSubtree():

Because borp's `Insert` modifies its argument to set the ID
when a field is marked as autoincrement (`.SetKeys(true, "ID")`), this method
also modifies its argument (in this case, `model`).

In other words, after calling InsertSubtree() we have a handy SubtreeModel object that carries the start and end we want, as well as the new ID. When I originally wrote this function, I was unsure as to whether it was better to return an ID, or simply rely on the mutate-in-place logic. Here it seems like perhaps the latter.

Alternatively, we could decide we actually don't like the way borp mutates things in place during Insert, and rely solely on the returned ID - which would be consistent with the earlier feedback I gave about mutation!

At any rate, I think this is good to merge and we can fiddle with it later if we see fit. :D

@aarongable aarongable left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM modulo one thing we discussed in the call yesterday

Comment thread mtca/mtca.go Resolved
@ezekiel
ezekiel dismissed stale reviews from beautifulentropy and jsha via 2d772fb November 10, 2026 18:18
@ezekiel
ezekiel requested a review from aarongable November 10, 2026 18:25
@ezekiel
ezekiel requested a review from jsha November 10, 2026 20:22
aarongable
aarongable previously approved these changes Nov 11, 2026
@jsha
jsha merged commit 5568368 into main Nov 11, 2026
32 checks passed
@jsha
jsha deleted the ezekiel/covering-subtrees branch November 11, 2026 00:45
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.

trees: compute covering subtrees for a range of indices

4 participants