You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Delta change feed: split a window at a schema change instead of reading the table whole #2175
Kernel refuses a change data feed range whose two ends have different schemas. So when a window spans a schema change, such as ALTER TABLE … ADD COLUMN, the pass reads the table whole instead. A whole read upserts what the table holds but cannot see what it no longer holds, so rows deleted inside that window stay in the target for good. An added column is probably the most common way a feed-enabled table loses a window.
#2166 logs this case as a schema change (fluree-db-delta/src/error.rs, change_feed_refusal), and docs/graph-sources/delta.md warns about it.
Proposal
Split the window at the change rather than reading whole. Kernel serves a range whose ends share a schema: in the review's repro, with a metaData commit at version 6, changes_since(5) opens fine. A change feed scan can already end early through MaterializeScan::stopped_at, so a pass can:
find the first version in (from, to] whose commit changes the schema (its metaData action);
read the feed through the version before it, and report that as stopped_at;
let the next pass start there, with a range whose ends share the new schema.
Nothing is lost, and the whole-read fallback is left for the cases that need it (feed off, log cleaned).
Testing
a_schema_change_inside_a_range_is_named_as_such in fluree-db-delta/tests/reader.rs stages a schema change on a copy of the change_feed fixture. The same staging works for a reader test that reads across the change in two ranges, and for an end-to-end test in fluree-db-api/tests/it_delta_local_fs.rs in which a delete before the change reaches the target.
Activity