feat(component-failover-adoption): add scheduler decision-publish retry-until-success-or-shutdown

Wraps sched_publish_dispatch()/sched_publish_pend_reason() in a shared
retry loop that keeps retrying a -E_XCE_NOT_READY-exhausted publish
until it succeeds or the scheduler is shutting down (core.stop checked
before each attempt, not only after), composed with the pending-rejoin
follow-up established in task 3.1. Extended-retry success logs
distinctly from an ordinary first-attempt success (Req 7 AC4).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NNB4zGPCsHyDUCDJyMbiQN
This commit is contained in:
Rongsong Shen 2026-08-11 12:03:21 +00:00
parent 54d53df956
commit 7c260e0c97
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
4 changed files with 747 additions and 3 deletions

View file

@ -791,6 +791,44 @@ sched_scheduler_connect_test = executable(
+ '"'],
install: false)
# Tests for the scheduler's decision-publish retry-until-success-or-shutdown
# wrapper, composed with rejoin retry-on-failure (component-failover-adoption,
# task 3.2, boundary: SchedulerControllerClient). scheduler.c IS the file
# under test here (sched_publish_dispatch()/sched_publish_pend_reason()), so
# unlike sched_driver_decision_cb_test this target cannot spy on those two
# functions directly. Same real-scheduler_srcs link technique as
# sched_scheduler_connect_test above (reused scheduler_connect_test_srcs
# list), PLUS `-Wl,--wrap=` linker symbol interposition on the three libxce
# client calls this task's retry/rejoin logic makes (xcecli_jobdispatch,
# xcecli_set_pend_reason, xcecli_join) and two more needed only to let this
# file's one real sched_init() setup call reach xcecli_set_reconnect_handler()
# without a live controller (xcecli_start, xcecli_set_reconnect_handler) --
# see the test file's own header comment for why `--wrap` (which redirects
# call sites, not archive members) was required instead of the "test double
# ahead of the archive" trick: all of these symbols share client.c's single
# translation unit inside libxce.a with several OTHER xcecli_* entry points
# this test's real scheduler_srcs dependency graph also needs, so simply
# excluding client.c from the link was not viable.
scheduler_decision_publish_retry_test_srcs = [
'test_scheduler_decision_publish_retry.c']
foreach f : scheduler_srcs
if f != 'src/main.c'
scheduler_decision_publish_retry_test_srcs += ['../' + f]
endif
endforeach
sched_scheduler_decision_publish_retry_test = executable(
'sched_scheduler_decision_publish_retry_test',
scheduler_decision_publish_retry_test_srcs,
include_directories:[incdir],
dependencies: [scheduler_deps, unity_dep],
link_args: ['-Wl,--wrap=xcecli_jobdispatch',
'-Wl,--wrap=xcecli_set_pend_reason',
'-Wl,--wrap=xcecli_join',
'-Wl,--wrap=xcecli_start',
'-Wl,--wrap=xcecli_set_reconnect_handler'],
install: false)
# Register as meson tests so `meson test --suite scheduler` runs them all.
# detect_leaks=0 matches the suite convention (fixtures are not torn down).
test('scheduler test', scheduler_test, suite: 'scheduler',
@ -896,3 +934,6 @@ test('scheduler repl equivalence test',
test('scheduler connect pipeline test',
sched_scheduler_connect_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler decision publish retry test',
sched_scheduler_decision_publish_retry_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])