@optimystic/db-core 0.5.2 → 0.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.
Files changed (93) hide show
  1. package/dist/src/btree/btree.d.ts +2 -0
  2. package/dist/src/btree/btree.d.ts.map +1 -1
  3. package/dist/src/btree/btree.js +72 -52
  4. package/dist/src/btree/btree.js.map +1 -1
  5. package/dist/src/cluster/structs.d.ts +13 -0
  6. package/dist/src/cluster/structs.d.ts.map +1 -1
  7. package/dist/src/collection/collection.d.ts +10 -0
  8. package/dist/src/collection/collection.d.ts.map +1 -1
  9. package/dist/src/collection/collection.js +34 -0
  10. package/dist/src/collection/collection.js.map +1 -1
  11. package/dist/src/index.d.ts +1 -0
  12. package/dist/src/index.d.ts.map +1 -1
  13. package/dist/src/index.js +1 -0
  14. package/dist/src/index.js.map +1 -1
  15. package/dist/src/log/log.js +1 -1
  16. package/dist/src/log/log.js.map +1 -1
  17. package/dist/src/logger.d.ts +4 -0
  18. package/dist/src/logger.d.ts.map +1 -0
  19. package/dist/src/logger.js +8 -0
  20. package/dist/src/logger.js.map +1 -0
  21. package/dist/src/transaction/coordinator.d.ts +31 -8
  22. package/dist/src/transaction/coordinator.d.ts.map +1 -1
  23. package/dist/src/transaction/coordinator.js +206 -53
  24. package/dist/src/transaction/coordinator.js.map +1 -1
  25. package/dist/src/transaction/index.d.ts +2 -2
  26. package/dist/src/transaction/index.d.ts.map +1 -1
  27. package/dist/src/transaction/index.js +1 -1
  28. package/dist/src/transaction/index.js.map +1 -1
  29. package/dist/src/transaction/session.d.ts +11 -7
  30. package/dist/src/transaction/session.d.ts.map +1 -1
  31. package/dist/src/transaction/session.js +27 -14
  32. package/dist/src/transaction/session.js.map +1 -1
  33. package/dist/src/transaction/transaction.d.ts +9 -3
  34. package/dist/src/transaction/transaction.d.ts.map +1 -1
  35. package/dist/src/transaction/transaction.js +14 -7
  36. package/dist/src/transaction/transaction.js.map +1 -1
  37. package/dist/src/transaction/validator.d.ts +9 -2
  38. package/dist/src/transaction/validator.d.ts.map +1 -1
  39. package/dist/src/transaction/validator.js +26 -6
  40. package/dist/src/transaction/validator.js.map +1 -1
  41. package/dist/src/transactor/network-transactor.d.ts.map +1 -1
  42. package/dist/src/transactor/network-transactor.js +84 -9
  43. package/dist/src/transactor/network-transactor.js.map +1 -1
  44. package/dist/src/transactor/transactor-source.d.ts +4 -0
  45. package/dist/src/transactor/transactor-source.d.ts.map +1 -1
  46. package/dist/src/transactor/transactor-source.js +25 -9
  47. package/dist/src/transactor/transactor-source.js.map +1 -1
  48. package/dist/src/transform/atomic-proxy.d.ts +26 -0
  49. package/dist/src/transform/atomic-proxy.d.ts.map +1 -0
  50. package/dist/src/transform/atomic-proxy.js +47 -0
  51. package/dist/src/transform/atomic-proxy.js.map +1 -0
  52. package/dist/src/transform/cache-source.d.ts +3 -2
  53. package/dist/src/transform/cache-source.d.ts.map +1 -1
  54. package/dist/src/transform/cache-source.js +15 -3
  55. package/dist/src/transform/cache-source.js.map +1 -1
  56. package/dist/src/transform/index.d.ts +1 -0
  57. package/dist/src/transform/index.d.ts.map +1 -1
  58. package/dist/src/transform/index.js +1 -0
  59. package/dist/src/transform/index.js.map +1 -1
  60. package/dist/src/utility/batch-coordinator.d.ts +2 -0
  61. package/dist/src/utility/batch-coordinator.d.ts.map +1 -1
  62. package/dist/src/utility/batch-coordinator.js +6 -1
  63. package/dist/src/utility/batch-coordinator.js.map +1 -1
  64. package/dist/src/utility/hash-string.d.ts +3 -6
  65. package/dist/src/utility/hash-string.d.ts.map +1 -1
  66. package/dist/src/utility/hash-string.js +8 -11
  67. package/dist/src/utility/hash-string.js.map +1 -1
  68. package/dist/src/utility/lru-map.d.ts +18 -0
  69. package/dist/src/utility/lru-map.d.ts.map +1 -0
  70. package/dist/src/utility/lru-map.js +52 -0
  71. package/dist/src/utility/lru-map.js.map +1 -0
  72. package/package.json +15 -8
  73. package/src/btree/btree.ts +71 -50
  74. package/src/cluster/structs.ts +11 -0
  75. package/src/collection/collection.ts +44 -0
  76. package/src/index.ts +1 -0
  77. package/src/log/log.ts +1 -1
  78. package/src/logger.ts +10 -0
  79. package/src/transaction/coordinator.ts +244 -57
  80. package/src/transaction/index.ts +4 -2
  81. package/src/transaction/session.ts +38 -14
  82. package/src/transaction/transaction.ts +23 -10
  83. package/src/transaction/validator.ts +34 -7
  84. package/src/transactor/network-transactor.ts +94 -13
  85. package/src/transactor/transactor-source.ts +28 -9
  86. package/src/transform/atomic-proxy.ts +49 -0
  87. package/src/transform/cache-source.ts +18 -4
  88. package/src/transform/index.ts +1 -0
  89. package/src/utility/batch-coordinator.ts +9 -1
  90. package/src/utility/hash-string.ts +14 -17
  91. package/src/utility/lru-map.ts +55 -0
  92. package/dist/index.min.js +0 -9
  93. package/dist/index.min.js.map +0 -7
