Skip to content
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

If using Replicaset use wiredTiger. #143

Merged
merged 1 commit into from
Apr 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions mgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (inst *MgoInstance) run() error {
mgoargs = append(mgoargs, "--nojournal")
}
if version.Compare(storageEngineMongoVersion) >= 0 {
storageEngine := mongoStorageEngine()
storageEngine := mongoStorageEngine(inst.EnableReplicaSet)
if storageEngine != "" {
mgoargs = append(mgoargs, "--storageEngine", storageEngine)
}
Expand Down Expand Up @@ -351,18 +351,23 @@ func (inst *MgoInstance) run() error {
return nil
}

func mongoStorageEngine() string {
func mongoStorageEngine(replicaset bool) string {
storageEngine := os.Getenv("JUJU_MONGO_STORAGE_ENGINE")
if storageEngine != "" {
return storageEngine
}
switch runtime.GOARCH {
case "amd64":
if replicaset {
// Use 'wiredTiger' unless explicitly requested to use a
// different backend. mmapv1 is generally available, but
// doesn't support things like server-side transactions, and
// also isn't our production backend.
return "wiredTiger"
} else {
// We use mmapv1 in the test suite as it can be 3-4x faster in many tests.
return "mmapv1"
}
}
return "" // use the default
}
Expand Down