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

guard against duplication key error from mongodb #3358

Merged
merged 1 commit into from Jan 16, 2017

Conversation

Projects
None yet
2 participants
@kroepke
Member

kroepke commented Jan 16, 2017

due to https://jira.mongodb.org/browse/SERVER-14322 concurrent upserts can fail leading to NPEs during session updates
these are generally harmless, as one of the concurrent updates will succeed (and all end up expiring the session anyway), but to at least handle the problem, we'll retry the request as suggested in the MongoDB bug report

fixes #3335

guard against duplication key error from mongodb
due to https://jira.mongodb.org/browse/SERVER-14322 concurrent upserts can fail leading to NPEs during session updates
these are generally harmless, as one of the concurrent updates will succeed (and all end up expiring the session anyway), but to at least handle the problem, we'll retry the request as suggested in the MongoDB bug report

fixes #3335

@kroepke kroepke added this to the 2.2.0 milestone Jan 16, 2017

@joschi joschi self-assigned this Jan 16, 2017

@joschi

joschi approved these changes Jan 16, 2017

LGTM.

// Due to https://jira.mongodb.org/browse/SERVER-14322 upserts can fail under concurrency.
// We need to retry the update, and stagger them a bit, so no all of the retries attempt it at the same time again.
// Usually this should succeed the first time, though
final Retryer<Object> retryer = RetryerBuilder.newBuilder()

This comment has been minimized.

@joschi

joschi Jan 16, 2017

Contributor

Minor nitpick: This could be Retryer<Void> since we never use the return value of mongoDBSessionService.saveWithoutValidation(dbSession)).

This comment has been minimized.

@kroepke

kroepke Jan 16, 2017

Member

I've tried that, but the compiler complained. Would probably have to use <Void>build() at the end, which looked ugly. So I decided to leave it as object.

This comment has been minimized.

@joschi

joschi Jan 16, 2017

Contributor

This comment has been minimized.

@kroepke

kroepke Jan 16, 2017

Member

Actually, <Void>newBuilder() and then also return a Void in the callable. I think it makes it less clear what's happening, so I'd vote for leaving it like it is.

@joschi joschi merged commit d46d047 into master Jan 16, 2017

4 checks passed

ci-web-linter Jenkins build graylog-pr-linter-check 1282 has succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
licence/cla Contributor License Agreement is signed.
Details

@joschi joschi deleted the issue-3335 branch Jan 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment