Skip to content

Commit

Permalink
python: idl: Avoid sending transactions when the DB is not synced up.
Browse files Browse the repository at this point in the history
This ports the C IDL change f50714b to the Python IDL:

Until now the code here would happily try to send transactions to the
database server even if the database connection was not in the correct
state.  In some cases this could lead to strange behavior, such as sending
a database transaction for a database that the IDL had just learned did not
exist on the server.

Signed-off-by: Terry Wilson <twilson@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
otherwiseguy authored and igsilya committed Oct 12, 2021
1 parent 9efa2ea commit 2a963fc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/ovs/db/idl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,11 @@ def commit(self):
if self != self.idl.txn:
return self._status

if self.idl.state != Idl.IDL_S_MONITORING:
self._status = Transaction.TRY_AGAIN
self.__disassemble()
return self._status

# If we need a lock but don't have it, give up quickly.
if self.idl.lock_name and not self.idl.has_lock:
self._status = Transaction.NOT_LOCKED
Expand Down

0 comments on commit 2a963fc

Please sign in to comment.