@@ -0,0 +1,4 @@
1
+ import debug from 'debug';
2
+ export declare function createLogger(subNamespace: string): debug.Debugger;
3
+ export declare const verbose: boolean;
4
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,CAEjE;AAED,eAAO,MAAM,OAAO,SACqE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import debug from 'debug';
2
+ const BASE_NAMESPACE = 'optimystic:db-core';
3
+ export function createLogger(subNamespace) {
4
+ return debug(`${BASE_NAMESPACE}:${subNamespace}`);
5
+ }
6
+ export const verbose = typeof process !== 'undefined'
7
+ && (process.env.OPTIMYSTIC_VERBOSE === '1' || process.env.OPTIMYSTIC_VERBOSE === 'true');
8
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,cAAc,GAAG,oBAAoB,CAAA;AAE3C,MAAM,UAAU,YAAY,CAAC,YAAoB;IAChD,OAAO,KAAK,CAAC,GAAG,cAAc,IAAI,YAAY,EAAE,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,OAAO,KAAK,WAAW;OACjD,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,MAAM,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { ITransactor, CollectionId, Transforms } from "../index.js";
2
- import type { Transaction, ExecutionResult, ITransactionEngine, CollectionActions } from "./transaction.js";
2
+ import type { Transaction, ExecutionResult, ITransactionEngine, CollectionActions, ReadDependency } from "./transaction.js";
3
3
  import type { Collection } from "../collection/collection.js";
4
4
  import { TransactionContext } from "./context.js";
5
5
  /**
@@ -15,6 +15,9 @@ import { TransactionContext } from "./context.js";
15
15
  export declare class TransactionCoordinator {
16
16
  private readonly transactor;
17
17
  private readonly collections;
18
+ /** Per-stampId tracking: snapshot before first apply + accumulated actions for replay */
19
+ private stampData;
20
+ private nextStampOrder;
18
21
  constructor(transactor: ITransactor, collections: Map<CollectionId, Collection<any>>);
19
22
  /**
20
23
  * Apply actions to collections (called by engines during statement execution).
@@ -27,6 +30,10 @@ export declare class TransactionCoordinator {
27
30
  * @param stampId - The transaction stamp ID to tag actions with
28
31
  */
29
32
  applyActions(actions: CollectionActions[], stampId: string): Promise<void>;
33
+ /**
34
+ * Apply actions without tracking (used internally and for replay during rollback).
35
+ */
36
+ private applyActionsRaw;
30
37
  /**
31
38
  * Commit a transaction (actions already applied, orchestrate PEND/COMMIT).
32
39
  *
@@ -38,14 +45,15 @@ export declare class TransactionCoordinator {
38
45
  */
39
46
  commit(transaction: Transaction): Promise<void>;
