Fix race condition in initial connection. 50/20050/5
authorEd Warnicke <hagbard@gmail.com>
Mon, 11 May 2015 18:56:09 +0000 (11:56 -0700)
committerEd Warnicke <hagbard@gmail.com>
Mon, 11 May 2015 20:11:49 +0000 (13:11 -0700)
commit23d2611b2436695524d6b270f2189e3db471d246
tree9f3a06e5b524822d60d6d842de6b30ecc0001964
parentdb06a1b66412f33aa63491c4452d1e16178d6f77
Fix race condition in initial connection.

We must register the OvsdbConnectionCreateCommand prior
to registerCallback or we will get race conditions.

*Before* any bridge information can be successfully written
to the operational datastore, the OvsdbNode *must* be written.
The txInvoker guarantees writes occur in the order they were
provided to *it*.

If we have:

  txInvoker.invoke(new OvsdbNodeCreateCommand(key, null,null));
  registerCallBack();

We can guarantee that, and thus guarantee we will not have race conditions.

However, if we reverse that:

  registerCallBack();
  txInvoker.invoke(new OvsdbNodeCreateCommand(key, null,null));

We are guarenteed to have race conditions, as the results of the original
monitor dump get written to the datastore before the OvsdbNode gets written.

Please note: ovsdb is actively broken out of the box due to this race
conditions, so this must be corrected ASAP.

Change-Id: Id71221f7665ece5ec4b2eb9a0b39465618bada01
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java