-
Notifications
You must be signed in to change notification settings - Fork 11
Retry mongo writes #345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retry mongo writes #345
Conversation
WalkthroughExponential backoff retry logic (max 3 retries) is added around three write paths in the common connector base, with non-retryable errors marked as permanent. Simultaneously, MongoDB connector error handling is refactored to centralize network error detection and mapping via a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)connectors/common/base.go (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
connectors/common/base.go (1)
1117-1129: Missing retryability check before returning errors.Same issue as the previous retry blocks - errors are returned without checking
isRetryable(err)first. This pattern appears in all three retry blocks added by this PR and should be fixed consistently.Apply this diff to add the retryability check:
backoffConfig := backoff.WithMaxRetries(backoff.NewExponentialBackOff(), 3) if err := backoff.Retry(func() error { _, err := c.impl.WriteUpdates(c.flowCtx, connect.NewRequest(&adiomv1.WriteUpdatesRequest{ Namespace: ns, Updates: msgs, Type: c.settings.DestinationDataType, })) + if err != nil && !isRetryable(err) { + return backoff.Permanent(err) + } return err }, backoffConfig); err != nil { return err }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
connectors/common/base.go(2 hunks)connectors/mongo/conn.go(5 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
connectors/common/base.go (2)
gen/adiom/v1/messages.pb.go (6)
WriteUpdatesRequest(977-984)WriteUpdatesRequest(997-997)WriteUpdatesRequest(1012-1014)WriteDataRequest(881-888)WriteDataRequest(901-901)WriteDataRequest(916-918)protocol/iface/connector.go (1)
Namespace(104-107)
🔇 Additional comments (1)
connectors/mongo/conn.go (1)
1015-1024: LGTM! Error classification correctly maps transient failures.The
maybeUnavailableErrorfunction properly centralizes error handling by mapping network-related errors toCodeUnavailable(which is retryable perisRetryablein base.go), while falling back toCodeInternalfor other failures. The two-level check (MongoDB-specific network errors, then generalnet.Error) provides comprehensive coverage of transient network issues.
a0fa27e to
787132e
Compare
787132e to
fef8d07
Compare
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.