@dbos-inc/dbos-sdk 2.1.9-preview → 2.1.12-preview
Sign up to get free protection for your applications and to get access to all the features.
- package/compose.yaml +19 -0
- package/dist/src/dbos-executor.d.ts +0 -4
- package/dist/src/dbos-executor.d.ts.map +1 -1
- package/dist/src/dbos-executor.js +86 -75
- package/dist/src/dbos-executor.js.map +1 -1
- package/dist/src/procedure.d.ts +1 -2
- package/dist/src/procedure.d.ts.map +1 -1
- package/dist/src/procedure.js.map +1 -1
- package/dist/src/step.d.ts +1 -2
- package/dist/src/step.d.ts.map +1 -1
- package/dist/src/step.js.map +1 -1
- package/dist/src/transaction.d.ts +1 -2
- package/dist/src/transaction.d.ts.map +1 -1
- package/dist/src/transaction.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/debugger/debug_workflow.d.ts +0 -56
- package/dist/src/debugger/debug_workflow.d.ts.map +0 -1
- package/dist/src/debugger/debug_workflow.js +0 -388
- package/dist/src/debugger/debug_workflow.js.map +0 -1
package/compose.yaml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
version: "3.7"
|
2
|
+
services:
|
3
|
+
broker:
|
4
|
+
image: bitnami/kafka:latest
|
5
|
+
hostname: broker
|
6
|
+
container_name: broker
|
7
|
+
ports:
|
8
|
+
- '9092:9092'
|
9
|
+
- '29093:29093'
|
10
|
+
- '19092:19092'
|
11
|
+
environment:
|
12
|
+
KAFKA_CFG_NODE_ID: 1
|
13
|
+
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
|
14
|
+
KAFKA_CFG_ADVERTISED_LISTENERS: 'PLAINTEXT_HOST://localhost:9092,PLAINTEXT://broker:19092'
|
15
|
+
KAFKA_CFG_PROCESS_ROLES: 'broker,controller'
|
16
|
+
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: '1@broker:29093'
|
17
|
+
KAFKA_CFG_LISTENERS: 'CONTROLLER://:29093,PLAINTEXT_HOST://:9092,PLAINTEXT://:19092'
|
18
|
+
KAFKA_CFG_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
|
19
|
+
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
|
@@ -127,10 +127,6 @@ export declare class DBOSExecutor implements DBOSExecutorContext {
|
|
127
127
|
getProcedureInfo<T extends unknown[], R>(pf: StoredProcedure<T, R>): ProcedureRegInfo | undefined;
|
128
128
|
workflow<T extends unknown[], R>(wf: Workflow<T, R>, params: InternalWorkflowParams, ...args: T): Promise<WorkflowHandle<R>>;
|
129
129
|
internalWorkflow<T extends unknown[], R>(wf: Workflow<T, R>, params: InternalWorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
|
130
|
-
/**
|
131
|
-
* DEBUG MODE workflow execution, skipping all the recording
|
132
|
-
*/
|
133
|
-
debugWorkflow<T extends unknown[], R>(wf: Workflow<T, R>, params: WorkflowParams, callerUUID?: string, callerFunctionID?: number, ...args: T): Promise<WorkflowHandle<R>>;
|
134
130
|
flushResultBuffer(client: UserDatabaseClient, resultBuffer: Map<number, BufferedResult>, workflowUUID: string): Promise<void>;
|
135
131
|
transaction<T extends unknown[], R>(txn: Transaction<T, R>, params: WorkflowParams, ...args: T): Promise<R>;
|
136
132
|
callTransactionFunction<T extends unknown[], R>(txn: Transaction<T, R>, clsinst: ConfiguredInstance | null, wfCtx: WorkflowContextImpl, ...args: T): Promise<R>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dbos-executor.d.ts","sourceRoot":"","sources":["../../src/dbos-executor.ts"],"names":[],"mappings":";AAGA,OAAO,EAEL,QAAQ,EACR,cAAc,EAEd,cAAc,EACd,cAAc,EAEd,mBAAmB,EACnB,cAAc,EAEd,cAAc,EAEd,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAkB,WAAW,EAAE,i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,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIzE,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE;IAS3C,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA4BzG;;;OAGG;IACG,uBAAuB,CAAC,WAAW,GAAE,MAAM,EAAc,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;IA2B9F,wBAAwB;IA6BxB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,GAAE,OAAe,GAAG,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAmF9G,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAGzG,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;IAGzF,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAgB9F;;OAEG;IACG,oBAAoB;IAQpB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;IAqDhD,qBAAqB;IAcrB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;CAQ3D"}
|
@@ -20,7 +20,6 @@ const decorators_1 = require("./decorators");
|
|
20
20
|
const api_1 = require("@opentelemetry/api");
|
21
21
|
const knex_1 = __importDefault(require("knex"));
|
22
22
|
const context_1 = require("./context");
|
23
|
-
const debug_workflow_1 = require("./debugger/debug_workflow");
|
24
23
|
const serialize_error_1 = require("serialize-error");
|
25
24
|
const utils_1 = require("./utils");
|
26
25
|
const node_path_1 = __importDefault(require("node:path"));
|
@@ -483,9 +482,6 @@ class DBOSExecutor {
|
|
483
482
|
}
|
484
483
|
// TODO: getProcedureInfoByNames??
|
485
484
|
async workflow(wf, params, ...args) {
|
486
|
-
if (this.debugMode) {
|
487
|
-
return this.debugWorkflow(wf, params, undefined, undefined, ...args);
|
488
|
-
}
|
489
485
|
return this.internalWorkflow(wf, params, undefined, undefined, ...args);
|
490
486
|
}
|
491
487
|
// If callerUUID and functionID are set, it means the workflow is invoked from within a workflow.
|
@@ -529,35 +525,57 @@ class DBOSExecutor {
|
|
529
525
|
if ((wCtxt.tempWfOperationType !== TempWorkflowType.transaction
|
530
526
|
&& wCtxt.tempWfOperationType !== TempWorkflowType.procedure)
|
531
527
|
|| params.queueName !== undefined) {
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
528
|
+
if (this.debugMode) {
|
529
|
+
const wfStatus = await this.systemDatabase.getWorkflowStatus(workflowUUID);
|
530
|
+
const wfInputs = await this.systemDatabase.getWorkflowInputs(workflowUUID);
|
531
|
+
if (!wfStatus || !wfInputs) {
|
532
|
+
throw new error_1.DBOSDebuggerError(`Failed to find inputs for workflow UUID ${workflowUUID}`);
|
533
|
+
}
|
534
|
+
// Make sure we use the same input.
|
535
|
+
if (utils_1.DBOSJSON.stringify(args) !== utils_1.DBOSJSON.stringify(wfInputs)) {
|
536
|
+
throw new error_1.DBOSDebuggerError(`Detected different inputs for workflow UUID ${workflowUUID}.\n Received: ${utils_1.DBOSJSON.stringify(args)}\n Original: ${utils_1.DBOSJSON.stringify(wfInputs)}`);
|
537
|
+
}
|
538
|
+
status = wfStatus.status;
|
539
|
+
}
|
540
|
+
else {
|
541
|
+
// TODO: Make this transactional (and with the queue step below)
|
542
|
+
const ires = await this.systemDatabase.initWorkflowStatus(internalStatus, args);
|
543
|
+
args = ires.args;
|
544
|
+
status = ires.status;
|
545
|
+
await (0, debugpoint_1.debugTriggerPoint)(debugpoint_1.DEBUG_TRIGGER_WORKFLOW_ENQUEUE);
|
546
|
+
}
|
537
547
|
}
|
538
548
|
const runWorkflow = async () => {
|
539
549
|
let result;
|
540
550
|
// Execute the workflow.
|
541
551
|
try {
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
else {
|
548
|
-
cresult = await wf.call(params.configuredInstance, ...args);
|
549
|
-
}
|
552
|
+
const callResult = await (0, context_1.runWithWorkflowContext)(wCtxt, async () => {
|
553
|
+
const callPromise = passContext
|
554
|
+
? wf.call(params.configuredInstance, wCtxt, ...args)
|
555
|
+
: wf.call(params.configuredInstance, ...args);
|
556
|
+
return await callPromise;
|
550
557
|
});
|
551
|
-
|
558
|
+
if (this.debugMode) {
|
559
|
+
const recordedResult = await this.systemDatabase.getWorkflowResult(workflowUUID);
|
560
|
+
if (utils_1.DBOSJSON.stringify(callResult) !== utils_1.DBOSJSON.stringify(recordedResult)) {
|
561
|
+
this.logger.error(`Detect different output for the workflow UUID ${workflowUUID}!\n Received: ${utils_1.DBOSJSON.stringify(callResult)}\n Original: ${utils_1.DBOSJSON.stringify(recordedResult)}`);
|
562
|
+
}
|
563
|
+
result = recordedResult;
|
564
|
+
}
|
565
|
+
else {
|
566
|
+
result = callResult;
|
567
|
+
}
|
552
568
|
internalStatus.output = result;
|
553
569
|
internalStatus.status = workflow_1.StatusString.SUCCESS;
|
554
|
-
if (internalStatus.queueName) {
|
570
|
+
if (internalStatus.queueName && !this.debugMode) {
|
555
571
|
// Now... the workflow isn't certainly done.
|
556
572
|
// But waiting this long is for concurrency control anyway,
|
557
573
|
// so it is probably done enough.
|
558
574
|
await this.systemDatabase.dequeueWorkflow(workflowUUID, this.#getQueueByName(internalStatus.queueName));
|
559
575
|
}
|
560
|
-
this.
|
576
|
+
if (!this.debugMode) {
|
577
|
+
this.systemDatabase.bufferWorkflowOutput(workflowUUID, internalStatus);
|
578
|
+
}
|
561
579
|
wCtxt.span.setStatus({ code: api_1.SpanStatusCode.OK });
|
562
580
|
}
|
563
581
|
catch (err) {
|
@@ -578,10 +596,12 @@ class DBOSExecutor {
|
|
578
596
|
}
|
579
597
|
internalStatus.error = utils_1.DBOSJSON.stringify((0, serialize_error_1.serializeError)(e));
|
580
598
|
internalStatus.status = workflow_1.StatusString.ERROR;
|
581
|
-
if (internalStatus.queueName) {
|
599
|
+
if (internalStatus.queueName && !this.debugMode) {
|
582
600
|
await this.systemDatabase.dequeueWorkflow(workflowUUID, this.#getQueueByName(internalStatus.queueName));
|
583
601
|
}
|
584
|
-
|
602
|
+
if (!this.debugMode) {
|
603
|
+
await this.systemDatabase.recordWorkflowError(workflowUUID, internalStatus);
|
604
|
+
}
|
585
605
|
// TODO: Log errors, but not in the tests when they're expected.
|
586
606
|
wCtxt.span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: e.message });
|
587
607
|
throw err;
|
@@ -593,7 +613,9 @@ class DBOSExecutor {
|
|
593
613
|
|| wCtxt.tempWfOperationType === TempWorkflowType.procedure) {
|
594
614
|
// For single-transaction workflows, asynchronously record inputs.
|
595
615
|
// We must buffer inputs after workflow status is buffered/flushed because workflow_inputs table has a foreign key reference to the workflow_status table.
|
596
|
-
this.
|
616
|
+
if (!this.debugMode) {
|
617
|
+
this.systemDatabase.bufferWorkflowInputs(workflowUUID, args);
|
618
|
+
}
|
597
619
|
}
|
598
620
|
}
|
599
621
|
// Asynchronously flush the result buffer.
|
@@ -602,7 +624,7 @@ class DBOSExecutor {
|
|
602
624
|
}
|
603
625
|
return result;
|
604
626
|
};
|
605
|
-
if (status !== 'SUCCESS' && status !== 'ERROR' && (params.queueName === undefined || params.executeWorkflow)) {
|
627
|
+
if (this.debugMode || (status !== 'SUCCESS' && status !== 'ERROR' && (params.queueName === undefined || params.executeWorkflow))) {
|
606
628
|
const workflowPromise = runWorkflow();
|
607
629
|
// Need to await for the workflow and capture errors.
|
608
630
|
const awaitWorkflowPromise = workflowPromise
|
@@ -618,7 +640,7 @@ class DBOSExecutor {
|
|
618
640
|
return new workflow_1.InvokedHandle(this.systemDatabase, workflowPromise, workflowUUID, wf.name, callerUUID, callerFunctionID);
|
619
641
|
}
|
620
642
|
else {
|
621
|
-
if (params.queueName && status === 'ENQUEUED') {
|
643
|
+
if (params.queueName && status === 'ENQUEUED' && !this.debugMode) {
|
622
644
|
await this.systemDatabase.enqueueWorkflow(workflowUUID, this.#getQueueByName(params.queueName));
|
623
645
|
}
|
624
646
|
return new workflow_1.RetrievedHandle(this.systemDatabase, workflowUUID, callerUUID, callerFunctionID);
|
@@ -630,47 +652,6 @@ class DBOSExecutor {
|
|
630
652
|
throw new error_1.DBOSNotRegisteredError(`Workflow queue '${name}' does is not defined.`);
|
631
653
|
return q;
|
632
654
|
}
|
633
|
-
/**
|
634
|
-
* DEBUG MODE workflow execution, skipping all the recording
|
635
|
-
*/
|
636
|
-
async debugWorkflow(wf, params, callerUUID, callerFunctionID, ...args) {
|
637
|
-
// In debug mode, we must have a specific workflow UUID.
|
638
|
-
if (!params.workflowUUID) {
|
639
|
-
throw new error_1.DBOSDebuggerError("Workflow UUID not found!");
|
640
|
-
}
|
641
|
-
const workflowUUID = params.workflowUUID;
|
642
|
-
const wInfo = this.getWorkflowInfo(wf);
|
643
|
-
if (wInfo === undefined) {
|
644
|
-
throw new error_1.DBOSDebuggerError("Workflow unregistered! " + wf.name);
|
645
|
-
}
|
646
|
-
const wConfig = wInfo.config;
|
647
|
-
const wCtxt = new debug_workflow_1.WorkflowContextDebug(this, params.parentCtx, workflowUUID, wConfig, wf.name);
|
648
|
-
// A workflow must have run before.
|
649
|
-
const wfStatus = await this.systemDatabase.getWorkflowStatus(workflowUUID);
|
650
|
-
const recordedInputs = await this.systemDatabase.getWorkflowInputs(workflowUUID);
|
651
|
-
if (!wfStatus || !recordedInputs) {
|
652
|
-
throw new error_1.DBOSDebuggerError("Workflow status or inputs not found! UUID: " + workflowUUID);
|
653
|
-
}
|
654
|
-
// Make sure we use the same input.
|
655
|
-
if (utils_1.DBOSJSON.stringify(args) !== utils_1.DBOSJSON.stringify(recordedInputs)) {
|
656
|
-
throw new error_1.DBOSDebuggerError(`Detect different input for the workflow UUID ${workflowUUID}!\n Received: ${utils_1.DBOSJSON.stringify(args)}\n Original: ${utils_1.DBOSJSON.stringify(recordedInputs)}`);
|
657
|
-
}
|
658
|
-
const workflowPromise = (0, context_1.runWithWorkflowContext)(wCtxt, async () => {
|
659
|
-
return await wf.call(params.configuredInstance, wCtxt, ...args)
|
660
|
-
.then(async (result) => {
|
661
|
-
// Check if the result is the same.
|
662
|
-
const recordedResult = await this.systemDatabase.getWorkflowResult(workflowUUID);
|
663
|
-
if (result === undefined && !recordedResult) {
|
664
|
-
return result;
|
665
|
-
}
|
666
|
-
if (utils_1.DBOSJSON.stringify(result) !== utils_1.DBOSJSON.stringify(recordedResult)) {
|
667
|
-
this.logger.error(`Detect different output for the workflow UUID ${workflowUUID}!\n Received: ${utils_1.DBOSJSON.stringify(result)}\n Original: ${utils_1.DBOSJSON.stringify(recordedResult)}`);
|
668
|
-
}
|
669
|
-
return recordedResult; // Always return the recorded result.
|
670
|
-
});
|
671
|
-
});
|
672
|
-
return new workflow_1.InvokedHandle(this.systemDatabase, workflowPromise, workflowUUID, wf.name, callerUUID, callerFunctionID);
|
673
|
-
}
|
674
655
|
/**
|
675
656
|
* Retrieve the transaction snapshot information of the current transaction
|
676
657
|
*/
|
@@ -711,7 +692,10 @@ class DBOSExecutor {
|
|
711
692
|
/**
|
712
693
|
* Write a operation's output to the database.
|
713
694
|
*/
|
714
|
-
|
695
|
+
async #recordOutput(query, workflowUUID, funcID, txnSnapshot, output, isKeyConflict) {
|
696
|
+
if (this.debugMode) {
|
697
|
+
throw new error_1.DBOSDebuggerError("Cannot record output in debug mode.");
|
698
|
+
}
|
715
699
|
try {
|
716
700
|
const serialOutput = utils_1.DBOSJSON.stringify(output);
|
717
701
|
const rows = await query("INSERT INTO dbos.transaction_outputs (workflow_uuid, function_id, output, txn_id, txn_snapshot, created_at) VALUES ($1, $2, $3, (select pg_current_xact_id_if_assigned()::text), $4, $5) RETURNING txn_id;", [workflowUUID, funcID, serialOutput, txnSnapshot, Date.now()]);
|
@@ -730,7 +714,10 @@ class DBOSExecutor {
|
|
730
714
|
/**
|
731
715
|
* Record an error in an operation to the database.
|
732
716
|
*/
|
733
|
-
|
717
|
+
async #recordError(query, workflowUUID, funcID, txnSnapshot, err, isKeyConflict) {
|
718
|
+
if (this.debugMode) {
|
719
|
+
throw new error_1.DBOSDebuggerError("Cannot record error in debug mode.");
|
720
|
+
}
|
734
721
|
try {
|
735
722
|
const serialErr = utils_1.DBOSJSON.stringify((0, serialize_error_1.serializeError)(err));
|
736
723
|
await query("INSERT INTO dbos.transaction_outputs (workflow_uuid, function_id, error, txn_id, txn_snapshot, created_at) VALUES ($1, $2, $3, null, $4, $5) RETURNING txn_id;", [workflowUUID, funcID, serialErr, txnSnapshot, Date.now()]);
|
@@ -754,6 +741,9 @@ class DBOSExecutor {
|
|
754
741
|
if (funcIDs.length === 0) {
|
755
742
|
return;
|
756
743
|
}
|
744
|
+
if (this.debugMode) {
|
745
|
+
throw new error_1.DBOSDebuggerError("Cannot flush result buffer in debug mode.");
|
746
|
+
}
|
757
747
|
funcIDs.sort();
|
758
748
|
try {
|
759
749
|
let sqlStmt = "INSERT INTO dbos.transaction_outputs (workflow_uuid, function_id, output, error, txn_id, txn_snapshot, created_at) VALUES ";
|
@@ -848,6 +838,9 @@ class DBOSExecutor {
|
|
848
838
|
const func = (sql, args) => this.userDatabase.queryWithClient(client, sql, ...args);
|
849
839
|
txn_snapshot = await DBOSExecutor.#retrieveSnapshot(func);
|
850
840
|
}
|
841
|
+
if (this.debugMode) {
|
842
|
+
throw new error_1.DBOSDebuggerError(`Failed to find inputs for workflow UUID ${workflowUUID}`);
|
843
|
+
}
|
851
844
|
// For non-read-only transactions, flush the result buffer.
|
852
845
|
if (!readOnly) {
|
853
846
|
await this.flushResultBuffer(client, wfCtx.resultBuffer, wfCtx.workflowUUID);
|
@@ -880,7 +873,7 @@ class DBOSExecutor {
|
|
880
873
|
try {
|
881
874
|
// Synchronously record the output of write transactions and obtain the transaction ID.
|
882
875
|
const func = (sql, args) => this.userDatabase.queryWithClient(client, sql, ...args);
|
883
|
-
const pg_txn_id = await
|
876
|
+
const pg_txn_id = await this.#recordOutput(func, wfCtx.workflowUUID, funcId, txn_snapshot, result, (error) => this.userDatabase.isKeyConflictError(error));
|
884
877
|
tCtxt.span.setAttribute("pg_txn_id", pg_txn_id);
|
885
878
|
wfCtx.resultBuffer.clear();
|
886
879
|
}
|
@@ -903,6 +896,9 @@ class DBOSExecutor {
|
|
903
896
|
return result;
|
904
897
|
}
|
905
898
|
catch (err) {
|
899
|
+
if (this.debugMode) {
|
900
|
+
throw err;
|
901
|
+
}
|
906
902
|
if (this.userDatabase.isRetriableTransactionError(err)) {
|
907
903
|
// serialization_failure in PostgreSQL
|
908
904
|
span.addEvent("TXN SERIALIZATION FAILURE", { "retryWaitMillis": retryWaitMillis }, performance.now());
|
@@ -917,7 +913,7 @@ class DBOSExecutor {
|
|
917
913
|
await this.userDatabase.transaction(async (client) => {
|
918
914
|
await this.flushResultBuffer(client, wfCtx.resultBuffer, wfCtx.workflowUUID);
|
919
915
|
const func = (sql, args) => this.userDatabase.queryWithClient(client, sql, ...args);
|
920
|
-
await
|
916
|
+
await this.#recordError(func, wfCtx.workflowUUID, funcId, txn_snapshot, e, (error) => this.userDatabase.isKeyConflictError(error));
|
921
917
|
}, { isolationLevel: transaction_1.IsolationLevel.ReadCommitted });
|
922
918
|
wfCtx.resultBuffer.clear();
|
923
919
|
span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: e.message });
|
@@ -944,7 +940,7 @@ class DBOSExecutor {
|
|
944
940
|
if (procInfo === undefined) {
|
945
941
|
throw new error_1.DBOSNotRegisteredError(proc.name);
|
946
942
|
}
|
947
|
-
const executeLocally = procInfo.config.executeLocally ?? false;
|
943
|
+
const executeLocally = this.debugMode || (procInfo.config.executeLocally ?? false);
|
948
944
|
const funcId = wfCtx.functionIDGetIncrement();
|
949
945
|
const span = this.tracer.startSpan(proc.name, {
|
950
946
|
operationUUID: wfCtx.workflowUUID,
|
@@ -997,6 +993,9 @@ class DBOSExecutor {
|
|
997
993
|
const func = (sql, args) => this.procedurePool.query(sql, args).then(v => v.rows);
|
998
994
|
txn_snapshot = await DBOSExecutor.#retrieveSnapshot(func);
|
999
995
|
}
|
996
|
+
if (this.debugMode) {
|
997
|
+
throw new error_1.DBOSDebuggerError(`Failed to find inputs for workflow UUID ${wfCtx.workflowUUID}`);
|
998
|
+
}
|
1000
999
|
// For non-read-only transactions, flush the result buffer.
|
1001
1000
|
if (!readOnly) {
|
1002
1001
|
await this.#flushResultBufferProc(client, wfCtx.resultBuffer, wfCtx.workflowUUID);
|
@@ -1026,7 +1025,7 @@ class DBOSExecutor {
|
|
1026
1025
|
else {
|
1027
1026
|
// Synchronously record the output of write transactions and obtain the transaction ID.
|
1028
1027
|
const func = (sql, args) => client.query(sql, args).then(v => v.rows);
|
1029
|
-
const pg_txn_id = await
|
1028
|
+
const pg_txn_id = await this.#recordOutput(func, wfCtx.workflowUUID, funcId, txn_snapshot, result, user_database_1.pgNodeIsKeyConflictError);
|
1030
1029
|
// const pg_txn_id = await wfCtx.recordOutputProc<R>(client, funcId, txn_snapshot, result);
|
1031
1030
|
ctxt.span.setAttribute("pg_txn_id", pg_txn_id);
|
1032
1031
|
wfCtx.resultBuffer.clear();
|
@@ -1053,12 +1052,12 @@ class DBOSExecutor {
|
|
1053
1052
|
await this.invokeStoredProcFunction(async (client) => {
|
1054
1053
|
await this.#flushResultBufferProc(client, wfCtx.resultBuffer, wfCtx.workflowUUID);
|
1055
1054
|
const func = (sql, args) => client.query(sql, args).then(v => v.rows);
|
1056
|
-
await
|
1055
|
+
await this.#recordError(func, wfCtx.workflowUUID, funcId, txn_snapshot, e, user_database_1.pgNodeIsKeyConflictError);
|
1057
1056
|
}, { isolationLevel: transaction_1.IsolationLevel.ReadCommitted });
|
1058
1057
|
await this.userDatabase.transaction(async (client) => {
|
1059
1058
|
await this.flushResultBuffer(client, wfCtx.resultBuffer, wfCtx.workflowUUID);
|
1060
1059
|
const func = (sql, args) => this.userDatabase.queryWithClient(client, sql, ...args);
|
1061
|
-
await
|
1060
|
+
await this.#recordError(func, wfCtx.workflowUUID, funcId, txn_snapshot, e, (error) => this.userDatabase.isKeyConflictError(error));
|
1062
1061
|
}, { isolationLevel: transaction_1.IsolationLevel.ReadCommitted });
|
1063
1062
|
wfCtx.resultBuffer.clear();
|
1064
1063
|
throw err;
|
@@ -1066,6 +1065,9 @@ class DBOSExecutor {
|
|
1066
1065
|
}
|
1067
1066
|
}
|
1068
1067
|
async #callProcedureFunctionRemote(proc, args, wfCtx, span, config, funcId) {
|
1068
|
+
if (this.debugMode) {
|
1069
|
+
throw new error_1.DBOSDebuggerError("Can't invoke stored procedure in debug mode.");
|
1070
|
+
}
|
1069
1071
|
const readOnly = config.readOnly ?? false;
|
1070
1072
|
const $jsonCtx = {
|
1071
1073
|
request: wfCtx.request,
|
@@ -1202,6 +1204,9 @@ class DBOSExecutor {
|
|
1202
1204
|
this.tracer.endSpan(ctxt.span);
|
1203
1205
|
return check;
|
1204
1206
|
}
|
1207
|
+
if (this.debugMode) {
|
1208
|
+
throw new error_1.DBOSDebuggerError(`Failed to find recorded output for workflow UUID: ${wfCtx.workflowUUID}`);
|
1209
|
+
}
|
1205
1210
|
// Execute the step function. If it throws an exception, retry with exponential backoff.
|
1206
1211
|
// After reaching the maximum number of retries, throw an DBOSError.
|
1207
1212
|
let result = exports.dbosNull;
|
@@ -1347,6 +1352,9 @@ class DBOSExecutor {
|
|
1347
1352
|
* It runs to completion all pending workflows that were executing when the previous executor failed.
|
1348
1353
|
*/
|
1349
1354
|
async recoverPendingWorkflows(executorIDs = ["local"]) {
|
1355
|
+
if (this.debugMode) {
|
1356
|
+
throw new error_1.DBOSDebuggerError("Cannot recover pending workflows in debug mode.");
|
1357
|
+
}
|
1350
1358
|
const pendingWorkflows = [];
|
1351
1359
|
for (const execID of executorIDs) {
|
1352
1360
|
if (execID === "local" && process.env.DBOS__VMID) {
|
@@ -1498,13 +1506,16 @@ class DBOSExecutor {
|
|
1498
1506
|
* Periodically flush the workflow output buffer to the system database.
|
1499
1507
|
*/
|
1500
1508
|
async flushWorkflowBuffers() {
|
1501
|
-
if (this.initialized) {
|
1509
|
+
if (this.initialized && !this.debugMode) {
|
1502
1510
|
await this.flushWorkflowResultBuffer();
|
1503
1511
|
await this.systemDatabase.flushWorkflowSystemBuffers();
|
1504
1512
|
}
|
1505
1513
|
this.isFlushingBuffers = false;
|
1506
1514
|
}
|
1507
1515
|
async flushWorkflowResultBuffer() {
|
1516
|
+
if (this.debugMode) {
|
1517
|
+
throw new error_1.DBOSDebuggerError(`Cannot flush workflow result buffer in debug mode.`);
|
1518
|
+
}
|
1508
1519
|
const localBuffer = new Map(this.workflowResultBuffer);
|
1509
1520
|
this.workflowResultBuffer.clear();
|
1510
1521
|
const totalSize = localBuffer.size;
|