juju.replicaset could use kr/pretty in its debug messages
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Fix Released
|
Medium
|
John A Meinel |
Bug Description
Things like this are hard to parse:
machine-0: 18:08:29 DEBUG juju.replicaset Set() changing replica set
from {Name: juju, Version: 10, Members: {Member{2 "10.16.17.4:37017" map[juju-
to {Name: juju, Version: 11, Members: {Member{3 "10.16.
It would be better to format those nicely so you can figure out what is actually changing. eg:
machine-0: 18:08:29 DEBUG juju.replicaset Set() changing replica set
from {
Name: juju,
Version: 10,
Members: {
Member{1 "10.16.
Member{2 "10.16.17.4:37017" map[juju-
Member{3 "10.16.
},
}
to {
Name: juju,
Version: 11,
Members: {
Member{1 "10.16.
Member{2 "10.16.17.4:37017" map[juju-
Member{3 "10.16.
},
}
Note that the members are also sorted by Id.
Also, this particular change was illegal because were also changing the Voting status of some machines, but that does not show up in the output. We need to include more fields so we can tell what is really changing.
Potentially we might even use something like:
https:/
description: | updated |
Changed in juju: | |
assignee: | nobody → John A Meinel (jameinel) |
Changed in juju: | |
status: | Triaged → In Progress |
Changed in juju: | |
status: | In Progress → Fix Committed |
milestone: | none → 2.4-beta1 |
Changed in juju: | |
status: | Fix Committed → Fix Released |
pretty.Diff turned out to not be super helpful when dealing with slices of Members. Using a custom formatter and then doing the diff gave: Member[ 1] != []replicaset. Member[ 3]
[LOG] 0:18.786 DEBUG juju.replicaset Add() changing replica set
from {
Name: juju,
Version: 1,
Members: {
{1 "localhost:43465" foo:bar voting},
},
}
to {
Name: juju,
Version: 2,
Members: {
{1 "localhost:43465" foo:bar voting},
{2 "localhost:41232" voting},
{3 "localhost:36076" voting},
},
}
diff:
Version: 1 != 2
Members: []replicaset.
So it didn't really clarify that #2 and #3 were being added.
However, we can at least update the existing "fmtConfigForLog" to do a better job with indenting, etc, and making it much clearer to read.
https:/ /github. com/juju/ replicaset/ pull/8