-
Notifications
You must be signed in to change notification settings - Fork 23
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
db.connect()/disconnect()
issues: db.prop
and db.syncStatus.prop
values, delayed replication, and read your own writes anomaly
#226
Comments
Thanks for the detailed write-up! Some intial comments:
It sounds like exactly that issue. It was fixed a couple of days ago in v1.11.0 - could you please re-test with that version?
Is this the same as / related to the above issue, or is a completely separate one? We'll have to investigate the sync status issues properly - it does seem like there are a couple of issues there. |
Yes, the summary's "And of most concern, db.disconnect()/connect() can lead to dropping local writes, possibly related to sqlite-core's # 54" and the example for "client not reading its own previous write" are the same/single issue.
With
With
And confirming that even though the client does not read its own write, the write is replicated to PostgreSQL:
|
Ok, sounds like it confirms the fix in v1.11.0 does have an impact, but there could still be a further issue. What exactly does the test do to reproduce the issue? One client or multiple? If I understand correctly you repeatedly disconnect and reconnect the client while writing data - Are you introducing any other faults (for example on postgres or the service), or only that? Is it feasible for me to run that test myself to reproduce? I could also configure my own test setup for that, but I'd need to get all the right conditions (like mentioned above). Let me know if a chat or call would be better to talk through this. |
The full Jepsen test environment is a heavy lift, steep learning curve, etc. I chatted with @kobiebotha to see if it would be appropriate to write a similar but simpler more specific purpose fuzzer in Dart for this use case, e.g. fuzzing disconnecting/connecting. Maybe it could even evolve into a full PowerSync API fuzzer easy enough to use for CI/CD testing. Give me a moment to architect and frame out an initial implementation, will be my first use of Isolates, Stream creation, etc and I can check back for feedback before a full implementation. I expect that such a fuzzer would expose:
|
Hi,
When
db.disconnect()/connect()
ing, some issues have been observed.The issue is being opened against the Dart client, even though it's likely to include other libs, as that's where the behavior is being observed.
Using debugging code like:
The expectation is that on return from
await
:connect
ing, bothdb.connected
anddb.syncStatus.connected
with betrue
db.syncStatus.uploading/downloading
will befalse
ifdb.connected
anddb.syncStatus.connected
arefalse
It's also possible for
db.disconnect()/connect()
to lead to replication pausing for 30s+:uploadData
dAnd of most concern,
db.disconnect()/connect()
can lead to:The first two issues can hopefully be debugged with existing or straightforward tests.
If the last issue isn't just another way to express the sqlite-core reverting local changes, I can pursue some type of simpler test case than a full Jepsen test.
Thanks!
Tests
disconnect()
a random majority of nodes every ~5s for ~5s, and theconnect()
all nodes.Some annotated sample log snippets, search for '#' for annotation comments.
SyncStatus not always tracking/reflecting the actual state:
replication paused
client not reading its own previous write
The transaction graph shows a cycle:
p-> is process order
rw-> is logical read/write order
So the graph cycles which shows a ready your own writes anomaly.
The text was updated successfully, but these errors were encountered: