Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions docs/provider-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Provider transactions

All SQL transactions delegate scheduling, journal/ledger writes,
locking, compensation and recovery to Omni. Plain BEGIN needs no SET. stackql retains SQL translation,
authentication and connection-bound handle storage.

Defaults: collection `sql`, existing IaC state directory and dynamic lock scope.
Creates get distinct durable intents and retain a conservative resource-address lock.
A single body/toString inverse token supplies identity; ambiguous bindings need explicit targets.

Optional scope/mode overrides:

```sql
SET "$.transaction" = '{"collection":"demo","mode":"lazy","keys":["item"],"targets":{"stackql_unstable_demo.service.items":{"key":"item","identity":"id","addressed_by":"id"}}}';
BEGIN;
-- provider INSERT / SELECT
SELECT * FROM stackql_preview.txn.status;
COMMIT; -- or ROLLBACK
```

`mode` accepts `eager` or `lazy`. If omitted, existing session `rollback_type`
configuration chooses execution timing. Reads and RETURNING flush preceding writes.
Rollback discards queued work and compensates executed work under retained locks.
`state` names an optional directory under the same caller/tenant IaC state root.

Recovery: reconnect, configure the same collection/state with `resume_id`, then BEGIN.
Read status in the resumed session before proceeding; resume advances its version. For an uncertain statement, verify the provider state,
then call `stackql_preview.txn.recover` with `version`, JSON `resources` containing
`key`, `outcome` (`applied`/`absent`), observed resource `version`, and verified identity
for applied creates. `continue = 'true'` explicitly attests statement completion;
false aborts it for subsequent rollback. Recovery sends no provider request.

Caller authentication and authorization are opt-in through the existing access configuration.
When enabled, ownership and permission checks apply to every transaction operation.
Without it, handles remain session-bound, but durable IDs do not establish user ownership.

Current limits: only creates with a declared delete
inverse are supported. Unsupported mutations fail before dispatch. Configuration cannot
change inside a transaction; nested transactions are rejected. Consume read cursors before
COMMIT/ROLLBACK. Provider aliases are unsupported; each resource address currently binds
one logical target. Leases default to 300 seconds; execution lifetime defaults to 900 seconds.
Stop or isolate the previous executor before takeover: leases cannot fence provider
requests already in flight. Legacy coordinators, TSM, host inverse execution and the
`--acid` depth configuration are removed. Unsupported local/provider writes fail
before dispatch. No backend SQL ACID isolation is emulated.

The new adapter requires an Omni release exposing `TransactionSession`. Local validation
uses a build-only modfile; pin the published release before normal CI. Protocol and
invariants: [Omni transactions](https://github.com/stackql-labs/omnisdk/blob/main/docs/developer/transactions.md).
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/spf13/viper v1.10.1
github.com/stackql-labs/omnisdk v0.1.12-alpha01
github.com/stackql-labs/omnisdk v0.1.12-beta03
github.com/stackql/go-suffix-map v0.0.1-alpha02
github.com/stackql/psql-wire v0.1.2-beta02
github.com/stackql/stackql-parser v0.0.17-alpha05
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ github.com/spf13/viper v1.10.1 h1:nuJZuYpG7gTj/XqiUwg8bA0cp1+M2mC3J4g5luUYBKk=
github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU=
github.com/spiffe/go-spiffe/v2 v2.7.0 h1:uXe1MflJoHw58wAUvxVlcM7WpKtijWG7I1UidcGh6g4=
github.com/spiffe/go-spiffe/v2 v2.7.0/go.mod h1:47Q0Q9/AqGha8QLHp+kxpH4Wca7X7EnOtlIJy3mxZ3U=
github.com/stackql-labs/omnisdk v0.1.12-alpha01 h1:M5pFE5fdClOQ3StZ+B7Ty9EvR0xbZG8u6Qm0JHgzmSA=
github.com/stackql-labs/omnisdk v0.1.12-alpha01/go.mod h1:G6qZy+6Vbuy9sSfws6erzpbbuThI+cD/uXDQPgQkRBI=
github.com/stackql-labs/omnisdk v0.1.12-beta03 h1:zw5mTcuR7OPYfwDNW4g+wbqA8G//CLNmr6XPSL4Bv+o=
github.com/stackql-labs/omnisdk v0.1.12-beta03/go.mod h1:G6qZy+6Vbuy9sSfws6erzpbbuThI+cD/uXDQPgQkRBI=
github.com/stackql/go-suffix-map v0.0.1-alpha02 h1:JI4aiq/OfHW4a/BiNqK31NbyaR94zlUOhGZof3G/OUo=
github.com/stackql/go-suffix-map v0.0.1-alpha02/go.mod h1:6BSMz4K/gIYfqdVRb7V8xL165wiPYyCjD9Kx7hLMd9Y=
github.com/stackql/psql-wire v0.1.2-beta02 h1:7DfliBpyyCaUHVJ1Jxk37q3zVwVLyh6+FCHeM0/gbAQ=
Expand Down
82 changes: 0 additions & 82 deletions internal/stackql/acid/acid_dto/commit_dto.go

This file was deleted.

12 changes: 0 additions & 12 deletions internal/stackql/acid/tsm/tsm.go

This file was deleted.

13 changes: 0 additions & 13 deletions internal/stackql/acid/tsm_physio/access_methods.go

This file was deleted.

Loading
Loading