Summary
Serialize a cache-miss Backend::dump commit with Backend::sync for the same cache_key.
Rationale
A cache-miss dump can fetch an older standalone configuration while a sync completes. If dump then calls Cache::set_dump_result, it can replace the cache configuration and raw configuration with the older snapshot. A later unpinned sync can then build its document from stale state.
Concurrent sync requests for the same cache_key are outside the current operational model. This issue tracks the planned per-key locking needed to enforce that model and to prevent dump-versus-sync state replacement.
Required changes
- Add a per-key synchronization mechanism for
rust/crates/adc-backend-apisix-standalone/src/backend.rs and the related cache flow.
- Serialize cache-miss
Fetcher::dump execution and its cache commit with sync for the same cache_key, or use a generation check that rejects a fetched snapshot superseded by sync.
- Preserve independent operation for different cache keys.
- Add a coordinated regression test that verifies an older cache-miss dump cannot overwrite state written by sync.
Affected areas
rust/crates/adc-backend-apisix-standalone/src/backend.rs
rust/crates/adc-backend-apisix-standalone/src/cache.rs
- APISIX standalone backend cache and synchronization tests
Acceptance criteria
- A cache-miss dump cannot commit stale configuration after a sync for the same cache key completes.
- The cache configuration, raw configuration, and latest version remain mutually consistent.
- The regression test deterministically covers the dump-versus-sync ordering.
Backlinks
Summary
Serialize a cache-miss
Backend::dumpcommit withBackend::syncfor the samecache_key.Rationale
A cache-miss
dumpcan fetch an older standalone configuration while asynccompletes. Ifdumpthen callsCache::set_dump_result, it can replace the cache configuration and raw configuration with the older snapshot. A later unpinnedsynccan then build its document from stale state.Concurrent
syncrequests for the samecache_keyare outside the current operational model. This issue tracks the planned per-key locking needed to enforce that model and to prevent dump-versus-sync state replacement.Required changes
rust/crates/adc-backend-apisix-standalone/src/backend.rsand the related cache flow.Fetcher::dumpexecution and its cache commit withsyncfor the samecache_key, or use a generation check that rejects a fetched snapshot superseded bysync.Affected areas
rust/crates/adc-backend-apisix-standalone/src/backend.rsrust/crates/adc-backend-apisix-standalone/src/cache.rsAcceptance criteria
Backlinks