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

Clean up stale local references referring to old interval endpoints #20026

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

jzaffiro
Copy link
Contributor

@jzaffiro jzaffiro commented Mar 8, 2024

During the interval change codepath, many local references are created and updated, but local references for removed interval endpoints were never cleaned up. This was causing a bug where after removing a range of text and reverting the remove, the interval endpoints would not return to the position at which they were created. Some existing unit tests also used the stale references, and these only worked in the past because we didn't do any clean up. Those tests now use the updated references.

AB#7044, #19352

@jzaffiro jzaffiro requested a review from a team as a code owner March 8, 2024 00:37
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: sharedstring base: main PRs targeted against main branch labels Mar 8, 2024
@msfluid-bot
Copy link
Collaborator

msfluid-bot commented Mar 8, 2024

@fluid-example/bundle-size-tests: +238 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 514.68 KB 514.79 KB +119 Bytes
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 249.11 KB 249.11 KB No change
loader.js 128.15 KB 128.15 KB No change
map.js 41.36 KB 41.36 KB No change
matrix.js 143.67 KB 143.67 KB No change
odspDriver.js 97.5 KB 97.5 KB No change
odspPrefetchSnapshot.js 41.87 KB 41.87 KB No change
sharedString.js 161.26 KB 161.38 KB +119 Bytes
sharedTree.js 330.25 KB 330.25 KB No change
Total Size 1.81 MB 1.81 MB +238 Bytes

Baseline commit: 023de01

Generated by 🚫 dangerJS against e55b6aa

Copy link
Contributor

@anthony-murphy anthony-murphy left a comment

Choose a reason for hiding this comment

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

It still feels a bit odd to me that this change would affect anything, or only affect the right things. Specifically, I'm not sure why this change doesn't need to consider if the change is made locally vs remotely. Usually local changes are optimistically applied, and then the real change is commit/finalized/completed on ack. That said, interval collections have a pretty odd flow for dealing with ops and acks plus i know we have pretty good testing here with fuzz, what's added here, and otherwise, so i trust we are doing the right things overall.

@scarlettjlee
Copy link
Contributor

There doesn't seem to be anything wrong with this change itself, but I still don't understand how/why it fixes the bug which makes me confused and wondering if there are more lurking bugs.

@scarlettjlee
Copy link
Contributor

The fix is good. The root problem is the logic in addIfIntervalEndpoint: it looks for any interval in the segments it examines, not current interval collections. It should probably validate that as well, but we can do that later. We want to clean up these unnecessary local refs anyway. (There may also be another lurking problem with extra change events on reverting, but that's a separate issue.)

@jzaffiro jzaffiro enabled auto-merge (squash) March 14, 2024 17:11
@jzaffiro jzaffiro merged commit 11968a2 into microsoft:main Mar 14, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: sharedstring area: dds Issues related to distributed data structures base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants