Merge lp:~natefinch/juju-core/042-sortaensure into lp:~go-bot/juju-core/trunk
Proposed by
Nate Finch
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 2620 | ||||
Proposed branch: | lp:~natefinch/juju-core/042-sortaensure | ||||
Merge into: | lp:~go-bot/juju-core/trunk | ||||
Diff against target: |
81 lines (+22/-11) 2 files modified
agent/mongo/mongo.go (+11/-2) agent/mongo/mongo_test.go (+11/-9) |
||||
To merge this branch: | bzr merge lp:~natefinch/juju-core/042-sortaensure | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+215504@code.launchpad.net |
Description of the change
fix upgrade from 1.18 to 1.19
So, we can't start old mongo servers into replset mode just yet, which was causing the problem. So for now, we won't replace the old upstart scripts of existing servers.
To post a comment you must log in.
Reviewers: mp+215504_ code.launchpad. net,
Message:
Please take a look.
Description:
fix upgrade from 1.18 to 1.19
So, we can't start old mongo servers into replset mode just yet, which
was causing the problem. So for now, we won't replace the old upstart
scripts of existing servers.
https:/ /code.launchpad .net/~natefinch /juju-core/ 042-sortaensure /+merge/ 215504
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/86930046/
Affected files (+24, -11 lines): mongo.go mongo_test. go
A [revision details]
M agent/mongo/
M agent/mongo/
Index: [revision details] 20140411112804- lhmoi3eyp2zaqx0 g
=== 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: agent/mongo/ mongo.go mongo/mongo. go' mongo.go 2014-04-10 09:58:05 +0000 mongo.go 2014-04-11 19:48:39 +0000 er(dataDir string, port int, namespace string) error { Infof(" Ensuring mongo server is running; dataDir %s; port %d", Join(dataDir, "db")
=== modified file 'agent/
--- agent/mongo/
+++ agent/mongo/
@@ -186,7 +186,6 @@
// the local provider.
func EnsureMongoServ
// NOTE: ensure that the right package is installed?
-
logger.
dataDir, port)
dbDir := filepath.
@@ -194,6 +193,12 @@ (dbDir) ; err != nil { "prealloc. %d", x) Join(journalDir , name) filename, os.O_WRONLY| os.O_CREATE| os.O_TRUNC, 0700) filename, os.O_WRONLY| os.O_CREATE| os.O_EXCL, 0700)
if err != nil {
return err
}
+
+ // TODO(natefinch): remove this once we support upgrading to HA
+ if service.Installed() {
+ return nil
+ }
+
if err := makeJournalDirs
return fmt.Errorf("Error creating journal directories: %v", err)
}
@@ -222,7 +227,11 @@
for x := 0; x < 3; x++ {
name := fmt.Sprintf(
filename := filepath.
- f, err := os.OpenFile(
+ f, err := os.OpenFile(
+ if os.IsExist(err) {
+ // already exists, don't overwrite
+ continue
+ }
if err != nil {
return fmt.Errorf("failed to open mongo prealloc file %q: %v",
filename, err)
}
Index: agent/mongo/ mongo_test. go mongo/mongo_ test.go' mongo_test. go 2014-04-08 15:04:46 +0000 mongo_test. go 2014-04-11 19:48:39 +0000
=== modified file 'agent/
--- agent/mongo/
+++ agent/mongo/
@@ -81,19 +81,19 @@
func testJournalDirs(dir string, c *gc.C) {
journalDir := path.Join(dir, "journal")
- c.Check(journalDir, jc.IsDirectory) journalDir, jc.IsDirectory) filepath. Join(journalDir , "prealloc.0"))
+ c.Assert(
info, err := os.Stat(
- c.Check(err, gc.IsNil)
+ c.Assert(err, gc.IsNil)
size := int64(1024 * 1024)
- c.Check( info.Size( ), gc.Equals, size) info.Size( ), gc.Equals, size) filepath. Join(journalDir , "prealloc.1")) info.Size( ), gc.Equals, size) info.Size( ), gc.Equals, size) filepath. Join(journalDir , "prealloc.2")) info.Size( ), gc.Equals, size) info.Size( ), gc.Equals, size)
+ c.Assert(
info, err = os.Stat(
- c.Check(err, gc.IsNil)
- c.Check(
+ c.Assert(err, gc.IsNil)
+ c.Assert(
info, err = os.Stat(
- c.Check(err, gc.IsNil)
- c.Check(
+ c.Assert(err, gc.IsNil)
+ c.Assert(
}
func (s *MongoSuite) TestEn...