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: upgrade leases before starting manager #8011
Conversation
|
another option might be to just allow reading docs that might be the old form rather than treating them as "corrupted". also, we clearly have a bug where corrupted documents cause us to spin and leak file descriptors. we should try to figure out what is leaking so that general restarts don't leak |
I did consider that, but I'd rather keep this package clean, and put the crappy hack (upgrade before start) with the other crappy hacks (start worker from within State).
Yup, looking into it now. |
jameinel
approved these changes
Nov 2, 2017
as mentioned, there may be other ways but this seems ok. I have not done any manual testing of it yet to know if it really does solve the upgrade problem.
| - continue | ||
| + err := st.db().Run(func(int) ([]txn.Op, error) { | ||
| + var doc struct { | ||
| + DocID string `bson:"_id"` |
jameinel
Nov 2, 2017
Owner
why not leave this as an old type instead of being an embedded struct. type oldLeaseDoc or something like that?
axw
Nov 2, 2017
Member
Why have a named type when you don't need one? I just cribbed from another upgrade. Doesn't really matter either way.
|
I'm also concerned that we *need* This for anyone who might be testing
upgrading to beta2. I guess maybe we don't usually ask people to test out
the beta yet?
John
=:->
…
|
|
Landing this, will continue investigating the leak separately. |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://ci.jujucharms.com/job/github-merge-juju |
|
Mostly because it allows a name and a context. It also seems pretty similar
to the general philosophy that you shouldn't have inline defined constants.
It also promotes it a bit to feel like something you should be careful
about modifying arbitrarily. It certainly isn't necessary, we as long as
you don't ever need to reference it in more than one place.
John
=:->
…
|
axw commentedNov 2, 2017
Description of change
Since the lease managers are started when you
open a State object, they may be in use before
the lease upgrade step runs. This can lead to
errors, since the lease manager will choke upon
seeing the old lease documents.
To work around this, we upgrade the lease docs
just prior to starting the lease manager. When
we extract the lease managers from State, we
can drop this bit of code and rely on the upgrade
step. The upgrade step has been left in place
for this purpose.
QA steps
Documentation changes
None.
Bug reference
Fixes https://bugs.launchpad.net/juju/+bug/1728972