Commit graph

1 commit

Author SHA1 Message Date
Claude
9cc1dc69d3
Add nightly-storeall.sh: wait-for-idle gate before triggering storeall
Adds the script that decides when it's safe to flush in-memory state via
the app's storeall command, so a nightly backup's freeze doesn't land on
top of live race/production traffic.

Busy signal is presence, within a trailing window, of any of five Tomcat
stdout log handlers (get_clipcast_screenplay/start_production/
update_production/finish_production/ESTPushServlet) - deliberately
excludes the idle-node polling handlers (peek_productions_queue_new,
request_batch, producer_log), which fire continuously regardless of
whether real work is happening. Validated the exact bash logic (not just
the concept) against excerpts of a real two-day event's production log:
zero false positives/negatives across quiet-night, pre-event, ramp-up,
and peak-racing cases at a 10-minute window.

Two escape hatches force the run regardless of traffic: a bounded retry
budget (default ~2h) and a JVM old-gen heap-pressure check via
supervisorctl+jstat, since storeall is the only thing that flushes state
to Postgres and the only thing that unblocks the registry's WeakHashMap
GC eviction for anything currently dirty - it can't be deferred forever.

Two things are still placeholders, not yet validated against the real
server: TOMCAT_LOG's actual path (depends on supervisord's
stdout_logfile setting) and HEAP_FORCE_THRESHOLD_PCT (needs a real jstat
baseline). Both are called out inline.

Scope is deliberately narrow: this script only decides when to call
storeall and calls it. Taking the actual pg_dump/webapp backup is a
separate step to chain after a successful run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tj4SF2BGFxgoRYrCAzNpDb
2026-09-30 11:29:45 +00:00