Skip to content

Improve trunk eviction in EditManager#16713

Merged
noencke merged 4 commits into
microsoft:mainfrom
noencke:skunk-eviction
Aug 8, 2023
Merged

Improve trunk eviction in EditManager#16713
noencke merged 4 commits into
microsoft:mainfrom
noencke:skunk-eviction

Conversation

@noencke
Copy link
Copy Markdown
Contributor

@noencke noencke commented Aug 4, 2023

Description

The SharedTree EditManager's trunk commit eviction was both more complicated than necessary and also buggy. This PR cleans up the code and addresses the known bugs. Previously, when the minimum sequence number advanced to some sequence number M, all commits with sequence numbers below M were dropped, but a commit with exactly sequence number M was not because any number of branches might be based off of that commit (e.g. the local branch), and dropping it was impossible because a branch might continue to reference it. After this PR, that commit is still not dropped from memory, however it takes the place of the special "trunk base" commit or "origin" commit which precedes the trunk but is not considered part of the trunk. Not only does this remove multiple edge cases from the eviction logic (and the bugs that currently dwell therein), it also makes it more intuitive to predict which commits are removed from the trunk as the minimum sequence number advances.

image

This PR also does some minor cleanup and optimizations in EditManager, adds some more eviction test cases, and enables an eviction pass after tracked branches rebase (which will evict the trunk more aggressively in scenarios where a long-lived user-created branch repeatedly rebases over a parent branch).

@noencke noencke requested a review from a team as a code owner August 4, 2023 00:32
@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 Aug 4, 2023
@noencke noencke requested a review from yann-achard-MS August 4, 2023 00:38
@msfluid-bot
Copy link
Copy Markdown
Collaborator

msfluid-bot commented Aug 4, 2023

@fluid-example/bundle-size-tests: +12 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 436.74 KB 436.74 KB No change
connectionState.js 680 Bytes 680 Bytes No change
containerRuntime.js 236.57 KB 236.57 KB No change
loader.js 146.52 KB 146.52 KB No change
map.js 45.98 KB 45.98 KB No change
matrix.js 138.31 KB 138.31 KB No change
odspDriver.js 88.94 KB 88.94 KB No change
odspPrefetchSnapshot.js 41.75 KB 41.75 KB No change
sharedString.js 154.72 KB 154.72 KB No change
sharedTree2.js 231.48 KB 231.49 KB +12 Bytes
Total Size 1.64 MB 1.64 MB +12 Bytes

Baseline commit: 19c99b7

Generated by 🚫 dangerJS against eb76173

Comment thread experimental/dds/tree2/src/shared-tree-core/editManager.ts Outdated
Comment thread experimental/dds/tree2/src/shared-tree-core/editManager.ts
Comment thread experimental/dds/tree2/src/shared-tree-core/editManager.ts
Comment thread experimental/dds/tree2/src/test/shared-tree-core/sharedTreeCore.spec.ts Outdated
Comment thread experimental/dds/tree2/src/test/shared-tree-core/sharedTreeCore.spec.ts Outdated
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.

4 participants