@adonis-agora/durable 1.0.0-rc.5 → 1.0.0-rc.7
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/CHANGELOG.md +12 -0
- package/dist/src/dashboard/index.d.ts +1 -1
- package/dist/src/dashboard/index.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/stores/lucid.d.ts +8 -0
- package/dist/src/stores/lucid.d.ts.map +1 -1
- package/dist/src/stores/lucid.js +95 -12
- package/dist/src/stores/lucid.js.map +1 -1
- package/dist/src/transports/db.d.ts.map +1 -1
- package/dist/src/transports/db.js +13 -3
- package/dist/src/transports/db.js.map +1 -1
- package/dist/src/transports/queue.d.ts.map +1 -1
- package/dist/src/transports/queue.js +31 -1
- package/dist/src/transports/queue.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @adonis-agora/durable
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#494](https://github.com/DavideCarvalho/adonis-agora-durable/pull/494) [`ecf801b`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/ecf801bbede4ba7156d2f939797c52e6e59107e5) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - The db and queue transports no longer hand work to a handler that they claimed after shutdown began. A poll already in flight when `stop()`/`close()` was called could claim a row or pop a job that arrived meanwhile and run it while the pod was going away (or after a run-queue consumer's own `stop()` resolved). Every claiming loop now gives back what it claimed once the transport (or the loop) is stopping: the db transport's results, heartbeat, control and message loops (decisions, step events, start-run, run requests and replies, tenant events) and its run queue on a transport stop, and every queue-transport loop (tasks, results, heartbeats, control, run queue and the tenant protocol). The db task loop already did.
|
|
8
|
+
|
|
9
|
+
## 1.0.0-rc.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#489](https://github.com/DavideCarvalho/adonis-agora-durable/pull/489) [`001663d`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/001663da24ea2c92f503816c173bdc69e139c2cb) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - The Lucid store's Postgres hot path names its columns instead of `select *` / `returning *` (run reads and lease, checkpoint read, buffered signals and events). With `preparedStatements: true`, a `*` statement prepared before the schema added a column (another pod's boot during a rolling upgrade) failed with "cached plan must not change result type". The run and checkpoint reads list the later-wave columns the tables actually have, probed once per store and again after its own `ensureSchema`. `preparedStatements` stays off by default; the Lucid store docs now say when it is safe to turn on (direct Postgres, or PgBouncer 1.21+ with `max_prepared_statements > 0`) and how to check.
|
|
14
|
+
|
|
3
15
|
## 1.0.0-rc.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export declare const VERSION = "1.0.0-rc.
|
|
2
|
+
export declare const VERSION = "1.0.0-rc.7";
|
|
3
3
|
export type { AccessDeniedInfo, AccessDeniedPageOptions, AccessDeniedReason, } from './access_denied_page.js';
|
|
4
4
|
export { CONSOLE as ACCESS_DENIED_CONSOLE, escapeHtml, renderAccessDeniedPage, resolveAccessDeniedPage, } from './access_denied_page.js';
|
|
5
5
|
export type { AuthMode, DashboardAuthOptions, LoginHook, LoginOutcome, ResolvedDashboardAuth, SessionHook, SessionOutcome, } from './auth.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export const VERSION = '1.0.0-rc.
|
|
2
|
+
export const VERSION = '1.0.0-rc.7';
|
|
3
3
|
// The built-in "access denied" page (what a browser sees on a refused page navigation).
|
|
4
4
|
export { CONSOLE as ACCESS_DENIED_CONSOLE, escapeHtml, renderAccessDeniedPage, resolveAccessDeniedPage, } from './access_denied_page.js';
|
|
5
5
|
// Built-in `dashboardAuth` login screen (optional; opt-in via `config/durable_dashboard.ts`).
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export declare const VERSION = "1.0.0-rc.
|
|
2
|
+
export declare const VERSION = "1.0.0-rc.7";
|
|
3
3
|
export { configure } from '../configure.js';
|
|
4
4
|
export * from './admission.js';
|
|
5
5
|
export type { AdmissionContext, AdmissionFactory, RedisAdmissionConfig, } from './admissions/factory.js';
|
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Keep in sync with this package's `version` in package.json. */
|
|
2
|
-
export const VERSION = '1.0.0-rc.
|
|
2
|
+
export const VERSION = '1.0.0-rc.7';
|
|
3
3
|
// Re-export the configure hook from the package root so `node ace configure` finds it.
|
|
4
4
|
// AdonisJS imports the package MAIN and reads `configure` off the module namespace —
|
|
5
5
|
// the `./configure` subpath alone is never consulted.
|
|
@@ -63,6 +63,14 @@ export declare class LucidStateStore implements StateStore {
|
|
|
63
63
|
* under a (global) transaction. Resolved per call, like {@link client}.
|
|
64
64
|
*/
|
|
65
65
|
private hot;
|
|
66
|
+
/**
|
|
67
|
+
* The hot reads with explicit column lists: each table's base columns plus the later-wave ones it
|
|
68
|
+
* has, probed once (an older schema without them keeps working) and again after this store's own
|
|
69
|
+
* {@link ensureSchema}. A column another process adds later is not read until the next probe, and a
|
|
70
|
+
* statement already prepared keeps its shape.
|
|
71
|
+
*/
|
|
72
|
+
private hotReadStatements;
|
|
73
|
+
private hotReads;
|
|
66
74
|
/** Idempotently provision the durable tables (called on boot when `autoSchema` is on). */
|
|
67
75
|
ensureSchema(): Promise<void>;
|
|
68
76
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lucid.d.ts","sourceRoot":"","sources":["../../../src/stores/lucid.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC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IAEK,yBAAyB,CAC7B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAQrC;IAEK,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAU9F;IAEK,gBAAgB,CACpB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,EAAE,GACnC,OAAO,CAAC,MAAM,CAAC,CAejB;IAED,kGAAkG;IAC5F,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,EAAE,GACnC,OAAO,CAAC,OAAO,CAAC,CAYlB;IAED;;;;;OAKG;IACG,eAAe,CACnB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,GACpC,OAAO,CAAC,cAAc,EAAE,CAAC,CAsC3B;IAED;;;;;OAKG;IACG,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA6BvF;IAID;2GACuG;YACzF,iBAAiB;CAkBhC"}
|
package/dist/src/stores/lucid.js
CHANGED
|
@@ -62,9 +62,43 @@ export class LucidStateStore {
|
|
|
62
62
|
preparedStatements: this.options.preparedStatements,
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* The hot reads with explicit column lists: each table's base columns plus the later-wave ones it
|
|
67
|
+
* has, probed once (an older schema without them keeps working) and again after this store's own
|
|
68
|
+
* {@link ensureSchema}. A column another process adds later is not read until the next probe, and a
|
|
69
|
+
* statement already prepared keeps its shape.
|
|
70
|
+
*/
|
|
71
|
+
hotReadStatements;
|
|
72
|
+
hotReads(hot) {
|
|
73
|
+
this.hotReadStatements ??= hot
|
|
74
|
+
.rows(COLUMNS_PRESENT_SQL, [
|
|
75
|
+
[DURABLE_TABLES.runs, DURABLE_TABLES.checkpoints],
|
|
76
|
+
[...RUN_OPTIONAL_COLUMNS, ...CHECKPOINT_OPTIONAL_COLUMNS],
|
|
77
|
+
])
|
|
78
|
+
.then((rows) => {
|
|
79
|
+
const present = new Set(rows.map((r) => `${String(r.table_name)}.${String(r.column_name)}`));
|
|
80
|
+
const has = (table) => (c) => present.has(`${table}.${c}`);
|
|
81
|
+
const runCols = [
|
|
82
|
+
...RUN_BASE_COLUMNS,
|
|
83
|
+
...RUN_OPTIONAL_COLUMNS.filter(has(DURABLE_TABLES.runs)),
|
|
84
|
+
];
|
|
85
|
+
const checkpointCols = [
|
|
86
|
+
...CHECKPOINT_BASE_COLUMNS,
|
|
87
|
+
...CHECKPOINT_OPTIONAL_COLUMNS.filter(has(DURABLE_TABLES.checkpoints)),
|
|
88
|
+
];
|
|
89
|
+
return hotReadSql(runCols.map(quote).join(', '), checkpointCols.map(quote).join(', '));
|
|
90
|
+
})
|
|
91
|
+
.catch((error) => {
|
|
92
|
+
this.hotReadStatements = undefined; // a failed probe is retried, never cached
|
|
93
|
+
throw error;
|
|
94
|
+
});
|
|
95
|
+
return this.hotReadStatements;
|
|
96
|
+
}
|
|
65
97
|
/** Idempotently provision the durable tables (called on boot when `autoSchema` is on). */
|
|
66
98
|
async ensureSchema() {
|
|
67
99
|
await createDurableTables(this.db, this.connectionName, this.options.collation !== undefined ? { collation: this.options.collation } : {});
|
|
100
|
+
// The tables may have gained columns: the next hot read probes them again.
|
|
101
|
+
this.hotReadStatements = undefined;
|
|
68
102
|
}
|
|
69
103
|
// --- runs ---------------------------------------------------------------
|
|
70
104
|
/**
|
|
@@ -291,9 +325,10 @@ export class LucidStateStore {
|
|
|
291
325
|
async getRun(runId) {
|
|
292
326
|
const hot = this.hot();
|
|
293
327
|
if (hot) {
|
|
328
|
+
const sql = await this.hotReads(hot);
|
|
294
329
|
const rows = this.scopeNamespace === undefined
|
|
295
|
-
? await hot.rows(
|
|
296
|
-
: await hot.rows(
|
|
330
|
+
? await hot.rows(sql.get, [runId])
|
|
331
|
+
: await hot.rows(sql.getScoped, [runId, namespaceFilterValues(this.scopeNamespace)]);
|
|
297
332
|
return rows[0] ? rowToRun(rows[0]) : null;
|
|
298
333
|
}
|
|
299
334
|
const row = await this.fenced(this.client().from(DURABLE_TABLES.runs).where('id', runId)).first();
|
|
@@ -337,7 +372,7 @@ export class LucidStateStore {
|
|
|
337
372
|
async getCheckpoint(runId, seq) {
|
|
338
373
|
const hot = this.hot();
|
|
339
374
|
if (hot) {
|
|
340
|
-
const rows = await hot.rows(
|
|
375
|
+
const rows = await hot.rows((await this.hotReads(hot)).getCheckpoint, [runId, seq]);
|
|
341
376
|
return rows[0] ? rowToCheckpoint(rows[0]) : null;
|
|
342
377
|
}
|
|
343
378
|
const row = await this.client()
|
|
@@ -763,9 +798,10 @@ export class LucidStateStore {
|
|
|
763
798
|
async tryLockRunAndGet(runId, owner, leaseUntilMs, nowMs) {
|
|
764
799
|
const hot = this.hot();
|
|
765
800
|
if (hot) {
|
|
801
|
+
const sql = await this.hotReads(hot);
|
|
766
802
|
const rows = this.scopeNamespace === undefined
|
|
767
|
-
? await hot.rows(
|
|
768
|
-
: await hot.rows(
|
|
803
|
+
? await hot.rows(sql.lockAndGet, [owner, leaseUntilMs, runId, nowMs])
|
|
804
|
+
: await hot.rows(sql.lockAndGetScoped, [
|
|
769
805
|
owner,
|
|
770
806
|
leaseUntilMs,
|
|
771
807
|
runId,
|
|
@@ -1697,24 +1733,71 @@ function escapeLike(value) {
|
|
|
1697
1733
|
const RUNS_T = quote(DURABLE_TABLES.runs);
|
|
1698
1734
|
const CHECKPOINTS_T = quote(DURABLE_TABLES.checkpoints);
|
|
1699
1735
|
const CHECKPOINT_LIST = CHECKPOINT_COLUMNS_BUT_INPUT.map(quote).join(', ');
|
|
1700
|
-
|
|
1701
|
-
|
|
1736
|
+
/**
|
|
1737
|
+
* The runs columns every schema has. The hot path names its columns instead of `*`: a named prepared
|
|
1738
|
+
* statement's result type is fixed when it is parsed, so a `*` statement fails ("cached plan must
|
|
1739
|
+
* not change result type") once a column is added under it — another pod's `ensureSchema` during a
|
|
1740
|
+
* rolling upgrade.
|
|
1741
|
+
*/
|
|
1742
|
+
const RUN_BASE_COLUMNS = [
|
|
1743
|
+
'id',
|
|
1744
|
+
'workflow',
|
|
1745
|
+
'workflow_version',
|
|
1746
|
+
'status',
|
|
1747
|
+
'namespace',
|
|
1748
|
+
'input',
|
|
1749
|
+
'output',
|
|
1750
|
+
'error',
|
|
1751
|
+
'wake_at',
|
|
1752
|
+
'locked_by',
|
|
1753
|
+
'locked_until',
|
|
1754
|
+
'recovery_attempts',
|
|
1755
|
+
'tags',
|
|
1756
|
+
'search_attributes',
|
|
1757
|
+
'priority',
|
|
1758
|
+
'created_at',
|
|
1759
|
+
'updated_at',
|
|
1760
|
+
];
|
|
1761
|
+
/** Runs columns that arrived in later schema waves: read only when the table has them. */
|
|
1762
|
+
const RUN_OPTIONAL_COLUMNS = ['origin', 'awaiting_decision_task_id', 'wake_requested_at'];
|
|
1763
|
+
/** Checkpoint columns that arrived in later schema waves: read only when the table has them. */
|
|
1764
|
+
const CHECKPOINT_OPTIONAL_COLUMNS = [
|
|
1765
|
+
'queue',
|
|
1766
|
+
'parallel_group',
|
|
1767
|
+
'last_heartbeat_at',
|
|
1768
|
+
'heartbeat_progress',
|
|
1769
|
+
];
|
|
1770
|
+
const CHECKPOINT_BASE_COLUMNS = [
|
|
1771
|
+
...CHECKPOINT_COLUMNS_BUT_INPUT.filter((c) => !CHECKPOINT_OPTIONAL_COLUMNS.includes(c)),
|
|
1772
|
+
'input',
|
|
1773
|
+
];
|
|
1774
|
+
const COLUMNS_PRESENT_SQL = `select "table_name", "column_name" from information_schema.columns where "table_schema" = current_schema() and "table_name" = any(?) and "column_name" = any(?)`;
|
|
1775
|
+
const BUFFERED_SIGNAL_LIST = ['id', 'token', 'payload'].map(quote).join(', ');
|
|
1776
|
+
const BUFFERED_EVENT_LIST = ['id', 'name', 'payload', 'published_at'].map(quote).join(', ');
|
|
1777
|
+
/** {@link HotReads} for the runs column list `cols` and checkpoints column list `checkpointCols`
|
|
1778
|
+
* (each quoted, comma-joined). */
|
|
1779
|
+
function hotReadSql(cols, checkpointCols) {
|
|
1780
|
+
return {
|
|
1781
|
+
getCheckpoint: shapedSql(`checkpoint-get:${checkpointCols}`, () => `select ${checkpointCols} from ${CHECKPOINTS_T} where "run_id" = ? and "seq" = ? limit 1`),
|
|
1782
|
+
get: shapedSql(`run-get:${cols}`, () => `select ${cols} from ${RUNS_T} where "id" = ? limit 1`),
|
|
1783
|
+
getScoped: shapedSql(`run-get-scoped:${cols}`, () => `select ${cols} from ${RUNS_T} where "id" = ? and "namespace" = any(?) limit 1`),
|
|
1784
|
+
lockAndGet: shapedSql(`run-lock:${cols}`, () => `update ${RUNS_T} set "locked_by" = ?, "locked_until" = ? where "id" = ? and ("locked_until" is null or "locked_until" <= ?) returning ${cols}`),
|
|
1785
|
+
lockAndGetScoped: shapedSql(`run-lock-scoped:${cols}`, () => `update ${RUNS_T} set "locked_by" = ?, "locked_until" = ? where "id" = ? and ("locked_until" is null or "locked_until" <= ?) and "namespace" = any(?) returning ${cols}`),
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1702
1788
|
const RUN_IN_STATUSES_SQL = `select 1 from ${RUNS_T} where "id" = ? and "status" = any(?) limit 1`;
|
|
1703
|
-
const LOCK_AND_GET_SQL = `update ${RUNS_T} set "locked_by" = ?, "locked_until" = ? where "id" = ? and ("locked_until" is null or "locked_until" <= ?) returning *`;
|
|
1704
|
-
const LOCK_AND_GET_SCOPED_SQL = `update ${RUNS_T} set "locked_by" = ?, "locked_until" = ? where "id" = ? and ("locked_until" is null or "locked_until" <= ?) and "namespace" = any(?) returning *`;
|
|
1705
1789
|
const RELEASE_LOCK_SQL = `update ${RUNS_T} set "locked_by" = null, "locked_until" = null where "id" = ?`;
|
|
1706
1790
|
const RELEASE_OWN_LOCK_SQL = `update ${RUNS_T} set "locked_by" = null, "locked_until" = null where "id" = ? and "locked_by" = ?`;
|
|
1707
1791
|
const RELEASE_UNLESS_WAKE_SQL = `update ${RUNS_T} set "locked_by" = null, "locked_until" = null where "id" = ? and "locked_by" = ? and "wake_requested_at" is null`;
|
|
1708
1792
|
const LOCKED_BY_SQL = `select "locked_by" from ${RUNS_T} where "id" = ? limit 1`;
|
|
1709
1793
|
const RENEW_LOCK_SQL = `update ${RUNS_T} set "locked_until" = ? where "id" = ? and "locked_by" = ?`;
|
|
1710
1794
|
const DELETE_ATTRIBUTES_SQL = `delete from ${quote(DURABLE_TABLES.attributes)} where "run_id" = ?`;
|
|
1711
|
-
const GET_CHECKPOINT_SQL = `select * from ${CHECKPOINTS_T} where "run_id" = ? and "seq" = ? limit 1`;
|
|
1712
1795
|
const CHECKPOINTS_FOR_SETTLE_SQL = `select ${CHECKPOINT_LIST} from ${CHECKPOINTS_T} where "run_id" = ? and "seq" = any(?)`;
|
|
1713
1796
|
const REPLAY_CHECKPOINTS_SQL = `select ${CHECKPOINT_LIST} from ${CHECKPOINTS_T} where "run_id" = ? order by "seq" asc`;
|
|
1714
1797
|
const COUNT_CHECKPOINTS_SQL = `select count(*) as "count" from ${CHECKPOINTS_T} where "run_id" = ? and "seq" >= ? and "seq" <= ? and "status" = any(?)`;
|
|
1715
|
-
const OLDEST_BUFFERED_SIGNAL_SQL = `select
|
|
1798
|
+
const OLDEST_BUFFERED_SIGNAL_SQL = `select ${BUFFERED_SIGNAL_LIST} from ${quote(DURABLE_TABLES.bufferedSignals)} where "token" = ? order by "id" asc limit 1`;
|
|
1716
1799
|
const DELETE_BUFFERED_SIGNAL_SQL = `delete from ${quote(DURABLE_TABLES.bufferedSignals)} where "id" = ?`;
|
|
1717
|
-
const BUFFERED_EVENTS_SQL = `select
|
|
1800
|
+
const BUFFERED_EVENTS_SQL = `select ${BUFFERED_EVENT_LIST} from ${quote(DURABLE_TABLES.bufferedEvents)} where "name" = ? order by "published_at" asc limit ?`;
|
|
1718
1801
|
/** Statements whose column list is the row's own keys, built once per key set. */
|
|
1719
1802
|
const shaped = new Map();
|
|
1720
1803
|
function shapedSql(key, build) {
|