@quereus/sync 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +14 -6
  2. package/dist/src/index.d.ts +1 -1
  3. package/dist/src/index.d.ts.map +1 -1
  4. package/dist/src/index.js +1 -1
  5. package/dist/src/index.js.map +1 -1
  6. package/dist/src/metadata/column-version.d.ts.map +1 -1
  7. package/dist/src/metadata/column-version.js +8 -9
  8. package/dist/src/metadata/column-version.js.map +1 -1
  9. package/dist/src/metadata/keys.d.ts +99 -39
  10. package/dist/src/metadata/keys.d.ts.map +1 -1
  11. package/dist/src/metadata/keys.js +213 -158
  12. package/dist/src/metadata/keys.js.map +1 -1
  13. package/dist/src/metadata/pk-identity.d.ts +19 -14
  14. package/dist/src/metadata/pk-identity.d.ts.map +1 -1
  15. package/dist/src/metadata/pk-identity.js +21 -28
  16. package/dist/src/metadata/pk-identity.js.map +1 -1
  17. package/dist/src/metadata/schema-migration.d.ts +33 -10
  18. package/dist/src/metadata/schema-migration.d.ts.map +1 -1
  19. package/dist/src/metadata/schema-migration.js +77 -18
  20. package/dist/src/metadata/schema-migration.js.map +1 -1
  21. package/dist/src/sync/change-applicator.d.ts +19 -3
  22. package/dist/src/sync/change-applicator.d.ts.map +1 -1
  23. package/dist/src/sync/change-applicator.js +253 -63
  24. package/dist/src/sync/change-applicator.js.map +1 -1
  25. package/dist/src/sync/maintenance.d.ts +8 -5
  26. package/dist/src/sync/maintenance.d.ts.map +1 -1
  27. package/dist/src/sync/maintenance.js +7 -4
  28. package/dist/src/sync/maintenance.js.map +1 -1
  29. package/dist/src/sync/manager.d.ts +46 -1
  30. package/dist/src/sync/manager.d.ts.map +1 -1
  31. package/dist/src/sync/protocol.d.ts +42 -3
  32. package/dist/src/sync/protocol.d.ts.map +1 -1
  33. package/dist/src/sync/protocol.js +40 -0
  34. package/dist/src/sync/protocol.js.map +1 -1
  35. package/dist/src/sync/snapshot-identity.d.ts.map +1 -1
  36. package/dist/src/sync/snapshot-identity.js +1 -9
  37. package/dist/src/sync/snapshot-identity.js.map +1 -1
  38. package/dist/src/sync/snapshot-stream.d.ts +11 -0
  39. package/dist/src/sync/snapshot-stream.d.ts.map +1 -1
  40. package/dist/src/sync/snapshot-stream.js +134 -67
  41. package/dist/src/sync/snapshot-stream.js.map +1 -1
  42. package/dist/src/sync/snapshot.d.ts.map +1 -1
  43. package/dist/src/sync/snapshot.js +15 -30
  44. package/dist/src/sync/snapshot.js.map +1 -1
  45. package/dist/src/sync/store-adapter.d.ts +5 -4
  46. package/dist/src/sync/store-adapter.d.ts.map +1 -1
  47. package/dist/src/sync/store-adapter.js +328 -108
  48. package/dist/src/sync/store-adapter.js.map +1 -1
  49. package/dist/src/sync/sync-manager-impl.d.ts +37 -4
  50. package/dist/src/sync/sync-manager-impl.d.ts.map +1 -1
  51. package/dist/src/sync/sync-manager-impl.js +110 -56
  52. package/dist/src/sync/sync-manager-impl.js.map +1 -1
  53. package/dist/src/sync/wire.d.ts +6 -0
  54. package/dist/src/sync/wire.d.ts.map +1 -1
  55. package/dist/src/sync/wire.js +3 -0
  56. package/dist/src/sync/wire.js.map +1 -1
  57. package/package.json +7 -7
@@ -17,10 +17,11 @@
17
17
  * receiver failing "already exists" on every sync (see
18
18
  * {@link decideSchemaChange}).
19
19
  * 2. Data changes are grouped per table, then per row; each row group
