[ovs-dev] [PATCH v3] [python] Avoid sending transactions when the DB is not synced up

Dumitru Ceara dceara at redhat.com
Thu Sep 2 15:53:16 UTC 2021


On 9/2/21 5:34 PM, Terry Wilson wrote:
> 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 at redhat.com>
> ---
>  python/ovs/db/idl.py | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
> index ecae5e143..87ee06cde 100644
> --- a/python/ovs/db/idl.py
> +++ b/python/ovs/db/idl.py
> @@ -1505,6 +1505,11 @@ class Transaction(object):
>          if self != self.idl.txn:
>              return self._status
>  

Sorry, I should've probably mentioned this in the previous review, but I
missed it.

Nit: the comment from f50714bf9a72 ("ovsdb-idl: Avoid sending
transactions when the DB is not synced up.") would be nice to have here too:

# If we're still connecting or re-connecting, don't bother sending a
# transaction.

I guess this can be fixed up at apply time so:

Acked-by: Dumitru Ceara <dceara at redhat.com>

> +        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
> 



More information about the dev mailing list