@quereus/store 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.
- package/README.md +34 -6
- package/dist/src/common/encoding.d.ts +4 -3
- package/dist/src/common/encoding.d.ts.map +1 -1
- package/dist/src/common/encoding.js +17 -13
- package/dist/src/common/encoding.js.map +1 -1
- package/dist/src/common/events.d.ts +31 -25
- package/dist/src/common/events.d.ts.map +1 -1
- package/dist/src/common/events.js +38 -39
- package/dist/src/common/events.js.map +1 -1
- package/dist/src/common/implicit-unique-index.d.ts +80 -0
- package/dist/src/common/implicit-unique-index.d.ts.map +1 -0
- package/dist/src/common/implicit-unique-index.js +148 -0
- package/dist/src/common/implicit-unique-index.js.map +1 -0
- package/dist/src/common/index.d.ts +7 -3
- package/dist/src/common/index.d.ts.map +1 -1
- package/dist/src/common/index.js +5 -2
- package/dist/src/common/index.js.map +1 -1
- package/dist/src/common/json-key.d.ts +30 -2
- package/dist/src/common/json-key.d.ts.map +1 -1
- package/dist/src/common/json-key.js +49 -2
- package/dist/src/common/json-key.js.map +1 -1
- package/dist/src/common/key-builder.d.ts +40 -20
- package/dist/src/common/key-builder.d.ts.map +1 -1
- package/dist/src/common/key-builder.js +31 -23
- package/dist/src/common/key-builder.js.map +1 -1
- package/dist/src/common/kv-store.d.ts +10 -0
- package/dist/src/common/kv-store.d.ts.map +1 -1
- package/dist/src/common/pk-key-resolution.d.ts +348 -0
- package/dist/src/common/pk-key-resolution.d.ts.map +1 -0
- package/dist/src/common/pk-key-resolution.js +481 -0
- package/dist/src/common/pk-key-resolution.js.map +1 -0
- package/dist/src/common/store-module-access-plan.d.ts +32 -0
- package/dist/src/common/store-module-access-plan.d.ts.map +1 -0
- package/dist/src/common/store-module-access-plan.js +428 -0
- package/dist/src/common/store-module-access-plan.js.map +1 -0
- package/dist/src/common/store-module-alter-column.d.ts +23 -0
- package/dist/src/common/store-module-alter-column.d.ts.map +1 -0
- package/dist/src/common/store-module-alter-column.js +389 -0
- package/dist/src/common/store-module-alter-column.js.map +1 -0
- package/dist/src/common/store-module-alter.d.ts +55 -0
- package/dist/src/common/store-module-alter.d.ts.map +1 -0
- package/dist/src/common/store-module-alter.js +504 -0
- package/dist/src/common/store-module-alter.js.map +1 -0
- package/dist/src/common/store-module-base.d.ts +268 -0
- package/dist/src/common/store-module-base.d.ts.map +1 -0
- package/dist/src/common/store-module-base.js +362 -0
- package/dist/src/common/store-module-base.js.map +1 -0
- package/dist/src/common/store-module-catalog.d.ts +269 -0
- package/dist/src/common/store-module-catalog.d.ts.map +1 -0
- package/dist/src/common/store-module-catalog.js +462 -0
- package/dist/src/common/store-module-catalog.js.map +1 -0
- package/dist/src/common/store-module-index-build.d.ts +88 -0
- package/dist/src/common/store-module-index-build.d.ts.map +1 -0
- package/dist/src/common/store-module-index-build.js +280 -0
- package/dist/src/common/store-module-index-build.js.map +1 -0
- package/dist/src/common/store-module-index.d.ts +116 -0
- package/dist/src/common/store-module-index.d.ts.map +1 -0
- package/dist/src/common/store-module-index.js +373 -0
- package/dist/src/common/store-module-index.js.map +1 -0
- package/dist/src/common/store-module-rename.d.ts +49 -0
- package/dist/src/common/store-module-rename.d.ts.map +1 -0
- package/dist/src/common/store-module-rename.js +268 -0
- package/dist/src/common/store-module-rename.js.map +1 -0
- package/dist/src/common/store-module-schema-rewrite.d.ts +57 -0
- package/dist/src/common/store-module-schema-rewrite.d.ts.map +1 -0
- package/dist/src/common/store-module-schema-rewrite.js +140 -0
- package/dist/src/common/store-module-schema-rewrite.js.map +1 -0
- package/dist/src/common/store-module-schema-sync.d.ts +232 -0
- package/dist/src/common/store-module-schema-sync.d.ts.map +1 -0
- package/dist/src/common/store-module-schema-sync.js +529 -0
- package/dist/src/common/store-module-schema-sync.js.map +1 -0
- package/dist/src/common/store-module.d.ts +43 -909
- package/dist/src/common/store-module.d.ts.map +1 -1
- package/dist/src/common/store-module.js +184 -3276
- package/dist/src/common/store-module.js.map +1 -1
- package/dist/src/common/store-table-base.d.ts +539 -0
- package/dist/src/common/store-table-base.d.ts.map +1 -0
- package/dist/src/common/store-table-base.js +900 -0
- package/dist/src/common/store-table-base.js.map +1 -0
- package/dist/src/common/store-table-constraints.d.ts +237 -0
- package/dist/src/common/store-table-constraints.d.ts.map +1 -0
- package/dist/src/common/store-table-constraints.js +624 -0
- package/dist/src/common/store-table-constraints.js.map +1 -0
- package/dist/src/common/store-table-scan.d.ts +452 -0
- package/dist/src/common/store-table-scan.d.ts.map +1 -0
- package/dist/src/common/store-table-scan.js +901 -0
- package/dist/src/common/store-table-scan.js.map +1 -0
- package/dist/src/common/store-table.d.ts +71 -1144
- package/dist/src/common/store-table.d.ts.map +1 -1
- package/dist/src/common/store-table.js +168 -2385
- package/dist/src/common/store-table.js.map +1 -1
- package/dist/src/testing/index.d.ts +12 -0
- package/dist/src/testing/index.d.ts.map +1 -0
- package/dist/src/testing/index.js +12 -0
- package/dist/src/testing/index.js.map +1 -0
- package/dist/src/testing/kv-assert.d.ts +19 -0
- package/dist/src/testing/kv-assert.d.ts.map +1 -0
- package/dist/src/testing/kv-assert.js +25 -0
- package/dist/src/testing/kv-assert.js.map +1 -0
- package/dist/src/testing/kv-conformance.d.ts.map +1 -1
- package/dist/src/testing/kv-conformance.js +1 -15
- package/dist/src/testing/kv-conformance.js.map +1 -1
- package/dist/src/testing/kv-provider-conformance.d.ts +54 -0
- package/dist/src/testing/kv-provider-conformance.d.ts.map +1 -0
- package/dist/src/testing/kv-provider-conformance.js +183 -0
- package/dist/src/testing/kv-provider-conformance.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ALTER TABLE dispatch and every arm except ALTER COLUMN: add / drop / rename a column,
|
|
3
|
+
* change the primary key, and add / drop / rename a table constraint. Each arm returns
|
|
4
|
+
* the rewritten table schema; the dispatcher owns what is common to all of them
|
|
5
|
+
* (resolving the table, reconciling the implicit UNIQUE index stores afterwards).
|
|
6
|
+
*
|
|
7
|
+
* Sixth layer of the store-module chain:
|
|
8
|
+
* StoreModuleBase -> StoreModuleCatalog -> StoreModuleSchemaSync -> StoreModuleIndex
|
|
9
|
+
* -> StoreModuleAlterColumn -> StoreModuleAlter -> StoreModuleRename -> StoreModule
|
|
10
|
+
*/
|
|
11
|
+
import { QuereusError, StatusCode, buildCheckConstraintSchema, buildColumnIndexMap, buildForeignKeyConstraintSchema, buildUniqueConstraintSchema, columnDefToSchema, foldDefaultToType, rekeySchemaPrimaryKey, renameColumnInCheckConstraints, renameColumnInColumnExpressions, renameColumnInIndexPredicates, resolveNamedConstraintClass, shiftSchemaIndicesForDrop, validateForeignKeyOverExistingRows, } from '@quereus/quereus';
|
|
12
|
+
import { withImplicitUniqueIndexes } from './implicit-unique-index.js';
|
|
13
|
+
import { StoreModuleAlterColumn } from './store-module-alter-column.js';
|
|
14
|
+
import { effectiveDdlRows, validateUniqueOverExistingRows } from './store-module-index-build.js';
|
|
15
|
+
import { buildColumnRemap, renameColumnInSelfForeignKeys } from './store-module-schema-rewrite.js';
|
|
16
|
+
export class StoreModuleAlter extends StoreModuleAlterColumn {
|
|
17
|
+
/**
|
|
18
|
+
* Alters an existing store table's structure. Resolves the table, captures the
|
|
19
|
+
* pre-alter schema, and dispatches to the per-change-type `alter*` helper below;
|
|
20
|
+
* the helper does the arm's work (row migration, physical re-key, constraint
|
|
21
|
+
* validation, DDL persist) and returns the updated TableSchema for the engine to
|
|
22
|
+
* register. The shared preamble (schema subscription, reconnect, not-found throw,
|
|
23
|
+
* `defaultNotNull`) lives here so every arm sees the same resolved state.
|
|
24
|
+
*/
|
|
25
|
+
async alterTable(db, schemaName, tableName, change, rows) {
|
|
26
|
+
this.ensureSchemaSubscription(db);
|
|
27
|
+
const table = this.getOrReconnectTable(db, schemaName, tableName);
|
|
28
|
+
if (!table) {
|
|
29
|
+
throw new QuereusError(`Store table '${tableName}' not found in schema '${schemaName}'. Cannot alter.`, StatusCode.ERROR);
|
|
30
|
+
}
|
|
31
|
+
// The engine-facing schema carries no `_uc_*` (the store keeps the materialized
|
|
32
|
+
// enforcement copy internal), so the arms build `updatedSchema` off a clean schema
|
|
33
|
+
// exactly as before this feature; `table.updateSchema` recomputes the enforcement
|
|
34
|
+
// copy, and `StoreModuleIndex.reconcileImplicitUniqueIndexStores` moves the physical
|
|
35
|
+
// stores for any constraint-set change.
|
|
36
|
+
const oldSchema = table.getSchema();
|
|
37
|
+
const defaultNotNull = db.options.getStringOption('default_column_nullability') === 'not_null';
|
|
38
|
+
let updated;
|
|
39
|
+
switch (change.type) {
|
|
40
|
+
case 'addColumn':
|
|
41
|
+
updated = await this.alterAddColumn(db, schemaName, tableName, table, oldSchema, change, defaultNotNull);
|
|
42
|
+
break;
|
|
43
|
+
case 'dropColumn':
|
|
44
|
+
updated = await this.alterDropColumn(db, schemaName, tableName, table, oldSchema, change);
|
|
45
|
+
break;
|
|
46
|
+
case 'renameColumn':
|
|
47
|
+
updated = await this.alterRenameColumn(db, schemaName, tableName, table, oldSchema, change, defaultNotNull);
|
|
48
|
+
break;
|
|
49
|
+
case 'alterPrimaryKey':
|
|
50
|
+
updated = await this.alterPrimaryKeyChange(db, schemaName, tableName, table, oldSchema, change);
|
|
51
|
+
break;
|
|
52
|
+
case 'addConstraint':
|
|
53
|
+
updated = await this.alterAddConstraint(db, table, oldSchema, change, rows);
|
|
54
|
+
break;
|
|
55
|
+
case 'dropConstraint':
|
|
56
|
+
updated = await this.alterDropConstraint(table, oldSchema, change);
|
|
57
|
+
break;
|
|
58
|
+
case 'renameConstraint':
|
|
59
|
+
updated = await this.alterRenameConstraint(table, oldSchema, change);
|
|
60
|
+
break;
|
|
61
|
+
case 'alterColumn':
|
|
62
|
+
updated = await this.alterColumnChange(db, schemaName, tableName, table, oldSchema, change, rows);
|
|
63
|
+
break;
|
|
64
|
+
default: {
|
|
65
|
+
const _exhaustive = change;
|
|
66
|
+
void _exhaustive;
|
|
67
|
+
throw new QuereusError(`Unhandled ALTER TABLE change type '${change.type}'`, StatusCode.INTERNAL);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Move the physical `_uc_*` index stores to match the post-ALTER constraint set:
|
|
71
|
+
// the SCHEMA entries were re-materialized by the arm's `table.updateSchema`, but a
|
|
72
|
+
// newly-added constraint's store must be BUILT and a dropped/renamed one's TORN
|
|
73
|
+
// DOWN. `oldSchema` carries the pre-ALTER `uniqueConstraints`; `table.getSchema()`
|
|
74
|
+
// the post-ALTER set. A no-op when the implicit-index name set is unchanged (the
|
|
75
|
+
// common case, incl. PK/collation/type ALTERs whose physical re-encode is already
|
|
76
|
+
// handled by `rebuildSecondaryIndexes`).
|
|
77
|
+
await this.reconcileImplicitUniqueIndexStores(db, schemaName, tableName, table, oldSchema);
|
|
78
|
+
// ONE event per statement, decided here — the single gate for every arm: emit iff
|
|
79
|
+
// the engine marked this call as the statement's own action (`change.ddl` set), and
|
|
80
|
+
// put that text on the event. Engine-internal sub-steps — the inline-constraint
|
|
81
|
+
// installs and revert calls of the engine's ADD COLUMN, the materialized-view
|
|
82
|
+
// backing reshapes — arrive with no `ddl` and announce nothing, which is what keeps
|
|
83
|
+
// `add column x text unique` (one addColumn call + one addConstraint call) at
|
|
84
|
+
// exactly one announced event. See `SchemaChangeInfo.ddl`.
|
|
85
|
+
if (change.ddl !== undefined) {
|
|
86
|
+
this.eventEmitter?.emitSchemaChange({
|
|
87
|
+
type: 'alter',
|
|
88
|
+
objectType: 'table',
|
|
89
|
+
schemaName,
|
|
90
|
+
objectName: tableName,
|
|
91
|
+
ddl: change.ddl,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return updated;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* ADD COLUMN arm of {@link alterTable}: append the new column, eagerly migrate
|
|
98
|
+
* each row (literal or per-row backfill), and persist. Behavior-preserving
|
|
99
|
+
* extraction of the former `switch` arm.
|
|
100
|
+
*
|
|
101
|
+
* The store always appends. A caller-chosen `insertAtIndex` (module-API only; SQL never
|
|
102
|
+
* produces one) is rejected unless it names the append position, rather than silently
|
|
103
|
+
* landing the column somewhere the caller did not ask for.
|
|
104
|
+
*/
|
|
105
|
+
async alterAddColumn(db, schemaName, tableName, table, oldSchema, change, defaultNotNull) {
|
|
106
|
+
if (change.insertAtIndex !== undefined && change.insertAtIndex !== oldSchema.columns.length) {
|
|
107
|
+
throw new QuereusError(`Store-backed table '${schemaName}.${tableName}' can only ADD COLUMN at the end `
|
|
108
|
+
+ `(position ${oldSchema.columns.length}), not at position ${change.insertAtIndex}`, StatusCode.UNSUPPORTED);
|
|
109
|
+
}
|
|
110
|
+
// Honor the session `default_collation` for an ADD COLUMN that omits an
|
|
111
|
+
// explicit COLLATE, matching the CREATE path so an ADD-COLUMN-ed text column
|
|
112
|
+
// gets the same collation a CREATE-d one would. The persisted DDL re-emits an
|
|
113
|
+
// explicit COLLATE for any non-BINARY collation, so reopen stays stable.
|
|
114
|
+
const newColSchema = columnDefToSchema(change.columnDef, defaultNotNull, db.options.getStringOption('default_collation'), (n) => db.isCollationRegistered(n));
|
|
115
|
+
// Extract default value from column def constraints. Use the shared
|
|
116
|
+
// `foldDefaultToType` helper so signed numerics like `-123.0`
|
|
117
|
+
// (a UnaryExpr in the AST) are recognized AND the folded literal is converted
|
|
118
|
+
// to the new column's declared type — matching the memory-mode path, the
|
|
119
|
+
// isolation overlay, and what a fresh INSERT under the same DEFAULT stores.
|
|
120
|
+
// An unconvertible literal (`integer default 'abc'`) throws MISMATCH here.
|
|
121
|
+
let defaultValue = null;
|
|
122
|
+
const defaultConstraint = change.columnDef.constraints?.find(c => c.type === 'default');
|
|
123
|
+
if (defaultConstraint?.expr) {
|
|
124
|
+
const folded = foldDefaultToType(defaultConstraint.expr, newColSchema.logicalType, newColSchema.name);
|
|
125
|
+
if (folded !== undefined) {
|
|
126
|
+
defaultValue = folded;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// A per-row value source — a non-foldable DEFAULT (e.g. `new.<col>`) or a
|
|
130
|
+
// `generated always as` expression — backfills each existing row from its own
|
|
131
|
+
// value via the engine-supplied evaluator (mirrors the memory path).
|
|
132
|
+
const backfillEvaluator = change.backfillEvaluator;
|
|
133
|
+
// Refuse NOT NULL without a usable value source on a non-empty table
|
|
134
|
+
// (SQLite-compatible). A per-row evaluator IS usable — its NOT NULL is enforced
|
|
135
|
+
// per row during migration — so it is exempt from this rejection.
|
|
136
|
+
if (newColSchema.notNull && defaultValue === null && !backfillEvaluator) {
|
|
137
|
+
if (await table.hasAnyRows()) {
|
|
138
|
+
throw new QuereusError(`Cannot add NOT NULL column '${newColSchema.name}' to non-empty table `
|
|
139
|
+
+ `'${schemaName}.${tableName}' without a DEFAULT value`, StatusCode.CONSTRAINT);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Build updated schema: append new column
|
|
143
|
+
const updatedColumns = Object.freeze([...oldSchema.columns, newColSchema]);
|
|
144
|
+
const updatedSchema = {
|
|
145
|
+
...oldSchema,
|
|
146
|
+
columns: updatedColumns,
|
|
147
|
+
columnIndexMap: buildColumnIndexMap(updatedColumns),
|
|
148
|
+
};
|
|
149
|
+
// Physical rewrite ahead: flush the module's buffered writes so `migrateRows`
|
|
150
|
+
// (a committed-store scan + batch) sees this transaction's rows and re-encodes
|
|
151
|
+
// them under the new column layout. See `StoreModuleBase.ddlCommitPendingOps`. Placed
|
|
152
|
+
// after every throw-only check above — the NOT NULL rejection reads effectively
|
|
153
|
+
// (`hasAnyRows`) — so a rejected ALTER leaves the enclosing transaction intact.
|
|
154
|
+
await this.ddlCommitPendingOps();
|
|
155
|
+
// Migrate rows: append the new column's value — a single literal default, or a
|
|
156
|
+
// per-row value derived from the existing row when a backfill evaluator is set.
|
|
157
|
+
const remap = buildColumnRemap(oldSchema.columns.map(c => c.name), updatedColumns.map(c => c.name));
|
|
158
|
+
await table.migrateRows(remap, defaultValue, backfillEvaluator
|
|
159
|
+
? { evaluator: backfillEvaluator, notNull: newColSchema.notNull, columnName: newColSchema.name }
|
|
160
|
+
: undefined);
|
|
161
|
+
// Update table schema (column-only) and persist DDL. Any constraint declared inline
|
|
162
|
+
// on the added column (UNIQUE / CHECK / FOREIGN KEY) arrives as its own follow-up
|
|
163
|
+
// `addConstraint` call from the engine's `runAddColumn`, which is what persists it —
|
|
164
|
+
// so this arm neither installs nor persists them, and the schema it hands back stays
|
|
165
|
+
// column-only.
|
|
166
|
+
table.updateSchema(updatedSchema);
|
|
167
|
+
await this.saveTableDDL(updatedSchema);
|
|
168
|
+
return updatedSchema;
|
|
169
|
+
}
|
|
170
|
+
/** DROP COLUMN arm of {@link alterTable}: drop the column slot, reindex PK / indexes /
|
|
171
|
+
* UNIQUE, migrate rows, re-encode or tear down the affected physical index stores,
|
|
172
|
+
* and persist. */
|
|
173
|
+
async alterDropColumn(db, schemaName, tableName, table, oldSchema, change) {
|
|
174
|
+
const colNameLower = change.columnName.toLowerCase();
|
|
175
|
+
const colIndex = oldSchema.columns.findIndex(c => c.name.toLowerCase() === colNameLower);
|
|
176
|
+
if (colIndex === -1) {
|
|
177
|
+
throw new QuereusError(`Column '${change.columnName}' not found.`, StatusCode.ERROR);
|
|
178
|
+
}
|
|
179
|
+
// Renumber every position-bearing field over the removed slot — shared with the
|
|
180
|
+
// memory module's `dropColumn`, the mirror of `shiftSchemaIndicesForInsert`. Store-backed
|
|
181
|
+
// UNIQUE is enforced by a full scan over `uniqueConstraints`, so a stranded constraint
|
|
182
|
+
// whose column index dangles past the column array would break the next insert's
|
|
183
|
+
// validation (and the persisted DDL); a foreign key left unshifted would either dangle
|
|
184
|
+
// the same way or silently slide onto an unrelated column and enforce against the parent
|
|
185
|
+
// there. `removedUniqueConstraints` is unused here: unlike the memory module, the store's
|
|
186
|
+
// engine-facing `.indexes` never carries the hidden `_uc_*` covering index for a plain
|
|
187
|
+
// UNIQUE (see `StoreModuleBase.materializedIndexNames`), so there is no by-name exclusion to apply —
|
|
188
|
+
// `StoreModuleIndex.reconcileImplicitUniqueIndexStores` tears down the physical `_uc_*` store
|
|
189
|
+
// generically, by diffing the old and new constraint sets after this arm returns. A *user*
|
|
190
|
+
// `CREATE UNIQUE INDEX` spanning the dropped column is removed from the schema by the helper
|
|
191
|
+
// itself.
|
|
192
|
+
const shifted = shiftSchemaIndicesForDrop(oldSchema, colIndex);
|
|
193
|
+
// Every physical consequence the schema rewrite implies for the `{table}_idx_{name}`
|
|
194
|
+
// stores falls out of one diff — see {@link partitionIndexesByDropFate}. Both inputs
|
|
195
|
+
// are ENGINE-FACING schemas, which carry no `_uc_*` (see
|
|
196
|
+
// `StoreModuleBase.materializedIndexNames`), so the implicit UNIQUE stores stay out of
|
|
197
|
+
// both buckets — they remain owned by `reconcileImplicitUniqueIndexStores`, which runs
|
|
198
|
+
// after this arm returns. A `_uc_*` never narrows anyway: a UNIQUE constraint spanning
|
|
199
|
+
// the dropped column is removed outright and a survivor keeps its whole column set.
|
|
200
|
+
const { removed: removedIndexes, narrowed: narrowedIndexes } = partitionIndexesByDropFate(oldSchema.indexes ?? [], shifted.indexes);
|
|
201
|
+
const updatedSchema = {
|
|
202
|
+
...oldSchema,
|
|
203
|
+
columns: shifted.columns,
|
|
204
|
+
columnIndexMap: buildColumnIndexMap(shifted.columns),
|
|
205
|
+
primaryKeyDefinition: shifted.primaryKeyDefinition,
|
|
206
|
+
indexes: shifted.indexes,
|
|
207
|
+
uniqueConstraints: shifted.uniqueConstraints,
|
|
208
|
+
foreignKeys: shifted.foreignKeys,
|
|
209
|
+
};
|
|
210
|
+
// Physical rewrite ahead — flush buffered writes so `migrateRows` re-encodes
|
|
211
|
+
// this transaction's rows too. See `StoreModuleBase.ddlCommitPendingOps`.
|
|
212
|
+
await this.ddlCommitPendingOps();
|
|
213
|
+
// Migrate rows: remove the dropped column slot
|
|
214
|
+
const remap = buildColumnRemap(oldSchema.columns.map(c => c.name), shifted.columns.map(c => c.name));
|
|
215
|
+
await table.migrateRows(remap, null);
|
|
216
|
+
// Re-encode every narrowed index against the now-re-encoded data store. AFTER
|
|
217
|
+
// `migrateRows`: the rebuild reads the data store and encodes each entry from the
|
|
218
|
+
// NEW column layout. `rebuildSecondaryIndexes` clears and rebuilds every index in
|
|
219
|
+
// the schema it is handed, so a schema whose `.indexes` holds only the narrowed ones
|
|
220
|
+
// keeps the pass off the untouched indexes. A narrowed index is necessarily
|
|
221
|
+
// non-UNIQUE (a UNIQUE one spanning the slot was removed outright), so the build's
|
|
222
|
+
// in-pass duplicate check is never exercised; and the engine rejects a DROP COLUMN
|
|
223
|
+
// whose column is named by a partial index's WHERE clause, so the pass can never
|
|
224
|
+
// meet a predicate over the departed column.
|
|
225
|
+
//
|
|
226
|
+
// NOTE: this widens a failure window the arm already had — `migrateRows` above has
|
|
227
|
+
// already re-encoded the rows outside the coordinator while the catalog still
|
|
228
|
+
// describes the OLD schema, so an IO error anywhere from there to `saveTableDDL`
|
|
229
|
+
// leaves the two diverged until the statement is re-run. Same shape as
|
|
230
|
+
// `alterPrimaryKeyChange` (rekey → rebuild → persist). If either arm ever needs to
|
|
231
|
+
// be crash-safe, the fix is one durable marker covering the whole physical rewrite,
|
|
232
|
+
// not a reordering here.
|
|
233
|
+
if (narrowedIndexes.length > 0) {
|
|
234
|
+
await this.rebuildSecondaryIndexes(schemaName, tableName, table, { ...updatedSchema, indexes: narrowedIndexes }, db.getKeyNormalizerResolver());
|
|
235
|
+
}
|
|
236
|
+
// Update table schema and persist DDL
|
|
237
|
+
table.updateSchema(updatedSchema);
|
|
238
|
+
await this.saveTableDDL(updatedSchema);
|
|
239
|
+
// Tear down each removed index's physical store — after the catalog write, for the
|
|
240
|
+
// same reason `dropIndex` orders it that way: the bundle must already omit the index
|
|
241
|
+
// so a failed physical delete cannot resurrect it on reopen.
|
|
242
|
+
//
|
|
243
|
+
// No second `ddlCommitPendingOps()` here (unlike `dropIndex`, which flushes
|
|
244
|
+
// immediately before its own teardown): the flush above already ran, and both
|
|
245
|
+
// `migrateRows` and `rebuildSecondaryIndexes` write straight to their stores outside
|
|
246
|
+
// the coordinator — so no buffered ops have accumulated against the doomed index
|
|
247
|
+
// handles in between, and the teardown cannot strand any at commit.
|
|
248
|
+
for (const removed of removedIndexes) {
|
|
249
|
+
await this.tearDownIndexStore(schemaName, tableName, table, removed.name);
|
|
250
|
+
}
|
|
251
|
+
return updatedSchema;
|
|
252
|
+
}
|
|
253
|
+
/** RENAME COLUMN arm of {@link alterTable}: schema-only rewrite (columns, indexes, self-FK,
|
|
254
|
+
* in-place predicate / CHECK AST rewrite) and persist. Behavior-preserving extraction. */
|
|
255
|
+
async alterRenameColumn(db, schemaName, tableName, table, oldSchema, change, defaultNotNull) {
|
|
256
|
+
if (!change.newColumnDefAst) {
|
|
257
|
+
throw new QuereusError('RENAME COLUMN requires a new column definition AST', StatusCode.INTERNAL);
|
|
258
|
+
}
|
|
259
|
+
const oldNameLower = change.oldName.toLowerCase();
|
|
260
|
+
const colIndex = oldSchema.columns.findIndex(c => c.name.toLowerCase() === oldNameLower);
|
|
261
|
+
if (colIndex === -1) {
|
|
262
|
+
throw new QuereusError(`Column '${change.oldName}' not found.`, StatusCode.ERROR);
|
|
263
|
+
}
|
|
264
|
+
const newColSchema = columnDefToSchema(change.newColumnDefAst, defaultNotNull, 'BINARY', (n) => db.isCollationRegistered(n));
|
|
265
|
+
const updatedColumns = oldSchema.columns.map((c, i) => i === colIndex ? newColSchema : c);
|
|
266
|
+
const updatedIndexes = (oldSchema.indexes || []).map(idx => ({
|
|
267
|
+
...idx,
|
|
268
|
+
columns: idx.columns.map(ic => ic.index === colIndex ? { ...ic, name: change.newName } : ic),
|
|
269
|
+
}));
|
|
270
|
+
const updatedSchema = {
|
|
271
|
+
...oldSchema,
|
|
272
|
+
columns: Object.freeze(updatedColumns),
|
|
273
|
+
columnIndexMap: buildColumnIndexMap(updatedColumns),
|
|
274
|
+
indexes: Object.freeze(updatedIndexes),
|
|
275
|
+
// A self-referencing FK names the renamed column in `referencedColumnNames`
|
|
276
|
+
// and is persisted by name; the engine rewrites it only in the post-hook
|
|
277
|
+
// pass. Pure copy — no rollback needed, this schema is only adopted on the
|
|
278
|
+
// success path.
|
|
279
|
+
foreignKeys: renameColumnInSelfForeignKeys(oldSchema.foreignKeys, schemaName, tableName, change.oldName, change.newName),
|
|
280
|
+
};
|
|
281
|
+
// A partial index's WHERE clause, a CHECK constraint's expression, and a column's
|
|
282
|
+
// DEFAULT / generated expression all still name the OLD column: the engine's
|
|
283
|
+
// `propagateColumnRename` pass runs only after this hook returns. Persisting now
|
|
284
|
+
// would durably write a bundle naming a column the table no longer has, and only
|
|
285
|
+
// the later propagation's `table_modified` event would correct it — a crash in
|
|
286
|
+
// between leaves the catalog un-rehydratable. So rewrite first, in place: each
|
|
287
|
+
// `Expression` is shared by reference with the catalog's `TableSchema` and, for a
|
|
288
|
+
// unique partial index, with the `derivedFromIndex` UNIQUE constraint, so one
|
|
289
|
+
// rewrite covers all holders and makes the later propagation pass a no-op.
|
|
290
|
+
//
|
|
291
|
+
// The column arm walks `updatedColumns` — the array this hook is about to persist.
|
|
292
|
+
// Its renamed entry is a fresh `ColumnSchema` built from `newColumnDefAst`, but that
|
|
293
|
+
// def carries the SAME expression nodes (`buildConstraintsFromColumn` passes them in
|
|
294
|
+
// by reference and `columnDefToSchema` assigns them straight back), and every other
|
|
295
|
+
// entry is `oldSchema`'s by reference — so this is the same one-rewrite-covers-all
|
|
296
|
+
// story as the two above, reverse pass included. `formatColumnDef` renders BOTH a
|
|
297
|
+
// DEFAULT and a `GENERATED ALWAYS AS` body into the persisted bundle (the latter
|
|
298
|
+
// since `bug-store-reopen-loses-computed-columns` landed), so the arm is
|
|
299
|
+
// load-bearing for both.
|
|
300
|
+
//
|
|
301
|
+
// The rewrites are the first statements in the `try`, and each walks its
|
|
302
|
+
// collection one item at a time, so a throw anywhere — including partway
|
|
303
|
+
// through a walk — must reverse them: restoring `oldSchema` cannot, since the
|
|
304
|
+
// ASTs are shared. Reversing is a no-op wherever nothing names the new column,
|
|
305
|
+
// and the engine has already rejected a rename onto an existing column name,
|
|
306
|
+
// so the reverse pass cannot collide with an expression that legitimately
|
|
307
|
+
// named it.
|
|
308
|
+
const resolveColumnInSource = (s, t, col) => db.schemaManager.getSchema(s)?.getTable(t)?.columnIndexMap.has(col.toLowerCase()) ?? false;
|
|
309
|
+
const rewriteColumn = (from, to) => {
|
|
310
|
+
renameColumnInIndexPredicates(updatedIndexes, tableName, from, to, schemaName, resolveColumnInSource);
|
|
311
|
+
renameColumnInCheckConstraints(oldSchema.checkConstraints, tableName, from, to, schemaName, resolveColumnInSource);
|
|
312
|
+
renameColumnInColumnExpressions(updatedColumns, tableName, from, to, schemaName, resolveColumnInSource);
|
|
313
|
+
};
|
|
314
|
+
try {
|
|
315
|
+
rewriteColumn(change.oldName, change.newName);
|
|
316
|
+
// Rename is schema-only — no row migration needed
|
|
317
|
+
table.updateSchema(updatedSchema);
|
|
318
|
+
await this.saveTableDDL(updatedSchema);
|
|
319
|
+
}
|
|
320
|
+
catch (e) {
|
|
321
|
+
rewriteColumn(change.newName, change.oldName);
|
|
322
|
+
throw e;
|
|
323
|
+
}
|
|
324
|
+
return updatedSchema;
|
|
325
|
+
}
|
|
326
|
+
/** ALTER PRIMARY KEY arm of {@link alterTable}: physically re-key the data store, rebuild
|
|
327
|
+
* secondary indexes, and persist. Behavior-preserving extraction. */
|
|
328
|
+
async alterPrimaryKeyChange(db, schemaName, tableName, table, oldSchema, change) {
|
|
329
|
+
const newPkColumns = change.newPkColumns;
|
|
330
|
+
// Shared with the memory module's native arm: rebuilds `primaryKeyDefinition` AND the
|
|
331
|
+
// per-column `primaryKey` / `pkOrder` flags together, so the DDL this arm persists (and
|
|
332
|
+
// the planner's uniqueness hints) describe the NEW key. Each member also carries its
|
|
333
|
+
// column's collation, which this arm previously dropped — the store keys PK columns
|
|
334
|
+
// under their declared collation (`StoreTable.pkKeyCollations`).
|
|
335
|
+
const updatedSchema = rekeySchemaPrimaryKey(oldSchema, newPkColumns);
|
|
336
|
+
// Physical re-key ahead — flush buffered writes so every live row is
|
|
337
|
+
// re-keyed and no stale-schema op replays over the rewritten store.
|
|
338
|
+
// `rekeyRows`' duplicate-key pass runs against the flushed store, so a
|
|
339
|
+
// pending insert that collides under the new PK is caught. See
|
|
340
|
+
// `StoreModuleBase.ddlCommitPendingOps` for the transaction consequences.
|
|
341
|
+
await this.ddlCommitPendingOps();
|
|
342
|
+
// Re-key the data store. Throws CONSTRAINT on duplicates without
|
|
343
|
+
// mutating the store, giving us all-or-nothing semantics for the
|
|
344
|
+
// validation phase.
|
|
345
|
+
await table.rekeyRows(newPkColumns);
|
|
346
|
+
// Secondary index keys embed the PK suffix — clear + rebuild every
|
|
347
|
+
// index against the now-rekeyed data store. Rebuild the MATERIALIZED index list
|
|
348
|
+
// so each implicit `_uc_*` PK suffix is re-encoded too (`updatedSchema` is built
|
|
349
|
+
// off the de-materialized `oldSchema`, so it carries no `_uc_*` on its own).
|
|
350
|
+
await this.rebuildSecondaryIndexes(schemaName, tableName, table, withImplicitUniqueIndexes(updatedSchema), db.getKeyNormalizerResolver());
|
|
351
|
+
table.updateSchema(updatedSchema);
|
|
352
|
+
await this.saveTableDDL(updatedSchema);
|
|
353
|
+
return updatedSchema;
|
|
354
|
+
}
|
|
355
|
+
/** ADD CONSTRAINT arm of {@link alterTable}: validate existing rows as the constraint kind
|
|
356
|
+
* (UNIQUE / FOREIGN KEY / CHECK) requires, then persist. Behavior-preserving extraction. */
|
|
357
|
+
async alterAddConstraint(db, table, oldSchema, change, rows) {
|
|
358
|
+
const constraint = change.constraint;
|
|
359
|
+
let updatedSchema;
|
|
360
|
+
if (constraint.type === 'unique') {
|
|
361
|
+
// Validate the existing rows against the new UNIQUE before persisting. The
|
|
362
|
+
// implicit `_uc_*` index that backs enforcement is materialized into the
|
|
363
|
+
// StoreTable schema by `table.updateSchema` below, and its PHYSICAL store is
|
|
364
|
+
// built by `reconcileImplicitUniqueIndexStores` after this arm returns — the
|
|
365
|
+
// validation here runs first, so a CONSTRAINT rejection never leaves a store
|
|
366
|
+
// behind.
|
|
367
|
+
//
|
|
368
|
+
// No `ddlCommitPendingOps()` here (unlike the row-rewriting arms): this
|
|
369
|
+
// writes no rows, and the validation scan already reads effectively, so
|
|
370
|
+
// the transaction survives a CONSTRAINT rejection.
|
|
371
|
+
const uc = buildUniqueConstraintSchema(constraint, oldSchema.columnIndexMap);
|
|
372
|
+
await validateUniqueOverExistingRows(effectiveDdlRows(table, rows), oldSchema, uc, db.getKeyNormalizerResolver());
|
|
373
|
+
updatedSchema = {
|
|
374
|
+
...oldSchema,
|
|
375
|
+
uniqueConstraints: Object.freeze([...(oldSchema.uniqueConstraints ?? []), uc]),
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
else if (constraint.type === 'foreignKey') {
|
|
379
|
+
const fk = buildForeignKeyConstraintSchema(constraint, oldSchema.columnIndexMap, oldSchema.name, oldSchema.schemaName);
|
|
380
|
+
updatedSchema = {
|
|
381
|
+
...oldSchema,
|
|
382
|
+
foreignKeys: Object.freeze([...(oldSchema.foreignKeys ?? []), fk]),
|
|
383
|
+
};
|
|
384
|
+
// Pragma-gated existing-row validation; throws before persistence on an orphan.
|
|
385
|
+
await validateForeignKeyOverExistingRows(db, updatedSchema, fk);
|
|
386
|
+
}
|
|
387
|
+
else if (constraint.type === 'check') {
|
|
388
|
+
// Schema-only: a CHECK has no physical structure and (matching the
|
|
389
|
+
// engine's prior in-emitter behavior) no existing-row scan. Routing it
|
|
390
|
+
// here — rather than catalog-only — keeps the persisted DDL and the
|
|
391
|
+
// connected-table schema in lock-step so DROP/RENAME CONSTRAINT resolve it.
|
|
392
|
+
const check = buildCheckConstraintSchema(constraint, oldSchema.checkConstraints.length);
|
|
393
|
+
updatedSchema = {
|
|
394
|
+
...oldSchema,
|
|
395
|
+
checkConstraints: Object.freeze([...oldSchema.checkConstraints, check]),
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
throw new QuereusError(`Store table ADD CONSTRAINT does not support constraint type '${constraint.type}'`, StatusCode.UNSUPPORTED);
|
|
400
|
+
}
|
|
401
|
+
table.updateSchema(updatedSchema);
|
|
402
|
+
await this.saveTableDDL(updatedSchema);
|
|
403
|
+
return updatedSchema;
|
|
404
|
+
}
|
|
405
|
+
/** DROP CONSTRAINT arm of {@link alterTable}: schema-only catalog rewrite dropping a named
|
|
406
|
+
* constraint, then persist. Behavior-preserving extraction. */
|
|
407
|
+
async alterDropConstraint(table, oldSchema, change) {
|
|
408
|
+
// Schema-only catalog rewrite. Dropping a UNIQUE removes it from
|
|
409
|
+
// `uniqueConstraints`, so `table.updateSchema` below de-materializes its implicit
|
|
410
|
+
// `_uc_*` index and `reconcileImplicitUniqueIndexStores` (after this arm returns)
|
|
411
|
+
// tears down the now-orphaned physical store — without which a later re-ADD would
|
|
412
|
+
// reopen stale entries. That teardown DDL-commits the module's pending transaction
|
|
413
|
+
// first (a deleted store's buffered ops cannot be replayed at commit — see
|
|
414
|
+
// `StoreModuleIndex.reconcileImplicitUniqueIndexStores`), so this arm is schema-only for the
|
|
415
|
+
// CATALOG but not transaction-neutral. A UNIQUE derived from a CREATE UNIQUE INDEX
|
|
416
|
+
// is rejected upstream (drop the index instead), and has no `_uc_*` anyway.
|
|
417
|
+
const constraintClass = resolveNamedConstraintClass(oldSchema, change.constraintName);
|
|
418
|
+
const lower = change.constraintName.toLowerCase();
|
|
419
|
+
let updatedSchema;
|
|
420
|
+
if (constraintClass === 'check') {
|
|
421
|
+
updatedSchema = {
|
|
422
|
+
...oldSchema,
|
|
423
|
+
checkConstraints: Object.freeze(oldSchema.checkConstraints.filter(c => c.name?.toLowerCase() !== lower)),
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
else if (constraintClass === 'foreignKey') {
|
|
427
|
+
const remaining = (oldSchema.foreignKeys ?? []).filter(c => c.name?.toLowerCase() !== lower);
|
|
428
|
+
updatedSchema = { ...oldSchema, foreignKeys: remaining.length > 0 ? Object.freeze(remaining) : undefined };
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
const remaining = (oldSchema.uniqueConstraints ?? []).filter(c => c.name?.toLowerCase() !== lower);
|
|
432
|
+
updatedSchema = { ...oldSchema, uniqueConstraints: remaining.length > 0 ? Object.freeze(remaining) : undefined };
|
|
433
|
+
}
|
|
434
|
+
table.updateSchema(updatedSchema);
|
|
435
|
+
await this.saveTableDDL(updatedSchema);
|
|
436
|
+
return updatedSchema;
|
|
437
|
+
}
|
|
438
|
+
/** RENAME CONSTRAINT arm of {@link alterTable}: schema-only rename of a named constraint,
|
|
439
|
+
* then persist. A renamed named-UNIQUE changes its implicit `_uc_*` index name, so
|
|
440
|
+
* `reconcileImplicitUniqueIndexStores` (run after this arm) MOVES the physical store —
|
|
441
|
+
* tears down the old-named store and rebuilds the new-named one from effective rows. */
|
|
442
|
+
async alterRenameConstraint(table, oldSchema, change) {
|
|
443
|
+
const constraintClass = resolveNamedConstraintClass(oldSchema, change.oldName);
|
|
444
|
+
const oldLower = change.oldName.toLowerCase();
|
|
445
|
+
let updatedSchema;
|
|
446
|
+
if (constraintClass === 'check') {
|
|
447
|
+
updatedSchema = {
|
|
448
|
+
...oldSchema,
|
|
449
|
+
checkConstraints: Object.freeze(oldSchema.checkConstraints.map(c => (c.name?.toLowerCase() === oldLower ? { ...c, name: change.newName } : c))),
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
else if (constraintClass === 'foreignKey') {
|
|
453
|
+
updatedSchema = {
|
|
454
|
+
...oldSchema,
|
|
455
|
+
foreignKeys: Object.freeze(oldSchema.foreignKeys.map(c => (c.name?.toLowerCase() === oldLower ? { ...c, name: change.newName } : c))),
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
updatedSchema = {
|
|
460
|
+
...oldSchema,
|
|
461
|
+
uniqueConstraints: Object.freeze(oldSchema.uniqueConstraints.map(c => (c.name?.toLowerCase() === oldLower ? { ...c, name: change.newName } : c))),
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
table.updateSchema(updatedSchema);
|
|
465
|
+
await this.saveTableDDL(updatedSchema);
|
|
466
|
+
return updatedSchema;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Which of `before`'s indexes DROP COLUMN's schema rewrite (`shiftSchemaIndicesForDrop`)
|
|
471
|
+
* left needing physical work, matched by lowercased name against the post-shift `after`:
|
|
472
|
+
*
|
|
473
|
+
* - `removed` — gone from `after` outright (UNIQUE spanning the dropped column, or a
|
|
474
|
+
* single-column index whose only column this was). Its store must be torn down,
|
|
475
|
+
* mirroring `DROP INDEX`: nothing else reclaims it, and a later `CREATE INDEX` of the
|
|
476
|
+
* same name would ADOPT the stale entries — `getIndexStore` hands back the existing
|
|
477
|
+
* store, `buildIndexEntries` appends, and `assertStoreNameFree` cannot catch it (it
|
|
478
|
+
* compares against REGISTERED schema objects, and this index is no longer one), so a
|
|
479
|
+
* range scan through the reused index yields each row twice. Carries the PRE-shift
|
|
480
|
+
* entry; only its name is used.
|
|
481
|
+
* - `narrowed` — survives with a different column COUNT, so its key layout lost one
|
|
482
|
+
* value ahead of the PK suffix while every pre-existing entry still carries the WIDE
|
|
483
|
+
* encoding: lookups miss those rows and deletes orphan their entries. Its store must be
|
|
484
|
+
* re-encoded. Carries the POST-shift entry, which is what the rebuild encodes from.
|
|
485
|
+
*
|
|
486
|
+
* A survivor whose column count is unchanged is in neither bucket: its column INDICES
|
|
487
|
+
* shifted, but it encodes the same values in the same order, so its key bytes do not move.
|
|
488
|
+
*/
|
|
489
|
+
function partitionIndexesByDropFate(before, after) {
|
|
490
|
+
const survivors = new Map(after.map(ix => [ix.name.toLowerCase(), ix]));
|
|
491
|
+
const removed = [];
|
|
492
|
+
const narrowed = [];
|
|
493
|
+
for (const old of before) {
|
|
494
|
+
const survivor = survivors.get(old.name.toLowerCase());
|
|
495
|
+
if (!survivor) {
|
|
496
|
+
removed.push(old);
|
|
497
|
+
}
|
|
498
|
+
else if (survivor.columns.length !== old.columns.length) {
|
|
499
|
+
narrowed.push(survivor);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return { removed, narrowed };
|
|
503
|
+
}
|
|
504
|
+
//# sourceMappingURL=store-module-alter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-module-alter.js","sourceRoot":"","sources":["../../../src/common/store-module-alter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAYH,OAAO,EACN,YAAY,EACZ,UAAU,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,+BAA+B,EAC/B,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,8BAA8B,EAC9B,+BAA+B,EAC/B,6BAA6B,EAC7B,2BAA2B,EAC3B,yBAAyB,EACzB,kCAAkC,GAClC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAEnG,MAAM,OAAgB,gBAAiB,SAAQ,sBAAsB;IACpE;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CACf,EAAY,EACZ,UAAkB,EAClB,SAAiB,EACjB,MAAwB,EACxB,IAAyB;QAEzB,IAAI,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,EAAE,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAElE,IAAI,CAAC,KAAK,EAAE,CAAC;YACZ,MAAM,IAAI,YAAY,CACrB,gBAAgB,SAAS,0BAA0B,UAAU,kBAAkB,EAC/E,UAAU,CAAC,KAAK,CAChB,CAAC;QACH,CAAC;QAED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