40
47
  /**
41
- * Rollback a transaction (undo applied actions).
48
+ * Rollback a transaction (undo only the given stampId's applied actions).
42
49
  *
43
- * This is called by TransactionSession.rollback() to undo all actions
44
- * that were applied via applyActions().
50
+ * Restores tracker state to the snapshot taken before the stampId's first
51
+ * applyActions call, then replays any later stamps' actions to preserve
52
+ * other sessions' transforms.
45
53
  *
46
- * @param _stampId - The transaction stamp ID to rollback (currently unused - we clear all trackers)
54
+ * @param stampId - The transaction stamp ID to rollback
47
55
  */
48
- rollback(_stampId: string): Promise<void>;
56
+ rollback(stampId: string): Promise<void>;
49
57
  /**
50
58
  * Get current transforms from all collections.
51
59
  *
@@ -61,6 +69,14 @@ export declare class TransactionCoordinator {
61
69
  * cleaning up after validation or when starting a new transaction.
62
70
  */
63
71
  resetTransforms(): void;
72
+ /**
73
+ * Collect read dependencies from all participating collections.
74
+ */
75
+ getReadDependencies(): ReadDependency[];
76
+ /**
77
+ * Clear read dependencies from all collections.
78
+ */
79
+ clearReadDependencies(): void;
64
80
  /**
65
81
  * Compute hash of all operations in a transaction.
66
82
  * This hash is used for validation - validators re-execute the transaction
@@ -122,11 +138,18 @@ export declare class TransactionCoordinator {
122
138
  */
123
139
  private pendPhase;
124
140
  /**
125
- * COMMIT phase: Commit to all critical blocks.
141
+ * COMMIT phase: Commit to all critical blocks with retry for transient failures.
142
+ *
143
+ * Once all collections are pended (Phase 1 passes), the coordinator has decided
144
+ * to commit. Failed commits are retried (forward recovery) before giving up.
145
+ * Returns which collections committed vs failed so the caller can do targeted cancel.
126
146
  */
127
147
  private commitPhase;
128
148
  /**
129
- * CANCEL phase: Cancel pending actions on all affected blocks.
149
+ * CANCEL phase: Cancel pending actions on affected blocks.
150
+ *
151
+ * Uses the authoritative pended block IDs from pendPhase rather than
152
+ * recomputing from transforms. Optionally skips already-committed collections.
130
153
  */
131
154
  private cancelPhase;
132
155
  }
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../../src/transaction/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,E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Ac,EAAE;IAQvC;;OAEG;IACH,qBAAqB,IAAI,IAAI;IAM7B;;;;OAIG;YACW,cAAc;IAK5B;;;;;;;;OAQG;IACG,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;IAkC9E;;;;;;;;;OASG;IACG,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;IA2G7F;;;;OAIG;YACW,wBAAwB;IAyDtC;;;;;;;OAOG;YACW,qBAAqB;IAuDnC;;;;;;;OAOG;YACW,WAAW;IAgCzB;;;;;;;OAOG;YACW,SAAS;IAuDvB;;;;;;OAMG;YACW,WAAW;IA0EzB;;;;;OAKG;YACW,WAAW;CAWzB"}
@@ -1,6 +1,8 @@
1
1
  import { ActionsEngine } from "./actions-engine.js";
2
- import { createActionsStatements, createTransactionStamp, createTransactionId } from "./transaction.js";
2
+ import { createActionsStatements, createTransactionStamp, createTransactionId, isTransactionExpired } from "./transaction.js";
3
3
  import { Log, blockIdsForTransforms, hashString } from "../index.js";
4
+ import { createLogger } from "../logger.js";
5
+ const log = createLogger('trx:coordinator');
4
6
  /**
5
7
  * Coordinates multi-collection transactions.
6
8
  *
@@ -14,6 +16,9 @@ import { Log, blockIdsForTransforms, hashString } from "../index.js";
14
16
  export class TransactionCoordinator {
15
17
  transactor;
16
18
  collections;
19
+ /** Per-stampId tracking: snapshot before first apply + accumulated actions for replay */
20
+ stampData = new Map();
21
+ nextStampOrder = 0;
17
22
  constructor(transactor, collections) {
18
23
  this.transactor = transactor;
19
24
  this.collections = collections;
@@ -29,13 +34,30 @@ export class TransactionCoordinator {
29
34
  * @param stampId - The transaction stamp ID to tag actions with
30
35
  */
31
36
  async applyActions(actions, stampId) {
37
+ // On first call for this stampId, snapshot all collections for potential rollback
38
+ if (!this.stampData.has(stampId)) {
39
+ const snapshot = new Map();
40
+ for (const [id, col] of this.collections) {
41
+ snapshot.set(id, structuredClone(col.tracker.transforms));
42
+ }
43
+ this.stampData.set(stampId, {
44
+ order: this.nextStampOrder++,
45
+ preSnapshot: snapshot,
46
+ actionBatches: []
47
+ });
48
+ }
49
+ this.stampData.get(stampId).actionBatches.push(actions);
50
+ await this.applyActionsRaw(actions, stampId);
51
+ }
52
+ /**
53
+ * Apply actions without tracking (used internally and for replay during rollback).
54
+ */
55
+ async applyActionsRaw(actions, stampId) {
32
56
  for (const { collectionId, actions: collectionActions } of actions) {
33
- // Get collection
34
57
  const collection = this.collections.get(collectionId);
35
58
  if (!collection) {
36
59
  throw new Error(`Collection not found: ${collectionId}`);
37
60
  }
38
- // Apply each action (tagged with stampId)
39
61
  for (const action of collectionActions) {
40
62
  const taggedAction = { ...action, transaction: stampId };
41
63
  await collection.act(taggedAction);
@@ -52,6 +74,9 @@ export class TransactionCoordinator {
52
74
  * @param transaction - The transaction to commit
53
75
  */
54
76
  async commit(transaction) {
77
+ if (isTransactionExpired(transaction.stamp)) {
78
+ throw new Error(`Transaction expired at ${transaction.stamp.expiration}`);
79
+ }
55
80
  // Collect transforms and determine critical blocks for each affected collection
56
81
  const collectionData = Array.from(this.collections.entries())
57
82
  .map(([collectionId, collection]) => ({
@@ -89,29 +114,73 @@ export class TransactionCoordinator {
89
114
  ...Object.entries(transforms.updates ?? {}).map(([blockId, operations]) => ({ type: 'update', collectionId, blockId, operations })),
90
115
  ...(transforms.deletes ?? []).map(blockId => ({ type: 'delete', collectionId, blockId }))
91
116
  ]);
92
- const operationsHash = this.hashOperations(allOperations);
117
+ const operationsHash = await this.hashOperations(allOperations);
93
118
  // Execute consensus phases (GATHER, PEND, COMMIT)
94
119
  const coordResult = await this.coordinateTransaction(transaction, operationsHash, collectionTransforms, criticalBlocks);
95
120
  if (!coordResult.success) {
96
121
  throw new Error(`Transaction commit failed: ${coordResult.error}`);
97
122
  }
123
+ // Reset trackers and update actionContext after successful commit
124
+ for (const { collection } of collectionData) {
125
+ const newRev = (collection['source'].actionContext?.rev ?? 0) + 1;
126
+ collection['source'].actionContext = {
127
+ committed: [
128
+ ...(collection['source'].actionContext?.committed ?? []),
129
+ { actionId: transaction.id, rev: newRev }
130
+ ],
131
+ rev: newRev,
132
+ };
133
+ collection.tracker.reset();
134
+ }
135
+ // Clean up stamp tracking data
136
+ this.stampData.delete(transaction.stamp.id);
98
137
  }
99
138
  /**
100
- * Rollback a transaction (undo applied actions).
139
+ * Rollback a transaction (undo only the given stampId's applied actions).
101
140
  *
102
- * This is called by TransactionSession.rollback() to undo all actions
103
- * that were applied via applyActions().
141
+ * Restores tracker state to the snapshot taken before the stampId's first
142
+ * applyActions call, then replays any later stamps' actions to preserve
143
+ * other sessions' transforms.
104
144
  *
105
- * @param _stampId - The transaction stamp ID to rollback (currently unused - we clear all trackers)
145
+ * @param stampId - The transaction stamp ID to rollback
106
146
  */
107
- async rollback(_stampId) {
108
- // Clear trackers for all collections
109
- // This discards all pending changes that were applied via applyActions()
110
- // TODO: In the future, we may want to track which collections were affected by
111
- // a specific stampId and only reset those trackers
112
- for (const collection of this.collections.values()) {
113
- // Reset the tracker to discard all pending transforms
114
- collection.tracker.reset();
147
+ async rollback(stampId) {
148
+ const data = this.stampData.get(stampId);
149
+ if (!data)
150
+ return;
151
+ this.stampData.delete(stampId);
152
+ // Collect all remaining stamps to replay
153
+ const toReplay = [...this.stampData.entries()]
154
+ .sort(([, a], [, b]) => a.order - b.order);
155
+ // Find the earliest snapshot among the rolled-back stamp and all remaining stamps.
156
+ // This is necessary because interleaved execution means a lower-order stamp
157
+ // may have batches applied after a higher-order stamp's snapshot was taken.
158
+ let earliestSnapshot = data.preSnapshot;
159
+ let earliestOrder = data.order;
160
+ for (const [, d] of toReplay) {
161
+ if (d.order < earliestOrder) {
162
+ earliestSnapshot = d.preSnapshot;
163
+ earliestOrder = d.order;
164
+ }
165
+ }
166
+ // Restore to the earliest snapshot
167
+ for (const [collectionId, transforms] of earliestSnapshot) {
168
+ const collection = this.collections.get(collectionId);
169
+ if (collection) {
170
+ collection.tracker.reset(structuredClone(transforms));
171
+ }
172
+ }
173
+ // Replay all remaining stamps' batches in order
174
+ for (const [replayStampId, replayData] of toReplay) {
175
+ // Update the snapshot to reflect current (post-replay) state
176
+ const newSnapshot = new Map();
177
+ for (const [id, col] of this.collections) {
178
+ newSnapshot.set(id, structuredClone(col.tracker.transforms));
179
+ }
180
+ replayData.preSnapshot = newSnapshot;
181
+ for (const actionBatch of replayData.actionBatches) {
182
+ await this.applyActionsRaw(actionBatch, replayStampId);
183
+ }
115
184
  }
116
185
  }
117
186
  /**
@@ -145,14 +214,32 @@ export class TransactionCoordinator {
145
214
  collection.tracker.reset();
146
215
  }
147
216
  }
217
+ /**
218
+ * Collect read dependencies from all participating collections.
219
+ */
220
+ getReadDependencies() {
221
+ const reads = [];
222
+ for (const collection of this.collections.values()) {
223
+ reads.push(...collection.getReadDependencies());
224
+ }
225
+ return reads;
226
+ }
227
+ /**
228
+ * Clear read dependencies from all collections.
229
+ */
230
+ clearReadDependencies() {
231
+ for (const collection of this.collections.values()) {
232
+ collection.clearReadDependencies();
233
+ }
234
+ }
148
235
  /**
149
236
  * Compute hash of all operations in a transaction.
150
237
  * This hash is used for validation - validators re-execute the transaction
151
238
  * and compare their computed operations hash with this one.
152
239
  */
153
- hashOperations(operations) {
240
+ async hashOperations(operations) {
154
241
  const operationsData = JSON.stringify(operations);
155
- return `ops:${hashString(operationsData)}`;
242
+ return `ops:${await hashString(operationsData)}`;
156
243
  }
157
244
  /**
158
245
  * Commit a transaction context.
@@ -172,14 +259,14 @@ export class TransactionCoordinator {
172
259
  const statements = createActionsStatements(collectionActions);
173
260
  const reads = context.getReads();
174
261
  // Create stamp from context
175
- const stamp = createTransactionStamp('local', // TODO: Get from context or coordinator
262
+ const stamp = await createTransactionStamp('local', // TODO: Get from context or coordinator
176
263
  Date.now(), '', // TODO: Get from engine
177
264
  context.engine);
178
265
  const transaction = {
179
266
  stamp,
180
267
  statements,
181
268
  reads,
182
- id: createTransactionId(stamp.id, statements, reads)
269
+ id: await createTransactionId(stamp.id, statements, reads)
183
270
  };
184
271
  const engine = new ActionsEngine(this);
185
272
  // Execute through standard path
@@ -196,17 +283,26 @@ export class TransactionCoordinator {
196
283
  * @returns Execution result with actions and results
197
284
  */
198
285
  async execute(transaction, engine) {
286
+ const trxId = transaction.id;
287
+ const t0 = Date.now();
288
+ if (isTransactionExpired(transaction.stamp)) {
289
+ return { success: false, error: `Transaction expired at ${transaction.stamp.expiration}` };
290
+ }
199
291
  // 1. Validate engine matches transaction
200
292
  // Note: We don't enforce this strictly since the engine is passed in explicitly
201
293
  // The caller is responsible for ensuring the correct engine is used
294
+ const tEngine = Date.now();
202
295
  const result = await engine.execute(transaction);
296
+ const engineMs = Date.now() - tEngine;
203
297
  if (!result.success) {
298
+ log('execute:done trxId=%s engine=%dms success=false total=%dms', trxId, engineMs, Date.now() - t0);
204
299
  return result;
205
300
  }
206
301
  if (!result.actions || result.actions.length === 0) {
207
302
  return { success: true }; // Nothing to do
208
303
  }
209
304
  // 2. Apply actions to collections and collect transforms
305
+ const tApply = Date.now();
210
306
  const collectionTransforms = new Map();
211
307
  const criticalBlocks = new Map();
212
308
  const actionResults = new Map();
@@ -226,13 +322,36 @@ export class TransactionCoordinator {
226
322
  ...Object.entries(transforms.updates ?? {}).map(([blockId, operations]) => ({ type: 'update', collectionId, blockId, operations })),
227
323
  ...(transforms.deletes ?? []).map(blockId => ({ type: 'delete', collectionId, blockId }))
228
324
  ]);
229
- const operationsHash = this.hashOperations(allOperations);
325
+ const operationsHash = await this.hashOperations(allOperations);
326
+ const applyMs = Date.now() - tApply;
230
327
  // 4. Coordinate (GATHER if multi-collection)
328
+ const tCoord = Date.now();
231
329
  const coordResult = await this.coordinateTransaction(transaction, operationsHash, collectionTransforms, criticalBlocks);
330
+ const coordMs = Date.now() - tCoord;
232
331
  if (!coordResult.success) {
332
+ log('execute:done trxId=%s engine=%dms apply=%dms coordinate=%dms success=false total=%dms', trxId, engineMs, applyMs, coordMs, Date.now() - t0);
233
333
  return coordResult;
234
334
  }
235
- // 4. Return results from actions
335
+ // 5. Update actionContext and reset trackers after successful commit
336
+ for (const collectionActions of result.actions) {
337
+ const collection = this.collections.get(collectionActions.collectionId);
338
+ if (collection) {
339
+ const newRev = (collection['source'].actionContext?.rev ?? 0) + 1;
340
+ const actionId = transaction.id;
341
+ collection['source'].actionContext = {
342
+ committed: [
343
+ ...(collection['source'].actionContext?.committed ?? []),
344
+ { actionId, rev: newRev }
345
+ ],
346
+ rev: newRev,
347
+ };
348
+ collection.tracker.reset();
349
+ }
350
+ }
351
+ // Clean up stamp tracking data
352
+ this.stampData.delete(transaction.stamp.id);
353
+ // 6. Return results from actions
354
+ log('execute:done trxId=%s engine=%dms apply=%dms coordinate=%dms total=%dms', trxId, engineMs, applyMs, coordMs, Date.now() - t0);
236
355
  return {
237
356
  success: true,
238
357
  actions: result.actions,
@@ -287,23 +406,34 @@ export class TransactionCoordinator {
287
406
  * @param criticalBlocks - Map of collectionId to its log tail blockId
288
407
  */
289
408
  async coordinateTransaction(transaction, operationsHash, collectionTransforms, criticalBlocks) {
409
+ const trxId = transaction.id;
410
+ const t0 = Date.now();
290
411
  // 1. GATHER phase: collect critical cluster nominees (skip if single collection)
291
412
  const criticalBlockIds = Array.from(criticalBlocks.values());
413
+ const tGather = Date.now();
292
414
  const superclusterNominees = await this.gatherPhase(criticalBlockIds);
415
+ const gatherMs = Date.now() - tGather;
293
416
  // 2. PEND phase: distribute to all block clusters
417
+ const tPend = Date.now();
294
418
  const pendResult = await this.pendPhase(transaction, operationsHash, collectionTransforms, superclusterNominees);
419
+ const pendMs = Date.now() - tPend;
295
420
  if (!pendResult.success) {
421
+ log('trx:phases trxId=%s gather=%dms pend=%dms (failed) total=%dms', trxId, gatherMs, pendMs, Date.now() - t0);
296
422
  return pendResult;
297
423
  }
298
- // 3. COMMIT phase: commit to all critical blocks
424
+ // 3. COMMIT phase: commit to all critical blocks (with retry for forward recovery)
425
+ const tCommit = Date.now();
299
426
  const commitResult = await this.commitPhase(transaction.id, criticalBlockIds, pendResult.pendedBlockIds);
427
+ const commitMs = Date.now() - tCommit;
300
428
  if (!commitResult.success) {
301
- // Cancel pending actions on failure
302
- await this.cancelPhase(transaction.id, collectionTransforms);
303
- return commitResult;
429
+ // Targeted cancel: only cancel collections that are still pending (not already committed)
430
+ await this.cancelPhase(transaction.id, pendResult.pendedBlockIds, commitResult.committedCollections);
431
+ log('trx:phases trxId=%s gather=%dms pend=%dms commit=%dms (failed) total=%dms', trxId, gatherMs, pendMs, commitMs, Date.now() - t0);
432
+ return { success: false, error: commitResult.error };
304
433
  }
305
434
  // 4. PROPAGATE and CHECKPOINT phases are handled by clusters automatically
306
435
  // (as per user's note: "managed by each cluster, the client doesn't have to worry about them")
436
+ log('trx:phases trxId=%s gather=%dms pend=%dms commit=%dms total=%dms', trxId, gatherMs, pendMs, commitMs, Date.now() - t0);
307
437
  return { success: true };
308
438
  }
309
439
  /**
@@ -370,6 +500,10 @@ export class TransactionCoordinator {
370
500
  // Pend the transaction
371
501
  const pendResult = await this.transactor.pend(pendRequest);
372
502
  if (!pendResult.success) {
503
+ // Cancel any already-pended collections before returning
504
+ for (const [pendedCollectionId, pendedBlockIdList] of pendedBlockIds.entries()) {
505
+ await this.transactor.cancel({ actionId, blockIds: pendedBlockIdList });
506
+ }
373
507
  return {
374
508
  success: false,
375
509
  error: `Pend failed for collection ${collectionId}: ${pendResult.reason}`
@@ -381,23 +515,38 @@ export class TransactionCoordinator {
381
515
  return { success: true, pendedBlockIds };
382
516
  }
383
517
  /**
384
- * COMMIT phase: Commit to all critical blocks.
518
+ * COMMIT phase: Commit to all critical blocks with retry for transient failures.
519
+ *
520
+ * Once all collections are pended (Phase 1 passes), the coordinator has decided
521
+ * to commit. Failed commits are retried (forward recovery) before giving up.
522
+ * Returns which collections committed vs failed so the caller can do targeted cancel.
385
523
  */
386
524
  async commitPhase(actionId, criticalBlockIds, pendedBlockIds) {
387
- // Commit each collection's transaction
525
+ const committedCollections = new Set();
526
+ const failedCollections = new Set();
527
+ // Commit each collection's transaction with retry
388
528
  for (const [collectionId, blockIds] of pendedBlockIds.entries()) {
389
529
  const collection = this.collections.get(collectionId);
390
530
  if (!collection) {
391
- return { success: false, error: `Collection not found: ${collectionId}` };
531
+ failedCollections.add(collectionId);
532
+ return {
533
+ success: false,
534
+ error: `Collection not found: ${collectionId}`,
535
+ committedCollections,
536
+ failedCollections
537
+ };
392
538
  }
393
539
  // Get revision
394
540
  const rev = (collection['source'].actionContext?.rev ?? 0) + 1;
395
541
  // Find the critical block (log tail) for this collection
396
542
  const logTailBlockId = criticalBlockIds.find(blockId => blockIds.includes(blockId));
397
543
  if (!logTailBlockId) {
544
+ failedCollections.add(collectionId);
398
545
  return {
399
546
  success: false,
400
- error: `Log tail block not found for collection ${collectionId}`
547
+ error: `Log tail block not found for collection ${collectionId}`,
548
+ committedCollections,
549
+ failedCollections
401
550
  };
402
551
  }
403
552
  // Create commit request
@@ -407,34 +556,38 @@ export class TransactionCoordinator {
407
556
  tailId: logTailBlockId,
408
557
  rev
409
558
  };
410
- // Commit the transaction
411
- const commitResult = await this.transactor.commit(commitRequest);
412
- if (!commitResult.success) {
413
- return {
414
- success: false,
415
- error: `Commit failed for collection ${collectionId}`
416
- };
559
+ // Retry up to 3 attempts for transient failures
560
+ let committed = false;
561
+ for (let attempt = 0; attempt < 3 && !committed; attempt++) {
562
+ const commitResult = await this.transactor.commit(commitRequest);
563
+ if (commitResult.success) {
564
+ committed = true;
565
+ committedCollections.add(collectionId);
566
+ }
567
+ else if (attempt === 2) {
568
+ failedCollections.add(collectionId);
569
+ return {
570
+ success: false,
571
+ error: `Commit failed for collection ${collectionId} after 3 attempts`,
572
+ committedCollections,
573
+ failedCollections
574
+ };
575
+ }
417
576
  }
418
577
  }
419
- return { success: true };
578
+ return { success: true, committedCollections, failedCollections };
420
579
  }
421
580
  /**
422
- * CANCEL phase: Cancel pending actions on all affected blocks.
581
+ * CANCEL phase: Cancel pending actions on affected blocks.
582
+ *
583
+ * Uses the authoritative pended block IDs from pendPhase rather than
584
+ * recomputing from transforms. Optionally skips already-committed collections.
423
585
  */
424
- async cancelPhase(actionId, collectionTransforms) {
425
- // Cancel each collection's pending transaction
426
- for (const [collectionId, transforms] of collectionTransforms.entries()) {
427
- const collection = this.collections.get(collectionId);
428
- if (!collection) {
429
- continue; // Skip if collection not found
430
- }
431
- // Get the block IDs from transforms
432
- const blockIds = blockIdsForTransforms(transforms);
433
- // Cancel the transaction
434
- await this.transactor.cancel({
435
- actionId,
436
- blockIds
437
- });
586
+ async cancelPhase(actionId, pendedBlockIds, excludeCollections) {
587
+ for (const [collectionId, blockIds] of pendedBlockIds.entries()) {
588
+ if (excludeCollections?.has(collectionId))
589
+ continue;
590
+ await this.transactor.cancel({ actionId, blockIds });
438
591
  }
439
592
  }
440
593
  }
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../../src/transaction/coordinator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAA2B,UAAU,EAAE,MAAM,aAAa,CAAC;AAU9F;;;;;;;;;GASG;AACH,MAAM,OAAO,sBAAsB;IAEhB;IACA;IAFlB,YACkB,UAAuB,EACvB,WAA+C;QAD/C,eAAU,GAAV,UAAU,CAAa;QACvB,gBAAW,GAAX,WAAW,CAAoC;IAC9D,CAAC;IAEJ;;;;;;;;;OASG;IACH,KAAK,CAAC,YAAY,CACjB,OAA4B,EAC5B,OAAe;QAEf,KAAK,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,OAAO,EAAE,CAAC;YACpE,iBAAiB;YACjB,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CA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EAAE,iBAAiB,EAAE,CAAC;IACnE,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,WAAW,CACxB,QAAkB,EAClB,cAA4C,EAC5C,kBAAsC;QAEtC,KAAK,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC;YACjE,IAAI,kBAAkB,EAAE,GAAG,CAAC,YAAY,CAAC;gBAAE,SAAS;YACpD,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtD,CAAC;IACF,CAAC;CAED"}
@@ -1,9 +1,9 @@
1
1
  export type { Transaction, TransactionStamp, ReadDependency, TransactionRef, ITransactionEngine, ExecutionResult, CollectionActions, ValidationResult, ITransactionValidator, ActionsStatement } from './transaction.js';
2
- export { createTransactionStamp, createTransactionId, createActionsStatements } from './transaction.js';
2
+ export { createTransactionStamp, createTransactionId, createActionsStatements, DEFAULT_TRANSACTION_TTL_MS, isTransactionExpired } from './transaction.js';
3
3
  export { ActionsEngine, ACTIONS_ENGINE_ID, } from './actions-engine.js';
4
4
  export { TransactionCoordinator } from './coordinator.js';
5
5
  export { TransactionContext } from './context.js';
6
6
  export { TransactionSession } from './session.js';
7
7
  export { TransactionValidator } from './validator.js';
8
- export type { EngineRegistration, ValidationCoordinatorFactory } from './validator.js';
8
+ export type { EngineRegistration, ValidationCoordinatorFactory, BlockStateProvider } from './validator.js';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,4 +1,4 @@
1
- export { createTransactionStamp, createTransactionId, createActionsStatements } from './transaction.js';
1
+ export { createTransactionStamp, createTransactionId, createActionsStatements, DEFAULT_TRANSACTION_TTL_MS, isTransactionExpired } from './transaction.js';
2
2
  export { ActionsEngine, ACTIONS_ENGINE_ID, } from './actions-engine.js';
3
3
  export { TransactionCoordinator } from './coordinator.js';
4
4
  export { TransactionContext } from './context.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}