Skip to content

Ensure warmup validates WAL write before readiness UP - #354

Merged
em3s merged 2 commits into
kakao:mainfrom
eazyhozy:feat/warmup-write-validation
May 26, 2026
Merged

em3s merged 2 commits into
kakao:mainfrom
eazyhozy:feat/warmup-write-validation

Conversation

@eazyhozy

@eazyhozy eazyhozy commented May 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix warmup logic so that a broken WAL producer causes readiness to stay DOWN at boot time.

In production, if one WAL producer in ProducerList is unreachable, the server currently boots successfully and readiness transitions to UP — but any subsequent DML request fails with 500 because WAL write is blocking. This fix detects the broken producer at bootstrap so the pod never becomes Ready in the first place.

Two problems allowed a broken producer to slip through previously:

  1. allMethods.random() could select GET, bypassing the WAL write path entirely
  2. The v2 mutation endpoint returns HTTP 200 even on WAL failure — body has
    result[].status = "ERROR" but this was not detected

Closes #

Related to #344

Changes

  • Round up warmUpConfig.count to the nearest multiple of allMethods.size.
  • Replace allMethods.random() with round-robin allMethods[i % allMethods.size](order: POST → PUT → DELETE → GET) to guarantee write ops run each cycle
  • Switch bodyToMono(String::class.java) → bodyToMono(Map::class.java) and add a flatMap chain that throws IllegalStateException when any result[].status == "ERROR"
  • Add subscribe error consumer to log 💔 Warm-up FAILED — readiness stays DOWN
  • Add StartUpWithWarmUpAndInvalidWalProducerTest with InvalidWalConfig fixture
    (ProducerList containing LoggerProducer + failing producer) to verify 503 on broken WAL

How to Test

./gradlew :server:test --tests \
  "com.kakao.actionbase.server.StartUpWithWarmUpAndInvalidWalProducerTest"

Or boot with an invalid WAL broker and confirm /graph/health/readiness returns 503.

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Sonnet 4.6 via Claude Code (Happy)

- Replace random method selection with round-robin (POST→PUT→DELETE→GET)
  so write operations are guaranteed on every warmup cycle
- Parse mutation response body as Map and propagate IllegalStateException
  when result[].status == "ERROR", making v2 WAL failures visible
- Add subscribe error consumer for explicit warmup failure logging
- Add StartUpWithWarmUpAndInvalidWalProducerTest with InvalidWalConfig
  fixture (ProducerList with healthy + failing producer) to verify
  readiness stays DOWN when WAL producer is broken

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Happy <[email protected]>
@eazyhozy eazyhozy self-assigned this May 26, 2026
@eazyhozy
eazyhozy marked this pull request as ready for review May 26, 2026 04:00
@eazyhozy
eazyhozy requested a review from em3s as a code owner May 26, 2026 04:00
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels May 26, 2026
@em3s em3s changed the title fix: ensure warmup validates WAL write before readiness UP Ensure warmup validates WAL/CDC write before readiness UP May 26, 2026
@em3s em3s changed the title Ensure warmup validates WAL/CDC write before readiness UP Ensure warmup validates WAL write before readiness UP May 26, 2026
@em3s
em3s removed their request for review May 26, 2026 04:30
@em3s

em3s commented May 26, 2026

Copy link
Copy Markdown
Contributor

Added warmUpCount to ensure all methods are rotated, and reverted unnecessary changes to minimize diffs. LGTM, merging. 👍 @eazyhozy

@em3s em3s closed this May 26, 2026
@em3s em3s reopened this May 26, 2026
@em3s
em3s merged commit f178f8c into kakao:main May 26, 2026
5 checks passed
@eazyhozy eazyhozy mentioned this pull request May 26, 2026
eazyhozy added a commit that referenced this pull request May 26, 2026
Co-authored-by: Minseok Kim <[email protected]>
(cherry picked from commit f178f8c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants