BUG-4794: use the transaction invoker to queue the clean-up
authorStephen Kitt <skitt@redhat.com>
Tue, 26 Jan 2016 14:28:38 +0000 (15:28 +0100)
committerStephen Kitt <skitt@redhat.com>
Tue, 26 Jan 2016 16:18:15 +0000 (17:18 +0100)
commitbab79acf90d08fbbf8cc70ff768cfdf936f079c7
tree7e388acf9861de1e9f5c0f62ccebb760ea4f4b77
parent78556fd7cf49883fc170021d89575427acd655fc
BUG-4794: use the transaction invoker to queue the clean-up

When a manager disconnection comes in, an OvsdbRemoveNodeCommand is
queued in the transaction invoker to remove the corresponding nodes.
If an ownership change is detected, an "emergency" clean-up is
executed, but without going through the transaction invoker; it's
executed using the MD-SAL data broker directly. Both of these
operations try to protect themselves by checking the presence of
appropriate nodes before running; but in some cases we see
manager-node-entry list item deletions being attempted on a deleted
manager-node-entry list, which causes a crash.

To avoid the race which leads to these crashes, this patch queues the
emergency clean-up with the transaction invoker, ensuring that the
operations will be serialised with any other clean-ups. In this way
the protection checks will be effective and avoid deleting items from
no-longer-existent lists.

Change-Id: Ia4ff31677e61d897720ce3209d6da7eed5e5ee8d
Signed-off-by: Stephen Kitt <skitt@redhat.com>