Skip to content

Strengthen the TLA+ lease model and the lease tests #48

Open

Description

@waldemort-auto

Summary

#44 adds docs/tla/orchestration-leases, a TLA+ model of fetch_orchestration_item, ack_orchestration_item, renew_orchestration_item_lock and abandon_orchestration_item. TLC checks it in 25 configurations, which run.sh compares with expected.tsv.

The model was written with the known failures in view. These steps would make it stronger, independent evidence:

  1. Reachability witnesses. Show that the fixed variant can still reach the risky situations:

    • a takeover during an acknowledge;
    • a second committed turn;
    • an abandon followed by a refetch.

    This proves the passing invariants are not passing vacuously.

  2. Mutation runs. Remove one part of the fix at a time:

    • the advisory lock in acknowledge;
    • the token recheck in acknowledge;
    • the row-count check in acknowledge;
    • the advisory lock in renewal;
    • the row order in renewal.

    Each removal must break an invariant. Add these runs to expected.tsv.

  3. An independent model. Write a second model from the provider contract alone, without the known bugs in view, and compare the two.

  4. Trace replay. Replay each TLC counterexample on PostgreSQL with the pause-trigger helpers in tests/deadlocks/harness.rs.

  5. A test for Step 1c. Write a test that tells acknowledge Step 1c (the token recheck after the advisory lock) apart from Step 12 (the row count):

    • while the acknowledge waits for the lock, another worker takes the instance over and commits its own turn;
    • the acknowledge must then fail with Invalid lock token, not 23505.

    Today, removing Step 1c breaks no test.

  6. Optional CI job. Run the configurations that take seconds with run.sh. This needs a workflow change.

  7. Wider scope. Extend the model to several instances, to cover the fetch-loop advisory-lock deadlock in fetch_orchestration_item: avoid the advisory-lock convoy and bound the candidate loop #34, and to the worker queue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions