Skip to content

Go-1.9 is now default for juju 2.3 #7903

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

Merged
merged 82 commits into from
Oct 13, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
774bf6e
Fan support for containers:
Sep 1, 2017
13b2b40
Fan support for containers:
Sep 4, 2017
98e044a
Merge branch '2.3-fan-networking' of github:wupeka/juju into 2.3-fan-…
Sep 5, 2017
0b54a82
Update juju/description deps
Sep 5, 2017
93444d4
Merge branch 'develop' into 2.3-fan-networking
Sep 15, 2017
f2bf5e9
Merge remote-tracking branch 'upstream/develop' into 2.3-fan-networking
Sep 15, 2017
e2ded9f
Separate API for fanconfigurer, container-networking-method model con…
Sep 26, 2017
6ecbc45
Merge branch 'develop' into 2.3-fan-networking
Sep 28, 2017
f1b5f56
FAN: small fix
Sep 28, 2017
1191741
FAN: some fixes
Sep 28, 2017
6fc6d76
Catch the failure on Mongo 2.4.
jameinel Oct 2, 2017
85553aa
Fix for BUG 1689683
hmlanigan Oct 2, 2017
863477c
Adde note about standard ssh options.
anastasiamac Oct 3, 2017
d3b8ff4
On Mongo 2.4 fallback to $inc operations.
jameinel Oct 2, 2017
0906fd9
More details.
anastasiamac Oct 3, 2017
40bddfd
More details.
anastasiamac Oct 3, 2017
595f0ad
Convert to using go-1.9 for PR jobs, update readme to refer to snap f…
Oct 3, 2017
5e3eb7b
change dirs to be snap friendly
Oct 3, 2017
a03757e
Re-phrase.
anastasiamac Oct 3, 2017
333eb96
Merge pull request #7901 from anastasiamac/ssh-help-lp1718775
jujubot Oct 3, 2017
6da1268
Add a few extra lines of logging at bootstrap time
wallyworld Oct 4, 2017
d1a995b
Merge pull request #7904 from wallyworld/extra-bootstrap-logging
jujubot Oct 4, 2017
c3d5931
Merge branch '2.3-fan-networking' of github:wupeka/juju into 2.3-fan-…
Oct 4, 2017
014e36a
review pointed out a dead comment
jameinel Oct 4, 2017
c1f373c
Merge pull request #7900 from jameinel/2.2-pingbatcher-1720155
jujubot Oct 4, 2017
e0b309b
Netplan containerizer
Oct 4, 2017
d1973cc
remote application on the offering side do not need status
wallyworld Oct 4, 2017
982f2c1
Merge pull request #7908 from wupeka/2.3-netplan-containerizer
jujubot Oct 4, 2017
0870d37
Merge pull request #7907 from wallyworld/no-remote-app-proxy-status
jujubot Oct 4, 2017
d7a13d9
juju offers supports filtering by user
wallyworld Oct 4, 2017
ad540e0
Merge pull request #7906 from wallyworld/offers-filter-by-user
jujubot Oct 4, 2017
0edad66
Merge remote-tracking branch 'upstream/2.2' into 2.2-into-develop
jameinel Oct 4, 2017
97ba665
Merge pull request #7909 from jameinel/2.2-into-develop
jujubot Oct 4, 2017
3fd2bbf
Merge pull request #7905 from hmlanigan/bug-1689683
jujubot Oct 4, 2017
fa7a7e4
beta1 incoming
Oct 4, 2017
276441e
Merge pull request #7910 from nskaggs/incoming-2.3-beta1
jujubot Oct 4, 2017
a409997
FAN: test for state/containernetworking
Oct 4, 2017
97fbe8f
Merge pull request #7718 from wupeka/2.3-fan-networking
jujubot Oct 4, 2017
33f0344
clarify bootstrap error message when agent versions different from cl…
anastasiamac Oct 5, 2017
e1fe99c
re-phrased based on review.
anastasiamac Oct 5, 2017
9cd5c5f
re-phrased based on review.
anastasiamac Oct 5, 2017
df87f77
Fix test race in TestRemoteRelationsSuspended
wallyworld Oct 5, 2017
4605eb2
Merge pull request #7911 from anastasiamac/clarify-err-msg
jujubot Oct 5, 2017
bde25dc
Merge pull request #7912 from wallyworld/remote-relations-race
jujubot Oct 5, 2017
ccea277
Clarify bootstrap help re:agent-version.
anastasiamac Oct 5, 2017
b107db3
review suggestions taken in.
anastasiamac Oct 5, 2017
a759959
Merge pull request #7914 from anastasiamac/bootstrap-help-agent-version
jujubot Oct 5, 2017
77116c1
Save an alias for the offering controller when consuming
wallyworld Oct 5, 2017
c70ab4d
Merge pull request #7913 from wallyworld/external-controller-alias
jujubot Oct 5, 2017
471747c
Don't try to create bridges for containers when using FAN
Oct 5, 2017
8d34bf0
update lxd space test to test non-fan behavoir
Oct 5, 2017
50c9d93
Merge pull request #7915 from wupeka/2.3-dont-create-bridges-if-fan
jujubot Oct 5, 2017
2972248
spacing
Oct 5, 2017
78a73ef
flake8 :-)
Oct 5, 2017
1b34a59
Fix method call
Oct 5, 2017
aadd8c3
drive-by fix for destroy_job_instances
Oct 5, 2017
3956ef4
drive by for cryptic release notes script
Oct 5, 2017
10f0cae
Increment juju to 2.3-beta2
Oct 5, 2017
d1de3eb
working
Oct 5, 2017
2fbc06c
Merge pull request #7916 from nskaggs/lxd-space-under-fan
jujubot Oct 5, 2017
ab12669
Merge pull request #7917 from nskaggs/inc-2.3-beta2
jujubot Oct 5, 2017
debe75b
google: add new regions
axw Oct 9, 2017
89011ff
Merge pull request #7918 from axw/google-add-regions
jujubot Oct 10, 2017
81fe53f
Drop bzr (shouldn't be needed, godeps is git), drop gccgo
Oct 10, 2017
c629c33
Update the output for the new version of application get settings.
howbazaar Oct 10, 2017
51e9368
Add a test for v4.
howbazaar Oct 10, 2017
911e093
Merge pull request #7922 from howbazaar/is-default-abi
jujubot Oct 10, 2017
c7151ae
testing groovy
Oct 10, 2017
501d6f3
fix for go binary
Oct 10, 2017
038f796
missing "
Oct 10, 2017
6b50158
update snap bin
Oct 10, 2017
583cb52
go snap must install as classic
Oct 11, 2017
bb93740
Convert to using go-1.9 for PR jobs, update readme to refer to snap f…
Oct 3, 2017
a4194c1
change dirs to be snap friendly
Oct 3, 2017
6124e26
Drop bzr (shouldn't be needed, godeps is git), drop gccgo
Oct 10, 2017
20bdc22
testing groovy
Oct 10, 2017
716ca3d
fix for go binary
Oct 10, 2017
009e31c
missing "
Oct 10, 2017
e7a2348
update snap bin
Oct 10, 2017
c23dda4
go snap must install as classic
Oct 11, 2017
f91c4fe
drop ppa from check-merge groovy
Oct 13, 2017
2ed0c29
Merge branch 'go-1.9' of https://github.com/nskaggs/juju into go-1.9
Oct 13, 2017
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
7 changes: 7 additions & 0 deletions state/presence/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ func (dr *directRecorder) Ping(modelUUID string, slot int64, fieldKey string, fi
})
return err
}

// ForceInc forces the PingBatcher to use $inc instead of $bit operations
// This exists to test the code path that runs when using Mongo 2.4 and older.
func (pb *PingBatcher) ForceUpdatesUsingInc() {
logger.Debugf("forcing $inc operations from (was %t)", pb.useInc)
pb.useInc = true
}
73 changes: 63 additions & 10 deletions state/presence/pingbatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func NewPingBatcher(base *mgo.Collection, flushInterval time.Duration) *PingBatc
syncDelay: defaultSyncDelay,
rand: rand.New(rand.NewSource(time.Now().UnixNano())),
}
pb.useInc = checkMongoVersion(base)
pb.start()
return pb
}
Expand Down Expand Up @@ -107,6 +108,10 @@ type PingBatcher struct {

// flushMutex ensures only one concurrent flush is done
flushMutex sync.Mutex

// useInc is set to True if we discover the mongo version doesn't support $bit and upsert correctly.
// see https://bugs.launchpad.net/juju/+bug/1699678
useInc bool
}

// Start the worker loop.
Expand Down Expand Up @@ -153,6 +158,35 @@ func (pb *PingBatcher) nextSleep(r *rand.Rand) time.Duration {
return time.Duration(int64(sleepMin) + offset)
}

func checkMongoVersion(coll *mgo.Collection) bool {
if coll == nil {
logger.Debugf("using $inc operations with unknown mongo version")
return true
}
buildInfo, err := coll.Database.Session.BuildInfo()
if err != nil {
logger.Debugf("using $inc operations with unknown mongo version")
return true
}
// useInc is set to true if we discover the database is <2.6.
// Really old mongo (2.?) didn't support $bit at all, and in Mongo 2.4,
// it did not handle Upsert and $bit operations correctly.
// (see https://bugs.launchpad.net/juju/+bug/1699678)
if len(buildInfo.VersionArray) < 2 {
// Something weird, just fallback to safe mode
logger.Debugf("using $inc operations with misunderstood Mongo version: %s", buildInfo.Version)
return true
}
if buildInfo.VersionArray[0] >= 3 ||
(buildInfo.VersionArray[0] == 2 && buildInfo.VersionArray[1] >= 6) {
logger.Debugf("using $bit operations with Mongo %s", buildInfo.Version)
return false
} else {
logger.Debugf("using $inc operations with Mongo %s", buildInfo.Version)
return true
}
}

func (pb *PingBatcher) loop() error {
flushTimeout := time.After(pb.nextSleep(pb.rand))
var syncTimeout <-chan time.Time
Expand Down Expand Up @@ -265,6 +299,28 @@ func (pb *PingBatcher) handlePing(ping singlePing) {
pb.pingCount++
}

func (pb *PingBatcher) upsertFieldsUsingInc(slt slot) bson.D {
var incFields bson.D
for fieldKey, value := range slt.Alive {
incFields = append(incFields, bson.DocElem{Name: "alive." + fieldKey, Value: value})
}
return bson.D{
{"$set", bson.D{{"slot", slt.Slot}}},
{"$inc", incFields},
}
}

func (pb *PingBatcher) upsertFieldsUsingBit(slt slot) bson.D {
var fields bson.D
for fieldKey, value := range slt.Alive {
fields = append(fields, bson.DocElem{Name: "alive." + fieldKey, Value: bson.M{"or": value}})
}
return bson.D{
{"$set", bson.D{{"slot", slt.Slot}}},
{"$bit", fields},
}
}

// flush pushes the internal state to the database. Note that if the database
// updates fail, we will still wipe our internal state as it is unsafe to
// publish the same updates to the same slots.
Expand Down Expand Up @@ -298,22 +354,19 @@ func (pb *PingBatcher) flush() error {
t := time.Now()
for docId, slot := range next {
docCount++
var fields bson.D
for fieldKey, value := range slot.Alive {
fields = append(fields, bson.DocElem{Name: "alive." + fieldKey, Value: bson.M{"or": value}})
fieldCount++
fieldCount += len(slot.Alive)
var update bson.D
if pb.useInc {
update = pb.upsertFieldsUsingInc(slot)
} else {
update = pb.upsertFieldsUsingBit(slot)
}
// Note: UpsertId already handles hitting the DuplicateKey error internally
// We also just Upsert directly instead of using Bulk because for now each PingBatcher is actually
// only used by 1 model. Given 30s slots, we only ever hit 1 or 2 documents being updated at the same
// time. If we switch to sharing batchers between models, then it might make more sense to use bulk updates
// but then we need to handle when we get Duplicate Key errors during update.
_, err := pings.UpsertId(docId,
bson.D{
{"$set", bson.D{{"slot", slot.Slot}}},
{"$bit", fields},
},
)
_, err := pings.UpsertId(docId, update)
if err != nil {
return errors.Trace(err)
}
Expand Down
17 changes: 13 additions & 4 deletions state/presence/pingbatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ func (s *PingBatcherSuite) TearDownTest(c *gc.C) {
presence.RealPeriod()
}

func (s *PingBatcherSuite) TestRecordsPings(c *gc.C) {
pb := presence.NewPingBatcher(s.presence, time.Second)
defer assertStopped(c, pb)

func (s *PingBatcherSuite) assertPingsRecorded(c *gc.C, pb *presence.PingBatcher) {
// UnixNano time rounded to 30s interval
slot := int64(1497960150)
c.Assert(pb.Ping("test-uuid", slot, "0", 8), jc.ErrorIsNil)
Expand All @@ -81,6 +78,18 @@ func (s *PingBatcherSuite) TestRecordsPings(c *gc.C) {
"1": int64(129),
})
}
func (s *PingBatcherSuite) TestRecordsPings(c *gc.C) {
pb := presence.NewPingBatcher(s.presence, time.Second)
defer assertStopped(c, pb)
s.assertPingsRecorded(c, pb)
}

func (s *PingBatcherSuite) TestRecordsPingsUsingInc(c *gc.C) {
pb := presence.NewPingBatcher(s.presence, time.Second)
pb.ForceUpdatesUsingInc()
defer assertStopped(c, pb)
s.assertPingsRecorded(c, pb)
}

func (s *PingBatcherSuite) TestMultipleUUIDs(c *gc.C) {
pb := presence.NewPingBatcher(s.presence, time.Second)
Expand Down