Add chunked payload generation and network transport#50
Open
marcobambini wants to merge 2 commits into
Open
Conversation
…elpers - cloudsync_payload_chunks: add exclude_filter_site_id flag (SQLite hidden column / PG 4th arg) to stream changes from all sites except filter_site_id, as the /check download path needs; setting it without a site_id is an error - add cloudsync_uuid_text()/cloudsync_uuid_blob() scalar functions on SQLite and PostgreSQL to convert site_id between its 16-byte binary form and the canonical UUID string (tolerant of dashed/undashed input), so string-based callers can pass a site_id to cloudsync_payload_chunks - sqlite vtab: rewrite best_index to assign argv in canonical column order, fixing a latent argument-ordering bug - perf: throttle the v3 fragment stale-group GC to at most once per 60s per connection (cloudsync_context.last_fragment_cleanup), removing an O(n^2) full-table scan that ran on every applied fragment - add PostgreSQL 1.0->1.1 migration for the new chunked-payload SQL surface - build: neutralize the ambient build env for curl's ./configure (CURL_CONFIG_ENV) so exported LDFLAGS/CPPFLAGS/LIBS don't break it - test: rename PG 39_payload_chunks.sql -> 52 (39 was duplicated); add multi-site exclude, UUID roundtrip and stale-GC-throttle coverage (SQLite unit + PG) - docs: API.md (new argument + two functions) and CHANGELOG Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Update — commit 92a048cAdds the Changes
Verified: SQLite TODO
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds chunk-aware payload generation and send-path transport support to sqlite-sync. It keeps the existing monolithic payload APIs intact while adding a streaming path for large rowsets and oversized individual BLOB/TEXT values.
Implemented changes:
cloudsync_payload_chunks():since_db_version,filter_site_id/ local site id, anduntil_db_version.payload_max_chunk_size:cloudsync_payload_encode()remains supported for monolithic payloads.cloudsync_payload_apply()accepts legacy payloads, monolithic payloads, and v3 fragment payloads regardless of the local chunk-size setting.cloudsync_network_send_changes():cloudsync_payload_chunks()instead of building one large payload first./applybackend contract, either inline asblobor through uploadurl.dblink, required by the test suite.Compatibility
Existing users of
cloudsync_payload_encode()and current network APIs continue to work. The new chunking behavior is opt-in for direct SQL callers viacloudsync_payload_chunks(), and automatic for the built-in network send path. Incoming payload apply remains format-compatible with older payloads and does not reject payloads based on the localpayload_max_chunk_size.Companion backend PR
Testing
makemake unittestmake testreached and passed the SQLite/unit portion, then stopped at the remote e2e stage becauseINTEGRATION_TEST_DATABASE_IDis not set locally.make postgres-docker-debug-rebuildpsql -U postgres -d postgres -f test/postgresql/full_test.sql(Failures: 0). This was run inside the debug container because the debug PostgreSQL build listens on loopback inside the container and the hostmake postgres-docker-run-testconnection is closed by that setup.git diff --check