Reviewers: mp+206765_code.launchpad.net, Message: Please take a look. Description: state: Make unit ids unique. Fix #1174610 This changes the way unit names are generated when adding a new unit to a service. Before, we used serviceDoc.UnitSeq to generate the last part of a unit name. Now, we use the sequence collection with a key "s##unit" as the unit ids sequence (as we do for machine, containers, etc.). This is a schema change (removing of UnitSeq from the service document). So it should be handled the same way as any schema change during an upgrade, but this CL does not do that. I realized the sequence collection is not created as all the other collections in state.Initialize, so I added it there. Also added a test to guarantee unit ids increase each time for the same service name (like the bug suggests and how it was before). Per fwereade's suggestion, I changed the error message AddUnit() returns when a service is not found: "service is no longer alive" rather than "service "blah" not found", and also fixed a test that relied on that. https://code.launchpad.net/~dimitern/juju-core/300-lp-1174610-unit-ids-unique/+merge/206765 (do not edit description out of merge proposal) Please review this at https://codereview.appspot.com/64890044/ Affected files (+35, -14 lines): A [revision details] M state/open.go M state/sequence.go M state/service.go M state/service_test.go M state/state.go Index: [revision details] === 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-20140217133244-ukuzvegy1wqly6nm +New revision: