Merge lp:~jameinel/juju-core/read-before-download into lp:~go-bot/juju-core/trunk
Status: | Merged |
---|---|
Approved by: | John A Meinel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2011 |
Proposed branch: | lp:~jameinel/juju-core/read-before-download |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
62 lines (+26/-2) 3 files modified
worker/upgrader/export_test.go (+8/-0) worker/upgrader/upgrader.go (+6/-2) worker/upgrader/upgrader_test.go (+12/-0) |
To merge this branch: | bzr merge lp:~jameinel/juju-core/read-before-download |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+193008@code.launchpad.net |
Commit message
worker/upgrader: check for tools before getting
When we moved Upgrader behind the API, we lost one of the checks that
it was doing. Namely, when it saw that an upgrade was requested, it
used to check if we already had that version of the tools available.
This restores that check.
I noticed this while doing scale testing. If you have 1000 units all
trying to upgrade at the same time on a machine, you end up consuming
4.5MB*1000 = 4.5GB of temporary Tar data, plus 20MB*1000=40GB of
'unpacking-' files. Which is more than my VMs have available :).
There is still a race condition, if you have all of the Unit agents
notice at the same time, they will still start trying to download
concurrently. The only thing I could really do there would be to add a
filesystem lock (like uniter-
isn't very trivial to set up a fs hook correctly (in uniter.go there
is a lot of code around checking the Tomb to see if we are stopping,
if we held the lock before so we can break it now, etc.) I'd rather
not get the fs locking wrong and end up in a situation where we
deadlock trying to upgrade.
Description of the change
worker/upgrader: check for tools before getting
When we moved Upgrader behind the API, we lost one of the checks that
it was doing. Namely, when it saw that an upgrade was requested, it
used to check if we already had that version of the tools available.
This restores that check.
I noticed this while doing scale testing. If you have 1000 units all
trying to upgrade at the same time on a machine, you end up consuming
4.5MB*1000 = 4.5GB of temporary Tar data, plus 20MB*1000=40GB of
'unpacking-' files. Which is more than my VMs have available :).
There is still a race condition, if you have all of the Unit agents
notice at the same time, they will still start trying to download
concurrently. The only thing I could really do there would be to add a
filesystem lock (like uniter-
isn't very trivial to set up a fs hook correctly (in uniter.go there
is a lot of code around checking the Tomb to see if we are stopping,
if we held the lock before so we can break it now, etc.) I'd rather
not get the fs locking wrong and end up in a situation where we
deadlock trying to upgrade.
Reviewers: mp+193008_ code.launchpad. net,
Message:
Please take a look.
Description:
worker/upgrader: check for tools before getting
When we moved Upgrader behind the API, we lost one of the checks that
it was doing. Namely, when it saw that an upgrade was requested, it
used to check if we already had that version of the tools available.
This restores that check.
I noticed this while doing scale testing. If you have 1000 units all
trying to upgrade at the same time on a machine, you end up consuming
4.5MB*1000 = 4.5GB of temporary Tar data, plus 20MB*1000=40GB of
'unpacking-' files. Which is more than my VMs have available :).
There is still a race condition, if you have all of the Unit agents hook-execution) . I looked into it, but it
notice at the same time, they will still start trying to download
concurrently. The only thing I could really do there would be to add a
filesystem lock (like uniter-
isn't very trivial to set up a fs hook correctly (in uniter.go there
is a lot of code around checking the Tomb to see if we are stopping,
if we held the lock before so we can break it now, etc.) I'd rather
not get the fs locking wrong and end up in a situation where we
deadlock trying to upgrade.
https:/ /code.launchpad .net/~jameinel/ juju-core/ read-before- download/ +merge/ 193008
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/19000043/
Affected files (+28, -2 lines): upgrader/ export_ test.go upgrader/ upgrader. go upgrader/ upgrader_ test.go
A [revision details]
M worker/
M worker/
M worker/
Index: [revision details] 20131026004354- fc2et5acdg4ntbe 4
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: worker/ upgrader/ export_ test.go upgrader/ export_ test.go' upgrader/ export_ test.go 2013-07-29 09:06:43 +0000 upgrader/ export_ test.go 2013-10-29 06:08:08 +0000
=== modified file 'worker/
--- worker/
+++ worker/
@@ -3,4 +3,12 @@
package upgrader
+import ( net/juju- core/tools" ameVerification bool) error { agentTools, disableSSLHostn ameVerification )
+ "launchpad.
+)
+
var RetryAfter = &retryAfter
+
+func EnsureTools(u *Upgrader, agentTools *tools.Tools,
disableSSLHostn
+ return u.ensureTools(
+}
Index: worker/ upgrader/ upgrader. go upgrader/ upgrader. go' upgrader/ upgrader. go 2013-10-17 22:48:19 +0000 upgrader/ upgrader. go 2013-10-29 06:05:03 +0000 wantTools, disableSSLHostn ameVerification ) wantTools, disableSSLHostn ameVerification )
=== modified file 'worker/
--- worker/
+++ worker/
@@ -152,7 +152,7 @@
// repeatedly (causing the agent to be stopped), as long
// as we have got as far as this, we will still be able to
// upgrade the agent.
- err := u.fetchTools(
+ err := u.ensureTools(
if err == nil {
return &UpgradeReadyError{
OldTools: currentTools,
@@ -167,13 +167,17 @@
}
}
-func (u *Upgrader) fetchTools( agentTools *coretools.Tools, ameVerification bool) error { agentTools *coretools.Tools, ameVerif. ..
disableSSLHostn
+func (u *Upgrader) ensureTools(
disableSSLHostn