state: fix address update assertions #2524

Merged
merged 1 commit into from Jun 9, 2015

Conversation

Projects
None yet
2 participants
Member

axw commented Jun 9, 2015

Back-port of #2513

Change machine address updates to not care about concurrent updates.

Block-device and address updates are currently asserting
that there are no concurrent changes. There are several
problems with this:

  • to do this, they assert that the current field value
    is equal to the in-memory struct representation. This
    means that removing or reordering fields in the struct
    will cause assertion failures
  • even without changing the above, there is an issue in
    mgo that can cause reordering of map elements in
    assertions
  • the assertions are pointless. Even if we prevent a change
    between observing the current value and updating, we still
    loop and then update. The net effect is that we always update,
    except in the case of "state changing too fast".

Fixes https://bugs.launchpad.net/bugs/1461871

(Review request: http://reviews.vapour.ws/r/1890/)

state: fix block-device/address update assertions
Change block-device and machine address updates to not
care about concurrent updates.

Block-device and address updates are currently asserting
that there are no concurrent changes. There are several
problems with this:
 - to do this, they assert that the current field value
   is equal to the in-memory struct representation. This
   means that removing or reordering fields in the struct
   will cause assertion failures
 - even without changing the above, there is an issue in
   mgo that can cause reordering of map elements in
   assertions
 - the assertions are pointless

The assertions are pointless for two main reasons:
 - for each of block-devices and addresses, there is a single
   worker responsible for updating. Any concurrent update
   issues are thus purely academic
 - even if we prevent a change between observing the current
   value and updating, we still loop and then update. The net
   effect is that we always update, except in the case of
   "state changing too fast".

Fixes https://bugs.launchpad.net/bugs/1461871
Member

axw commented Jun 9, 2015

$$merge$$

Contributor

jujubot commented Jun 9, 2015

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

jujubot added a commit that referenced this pull request Jun 9, 2015

Merge pull request #2524 from axw/lp1461871-state-assertions-1.22
state: fix address update assertions

Back-port of #2513

Change machine address updates to not care about concurrent updates.

Block-device and address updates are currently asserting
that there are no concurrent changes. There are several
problems with this:
 - to do this, they assert that the current field value
   is equal to the in-memory struct representation. This
   means that removing or reordering fields in the struct
   will cause assertion failures
 - even without changing the above, there is an issue in
   mgo that can cause reordering of map elements in
   assertions
 - the assertions are pointless. Even if we prevent a change
   between observing the current value and updating, we still
   loop and then update. The net effect is that we always update,
   except in the case of "state changing too fast".

Fixes https://bugs.launchpad.net/bugs/1461871

(Review request: http://reviews.vapour.ws/r/1890/)

@jujubot jujubot merged commit 1c112e9 into juju:1.22 Jun 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment