-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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.
There was a problem hiding this 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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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.
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.