tursodatabase / libsql-client-go

Go client API for libSQL
MIT License
159 stars 23 forks source link

bugfix: propagate replication index to guarantee read your writes #103

Closed avinassh closed 5 months ago

avinassh commented 6 months ago

closes #99

I have added ReplicationIndex to relevant structs. The older version of sqld expected this field as a u64 and in the newer version of sqld changed to string.

So, while sending the value to sqld, we send it as u64 so that it is compatible with both older and newer versions. While receiving this value from the server we handle both the cases of u64 and string.

Testing this PR was a pain since it was difficult to reproduce the read-your-write issue as mentioned in #99 After several attempts, I updated sqld to make replication slower (by adding a sleep statement) and deployed my custom build. The script mentioned in the issue failed for main branch and works with this branch.

haaawk commented 5 months ago

@MarinPostma Could you please have a brief look to verify that we're handling the replication index returned from sqld correctly?

avinassh commented 5 months ago

All review comments are resolved. Merging this now.