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

fix: anchor after each write #167

Merged
merged 2 commits into from
Nov 15, 2024
Merged

fix: anchor after each write #167

merged 2 commits into from
Nov 15, 2024

Conversation

nathanielc
Copy link
Collaborator

Tests that tried to control anchoring directly fail with ceramic-one as that is no longer a feature. Now each write is anchored before doing the next write.

Tests that tried to control anchoring directly fail with ceramic-one as
that is no longer a feature. Now each write is anchored before doing the
next write.
Copy link
Collaborator

@smrz2001 smrz2001 left a comment

Choose a reason for hiding this comment

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

🚀

await doc2.replace(content1, undefined, { anchor: false })
await doc3.replace(content1, undefined, { anchor: false })
await doc4.replace(content1, undefined, { anchor: false })
await doc1.replace(content1, undefined)
Copy link
Collaborator

Choose a reason for hiding this comment

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

the second undefined arg can be removed now

await doc2.replace(content1, undefined)
await doc3.replace(content1, undefined)
await doc4.replace(content1, undefined)
await waitForAnchor(doc1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is going to dramatically increase the time this test takes to run.

I think we should just do this one round where we update all 4 streams then wait for them to be anchored, and that's it. Remove all updates after this point, so that we still have only a single round of anchoring we are waiting on in this test.

We would then lose any integration test coverage that anchoring works when multiple consecutive writes are anchored by a single time event, but it sounds like we have no reliable way to introduce such a scenario anymore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I started with that plan however this creates races the test cannot deal with. The current conflict resolution rules prefer branches that have the earlier time event. Its easy to get unanchored writes pruned in these tests because we anchor so quickly.

Basically what happens is that the test writes 4 events to a stream. If its right before an anchor batch then say only the first two writes get anchored. But the test didn't wait to see if the updates are anchored and so the last two writes are pruned and it causes the test to fail.

This is basically the race we already know exists but in these test envs the race window is large.

As discussed before the solution here is to change/update conflict resolution rules and make time events branches so that time events cannot prune valid data events. Until we have that fix we have to wait for anchors in the test case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry, my proposal was to do a single update to each stream and get them anchored. Not to do 4 updates in a row

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok can do, I misunderstood. Keeping it simple works for me.

@@ -123,18 +123,6 @@ describe('Ceramic<->CAS basic integration', () => {

// Test document updates are anchored correctly
console.log('Waiting for anchor of updates')
Copy link
Collaborator

Choose a reason for hiding this comment

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

this log is no longer accurrate.

@nathanielc nathanielc added this pull request to the merge queue Nov 14, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 14, 2024
@nathanielc nathanielc added this pull request to the merge queue Nov 15, 2024
Merged via the queue into main with commit f38f2cf Nov 15, 2024
10 checks passed
@nathanielc nathanielc deleted the fix/anchor-each branch November 15, 2024 15:33
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.

3 participants