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

Region tree renaming and fix #26

Merged
merged 5 commits into from
Jun 28, 2023
Merged

Region tree renaming and fix #26

merged 5 commits into from
Jun 28, 2023

Conversation

sergeypospelov
Copy link
Member

@sergeypospelov sergeypospelov commented Jun 21, 2023

This PR fixes issues with key deduplication by RegionTree and simplification found by @Saloed. Also, made renaming in RegionTree to make it easier to understand.

Details

Issue with key deduplication

Consider the following example:

// writings
arr {i <- 1} {j <- 2} {j <- 3}
// expected
arr {i <- 1} {j <- 3}
// actual
arr {j <- 3}

It happens, because in case keyFilter returns true, localize skips not only the top node, but also its subtree, which is incorrect in such case. Now localize with filtering maintains this correctly, but may leave some nodes even they satisfy keyFilter, which is OK for us.

Issue with simplification

Consider the following example:

reading := arr {i <- 1 | p1 } {i <- 2 | p2} [j]
model := {i -> 0, p1 -> true, p2 -> false, j -> 0}
composed := compose(reading, model)
// expected
1
// actual
RE in composition

It happens, because guarded update nodes still remains in the memory region, though guards of some of them have evaluated to false. Fixed it in memory updates map functions.

Renaming

RegionTree is actually a persistent event-storage with support of grouped reading and writing, where events live in specific regions. Thus, now its signature looks as following class RegionTree<Reg, Value>. IMO, it's much clearer.

@sergeypospelov sergeypospelov merged commit b128db4 into main Jun 28, 2023
@sergeypospelov sergeypospelov mentioned this pull request Jun 29, 2023
24 tasks
@sergeypospelov sergeypospelov deleted the sergey/region_tree_fix branch June 29, 2023 12:27
korifey pushed a commit that referenced this pull request Jul 12, 2023
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