20
- * collapses to ONE `ExternalRowOp` — the group's NET effect in arrival
21
- * order (a delete resets the row to absent and later column updates
22
- * rebuild it from PK+nulls; updates with no later delete merge onto the
23
- * pre-read existing row — UPSERT semantics; see {@link buildRowOp}).
20
+ * collapses to ONE `ExternalRowOp` — the group's NET effect in list
21
+ * order, which the caller delivers HLC-ordered (a delete resets the row to
22
+ * absent and later column updates rebuild it from PK+nulls; updates with no
23
+ * later delete merge onto the pre-read existing row — UPSERT semantics; see
24
+ * {@link buildRowOp}).
24
25
  * 3. `StoreTable.applyExternalRowChanges(ops)` applies the table's ops to
25
26
  * committed storage and returns the EFFECTIVE changes (no-ops — absent
26
27
  * delete, value-identical upsert — are suppressed: no storage write, no
@@ -104,7 +105,7 @@
104
105
  * MV/capture state from the already-committed storage rows; recoverable via
105
106
  * MV refresh).
106
107
  */
107
- import { compareSqlValues, generateIndexDDL, generateTableDDL } from '@quereus/quereus';
108
+ import { compareSqlValues, expressionToString, generateIndexDDL, generateTableDDL, inferType, namedConstraintExists, Parser } from '@quereus/quereus';
108
109
  import { makePkIdentityEncoder } from '../metadata/pk-identity.js';
109
110
  import { toError } from './sync-context.js';
