nowity 1.10.0 → 1.11.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 +65 -15
- package/dist/core/types.d.ts +7 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/server/api/configure.d.ts +5 -1
- package/dist/server/api/configure.d.ts.map +1 -1
- package/dist/server/api/configure.js +2 -0
- package/dist/server/change-source/change-source.d.ts +23 -5
- package/dist/server/change-source/change-source.d.ts.map +1 -1
- package/dist/server/change-source/outbox-change-source.d.ts +46 -12
- package/dist/server/change-source/outbox-change-source.d.ts.map +1 -1
- package/dist/server/change-source/outbox-change-source.js +153 -65
- package/dist/server/change-source/pg-snapshot.d.ts +25 -0
- package/dist/server/change-source/pg-snapshot.d.ts.map +1 -0
- package/dist/server/change-source/pg-snapshot.js +43 -0
- package/dist/server/sync-engine.d.ts +110 -0
- package/dist/server/sync-engine.d.ts.map +1 -1
- package/dist/server/sync-engine.js +409 -111
- package/dist/server/ws-server.d.ts +8 -0
- package/dist/server/ws-server.d.ts.map +1 -1
- package/dist/server/ws-server.js +32 -5
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ exports.mergeTransactions = mergeTransactions;
|
|
|
5
5
|
exports.groupByTransaction = groupByTransaction;
|
|
6
6
|
const node_crypto_1 = require("node:crypto");
|
|
7
7
|
const normalize_1 = require("../../core/normalize");
|
|
8
|
+
const pg_snapshot_1 = require("./pg-snapshot");
|
|
8
9
|
const SELECT_COLUMNS = `seq::text AS seq, xid::text AS xid, tbl, op, pk, before, after, client_id, mutation_id::text AS mutation_id, (extract(epoch FROM created_at) * 1000)::float8 AS written_ms`;
|
|
9
10
|
/**
|
|
10
11
|
* Change source built on an outbox table filled by triggers, woken by
|
|
@@ -13,29 +14,52 @@ const SELECT_COLUMNS = `seq::text AS seq, xid::text AS xid, tbl, op, pk, before,
|
|
|
13
14
|
* The interesting part is the read cursor. `seq` alone is not usable: sequence
|
|
14
15
|
* values are assigned before commit, so ordering by `seq` can walk past a row
|
|
15
16
|
* whose transaction commits later, and that row would then be filtered out by
|
|
16
|
-
* `seq > cursor` forever.
|
|
17
|
-
*
|
|
18
|
-
* transaction id still in flight. That set has two properties we need:
|
|
17
|
+
* `seq > cursor` forever. A single `xid` cursor has the same hole for the same
|
|
18
|
+
* reason — xids are handed out at the first write, not at commit.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* The cursor is therefore a *snapshot* (`pg_current_snapshot()`): "every
|
|
21
|
+
* transaction this snapshot sees has been delivered". A read takes the
|
|
22
|
+
* statement's own snapshot and returns the rows of exactly the transactions it
|
|
23
|
+
* sees and the cursor did not. Every transaction becomes visible in exactly one
|
|
24
|
+
* such interval, so nothing is skipped and nothing is read twice, and the new
|
|
25
|
+
* snapshot becomes the cursor.
|
|
24
26
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* Up to 1.10 the cursor was the transaction horizon (`xmin`) instead, and one
|
|
28
|
+
* long-running *write* transaction anywhere in the database — a scheduler job,
|
|
29
|
+
* a migration, a `psql` session left open — held every change behind it until
|
|
30
|
+
* it finished. With a snapshot cursor a transaction still in flight is simply
|
|
31
|
+
* not seen yet; whatever commits around it flows on, and its own rows arrive
|
|
32
|
+
* in the read after its commit. What such a transaction still costs is index
|
|
33
|
+
* range: the read scans from the oldest in-flight xid of the cursor, so a very
|
|
34
|
+
* long one makes each read walk the rows written since it began (filtered out
|
|
35
|
+
* by visibility, never delivered again).
|
|
30
36
|
*/
|
|
31
37
|
class OutboxChangeSource {
|
|
32
38
|
constructor(opts) {
|
|
33
39
|
this.name = "outbox";
|
|
34
40
|
/** The trigger stamps every row with the mutation that produced it. */
|
|
35
41
|
this.attributesWrites = true;
|
|
36
|
-
this.
|
|
42
|
+
/** Every transaction this snapshot sees has been delivered. */
|
|
43
|
+
this.cursor = (0, pg_snapshot_1.snapshotAfterXid)(0n);
|
|
44
|
+
/** See {@link hold}. */
|
|
45
|
+
this.held = false;
|
|
37
46
|
/** Last cursor written to `nowity_consumer`; avoids a write per idle lap. */
|
|
38
47
|
this.publishedCursor = null;
|
|
48
|
+
/**
|
|
49
|
+
* What the engine may fold into a mutation's own transaction to learn what
|
|
50
|
+
* it wrote: the capture trigger has already put it here, under this
|
|
51
|
+
* transaction's xid.
|
|
52
|
+
*/
|
|
53
|
+
this.ownWrites = {
|
|
54
|
+
sql: `(SELECT COALESCE(json_agg(json_build_object(
|
|
55
|
+
'tbl', tbl, 'op', op, 'pk', pk, 'before', before, 'after', after,
|
|
56
|
+
'written_ms', (extract(epoch FROM created_at) * 1000)::float8) ORDER BY seq), '[]'::json)
|
|
57
|
+
FROM nowity.nowity_outbox WHERE xid = pg_current_xact_id())`,
|
|
58
|
+
parse: (value, clientId, mutationId) => {
|
|
59
|
+
const rows = (typeof value === "string" ? JSON.parse(value) : value);
|
|
60
|
+
return (rows ?? []).map((row) => toEvent({ ...row, seq: "0", xid: "0", client_id: clientId, mutation_id: String(mutationId) }));
|
|
61
|
+
},
|
|
62
|
+
};
|
|
39
63
|
this.handler = null;
|
|
40
64
|
this.listener = null;
|
|
41
65
|
this.timer = null;
|
|
@@ -56,15 +80,14 @@ class OutboxChangeSource {
|
|
|
56
80
|
this.onError = opts.onError ?? ((err) => console.error("[nowity/outbox]", err));
|
|
57
81
|
}
|
|
58
82
|
async startPosition(snap) {
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const xmin = BigInt(rows[0].xmin);
|
|
64
|
-
return (xmin - 1n).toString();
|
|
83
|
+
// The engine's starting state is exactly what this snapshot sees, so
|
|
84
|
+
// the stream starts with whatever it does not.
|
|
85
|
+
const { rows } = await snap.query(`SELECT pg_current_snapshot()::text AS snap`);
|
|
86
|
+
return rows[0].snap;
|
|
65
87
|
}
|
|
66
88
|
async start(from, handler) {
|
|
67
|
-
|
|
89
|
+
// A bare xid is a cursor of the horizon era: everything up to it.
|
|
90
|
+
this.cursor = from.includes(":") ? (0, pg_snapshot_1.parseSnapshot)(from) : (0, pg_snapshot_1.snapshotAfterXid)(BigInt(from));
|
|
68
91
|
this.handler = handler;
|
|
69
92
|
this.running = true;
|
|
70
93
|
// Registered before the first read, so retention cannot delete rows this
|
|
@@ -134,6 +157,18 @@ class OutboxChangeSource {
|
|
|
134
157
|
await this.draining;
|
|
135
158
|
}
|
|
136
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Stop reading until {@link release}, for tests that need several
|
|
162
|
+
* transactions in one read. Laps still run — `drain()` resolves — they
|
|
163
|
+
* just read nothing.
|
|
164
|
+
*/
|
|
165
|
+
hold() {
|
|
166
|
+
this.held = true;
|
|
167
|
+
}
|
|
168
|
+
async release() {
|
|
169
|
+
this.held = false;
|
|
170
|
+
await this.drain();
|
|
171
|
+
}
|
|
137
172
|
wake() {
|
|
138
173
|
if (!this.running)
|
|
139
174
|
return;
|
|
@@ -143,40 +178,55 @@ class OutboxChangeSource {
|
|
|
143
178
|
// Claim every request made so far; a request arriving mid-loop bumps
|
|
144
179
|
// requestSeq again and gets its own lap.
|
|
145
180
|
const claimed = this.requestSeq;
|
|
146
|
-
|
|
181
|
+
// eslint-disable-next-line no-constant-condition
|
|
182
|
+
while (!this.held) {
|
|
183
|
+
// One round: everything the snapshot of its first read sees and the
|
|
184
|
+
// cursor does not, in pages of whole transactions.
|
|
185
|
+
let target = null;
|
|
186
|
+
let after = null;
|
|
187
|
+
let delivered = 0;
|
|
147
188
|
// eslint-disable-next-line no-constant-condition
|
|
148
189
|
while (true) {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
190
|
+
const page = await this.fetch(target, after);
|
|
191
|
+
target = page.target;
|
|
192
|
+
if (page.rows.length > 0) {
|
|
193
|
+
const transactions = groupByTransaction(page.rows);
|
|
194
|
+
for (const batch of this.coalesce ? [mergeTransactions(transactions)] : transactions) {
|
|
195
|
+
if (!this.handler)
|
|
196
|
+
return;
|
|
197
|
+
await this.handler(batch);
|
|
198
|
+
delivered += batch.transactions ?? 1;
|
|
199
|
+
}
|
|
200
|
+
after = page.rows[page.rows.length - 1].xid;
|
|
158
201
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
// change would double the cost of every change.
|
|
162
|
-
await this.publishCursor();
|
|
202
|
+
if (!page.more)
|
|
203
|
+
break;
|
|
163
204
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
205
|
+
// Only once the whole round is in: a failed handler leaves the
|
|
206
|
+
// cursor where it was and the next lap reads the round again,
|
|
207
|
+
// which delivery is allowed to do.
|
|
208
|
+
this.cursor = target;
|
|
209
|
+
// Once per round rather than once per transaction: the watermark
|
|
210
|
+
// only has to be behind-or-equal to be safe, and a write per
|
|
211
|
+
// change would double the cost of every change.
|
|
212
|
+
await this.publishCursor();
|
|
213
|
+
if (delivered === 0)
|
|
214
|
+
break;
|
|
169
215
|
}
|
|
216
|
+
this.servedSeq = Math.max(this.servedSeq, claimed);
|
|
170
217
|
}
|
|
171
218
|
/** Tell retention where this reader is, when it has moved. */
|
|
172
219
|
async publishCursor() {
|
|
173
|
-
|
|
220
|
+
// Retention needs an xid: everything below the cursor's xmin has been
|
|
221
|
+
// delivered, whatever is still in flight above it has not.
|
|
222
|
+
const watermark = this.cursor.xmin - 1n;
|
|
223
|
+
if (this.publishedCursor === watermark)
|
|
174
224
|
return;
|
|
175
225
|
await this.pool.query(`SELECT nowity.nowity_consumer_seen($1, $2)`, [
|
|
176
226
|
this.consumerId,
|
|
177
|
-
|
|
227
|
+
watermark.toString(),
|
|
178
228
|
]);
|
|
179
|
-
this.publishedCursor =
|
|
229
|
+
this.publishedCursor = watermark;
|
|
180
230
|
}
|
|
181
231
|
/**
|
|
182
232
|
* Delete what every live reader has passed. Returns how many rows went.
|
|
@@ -191,27 +241,61 @@ class OutboxChangeSource {
|
|
|
191
241
|
]);
|
|
192
242
|
return Number(rows[0]?.deleted ?? 0);
|
|
193
243
|
}
|
|
194
|
-
|
|
195
|
-
|
|
244
|
+
/**
|
|
245
|
+
* One page of a round: rows of transactions `target` sees and the cursor
|
|
246
|
+
* does not, whole transactions only, xids above `after`.
|
|
247
|
+
*
|
|
248
|
+
* The first page of a round has no target yet and takes its own statement
|
|
249
|
+
* snapshot as one, so the rows and the snapshot that becomes the cursor
|
|
250
|
+
* cannot disagree. Later pages read in newer statement snapshots and keep
|
|
251
|
+
* to the target explicitly.
|
|
252
|
+
*/
|
|
253
|
+
async fetch(target, after) {
|
|
254
|
+
const cursor = this.cursor.text;
|
|
255
|
+
let rows;
|
|
256
|
+
if (target === null) {
|
|
257
|
+
({ rows } = (await this.pool.query(`WITH s AS (SELECT pg_current_snapshot() AS snap)
|
|
258
|
+
SELECT s.snap::text AS target, o.*
|
|
259
|
+
FROM s
|
|
260
|
+
LEFT JOIN LATERAL (
|
|
261
|
+
SELECT ${SELECT_COLUMNS}
|
|
262
|
+
FROM nowity.nowity_outbox
|
|
263
|
+
WHERE xid >= pg_snapshot_xmin($1::pg_snapshot)
|
|
264
|
+
AND xid < pg_snapshot_xmax(s.snap)
|
|
265
|
+
AND NOT pg_visible_in_snapshot(xid, $1::pg_snapshot)
|
|
266
|
+
AND pg_visible_in_snapshot(xid, s.snap)
|
|
267
|
+
ORDER BY xid, seq
|
|
268
|
+
LIMIT $2
|
|
269
|
+
) o ON true`, [cursor, this.batchSize])));
|
|
270
|
+
const snap = (0, pg_snapshot_1.parseSnapshot)(rows[0].target);
|
|
271
|
+
rows = rows.filter((row) => row.seq !== null);
|
|
272
|
+
return this.page(snap, rows);
|
|
273
|
+
}
|
|
274
|
+
({ rows } = (await this.pool.query(`SELECT ${SELECT_COLUMNS}
|
|
196
275
|
FROM nowity.nowity_outbox
|
|
197
|
-
WHERE xid > $
|
|
198
|
-
AND xid <
|
|
276
|
+
WHERE xid > $3::xid8
|
|
277
|
+
AND xid < pg_snapshot_xmax($2::pg_snapshot)
|
|
278
|
+
AND NOT pg_visible_in_snapshot(xid, $1::pg_snapshot)
|
|
279
|
+
AND pg_visible_in_snapshot(xid, $2::pg_snapshot)
|
|
199
280
|
ORDER BY xid, seq
|
|
200
|
-
LIMIT $
|
|
281
|
+
LIMIT $4`, [cursor, target.text, after ?? "0", this.batchSize])));
|
|
282
|
+
return this.page(target, rows);
|
|
283
|
+
}
|
|
284
|
+
async page(target, rows) {
|
|
201
285
|
if (rows.length < this.batchSize)
|
|
202
|
-
return rows;
|
|
286
|
+
return { target, rows, more: false };
|
|
203
287
|
// The limit may have cut a transaction in half; drop the trailing group
|
|
204
288
|
// so no batch is ever delivered incomplete.
|
|
205
289
|
const lastXid = rows[rows.length - 1].xid;
|
|
206
290
|
const trimmed = rows.filter((r) => r.xid !== lastXid);
|
|
207
291
|
if (trimmed.length > 0)
|
|
208
|
-
return trimmed;
|
|
292
|
+
return { target, rows: trimmed, more: true };
|
|
209
293
|
// A single transaction larger than the batch size: fetch it whole.
|
|
210
294
|
const { rows: whole } = (await this.pool.query(`SELECT ${SELECT_COLUMNS}
|
|
211
295
|
FROM nowity.nowity_outbox
|
|
212
296
|
WHERE xid = $1::xid8
|
|
213
297
|
ORDER BY seq`, [lastXid]));
|
|
214
|
-
return whole;
|
|
298
|
+
return { target, rows: whole, more: true };
|
|
215
299
|
}
|
|
216
300
|
}
|
|
217
301
|
exports.OutboxChangeSource = OutboxChangeSource;
|
|
@@ -230,6 +314,7 @@ function mergeTransactions(batches) {
|
|
|
230
314
|
position: last.position,
|
|
231
315
|
xid: last.xid,
|
|
232
316
|
transactions: batches.reduce((sum, batch) => sum + (batch.transactions ?? 1), 0),
|
|
317
|
+
xids: batches.flatMap((batch) => batch.xids ?? [batch.xid]),
|
|
233
318
|
events: batches.flatMap((batch) => batch.events),
|
|
234
319
|
};
|
|
235
320
|
}
|
|
@@ -238,23 +323,26 @@ function groupByTransaction(rows) {
|
|
|
238
323
|
let current = null;
|
|
239
324
|
for (const row of rows) {
|
|
240
325
|
if (!current || current.xid !== row.xid) {
|
|
241
|
-
current = { position: row.xid, xid: row.xid, events: [] };
|
|
326
|
+
current = { position: row.xid, xid: row.xid, xids: [row.xid], events: [] };
|
|
242
327
|
batches.push(current);
|
|
243
328
|
}
|
|
244
|
-
current.events.push(
|
|
245
|
-
table: row.tbl,
|
|
246
|
-
op: row.op,
|
|
247
|
-
pk: (0, normalize_1.normalizeRow)(row.pk ?? {}),
|
|
248
|
-
before: row.before ? (0, normalize_1.normalizeRow)(row.before) : null,
|
|
249
|
-
after: row.after ? (0, normalize_1.normalizeRow)(row.after) : null,
|
|
250
|
-
clientId: row.client_id,
|
|
251
|
-
mutationId: row.mutation_id === null ? null : Number(row.mutation_id),
|
|
252
|
-
// The capture trigger stores `to_jsonb(OLD)`, so the previous row is
|
|
253
|
-
// always whole here — a row leaving a live query's filter is visible
|
|
254
|
-
// without any per-table configuration.
|
|
255
|
-
beforeComplete: true,
|
|
256
|
-
...(row.written_ms !== null && row.written_ms !== undefined ? { writtenAt: Number(row.written_ms) } : {}),
|
|
257
|
-
});
|
|
329
|
+
current.events.push(toEvent(row));
|
|
258
330
|
}
|
|
259
331
|
return batches;
|
|
260
332
|
}
|
|
333
|
+
function toEvent(row) {
|
|
334
|
+
return {
|
|
335
|
+
table: row.tbl,
|
|
336
|
+
op: row.op,
|
|
337
|
+
pk: (0, normalize_1.normalizeRow)(row.pk ?? {}),
|
|
338
|
+
before: row.before ? (0, normalize_1.normalizeRow)(row.before) : null,
|
|
339
|
+
after: row.after ? (0, normalize_1.normalizeRow)(row.after) : null,
|
|
340
|
+
clientId: row.client_id,
|
|
341
|
+
mutationId: row.mutation_id === null ? null : Number(row.mutation_id),
|
|
342
|
+
// The capture trigger stores `to_jsonb(OLD)`, so the previous row is
|
|
343
|
+
// always whole here — a row leaving a live query's filter is visible
|
|
344
|
+
// without any per-table configuration.
|
|
345
|
+
beforeComplete: true,
|
|
346
|
+
...(row.written_ms !== null && row.written_ms !== undefined ? { writtenAt: Number(row.written_ms) } : {}),
|
|
347
|
+
};
|
|
348
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A PostgreSQL snapshot (`pg_snapshot`), as text `xmin:xmax:xip,xip,…`.
|
|
3
|
+
*
|
|
4
|
+
* Which transactions it sees: every xid below `xmin`, and every xid below
|
|
5
|
+
* `xmax` that is not in `xip` (in flight when it was taken). An xid that
|
|
6
|
+
* aborted counts as "seen" too — it has no rows, so for our purposes that is
|
|
7
|
+
* the same thing.
|
|
8
|
+
*/
|
|
9
|
+
export interface PgSnapshot {
|
|
10
|
+
readonly text: string;
|
|
11
|
+
readonly xmin: bigint;
|
|
12
|
+
readonly xmax: bigint;
|
|
13
|
+
readonly xip: ReadonlySet<bigint>;
|
|
14
|
+
}
|
|
15
|
+
export declare function parseSnapshot(text: string): PgSnapshot;
|
|
16
|
+
/**
|
|
17
|
+
* The snapshot that has seen every transaction up to and including `xid` and
|
|
18
|
+
* nothing after it — how a cursor of the xid-horizon era translates.
|
|
19
|
+
*/
|
|
20
|
+
export declare function snapshotAfterXid(xid: bigint): PgSnapshot;
|
|
21
|
+
/** Whether `snap` sees the transaction `xid` (committed before it was taken). */
|
|
22
|
+
export declare function sees(snap: PgSnapshot, xid: bigint): boolean;
|
|
23
|
+
/** Whether `snap` sees every one of `xids`. False for an unknown (absent) list. */
|
|
24
|
+
export declare function seesAll(snap: PgSnapshot, xids: readonly string[] | undefined): boolean;
|
|
25
|
+
//# sourceMappingURL=pg-snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pg-snapshot.d.ts","sourceRoot":"","sources":["../../../src/server/change-source/pg-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAStD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAGxD;AAED,iFAAiF;AACjF,wBAAgB,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAI3D;AAED,mFAAmF;AACnF,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAMtF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSnapshot = parseSnapshot;
|
|
4
|
+
exports.snapshotAfterXid = snapshotAfterXid;
|
|
5
|
+
exports.sees = sees;
|
|
6
|
+
exports.seesAll = seesAll;
|
|
7
|
+
function parseSnapshot(text) {
|
|
8
|
+
const [xmin, xmax, xip = ""] = text.split(":");
|
|
9
|
+
if (xmin === undefined || xmax === undefined)
|
|
10
|
+
throw new Error(`Not a pg_snapshot: "${text}"`);
|
|
11
|
+
return {
|
|
12
|
+
text,
|
|
13
|
+
xmin: BigInt(xmin),
|
|
14
|
+
xmax: BigInt(xmax),
|
|
15
|
+
xip: new Set(xip === "" ? [] : xip.split(",").map((x) => BigInt(x))),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The snapshot that has seen every transaction up to and including `xid` and
|
|
20
|
+
* nothing after it — how a cursor of the xid-horizon era translates.
|
|
21
|
+
*/
|
|
22
|
+
function snapshotAfterXid(xid) {
|
|
23
|
+
const next = xid + 1n;
|
|
24
|
+
return parseSnapshot(`${next}:${next}:`);
|
|
25
|
+
}
|
|
26
|
+
/** Whether `snap` sees the transaction `xid` (committed before it was taken). */
|
|
27
|
+
function sees(snap, xid) {
|
|
28
|
+
if (xid < snap.xmin)
|
|
29
|
+
return true;
|
|
30
|
+
if (xid >= snap.xmax)
|
|
31
|
+
return false;
|
|
32
|
+
return !snap.xip.has(xid);
|
|
33
|
+
}
|
|
34
|
+
/** Whether `snap` sees every one of `xids`. False for an unknown (absent) list. */
|
|
35
|
+
function seesAll(snap, xids) {
|
|
36
|
+
if (!xids || xids.length === 0)
|
|
37
|
+
return false;
|
|
38
|
+
for (const xid of xids) {
|
|
39
|
+
if (!sees(snap, BigInt(xid)))
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
@@ -2,6 +2,7 @@ import { type ServerMessage, type ServerWelcome } from "../core/protocol";
|
|
|
2
2
|
import { type ChangeEvent, type ReadKeySet } from "../core/types";
|
|
3
3
|
import type { DerivedMutators } from "./api/derived";
|
|
4
4
|
import type { ChangeSource } from "./change-source/change-source";
|
|
5
|
+
import { type PgSnapshot } from "./change-source/pg-snapshot";
|
|
5
6
|
import type { SnapshotRunner } from "./db";
|
|
6
7
|
import { type QueryOutput } from "./evaluate";
|
|
7
8
|
import { type MutatorRegistry, type WriteRunner } from "./mutator";
|
|
@@ -48,8 +49,44 @@ export interface SyncEngineOptions {
|
|
|
48
49
|
* Absent, no subscription gets any.
|
|
49
50
|
*/
|
|
50
51
|
derived?: DerivedMutators;
|
|
52
|
+
/**
|
|
53
|
+
* Send the writer its own subscriptions, recomputed after the commit, with
|
|
54
|
+
* the result of the mutation — a `tx` message carrying the new data and
|
|
55
|
+
* `lastMutationId` right before `mutation-result` — instead of after the
|
|
56
|
+
* round trip through the change stream.
|
|
57
|
+
*
|
|
58
|
+
* On unless `false`, and only with a change source that can say what a
|
|
59
|
+
* transaction wrote (`ChangeSource.ownWrites`, the outbox). A write to a
|
|
60
|
+
* permission table, or one the recomputation fails on, falls back to the
|
|
61
|
+
* stream. The stream still delivers the transaction to everyone,
|
|
62
|
+
* the writer included; what the writer already has produces an empty diff
|
|
63
|
+
* and no message.
|
|
64
|
+
*/
|
|
65
|
+
ackWithState?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Fan a batch out over several snapshots at once.
|
|
68
|
+
*
|
|
69
|
+
* Each snapshot is a connection of the snapshot pool and takes a share of
|
|
70
|
+
* the sessions with something to recompute; one session is always
|
|
71
|
+
* recomputed in one snapshot, so a client still never sees half of a
|
|
72
|
+
* transaction, and batches still go out one after another, so the patches
|
|
73
|
+
* of one subscription keep their order.
|
|
74
|
+
*/
|
|
75
|
+
fanOut?: {
|
|
76
|
+
/** Snapshots one batch may use at once. Default 4; 1 = serial as before 1.11. */
|
|
77
|
+
concurrency?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Recomputations it takes to be worth another snapshot. Default 8: a
|
|
80
|
+
* batch touching a handful of subscriptions is cheaper on one
|
|
81
|
+
* connection than on several.
|
|
82
|
+
*/
|
|
83
|
+
minPerSnapshot?: number;
|
|
84
|
+
};
|
|
51
85
|
onError?: (err: Error) => void;
|
|
52
86
|
}
|
|
87
|
+
/** See {@link SyncEngineOptions.fanOut}. */
|
|
88
|
+
export declare const DEFAULT_FAN_OUT_CONCURRENCY = 4;
|
|
89
|
+
export declare const DEFAULT_FAN_OUT_MIN_PER_SNAPSHOT = 8;
|
|
53
90
|
interface Subscription {
|
|
54
91
|
subId: string;
|
|
55
92
|
def: QueryDef;
|
|
@@ -92,6 +129,31 @@ interface Subscription {
|
|
|
92
129
|
filterColumns: Map<string, Set<string>> | null;
|
|
93
130
|
/** The derived mutators last sent for it, serialised; `"[]"` = none. */
|
|
94
131
|
mutatorsSent: string;
|
|
132
|
+
/**
|
|
133
|
+
* The snapshot `prev` was computed in, when that was a recomputation for
|
|
134
|
+
* the writer's own mutation (see {@link SyncEngineOptions.ackWithState}).
|
|
135
|
+
* A batch whose transactions this snapshot already sees has nothing new
|
|
136
|
+
* for the subscription. Null = unknown, recompute as usual.
|
|
137
|
+
*/
|
|
138
|
+
mark: PgSnapshot | null;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* One holder at a time, in the order they asked.
|
|
142
|
+
*
|
|
143
|
+
* Both things that recompute a session's existing subscriptions and send the
|
|
144
|
+
* result — a batch and a mutation's own recomputation — hold its session's
|
|
145
|
+
* lock from before they open their snapshot until the message is out. (A
|
|
146
|
+
* subscribe creates a subscription rather than recomputing one; it is ordered
|
|
147
|
+
* against batches by the engine's queue and against acks by
|
|
148
|
+
* `EngineSession.subscribing`.) That keeps
|
|
149
|
+
* a subscription's diffs in order, and makes every recomputation of a session
|
|
150
|
+
* read in a snapshot newer than the one before it, so nothing ever moves a
|
|
151
|
+
* client back in time. A holder may wait for a connection, but nobody waits for
|
|
152
|
+
* a lock while holding a connection, which is what keeps it free of deadlocks.
|
|
153
|
+
*/
|
|
154
|
+
declare class SessionLock {
|
|
155
|
+
private tail;
|
|
156
|
+
acquire(): Promise<() => void>;
|
|
95
157
|
}
|
|
96
158
|
/** Server-side handle for one connected client. */
|
|
97
159
|
export declare class EngineSession {
|
|
@@ -109,6 +171,10 @@ export declare class EngineSession {
|
|
|
109
171
|
lastSentMutationId: number;
|
|
110
172
|
/** Serialises this client's mutations; they must be applied in order. */
|
|
111
173
|
mutationChain: Promise<unknown>;
|
|
174
|
+
/** See {@link SessionLock}. */
|
|
175
|
+
readonly lock: SessionLock;
|
|
176
|
+
/** Subscribes of this session being evaluated right now. */
|
|
177
|
+
subscribing: number;
|
|
112
178
|
closed: boolean;
|
|
113
179
|
/**
|
|
114
180
|
* This socket, as presence records it. Not the client id: a client id
|
|
@@ -194,7 +260,17 @@ export declare class SyncEngine {
|
|
|
194
260
|
candidates: number;
|
|
195
261
|
evaluations: number;
|
|
196
262
|
fanOutMs: number;
|
|
263
|
+
/** Mutations whose result went out with the writer's recomputed data. */
|
|
264
|
+
acks: number;
|
|
265
|
+
/** Snapshots and recomputations those took (not in the totals above). */
|
|
266
|
+
ackSnapshots: number;
|
|
267
|
+
ackEvaluations: number;
|
|
268
|
+
/** Recomputations a batch skipped because the writer's ack had them already. */
|
|
269
|
+
skipped: number;
|
|
197
270
|
};
|
|
271
|
+
private readonly ackWithState;
|
|
272
|
+
private readonly fanOutConcurrency;
|
|
273
|
+
private readonly fanOutMinPerSnapshot;
|
|
198
274
|
/** See {@link SyncEngineOptions.narrowInvalidation}. */
|
|
199
275
|
private readonly narrow;
|
|
200
276
|
constructor(opts: SyncEngineOptions);
|
|
@@ -224,6 +300,7 @@ export declare class SyncEngine {
|
|
|
224
300
|
*/
|
|
225
301
|
setContext(session: EngineSession, context: PresenceContext | null): void;
|
|
226
302
|
subscribe(session: EngineSession, subId: string, queryName: string, args: unknown): Promise<void>;
|
|
303
|
+
private subscribeNow;
|
|
227
304
|
unsubscribe(session: EngineSession, subId: string): Promise<void>;
|
|
228
305
|
/**
|
|
229
306
|
* File a subscription under what it reads, and under its scope.
|
|
@@ -244,6 +321,18 @@ export declare class SyncEngine {
|
|
|
244
321
|
/** `handleBatch`, with the one number worth watching taken around it. */
|
|
245
322
|
private timedBatch;
|
|
246
323
|
private handleBatch;
|
|
324
|
+
/**
|
|
325
|
+
* Sessions in groups of roughly equal work, one snapshot per group.
|
|
326
|
+
*
|
|
327
|
+
* A session is never split: everything it is sent for one batch comes from
|
|
328
|
+
* one snapshot. Groups only appear when there is enough work to pay for
|
|
329
|
+
* the extra connection.
|
|
330
|
+
*/
|
|
331
|
+
private partition;
|
|
332
|
+
private fanOutGroup;
|
|
333
|
+
/** What one session is sent for a batch, if anything. */
|
|
334
|
+
private fanOutSession;
|
|
335
|
+
private reportQueryFailure;
|
|
247
336
|
/**
|
|
248
337
|
* Sessions whose mutation watermark this batch may have moved.
|
|
249
338
|
*
|
|
@@ -278,6 +367,8 @@ export declare class SyncEngine {
|
|
|
278
367
|
* moved: granted, revoked, or merely changed.
|
|
279
368
|
*/
|
|
280
369
|
private refreshTracked;
|
|
370
|
+
/** The second half of {@link refreshTracked}: adopt an evaluation's outcome. */
|
|
371
|
+
private applyTracked;
|
|
281
372
|
private reauthorizeAndResnapshot;
|
|
282
373
|
private patchFor;
|
|
283
374
|
/** Diff a fresh output against the subscription's previous one and adopt it. */
|
|
@@ -297,6 +388,25 @@ export declare class SyncEngine {
|
|
|
297
388
|
/** Queue a mutation; mutations of one client are applied in order. */
|
|
298
389
|
mutate(session: EngineSession, mutationId: number, name: string, args: unknown): Promise<MutationOutcome>;
|
|
299
390
|
private executeMutation;
|
|
391
|
+
/**
|
|
392
|
+
* The writer's subscriptions this mutation can have changed, recomputed
|
|
393
|
+
* now and sent as one `tx` with its `lastMutationId` — before the result
|
|
394
|
+
* (see {@link SyncEngineOptions.ackWithState}).
|
|
395
|
+
*
|
|
396
|
+
* Read in a snapshot opened after the commit, under the session's lock, so
|
|
397
|
+
* it is newer than anything the session was sent before and older than
|
|
398
|
+
* anything it is sent after. Each recomputed subscription remembers that
|
|
399
|
+
* snapshot: the batch that later carries this transaction finds it already
|
|
400
|
+
* seen and skips the subscription, and anything committed after it is in
|
|
401
|
+
* a later batch, which recomputes as usual.
|
|
402
|
+
*
|
|
403
|
+
* All or nothing. The `lastMutationId` tells the client to drop its
|
|
404
|
+
* optimistic copy of the mutation, so it may only go out when every
|
|
405
|
+
* subscription the write can reach is in the same message; a write to a
|
|
406
|
+
* permission table is left to the stream, whose invalidation path the
|
|
407
|
+
* data-only recomputation here does not replace.
|
|
408
|
+
*/
|
|
409
|
+
private ackWithData;
|
|
300
410
|
/**
|
|
301
411
|
* Move a scope's epoch on, once per change rather than once per reader.
|
|
302
412
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-engine.d.ts","sourceRoot":"","sources":["../../src/server/sync-engine.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,KAAK,aAAa,EAElB,KA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