23 lines
1.6 KiB
SQL
23 lines
1.6 KiB
SQL
-- A4/metrics: put the control plane into the state the P8-FIX handle exists for —
|
|
-- ONE live run the reconciler has failed on past runs.StalledAfter (=5), deferred into the
|
|
-- future so the sweep leaves it alone while `pgstore.Observe` keeps counting it, plus the
|
|
-- open hold such a run is sitting on and the quarantine of its journal.
|
|
-- Run against the A4 DEV database only:
|
|
-- psql -d tmp8rev_a4_dev -v ON_ERROR_STOP=1 -f 10-inject-stalled-run.sql
|
|
\set book 'bk_H3PFHAWIEHUJUN2O'
|
|
\set user 'u_IRBY3KWMFITANAPL'
|
|
|
|
insert into runs (id, book_id, status, verify_bank, started_at, ceiling_chapters)
|
|
values ('rn_A4STALL', :'book', 'translating', false, now() - interval '45 minutes', 3);
|
|
|
|
insert into run_attempts (run_id, attempt_no, started_at, reconcile_failures, reconcile_after,
|
|
reconcile_error, quarantine_reason, engine_binary)
|
|
values ('rn_A4STALL', 1, now() - interval '45 minutes', 7, now() + interval '1 hour',
|
|
'tmctl status did not answer within the run budget', 'journal line 412 does not decode', '/home/ubuntu-26/tmstand-work/tmctl');
|
|
|
|
-- the money that is sitting still while it stalls
|
|
insert into reservations (engine_run_id, user_id, book_id, amount_micro_usd, ceiling_micro_usd, state, opened_at)
|
|
values ('rn_A4STALL#1', :'user', :'book', 3000000, 3000000, 'open', now() - interval '45 minutes');
|
|
insert into credit_ledger (user_id, kind, amount_micro_usd, source, source_id)
|
|
values (:'user', 'hold', -3000000, 'reservation', 'rn_A4STALL#1');
|
|
update account_balances set balance_micro_usd = balance_micro_usd - 3000000 where user_id = :'user';
|