Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
state: Generalise error handling when splitting logs collection #7588
Conversation
mjs
changed the base branch from
develop
to
2.2
Jul 3, 2017
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
jujubot
merged commit 8b26e24
into
juju:2.2
Jul 3, 2017
1 check passed
github-check-merge-juju
Ran tests against PR. Use !!.*!! to request another build. IE, !!build!!, !!retry!!
Details
mjs
deleted the
mjs:log-split-upgrade-err-handling
branch
Jul 3, 2017
| +func isMgoNamespaceNotFound(err error) bool { | ||
| + // Check for &mgo.QueryError{Code:26, Message:"ns not found"} | ||
| + if qerr, ok := err.(*mgo.QueryError); ok { | ||
| + if qerr.Code == 26 { |
jameinel
Jul 3, 2017
Owner
Off-hand, shouldn't we have a a name for the error code instead of just a number mgo.NamespaceNotFoundCode or somesuch?
|
I mean that something like '26' should definitely be pulled into a
constant. Having it in 'mgo' would be ideal, but if not there, we should
have our own.
Its somewhat ok that we're at least using a helper
(isMgoNamespaceNotFound), but it still feels very odd to not have the
collection of error codes somewhere.
…
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mjs commentedJul 3, 2017
Description of change
The error checks in SplitLogCollections didn't work on MongoDB 2.4 as
older MongoDB versions only return an error string without the error
code.
mgo's IsDup helper is now used for insert error handling and "ns not
found" is now checked by code or string.
Fixes https://bugs.launchpad.net/juju/+bug/1701999
QA steps
Related unit tests were failing on MongoDB 2.4 before and pass now.
Documentation changes
N.A.
Bug reference
https://bugs.launchpad.net/juju/+bug/1701999