pg-boss 12.28.1 → 12.30.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/dist/attorney.d.ts.map +1 -1
- package/dist/attorney.js +45 -3
- package/dist/boss.d.ts +7 -1
- package/dist/boss.d.ts.map +1 -1
- package/dist/boss.js +601 -15
- package/dist/cli.js +117 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -2
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +48 -2
- package/dist/migrationStore.d.ts.map +1 -1
- package/dist/migrationStore.js +161 -25
- package/dist/plans.d.ts +114 -2
- package/dist/plans.d.ts.map +1 -1
- package/dist/plans.js +692 -63
- package/dist/schema.json +56 -14
- package/dist/types.d.ts +102 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/attorney.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attorney.d.ts","sourceRoot":"","sources":["../src/attorney.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AAExC,QAAA,MAAM,MAAM;;;;CAIX,CAAA;
|
|
1
|
+
{"version":3,"file":"attorney.d.ts","sourceRoot":"","sources":["../src/attorney.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AAExC,QAAA,MAAM,MAAM;;;;CAIX,CAAA;AAkFD,iBAAS,iBAAiB,CAAE,MAAM,GAAE,GAAQ,QAc3C;AAgBD,iBAAS,mBAAmB,CAAE,KAAK,EAAE,MAAM,UAE1C;AAED,iBAAS,aAAa,CAAE,IAAI,EAAE,GAAG,GAAG,KAAK,CAAC,OAAO,CAgDhD;AAOD,iBAAS,eAAe,CAAE,IAAI,EAAE,GAAG,EAAE,EAAE,MAAc,EAAE;;CAAK,GAAG,KAAK,CAAC,OAAO,CA4D3E;AAED,iBAAS,mBAAmB,CAAE,MAAM,EAAE,GAAG,QAOxC;AAED,iBAAS,gBAAgB,CAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,QA2D/C;AA2GD,iBAAS,aAAa,CAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG;IAClD,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAA;IAClC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;CACjC,CA8BA;AAED,iBAAS,cAAc,CAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,QAQlD;AAED,iBAAS,SAAS,CAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC,0BAA0B,CAyB9F;AA4FD,iBAAS,wBAAwB,CAAE,IAAI,EAAE,MAAM,QAiC9C;AAED,iBAAS,eAAe,CAAE,IAAI,EAAE,MAAM,QAIrC;AAED,iBAAS,SAAS,CAAE,GAAG,EAAE,MAAM,QAI9B;AA+LD,OAAO,EACL,SAAS,EACT,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EAClB,CAAA"}
|
package/dist/attorney.js
CHANGED
|
@@ -16,7 +16,9 @@ const COMPATIBILITY_FLAGS = [
|
|
|
16
16
|
'noAdvisoryLocks',
|
|
17
17
|
'noCoveringIndexes',
|
|
18
18
|
'noListenNotify',
|
|
19
|
-
'noIndexProgressView'
|
|
19
|
+
'noIndexProgressView',
|
|
20
|
+
'noReindex',
|
|
21
|
+
'noMonitorVacuum'
|
|
20
22
|
];
|
|
21
23
|
// The single source of truth for backend presets, mirrored by test/testHelper.ts.
|
|
22
24
|
const BACKEND_PROFILES = {
|
|
@@ -33,7 +35,13 @@ const BACKEND_PROFILES = {
|
|
|
33
35
|
noListenNotify: true,
|
|
34
36
|
// Online DDL runs as a schema-change job, not the PG CONCURRENTLY path, and
|
|
35
37
|
// pg_stat_progress_create_index isn't available — so BAM can't use liveness-based reclaim.
|
|
36
|
-
noIndexProgressView: true
|
|
38
|
+
noIndexProgressView: true,
|
|
39
|
+
// REINDEX is rejected in either form — "CockroachDB does not require reindexing" with
|
|
40
|
+
// CONCURRENTLY, "unimplemented: this syntax" without — and the bloat check itself cannot run:
|
|
41
|
+
// there is no pg_relation_size(), and reltuples / relpages is an "unsupported binary
|
|
42
|
+
// operator: <float4> / <int4>".
|
|
43
|
+
noReindex: true,
|
|
44
|
+
noMonitorVacuum: true
|
|
37
45
|
}
|
|
38
46
|
},
|
|
39
47
|
yugabytedb: {
|
|
@@ -43,7 +51,12 @@ const BACKEND_PROFILES = {
|
|
|
43
51
|
noTablePartitioning: true,
|
|
44
52
|
// Index builds are a distributed backfill that pg_stat_progress_create_index doesn't reflect,
|
|
45
53
|
// so liveness would misread an in-flight build as dead. BAM falls back to the timeout instead.
|
|
46
|
-
noIndexProgressView: true
|
|
54
|
+
noIndexProgressView: true,
|
|
55
|
+
// "REINDEX not supported yet" with or without CONCURRENTLY, and DocDB compaction owns
|
|
56
|
+
// reclamation. The bloat check runs but can never match: relpages and pg_relation_size() are
|
|
57
|
+
// 0 for every relation.
|
|
58
|
+
noReindex: true,
|
|
59
|
+
noMonitorVacuum: true
|
|
47
60
|
}
|
|
48
61
|
},
|
|
49
62
|
// No noIndexProgressView: pg-boss keeps its tables coordinator-local (it never calls
|
|
@@ -366,6 +379,7 @@ function getConfig(value) {
|
|
|
366
379
|
config.migrate = ('migrate' in config) ? config.migrate : true;
|
|
367
380
|
config.createSchema = ('createSchema' in config) ? config.createSchema : true;
|
|
368
381
|
config.useListenNotify = ('useListenNotify' in config) ? config.useListenNotify : false;
|
|
382
|
+
config.reindex = ('reindex' in config) ? config.reindex : true;
|
|
369
383
|
resolveBackend(config);
|
|
370
384
|
applySchemaConfig(config);
|
|
371
385
|
applyOpsConfig(config);
|
|
@@ -414,6 +428,11 @@ function resolveBackend(config) {
|
|
|
414
428
|
if (config.__test__noIndexProgressView) {
|
|
415
429
|
config.noIndexProgressView = true;
|
|
416
430
|
}
|
|
431
|
+
// Test hook: exercise the detection-only reindex path (bloat is reported, never rebuilt) used by
|
|
432
|
+
// CockroachDB/YugabyteDB, on a plain Postgres instance.
|
|
433
|
+
if (config.__test__noReindex) {
|
|
434
|
+
config.noReindex = true;
|
|
435
|
+
}
|
|
417
436
|
}
|
|
418
437
|
// The character rules for the contents of a quoted name, as a predicate clause returned rather than
|
|
419
438
|
// thrown, so the bare-name path can ask whether quoting would actually fix a name before
|
|
@@ -553,6 +572,29 @@ function applyOpsConfig(config) {
|
|
|
553
572
|
assert(config.queueStatRetentionDays <= POLICY.MAX_RETENTION_DAYS, `configuration assert: queueStatRetentionDays cannot exceed ${POLICY.MAX_RETENTION_DAYS} days`);
|
|
554
573
|
}
|
|
555
574
|
config.queueStatRetentionDays = config.queueStatRetentionDays || 7;
|
|
575
|
+
validateReindexConfig(config);
|
|
576
|
+
validateVacuumMonitorConfig(config);
|
|
577
|
+
}
|
|
578
|
+
function validateReindexConfig(config) {
|
|
579
|
+
assert(!('reindex' in config) || typeof config.reindex === 'boolean' || (typeof config.reindex === 'object' && config.reindex !== null), 'configuration assert: reindex must be a boolean or an options object');
|
|
580
|
+
if (typeof config.reindex === 'object' && config.reindex !== null) {
|
|
581
|
+
const { minPages, maxEntriesPerPage, minSizeRatio, maxIndexBytes, force } = config.reindex;
|
|
582
|
+
assert(minPages === undefined || (Number.isInteger(minPages) && minPages >= 0), 'configuration assert: reindex.minPages must be an integer >= 0');
|
|
583
|
+
assert(maxEntriesPerPage === undefined || (typeof maxEntriesPerPage === 'number' && maxEntriesPerPage > 0), 'configuration assert: reindex.maxEntriesPerPage must be a number > 0');
|
|
584
|
+
assert(minSizeRatio === undefined || (typeof minSizeRatio === 'number' && minSizeRatio >= 0), 'configuration assert: reindex.minSizeRatio must be a number >= 0');
|
|
585
|
+
assert(maxIndexBytes === undefined || (Number.isInteger(maxIndexBytes) && maxIndexBytes > 0), 'configuration assert: reindex.maxIndexBytes must be an integer > 0');
|
|
586
|
+
// force belongs to an explicit supervise() call, not to a background timer that would then
|
|
587
|
+
// rebuild every job index on every interval.
|
|
588
|
+
assert(force === undefined || force === false, 'configuration assert: reindex.force cannot be set in constructor options — pass it to supervise()');
|
|
589
|
+
}
|
|
590
|
+
assert(!('reindexIntervalSeconds' in config) || config.reindexIntervalSeconds >= 1, 'configuration assert: reindexIntervalSeconds must be at least every second');
|
|
591
|
+
config.reindexIntervalSeconds = config.reindexIntervalSeconds || POLICY.MAX_EXPIRATION_HOURS * 60 * 60;
|
|
592
|
+
assert(config.reindexIntervalSeconds / 60 / 60 <= POLICY.MAX_EXPIRATION_HOURS, `configuration assert: reindexIntervalSeconds cannot exceed ${POLICY.MAX_EXPIRATION_HOURS} hours`);
|
|
593
|
+
}
|
|
594
|
+
function validateVacuumMonitorConfig(config) {
|
|
595
|
+
// A switch, not a threshold: the check derives its trigger from the server's own autovacuum
|
|
596
|
+
// settings and from measured dead tuples, so there is no number here for a caller to get wrong.
|
|
597
|
+
assert(!('monitorVacuum' in config) || typeof config.monitorVacuum === 'boolean', 'configuration assert: monitorVacuum must be a boolean');
|
|
556
598
|
}
|
|
557
599
|
function validateDeletionConfig(config) {
|
|
558
600
|
assert(!('deleteAfterSeconds' in config) || config.deleteAfterSeconds >= 0, 'configuration assert: deleteAfterSeconds must be at least 0 (0 disables deletion)');
|
package/dist/boss.d.ts
CHANGED
|
@@ -11,7 +11,13 @@ declare class Boss extends EventEmitter implements types.EventsMixin {
|
|
|
11
11
|
get maintaining(): boolean;
|
|
12
12
|
start(): Promise<void>;
|
|
13
13
|
stop(): Promise<void>;
|
|
14
|
-
supervise(value?: string | types.QueueResult[]): Promise<void>;
|
|
14
|
+
supervise(value?: string | types.QueueResult[], options?: types.SuperviseOptions): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* The REINDEX statements this instance would run, for installations where it cannot run them
|
|
17
|
+
* itself. Unlike the background pass this applies no ownership filter and no size cap unless one
|
|
18
|
+
* is passed — the commands are for an operator, who may run them as a different role.
|
|
19
|
+
*/
|
|
20
|
+
getReindexCommands(options?: types.ReindexOptions): Promise<string[]>;
|
|
15
21
|
}
|
|
16
22
|
export default Boss;
|
|
17
23
|
//# sourceMappingURL=boss.d.ts.map
|
package/dist/boss.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boss.d.ts","sourceRoot":"","sources":["../src/boss.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAGvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"boss.d.ts","sourceRoot":"","sources":["../src/boss.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAGvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAgHnC,cAAM,IAAK,SAAQ,YAAa,YAAW,KAAK,CAAC,WAAW;;IAsC1D,MAAM;;;MAAS;gBAGb,EAAE,EAAE,KAAK,CAAC,SAAS,EACnB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,KAAK,CAAC,0BAA0B;IAa1C,IAAI,WAAW,IAAK,OAAO,CAE1B;IAEK,KAAK;IAWL,IAAI;IA8FJ,SAAS,CAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,gBAAgB;IAwqBvF;;;;OAIG;IACG,kBAAkB,CAAE,OAAO,CAAC,EAAE,KAAK,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAwB7E;AAED,eAAe,IAAI,CAAA"}
|