Repository navigation
Conversation
Transient connection resets during the initial ping fail PeerCreate for ClickPipes multiple times a day. Retry transient errors up to 5 times, but return non-retryable server exceptions (e.g. auth failures) immediately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gheorghepucea
left a comment
There was a problem hiding this comment.
Nice work! I like the code refactoring as well, just left a comment about more test cases.
| import ( | ||
| "context" | ||
| "errors" | ||
| "net" |
There was a problem hiding this comment.
Could you add Ping tests for these cases?
- A permanent network error, such as DNS "no such host" or a TLSfailure, isn't retried?
- An unreachable host, where packets are silently dropped, isn't retried?
- A canceled context stops retries?
There was a problem hiding this comment.
for 1/2, unless we do integrations testing, these belong to unit tests for isRetryableException imo, but is allso not super interesting. could add an integrations test and use toxiproxy to mimic bad network.
+1 for context cancellation coverage
| // withRetry runs fn up to 5 times with backoff while shouldRetry returns true for its error. | ||
| // On context cancellation during backoff it returns the last result along with ctx.Err(). |
There was a problem hiding this comment.
nit: the code is pretty self-explanatory, recommend removing the comment
(also the last result is typically ignored and not used on context cancellation, so highlighting this in comment is a bit confusing imo)
Connecting to a ClickHouse peer fails if the initial ping hits a transient network error. In prod this happens several times a day across multiple ClickPipes:
failed to ping to ClickHouse peer: read tcp ...: read: connection reset by peer.peerdb_clickhouse.Ping, which retries up to 5 times with the same backoff asExec/Query(1s, 6s, 11s, 16s). Network errors are always retried; server exceptions that aren't retryable, such as auth failures, return right away.Exec,Query,QueryRowandPinginto a genericwithRetryhelper. Retries are now logged at warn level instead of info.Added unit tests
TestPingRetriesConnectionResetandTestPingDoesNotRetryAuthFailure.🤖 Generated with Claude Code