Skip to content

Use serde to parse data lines and checkpoints #82

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

Merged
merged 3 commits into from
Jun 2, 2025
Merged

Conversation

simolus3
Copy link
Contributor

@simolus3 simolus3 commented Jun 2, 2025

This is another item moved out of #70 with the intention of making that PR easier to review.

This replaces SQL queries to traverse JSON structures with a serde deserialization in two places:

  1. When validating checksums.
  2. When inserting a data batch.

For checkpoints, the implementation has been moved to src/sync/checkpoint.rs, the existing checkpoint.rs delegates to the new function. The new sync client will also log a bit more information on checksum failures (like the checksum from the checkpoint line and the op_checksum and add_checksum in the database) - I've kept that logic here, which means that checkpoint.rs needs to map back into the simple string representation.

Similarly, logic to insert data has moved to src/sync/operations.rs with the existing file just delegating to the new function. This shouldn't change behavior at all (the only change is that the save_data previously accepted oplog entries where data was a direct JSON object - now it needs to be a JSON-serialized string. I can restore the existing behavior here as well, but my understanding is that all client SDKs have been migrated).

@simolus3 simolus3 requested a review from rkistner June 2, 2025 10:56
@simolus3 simolus3 force-pushed the serde-oplog-parsing branch from a2a18ed to 202ebba Compare June 2, 2025 10:57
@simolus3 simolus3 merged commit 3dde911 into main Jun 2, 2025
21 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.

2 participants