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

refactor(tree) use separate cells ids for src and dst cells in moves #21156

Merged

Conversation

yann-achard-MS
Copy link
Contributor

Description

Before this PR, we used to use assign the same identifiers to cells emptied by a move's detach and cells filled by a move's attach.
This is a problem because, when such a move is rolled back, the inverse move would keep those cell IDs the same, leading to a situation where different cells had been assigned the same identifier over time. This is an unnecessary complication that may cause bugs.

This PR allocates separate IDs for source and destination cells (using sequential IDs for neighboring cells).
The ID associated with the overall move (which is used to link the source and destination marks) gets assigned the same ID as the detached cell (except when the detach comes with an override).

Breaking Changes

None. The way edits are processed has not changed.

@yann-achard-MS yann-achard-MS marked this pull request as ready for review May 18, 2024 00:44
@yann-achard-MS yann-achard-MS requested a review from a team as a code owner May 18, 2024 00:44
@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree base: main PRs targeted against main branch labels May 18, 2024
moveIn(
destIndex: number,
count: number,
detachCellId: ChangesetLocalId,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it makes more sense to call this moveId instead of detachCellId, since the fact that it's the ID of the detach cell isn't relevant to the move in?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's a good point. Thanks for pointing that out.

@yann-achard-MS yann-achard-MS enabled auto-merge (squash) May 20, 2024 21:32
@msfluid-bot
Copy link
Collaborator

@fluid-example/bundle-size-tests: +226 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 453.96 KB 453.96 KB No change
azureClient.js 551.21 KB 551.21 KB No change
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 257.82 KB 257.82 KB No change
fluidFramework.js 356.75 KB 356.86 KB +113 Bytes
loader.js 132.91 KB 132.91 KB No change
map.js 41.43 KB 41.43 KB No change
matrix.js 143.66 KB 143.66 KB No change
odspClient.js 519.75 KB 519.75 KB No change
odspDriver.js 97.3 KB 97.3 KB No change
odspPrefetchSnapshot.js 42.16 KB 42.16 KB No change
sharedString.js 160.18 KB 160.18 KB No change
sharedTree.js 356.74 KB 356.85 KB +113 Bytes
Total Size 3.19 MB 3.19 MB +226 Bytes

Baseline commit: 0016b60

Generated by 🚫 dangerJS against 49ee4a7

@yann-achard-MS yann-achard-MS merged commit c5396ef into microsoft:main May 21, 2024
30 checks passed
@yann-achard-MS yann-achard-MS deleted the separate-cells-ids-for-move branch May 21, 2024 00:52
kekachmar pushed a commit to kekachmar/FluidFramework that referenced this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: tree 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.

None yet

3 participants