fix(file-service, v1.2): retry LakeFS health check on startup - #7103
Open
Yicong-Huang wants to merge 2 commits into
Open
fix(file-service, v1.2): retry LakeFS health check on startup#7103Yicong-Huang wants to merge 2 commits into
Yicong-Huang wants to merge 2 commits into
Conversation
### What changes were proposed in this PR? - `LakeFSStorageClient.healthCheck()` now retries the LakeFS health check with **exponential backoff** before failing, so a transient `Connection reset` during concurrent startup no longer crashes the file-service. - Retry policy: 5 attempts with the delay doubling each time, starting at 200ms (200, 400, 800, 1600ms), capping total wait at ~3s. - The retry logic is factored into a small, reusable `retryWithBackoff` helper with an injectable `sleep` function so the backoff can be unit-tested without real waiting. - Each failed attempt logs a warning; if LakeFS is still unreachable after all attempts, startup fails with a clear aggregated error (preserving the last exception as the cause) so a genuine outage is still surfaced. - An `InterruptedException` while waiting restores the thread's interrupt status and fails fast instead of retrying. - Added `LakeFSStorageClientSpec` covering immediate success, retry-then-success with doubling delays, give-up-after-max-attempts (with cause preserved), and interrupt handling. ### Any related issues, documentation, discussions? Closes: apache#5646 ### How was this PR tested? - Unit tests: `LakeFSStorageClientSpec` exercises the backoff behavior (delay sequence, max-attempt failure, interrupt handling) using an injected `sleep`. - Reproduce the race: stop LakeFS, start file-service, then start LakeFS within a few seconds; confirm file-service logs retry warnings and then starts successfully instead of exiting. - Regression with LakeFS already up: start file-service, confirm it binds `:9092` and `curl http://127.0.0.1:9092/api/healthcheck` returns HTTP 200. - Compile: run `sbt "FileService/compile"` and expect `[success]`. ### Was this PR authored or co-authored using generative AI tooling? Co-authored with Claude Opus 4.8 in compliance with ASF (backported from commit 263093a)
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/v1.2 #7103 +/- ##
==================================================
+ Coverage 52.58% 54.12% +1.53%
+ Complexity 2520 1453 -1067
==================================================
Files 1078 809 -269
Lines 42343 34190 -8153
Branches 4561 3454 -1107
==================================================
- Hits 22267 18504 -3763
+ Misses 18762 14772 -3990
+ Partials 1314 914 -400
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xuang7
approved these changes
Jul 30, 2026
…eck-on-startup-v1.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Backport of #5647 to
release/v1.2, cherry-picked from 263093a.Follows the Direct Backport Push convention; opened as a PR (rather than a direct push) as part of a backport-coverage audit for fixes merged to
mainsince early June that were never labeled for backport.Any related issues, documentation, discussions?
Backport of #5647. Originally linked #5646.
How was this PR tested?
Release-branch CI runs on this PR. The cherry-pick applied cleanly onto
release/v1.2; no manual conflict resolution was needed.Was this PR authored or co-authored using generative AI tooling?
Yes — backport prepared with Claude Code (mechanical cherry-pick; the change itself is #5647 by its original author).