110
111
  /**
@@ -311,31 +312,6 @@ function normalizeDDL(ddl) {
311
312
  // trim again — collapsing first would leave the `;`-adjacent space behind.
312
313
  return ddl.replace(/;\s*$/, '').replace(/\s+/g, ' ').trim().toLowerCase();
313
314
  }
314
- /**
315
- * Locate the table owning `indexName` in `schemaName`, case-insensitively.
316
- *
317
- * There is no direct index accessor on the schema manager, so this mirrors the
318
- * owner scan `SchemaManager.dropIndex` performs.
319
- *
320
- * NOTE: first-match is unambiguous only because `SchemaManager.createIndex`
321
- * rejects an index name already taken by a user index elsewhere in the same
322
- * schema. A replicated `drop index "main"."idx"` carries no table name (the
323
- * DROP INDEX grammar has no slot for one), so without that invariant each
324
- * receiver would resolve the owner by its own table-registration order and two
325
- * devices could drop different indexes while both believing they converged.
326
- */
327
- function findIndexOwner(db, schemaName, indexName) {
328
- const schema = db.schemaManager.getSchema(schemaName);
329
- if (!schema)
330
- return undefined;
331
- const lowerIndexName = indexName.toLowerCase();
332
- for (const table of schema.getAllTables()) {
333
- const index = table.indexes?.find(idx => idx.name.toLowerCase() === lowerIndexName);
334
- if (index)
335
- return { table, index };
336
- }
337
- return undefined;
338
- }
339
315
  /**
340
316
  * The object named by the migration already exists locally: converge silently if
341
317
  * its definition matches the replicated one, otherwise throw a conflict naming
@@ -398,62 +374,309 @@ function decideSchemaChange(db, change) {
398
374
  }
399
375
  case 'drop_table':
400
376
  return db.schemaManager.getTable(change.schema, change.table) ? 'execute' : 'already-applied';
377
+ case 'rename_table':
378
+ return decideRenameTable(db, change);
401
379
  case 'add_index': {
402
380
  // For an index migration `change.table` holds the INDEX name, not the
403
381
  // table name (see `mapSchemaMigrationType` / `recordSchemaMigration`).
404
- const owner = findIndexOwner(db, change.schema, change.table);
382
+ // `findIndexOwner` is the engine's own by-name owner resolver — the same one
383
+ // `DROP INDEX` uses, at the same default scope — so the receiver's verdict
384
+ // here can never disagree with what the replicated DDL would then resolve to.
385
+ const owner = db.schemaManager.findIndexOwner(change.schema, change.table);
405
386
  if (!owner)
406
387
  return 'execute';
407
388
  assertDefinitionMatches(change, generateIndexDDL(owner.index, owner.table));
408
389
  return 'already-applied';
409
390
  }
410
391
  case 'drop_index':
411
- return findIndexOwner(db, change.schema, change.table) ? 'execute' : 'already-applied';
392
+ // No owner in the default scope ⇒ nothing a `DROP INDEX` could remove, so
393
+ // converge silently rather than exec a statement that would throw
394
+ // `no such index` and abort the admission unit.
395
+ return db.schemaManager.findIndexOwner(change.schema, change.table) ? 'execute' : 'already-applied';
396
+ case 'alter_column':
397
+ // A table alteration (the coarse "table definition changed" migration the
398
+ // origin records for every ALTER TABLE form). Parse the statement and decide
399
+ // per alteration arm whether the local table is already in the wanted state.
400
+ return decideAlterTable(db, change);
412
401
  default:
413
- // Column-level migrations (add_column / drop_column / alter_column) carry
414
- // no object-lifecycle state to compare; run them as before.
402
+ // add_column / drop_column are legacy wire types no current origin records
403
+ // (mapSchemaMigrationType folds every table alter into alter_column); run
404
+ // them as before.
415
405
  return 'execute';
416
406
  }
417
407
  }
418
408
  /**
419
- * The module schema-event signature the migration's DDL will produce — the exact
420
- * inverse of `mapSchemaMigrationType` (sync-manager-impl.ts), which is what
421
- * recorded the migration on the origin in the first place.
409
+ * Idempotency / conflict decision for a replicated `rename_table` migration,
410
+ * read from the local catalog for BOTH names:
411
+ *
412
+ * | old present | new present | verdict |
413
+ * |---|---|---|
414
+ * | yes | no | execute |
415
+ * | no | yes | already-applied — the rename already happened here |
416
+ * | yes | yes | THROW a conflict naming both tables (see below) |
417
+ * | no | no | converge with a warning — nothing to rename (drop won) |
422
418
  *
423
- * Keeping the two inverse is load-bearing: the signature is what pre-marks the
424
- * emitted event remote, and a signature that never matches means the receiver
425
- * records the replicated DDL as its OWN local migration and broadcasts it back
426
- * out. Deriving it from the migration type by string-shape (`startsWith('drop')`,
427
- * `includes('table')`) does not survive the `add_index` / `*_column` names, so
428
- * map explicitly.
419
+ * A missing `fromTable` (a peer that omitted it) makes the migration
420
+ * undecidable: converge with a warning rather than exec a statement whose
421
+ * outcome we cannot predict.
422
+ *
423
+ * The yes/yes row throws rather than picking a side: renaming would collide
424
+ * with a table that already exists, and silently keeping either shape would
425
+ * record "converged" for a divergence that is not — the same posture as a
426
+ * divergent `create_table` (see {@link assertDefinitionMatches}'s NOTE).
427
+ *
428
+ * NOTE: sync's per-row bookkeeping (`cv:`/`tb:`/`cl:`) is keyed by table name,
429
+ * so both origin and receiver strand it at the old name and start empty at the
430
+ * new one — later conflict resolution and tombstone blocking lose their history
431
+ * for the renamed table (an old delete no longer blocks a replayed insert).
432
+ * Pre-existing for a purely local rename; replicating the rename makes it
433
+ * happen on every peer. Tracked as
434
+ * `bug-sync-rename-and-pk-change-strand-crdt-metadata` (tickets/backlog).
429
435
  */
430
- function schemaEventSignature(type) {
431
- switch (type) {
432
- case 'create_table': return { type: 'create', objectType: 'table' };
433
- case 'drop_table': return { type: 'drop', objectType: 'table' };
434
- case 'add_index': return { type: 'create', objectType: 'index' };
435
- case 'drop_index': return { type: 'drop', objectType: 'index' };
436
- // Column-level migrations replay as an ALTER of the owning table — matching
437
- // the `'table' alter → alter_column` direction of mapSchemaMigrationType.
438
- case 'add_column':
439
- case 'drop_column':
440
- case 'alter_column':
441
- return { type: 'alter', objectType: 'table' };
436
+ function decideRenameTable(db, change) {
437
+ if (change.fromTable === undefined) {
438
+ console.warn(`[Sync] Remote ${change.type} for ${change.schema}.${change.table} carries no old table name — `
439
+ + `undecidable; converging without applying: ${change.ddl}`);
440
+ return 'already-applied';
441
+ }
442
+ const oldPresent = db.schemaManager.getTable(change.schema, change.fromTable) !== undefined;
443
+ const newPresent = db.schemaManager.getTable(change.schema, change.table) !== undefined;
444
+ if (oldPresent && newPresent) {
445
+ throw new Error(`Schema conflict applying remote ${change.type} for ${change.schema}.${change.fromTable}: ` +
446
+ `renaming to ${change.schema}.${change.table} would collide with a table that already exists locally.\n` +
447
+ ` remote: ${change.ddl}`);
448
+ }
449
+ if (oldPresent)
450
+ return 'execute';
451
+ if (newPresent)
452
+ return 'already-applied';
453
+ console.warn(`[Sync] Remote ${change.type} for ${change.schema}.${change.table}: neither `
454
+ + `'${change.fromTable}' nor '${change.table}' exists locally — converging without applying: ${change.ddl}`);
455
+ return 'already-applied';
456
+ }
457
+ /**
458
+ * Idempotency decision for a replicated `alter_column` migration. The migration
459
+ * carries only the statement text, so parse it with the engine's own parser and
460
+ * compare the parsed alteration against the local {@link TableSchema}.
461
+ *
462
+ * Two peers offline can each run `alter table orders add column sku text`;
463
+ * whichever migration wins the HLC comparison is then delivered to a peer that
464
+ * already has `sku`. Re-executing the raw DDL there throws, aborting the whole
465
+ * admission unit before its CRDT metadata commits — the same permanent re-fail
466
+ * loop `create_table` idempotency exists to prevent.
467
+ */
468
+ function decideAlterTable(db, change) {
469
+ let stmt;
470
+ try {
471
+ const parsed = new Parser().parse(change.ddl);
472
+ if (parsed.type !== 'alterTable')
473
+ return 'execute';
474
+ stmt = parsed;
475
+ }
476
+ catch (e) {
477
+ // A parse failure must not be swallowed into a skip: execute the DDL so the
478
+ // underlying engine error is what the operator sees, not a parser message.
479
+ console.error(`[Sync] Could not parse replicated ${change.type} DDL for ${change.schema}.${change.table} — executing as-is:`, e);
480
+ return 'execute';
481
+ }
482
+ // NOTE: the decision reads the migration's `(schema, table)` envelope, never
483
+ // `stmt.table` — the origin filed the envelope from the same event that carried
484
+ // this text, so the two agree for anything the pipeline produces. A hand-crafted
485
+ // migration whose DDL names a different table would be decided against the wrong
486
+ // local table; if migrations ever arrive from outside the capture path, compare
487
+ // the two here first.
488
+ const action = stmt.action;
489
+ // The tag/maintained arms have no idempotency arm — execute as before. A
490
+ // renameTable action under `alter_column` can only come from a peer on an older
491
+ // build (a current origin records it as `rename_table`, decided by
492
+ // decideRenameTable above); execute it as those builds always did.
493
+ if (action.type === 'renameTable' || action.type === 'setTags' || action.type === 'dropTags'
494
+ || action.type === 'setMaintained' || action.type === 'dropMaintained') {
495
+ return 'execute';
496
+ }
497
+ const local = db.schemaManager.getTable(change.schema, change.table);
498
+ if (!local) {
499
+ // Nothing to alter: the receiver dropped the table (drop is the more
500
+ // destructive migration and wins). Converge with a warning rather than exec a
501
+ // statement that would throw `no such table` and abort the admission unit —
502
+ // consistent with drop_index's absent-owner arm.
503
+ console.warn(`[Sync] Remote ${change.type} for ${change.schema}.${change.table} names a table this peer does not have — `
504
+ + `converging without applying: ${change.ddl}`);
505
+ return 'already-applied';
506
+ }
507
+ switch (action.type) {
508
+ case 'addColumn':
509
+ return decideAddColumn(local, action.column, change);
510
+ case 'dropColumn':
511
+ return localColumn(local, action.name) ? 'execute' : 'already-applied';
512
+ case 'renameColumn': {
513
+ // Old name still present ⇒ the rename has not happened here (if the new name
514
+ // ALSO exists the exec surfaces the engine's own duplicate-name error — a
515
+ // genuine divergence, not one to paper over).
516
+ if (localColumn(local, action.oldName))
517
+ return 'execute';
518
+ if (localColumn(local, action.newName))
519
+ return 'already-applied';
520
+ console.warn(`[Sync] Remote ${change.type} for ${change.schema}.${change.table}: neither column `
521
+ + `'${action.oldName}' nor '${action.newName}' exists locally — converging without applying`);
522
+ return 'already-applied';
523
+ }
524
+ case 'addConstraint': {
525
+ const constraint = action.constraint;
526
+ // Named: presence of the name is the whole check — see the NOTE on
527
+ // decideAddColumn for why no definition comparison is attempted.
528
+ if (constraint.name) {
529
+ return namedConstraintExists(local, constraint.name) ? 'already-applied' : 'execute';
530
+ }
531
+ // Unnamed UNIQUE: an equivalent UNIQUE over the same column set converges.
532
+ if (constraint.type === 'unique' && constraint.columns) {
533
+ return equivalentUniqueExists(local, constraint.columns.map(c => c.name)) ? 'already-applied' : 'execute';
534
+ }
535
+ // Unnamed CHECK (or other forms): no identity to compare against — execute.
536
+ // NOTE: two peers that concurrently add the SAME unnamed CHECK therefore end
537
+ // up enforcing it twice (the engine auto-names each install separately), which
538
+ // is semantically harmless — same predicate, evaluated twice. If the duplicate
539
+ // ever matters (per-row cost, or a confusing `table_info`), the identity to
540
+ // compare on is the rendered predicate expression, not the constraint name.
541
+ return 'execute';
542
+ }
543
+ case 'dropConstraint':
544
+ return namedConstraintExists(local, action.name) ? 'execute' : 'already-applied';
545
+ case 'renameConstraint': {
546
+ if (namedConstraintExists(local, action.oldName))
547
+ return 'execute';
548
+ if (namedConstraintExists(local, action.newName))
549
+ return 'already-applied';
550
+ console.warn(`[Sync] Remote ${change.type} for ${change.schema}.${change.table}: neither constraint `
551
+ + `'${action.oldName}' nor '${action.newName}' exists locally — converging without applying`);
552
+ return 'already-applied';
553
+ }
554
+ case 'alterColumn': {
555
+ const col = localColumn(local, action.columnName);
556
+ if (!col) {
557
+ // Most-destructive-wins (docs/sync-schema.md § Conflict Resolution): a
558
+ // concurrent local DROP COLUMN beats the alteration, so converge.
559
+ console.warn(`[Sync] Remote ${change.type} for ${change.schema}.${change.table}: column `
560
+ + `'${action.columnName}' does not exist locally — converging without applying: ${change.ddl}`);
561
+ return 'already-applied';
562
+ }
563
+ if (action.setDataType !== undefined) {
564
+ return inferType(action.setDataType).name === col.logicalType.name ? 'already-applied' : 'execute';
565
+ }
566
+ if (action.setNotNull !== undefined) {
567
+ // A `set not null` executes against the rows this peer currently holds, and
568
+ // schema changes are applied ahead of the same batch's data facts — so the
569
+ // very batch that fills the NULLs fails its own DDL and only succeeds on the
570
+ // next sync round. Whole class (tightening DDL vs. the data that satisfies
571
+ // it); tracked as `bug-sync-tightening-ddl-applied-before-its-data`.
572
+ return col.notNull === action.setNotNull ? 'already-applied' : 'execute';
573
+ }
574
+ if (action.setDefault !== undefined) {
575
+ if (action.setDefault === null) {
576
+ return col.defaultValue === null ? 'already-applied' : 'execute';
577
+ }
578
+ return col.defaultValue !== null
579
+ && expressionToString(col.defaultValue) === expressionToString(action.setDefault)
580
+ ? 'already-applied' : 'execute';
581
+ }
582
+ if (action.setCollation !== undefined) {
583
+ return col.collation.toLowerCase() === action.setCollation.toLowerCase() ? 'already-applied' : 'execute';
584
+ }
585
+ return 'execute';
586
+ }
587
+ case 'alterPrimaryKey': {
588
+ // NOTE: replicating a PK change re-keys the table on EVERY peer, and sync's
589
+ // cv:/tb:/cl: metadata is filed under the row's old pk identity — so conflict
590
+ // resolution for existing rows silently restarts from empty. Pre-existing for
591
+ // a local PK change; tracked as
592
+ // `bug-sync-rename-and-pk-change-strand-crdt-metadata` (tickets/backlog).
593
+ const wanted = action.columns;
594
+ const current = local.primaryKeyDefinition;
595
+ const same = wanted.length === current.length && wanted.every((w, i) => {
596
+ const def = current[i];
597
+ const col = local.columns[def.index];
598
+ return col.name.toLowerCase() === w.name.toLowerCase()
599
+ && (def.desc === true) === (w.direction === 'desc');
600
+ });
601
+ return same ? 'already-applied' : 'execute';
602
+ }
603
+ default:
604
+ return 'execute';
442
605
  }
443
606
  }
607
+ /** Position of the local column named `name`, or undefined. */
608
+ function localColumnIndex(table, name) {
609
+ return table.columnIndexMap.get(name.toLowerCase());
610
+ }
611
+ /** The local column named `name`, or undefined. */
612
+ function localColumn(table, name) {
613
+ const idx = localColumnIndex(table, name);
614
+ return idx === undefined ? undefined : table.columns[idx];
615
+ }
616
+ /**
617
+ * ADD COLUMN idempotency: absent ⇒ execute; present with the same LOGICAL TYPE ⇒
618
+ * converged; present with a different type ⇒ conflict.
619
+ *
620
+ * NOTE: only the logical type is compared, deliberately. A type difference is the
621
+ * dangerous divergence — two peers would interpret the same rows under different
622
+ * shapes, exactly what the create_table arm refuses to paper over. Anything
623
+ * richer would compare an AST column definition (rendered from the origin's
624
+ * statement) against a ColumnSchema (rendered from the receiver's catalog), and
625
+ * those do not round-trip: an unnamed inline CHECK is auto-named `_check_<col>`
626
+ * on the way into the catalog, session `default_column_nullability` decides
627
+ * whether `not null` is even spelled, and so on. A false conflict permanently
628
+ * blocks the peer — strictly worse than converging on a constraint-level
629
+ * difference. So constraint-level drift between two same-named, same-typed
630
+ * columns converges silently; if that ever bites, the fix is to compare parsed
631
+ * schemas, not rendered text.
632
+ */
633
+ function decideAddColumn(local, column, change) {
634
+ const existing = localColumn(local, column.name);
635
+ if (!existing)
636
+ return 'execute';
637
+ const wanted = inferType(column.dataType);
638
+ if (wanted.name === existing.logicalType.name)
639
+ return 'already-applied';
640
+ throw new Error(`Schema conflict applying remote ${change.type} for ${change.schema}.${change.table}: ` +
641
+ `column '${column.name}' already exists with type ${existing.logicalType.name}, ` +
642
+ `but the remote alteration adds it as ${wanted.name}.\n` +
643
+ ` remote: ${change.ddl}`);
644
+ }
645
+ /**
646
+ * True when the table already has a UNIQUE constraint over exactly this column
647
+ * set (order-insensitive — `unique (a, b)` and `unique (b, a)` enforce the same
648
+ * predicate). A column name the local table lacks ⇒ false, and the exec surfaces
649
+ * the engine's own error.
650
+ *
651
+ * PARTIAL constraints do not count. A table-level `unique (a)` is unconditional,
652
+ * while a `predicate`-carrying constraint (only ever synthesized from a
653
+ * `create unique index … where …`) enforces over a subset of the rows — treating
654
+ * it as equivalent would converge the peer onto WEAKER enforcement than the
655
+ * alteration asked for, and duplicate-but-outside-the-predicate rows would then
656
+ * replicate here and be rejected on the origin.
657
+ */
658
+ function equivalentUniqueExists(table, columnNames) {
659
+ const wanted = [];
660
+ for (const name of columnNames) {
661
+ const idx = localColumnIndex(table, name);
662
+ if (idx === undefined)
663
+ return false;
664
+ wanted.push(idx);
665
+ }
666
+ const wantedKey = sortedIndexKey(wanted);
667
+ return (table.uniqueConstraints ?? []).some(uc => uc.predicate === undefined && sortedIndexKey(uc.columns) === wantedKey);
668
+ }
669
+ /** Order-insensitive identity of a column-index set. */
670
+ function sortedIndexKey(columns) {
671
+ return [...columns].sort((a, b) => a - b).join(',');
672
+ }
444
673
  /**
445
674
  * Apply one schema change (DDL) to the database, idempotently.
446
675
  */
447
676
  async function applySchemaChange(db, events, change, _options) {
448
- // A blank `ddl` still reaches here: the four object-lifecycle migrations
449
- // (create/drop table, add/drop index) now carry canonical text, but the
450
- // `*_column` migrations do not, and a peer on an older build still sends blank
451
- // drop/index migrations. Such a migration runs nothing, so it also EMITS
452
- // nothing — registering a remote-event expectation for it would leave that
453
- // expectation pending forever (the emitter refcounts expectations and never
454
- // expires them), and the next genuine LOCAL DDL of the same signature would be
455
- // consumed by it, marked remote, and dropped from the SyncManager's local-fact
456
- // capture — silently never replicated.
677
+ // A blank `ddl` can still reach here from a peer on an older build (blank
678
+ // drop/index/alter migrations). Such a migration runs nothing; skip it before
679
+ // deciding anything (an empty string is not a parseable statement).
457
680
  if (change.ddl.trim() === '') {
458
681
  // Deliberately NOT scoped to `alter_column`, unlike the origin-side warning in
459
682
  // `recordSchemaMigration` (sync-manager-impl.ts): a peer on an older build can
@@ -468,60 +691,51 @@ async function applySchemaChange(db, events, change, _options) {
468
691
  + `not applied; this peer's schema is unchanged`);
469
692
  return;
470
693
  }
471
- // Decide BEFORE registering the remote-event expectation, for the same reason:
472
- // an expectation for DDL that is then not executed would linger and mis-mark a
473
- // later genuine LOCAL DDL of the same signature as remote.
474
694
  if (decideSchemaChange(db, change) === 'already-applied') {
475
695
  console.debug(`[Sync] Remote ${change.type} for ${change.schema}.${change.table} already applied locally — converging without re-executing DDL`);
476
696
  return;
477
697
  }
478
- const { type: eventType, objectType } = schemaEventSignature(change.type);
479
- // Register this as an expected remote event BEFORE executing DDL.
480
- // When the module emits the event, it will be automatically marked as
481
- // remote, so SyncManager won't re-record it.
482
- // This approach avoids race conditions with concurrent local DDL.
483
- events.expectRemoteSchemaEvent({
484
- type: eventType,
485
- objectType,
486
- schemaName: change.schema,
487
- objectName: change.table,
488
- });
698
+ // Mark every schema event the replicated DDL emits as remote, so the
699
+ // SyncManager doesn't re-record it as a local change and broadcast it back
700
+ // out. The scope covers zero, one, or several events, and the `finally`
701
+ // releases it whether the exec succeeds or throws — so a statement that emits
702
+ // nothing leaves no residue to swallow the next genuine local DDL. (See
703
+ // `StoreEventEmitter.beginRemoteSchemaScope` for the concurrency tradeoff.)
704
+ //
705
+ // A rename_table scopes BOTH names: the store module's renameTable announces
706
+ // under the NEW name (`change.table`), but scoping the old one too costs
707
+ // nothing and protects against a module that announces under the pre-rename
708
+ // name.
709
+ const scopeNames = change.type === 'rename_table' && change.fromTable !== undefined
710
+ ? [change.table, change.fromTable]
711
+ : [change.table];
712
+ for (const name of scopeNames)
713
+ events.beginRemoteSchemaScope(change.schema, name);
489
714
  try {
490
- // Execute the DDL statement
491
- // The module will emit a schema event, which will be marked as remote
492
715
  await db.exec(change.ddl);
493
716
  }
494
- catch (e) {
495
- // Clear the expectation if DDL failed
496
- events.clearExpectedRemoteSchemaEvent({
497
- type: eventType,
498
- objectType,
499
- schemaName: change.schema,
500
- objectName: change.table,
501
- });
502
- throw e;
717
+ finally {
718
+ for (const name of scopeNames)
719
+ events.endRemoteSchemaScope(change.schema, name);
503
720
  }
504
- // Note: We don't emit a separate event here anymore.
505
- // The module's event is automatically marked as remote.
506
721
  }
507
722
  /**
508
723
  * Collapse one row group's changes into a single ExternalRowOp — the group's NET
509
- * effect in arrival (batch) order. A delete resets the row to absent: column
510
- * updates BEFORE it are discarded (the delete already erased their effect) and
511
- * updates AFTER it rebuild the row from a PK+nulls base — the same state the
512
- * changes would leave applied one at a time (a re-creation after a same-batch
513
- * delete must not resurrect the pre-delete image of columns it does not set).
514
- * A group whose net effect is the delete collapses to a delete op; updates with
515
- * no later delete merge onto the pre-read existing row (UPSERT semantics).
724
+ * effect in list order. A delete resets the row to absent: column updates BEFORE
725
+ * it are discarded (the delete already erased their effect) and updates AFTER it
726
+ * rebuild the row from a PK+nulls base — the same state the changes would leave
727
+ * applied one at a time (a re-creation after a same-batch delete must not
728
+ * resurrect the pre-delete image of columns it does not set). A group whose net
729
+ * effect is the delete collapses to a delete op; updates with no later delete
730
+ * merge onto the pre-read existing row (UPSERT semantics).
516
731
  *
517
- * NOTE: "net effect in order" assumes the batch arrives in HLC order, which
518
- * `getChangesSince` guarantees (`DataChangeToApply` carries no HLC to re-sort
519
- * by). The change-applicator's in-batch delete reconciliation decides the SAME
520
- * question by HLC instead, so on a batch whose changesets were reordered the two
521
- * disagree: under `allowResurrection` a resurrected row keeps its cell records
522
- * and change-log entries while this collapse deletes it from the table, leaving
523
- * the replica relaying a row it does not have. Tracked as
524
- * `bug-sync-apply-order-splits-data-from-metadata`.
732
+ * "Net effect in order" is only correct on an HLC-ORDERED list, and
733
+ * `DataChangeToApply` carries no HLC for this function to re-sort by. The CALLER
734
+ * establishes that order: `change-applicator.ts`'s `orderDataChangesByHLC` sorts the
735
+ * reconciled batch by HLC — in the one place that still holds the HLCs — before
736
+ * handing it to `applyToStore`, so this collapse decides the same question by the
737
+ * same rule as resolution and the in-batch delete reconciliation, whatever order the
738
+ * batch arrived in. Anything else driving this callback owes it the same ordering.
525
739
  */
526
740
  async function buildRowOp(table, changes) {
527
741
  const { pk } = changes[0];
@@ -572,8 +786,14 @@ async function mergeColumnUpdates(table, pk, changes, rowDeletedInGroup = false)
572
786
  columnsApplied++;
573
787
  }
574
788
  else {
575
- // Column name not found in schema - this could be a sync bug
576
- console.warn(`[Sync] Column '${colName}' not found in ${tableSchema.schemaName}.${tableSchema.name}. ` +
789
+ // Now that DROP COLUMN and RENAME COLUMN replicate, the ordinary cause is a
790
+ // change-log fact recorded before the alteration reached this peer — the value
791
+ // is correctly discarded. A name that is neither dropped nor renamed still
792
+ // indicates a genuine source/destination mismatch, so this stays a warning.
793
+ // NOTE: one line per unknown column per change. If a wide table's drop ever
794
+ // makes this drown the log, aggregate per (table, column) instead of demoting.
795
+ console.warn(`[Sync] Column '${colName}' not found in ${tableSchema.schemaName}.${tableSchema.name} — ` +
796
+ `discarding its value (expected if a replicated ALTER TABLE dropped or renamed it). ` +
577
797
  `Available columns: ${[...tableSchema.columnIndexMap.keys()].join(', ')}`);
578
798
  }
579
799
  }
@@ -1 +1 @@
1
- {"version":3,"file":"store-adapter.js","sourceRoot":"","sources":["../../../src/sync/store-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAExF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAQnE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AA6B5C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgC;IACjE,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,sBAAsB,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAE5E,OAAO,KAAK,EACV,WAAgC,EAChC,aAAoC,EACpC,YAAiC,EACJ,EAAE;QAC/B,4EAA4E;QAC5E,uEAAuE;QACvE,IAAI,YAAY,CAAC,iBAAiB,EAAE,CAAC;YACnC,OAAO,iBAAiB,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;QAC7C,CAAC;QAED,MAAM,MAAM,GAAuB;YACjC,kBAAkB,EAAE,CAAC;YACrB,oBAAoB,EAAE,CAAC;YACvB,MAAM,EAAE,EAAE;SACX,CAAC;QAEF,8CAA8C;QAC9C,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE,CAAC;YACzC,IAAI,CAAC;gBACH,MAAM,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;gBAChE,MAAM,CAAC,oBAAoB,EAAE,CAAC;YAChC,C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