Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1158 +/- ##
=======================================
Coverage 61.42% 61.42%
=======================================
Files 293 293
Lines 19314 19314
=======================================
+ Hits 11863 11864 +1
Misses 6895 6895
+ Partials 556 555 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adds polling-based longpoll and continuous feed modes to the SQLite driver's DBUpdates implementation. Uses exponential backoff (100ms-10s) to efficiently poll for new database creation/deletion events. Batches updates by keeping the SQL cursor open rather than re-querying for each update. Also fixes normal feed mode to properly handle since="now" parameter.
- Since() now returns the suffix portion of compound sequence IDs (e.g. "42-foo" yields seq=42, suffix="foo") rather than the full string - sqlite drivers discard the suffix (unused) and drop pointer indirection on since, since since=0 and unspecified are semantically equivalent
Removes redundant since, sinceNow, feed, and lastSeq parameters from the signature; the function now derives all it needs directly from opts.
…Membership)
ClusterSetup("enable_single_node") creates _users, _replicator, and _global_changes
idempotently, matching CouchDB's setup wizard behavior. ClusterStatus and Membership
are stubbed pending TDD cycles.
Add ModulePath() to kiviktest.deps for Go 1.24+ compatibility. Fix unchecked sql.Rows.Close() return values in longpollDBUpdates. Extend ClusterSetup to treat finish_cluster identically to enable_single_node, and no-op for enable_cluster and add_node, allowing test harnesses using the multi-node setup flow to work against SQLite.
Returns "cluster_disabled" before ClusterSetup is called and "single_node_enabled" after, by checking for the _global_changes table.
Reports "sqlite@localhost" in both all_nodes and cluster_nodes, matching CouchDB's name@host format for Erlang distributed nodes.
Adds logGlobalChange which inserts an append-only document into _global_changes within the CreateDB transaction, silently no-oping when _global_changes tables are absent (pre-ClusterSetup state). Refactors resolveSince to return (since, hasSince, err) for clarity.
Adds logGlobalChange call in DestroyDB alongside logDBUpdate so that database deletions are recorded in _global_changes when ClusterSetup has been run. Refactors test to use setup callbacks per testy convention.
Introduces testClient(t) in common_test.go to replace the repeated
drv{}.NewClient(":memory:", mock.NilOption) pattern across all sqlite
test files, reducing boilerplate and making setup intent clearer.
Guards DBUpdates with a _global_changes existence check so callers get a meaningful 503 before ClusterSetup is run. Old kivik$db_updates_log tests are skipped with TODOs pending removal in Cycle 5.
Replace kivik$db_updates_log queries with a globalChangesDBUpdates adapter that wraps the _global_changes Changes feed. Reorder systemDatabases so _global_changes is created first, enabling _users/_replicator events to be logged during ClusterSetup.
Delete ensureDBUpdatesLog, logDBUpdate, longpollDBUpdates, the DBUpdatesLog template func, and the schema entry — all dead code now that DBUpdates reads from _global_changes/_changes.
Forward feed/since options to the underlying Changes call and default since=now for longpoll/continuous feeds. Un-skip the longpoll test now that the old kivik$db_updates_log has been removed.
Call ClusterSetup in the test setup so _global_changes exists, configure AllDBs.expected for the three system databases, and remove DBUpdates.skip.
Tests now use ClusterSetup so _global_changes exists, and expected sequences reflect _users(1) and _replicator(2) being logged before user-created databases.
Previously, feed=longpoll only routed to newLongpollChanges when since=now. With an explicit since=<seq> at the current tip (no new records to return), the feed fell through to newNormalChanges and returned EOF immediately instead of blocking for the next change.
…DBChanges_longpoll Five separate test functions shared identical structure (goroutine trigger after delay, timing assertion, result check) and are cleaner as a single table.
…tabases Replace the MD5-of-test-name DSN in testClient/newDB with an atomic counter, ensuring every call gets a distinct named shared-memory database. Parallel test runs (count>1, shuffle) with the same test name no longer collide, and the underlying sql.DB is closed in cleanup so the named database is released between runs.
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.
No description provided.