Fix/discovery wait ready time units - #698
Conversation
YdbTransportImpl.getChannel computed the time left until the request deadline in nanoseconds (deadlineAfter is a System.nanoTime() value) and passed it to YdbDiscovery.waitReady(long millis), which awaits on a Condition with MILLISECONDS. A 5 second deadline therefore became a wait of roughly 57 days, so any request issued before the endpoint pool was populated blocked indefinitely instead of failing at its own deadline.
There was a problem hiding this comment.
AI Review Summary
Verdict: ✅ No critical issues found
Critical issues
No critical issues found.
Other findings
- Minor | Medium: When
leftNanosis positive but < 1,000,000 (sub-millisecond remaining),toMillis()truncates to 0 and theMath.max(..., 1)clamp gives a 1ms wait window. This is arguably the right trade-off (avoids default-timeout fallback), but the request deadline will have expired by the timeprepareCallOptionsruns, so the call returnsCLIENT_DEADLINE_EXPIREDregardless. No action needed — noting for completeness. —core/src/main/java/tech/ydb/core/impl/YdbTransportImpl.java:144 - Nit | Low: The test asserts
elapsed < discoveryTimeout(5s) but the actual expected behavior is ~50ms. A tighter upper bound (e.g.,Duration.ofSeconds(2)) would catch regressions where the wait is shorter than the full discovery timeout but still far longer than the request deadline. Current assertion is safe for CI. —core/src/test/java/tech/ydb/core/impl/YdbTransportImplTest.java:217
This review was generated automatically. Critical issues require attention; other findings are advisory.
If this comment was useful, please give it a 👍 — it helps us improve the review bot.
|
Analysis performed by claude, claude-opus-4-6. |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (75.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #698 +/- ##
============================================
+ Coverage 71.91% 72.00% +0.09%
- Complexity 3474 3497 +23
============================================
Files 390 391 +1
Lines 16220 16277 +57
Branches 1698 1705 +7
============================================
+ Hits 11664 11721 +57
+ Misses 3904 3903 -1
- Partials 652 653 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
No description provided.