start storage transaction

This block is part of the storage group and was last modified in core v15.0.1.

start storage transaction v15.0.1

Opens a storage transaction: every document create, update, remove and restore this flow performs until the end block is journaled so the whole group can be reverted as one.

In pins 5 + flow
  • flow
    flow
  • transaction id
    value

    Stable identity of this operation (e.g. an order number). Leave empty for a random id : usable for rollback, not for idempotent retry.

  • name
    value

    Human label stored on the transaction record.

  • retention (sec.)
    number

    How long the journal is kept after the transaction ends. Default 604800 (7 days).

    Default 604800

  • lease (sec.)
    number

    How long an opener that stopped renewing (crashed) is still considered alive before a retry may revert its attempt. Default 60.

    Default 60

  • revert abandoned attempt
    condition

    When a previous attempt under the same id is open with an expired lease, revert it before starting fresh (default on). Off fails with TRANSACTION_ABANDONED instead.

    Default true

Out pins 9 + flow
  • flow
    flow
  • success
    condition
  • transaction id
    value
  • transaction reference
    value

    Qualified `bp::` form of the id. A transaction belongs to the blueprint that started it; hand this to an end or revert block in ANOTHER blueprint (an operator's repair flow) to address it there.

  • already committed
    condition

    True when this id already committed earlier; `result` then carries what the end block stored.

  • stored result
    value
  • status
    value

    started, already_committed, in_progress, abandoned, revert_conflict or simulated.

  • attempt
    number
  • abandoned revert report
    object
  • error
    value

Opens a storage transaction for the rest of this flow (and every function it calls). While it is open, every store write : function_create_*, function_update_*, function_remove_*, function_restore_*, function_delete_document, upserts : records the document's state BEFORE the write into a Redis journal, and created documents carry _meta.transaction_id. function_transaction_revert then undoes the journal newest-first, refusing any document whose update_hash moved since; function_transaction_end commits it and stores `result`. NOT an ACID transaction: writes are visible immediately, and bulk ES operations (update by query, reindex, bulk delete) fail with TRANSACTION_UNSUPPORTED_WRITE while one is open. A transaction is identified by the id AND the blueprint that started it (the `transaction_ref` out-pin is the qualified form), so another blueprint cannot read or revert it by guessing the id. With a stable `id` (an order number, account+season) it is also an idempotent-retry gate: a second start of an id that already committed answers already_committed=true with the stored result and does not reopen; one whose previous attempt is still running (its lease is alive) fails with TRANSACTION_IN_PROGRESS; one whose previous attempt died (lease expired) is reverted first when revert_abandoned is on (default) : status revert_conflict and TRANSACTION_REVERT_CONFLICT when that revert could not complete : or fails with TRANSACTION_ABANDONED when it is off. status is one of started, already_committed, in_progress, abandoned, revert_conflict; success is true only for started and already_committed. The journal is kept for `retention` seconds (default 7 days); `lease` seconds (default 60) is how long a crashed opener is still considered alive. In simulation nothing is written and status is simulated.

A typical wiring for start storage transaction: a function trigger starts the flow; the flow out pin feeds debug.

Studio canvas example for the start storage transaction block: typical wiring for start storage transaction.

Version history

Introduced in v15.0.1.


Back to storage Return to the main group to view all sub-groups Back to storage Return to the group to view all blocks within this group