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

Upgrade to automerge 0.5; fix compaction #58

Merged
merged 5 commits into from
Dec 8, 2023

Conversation

teohhanhui
Copy link
Contributor

Replaces #21 and #50

TODO:

src/repo.rs Outdated Show resolved Hide resolved
src/repo.rs Outdated Show resolved Hide resolved
src/repo.rs Outdated Show resolved Hide resolved
src/fs_store.rs Outdated Show resolved Hide resolved
@issackelly
Copy link
Contributor

@teohhanhui I think that's the one where I chose Greg's API over Alex's for compaction and nobody has really stepped in to decide which one was more correct but we do need them to be consistent for sure.

#52 (comment) is the context

Copy link
Collaborator

@alexjg alexjg left a comment

Choose a reason for hiding this comment

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

@issackelly apologies for missing the compaction API stuff. I think what you have here makes sense. I'm actually busy working on a bunch of parts of this codebase getting it to interop with the JS implementation and I might tighten up the storage API a bit as part of that.

src/repo.rs Outdated Show resolved Hide resolved
src/repo.rs Outdated Show resolved Hide resolved
src/fs_store.rs Outdated Show resolved Hide resolved
@teohhanhui teohhanhui force-pushed the compaction branch 3 times, most recently from 5760556 to ce4ed60 Compare November 13, 2023 07:10
src/repo.rs Outdated Show resolved Hide resolved
@@ -732,7 +766,7 @@ impl DocumentInfo {
}
let waker = Arc::new(RepoWaker::Storage(wake_sender.clone(), document_id));
self.state.poll_pending_save(waker);
self.patches_since_last_save = 0;
self.last_heads = new_heads;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this lead to data loss? We update the heads of the last time we saved before the storage future has resolved, which means the storage future can fail for some reason (or more likely, be stuck in some kind of deadlock) and then then next time we save we only save since the heads which havent made it to disk.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about whether it can lead to data loss, but in any case it does make sense to store the heads together with the future onto the DocState, and then note_changes could use the heads of the last (fut, heads) pair? I think it's a good follow-up, because it's a complicated change to make.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Filed #60

src/repo.rs Outdated Show resolved Hide resolved
@@ -732,7 +766,7 @@ impl DocumentInfo {
}
let waker = Arc::new(RepoWaker::Storage(wake_sender.clone(), document_id));
self.state.poll_pending_save(waker);
self.patches_since_last_save = 0;
self.last_heads = new_heads;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about whether it can lead to data loss, but in any case it does make sense to store the heads together with the future onto the DocState, and then note_changes could use the heads of the last (fut, heads) pair? I think it's a good follow-up, because it's a complicated change to make.

src/repo.rs Show resolved Hide resolved
@teohhanhui teohhanhui force-pushed the compaction branch 2 times, most recently from 5e84c07 to bba686e Compare November 28, 2023 15:44
@teohhanhui
Copy link
Contributor Author

@gterzian I hope I didn't mess up the rebase for the test_document_changed_over_sync 😅

b55cf0f seems no longer necessary? So I have squashed it.

@gterzian
Copy link
Collaborator

@teohhanhui Thanks! Will take another look...

@gterzian
Copy link
Collaborator

gterzian commented Dec 1, 2023

Ok if we remove the line at #58 (comment) and fix the conflict it looks good to go. Haven't looked at the fs store changes yet. cc @alexjg

@teohhanhui
Copy link
Contributor Author

Punting the question of ee9504d, but otherwise this should be ready to merge if everything is okay.

@alexjg alexjg merged commit 7ecbdf0 into automerge:main Dec 8, 2023
8 checks passed
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.

4 participants