diff mbox series

[ovs-dev,4/6] python: idl: Treat "unknown database" error as reason to reconnect.

Message ID 20260826043433.1832409-5-twilson@redhat.com
State New
Delegated to: Ilya Maximets
Headers show
Series python: Backport C fixes that never made it. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_FreeBSD_Build_and_Test success github build: passed

Commit Message

Terry Wilson Aug. 26, 2026, 4:34 a.m. UTC
Ordinarily the IDL finds out in advance whether a particular database is
on its server, or it finds out via notifications.  But it's also a good
idea to adopt a belt-and-suspenders approach so that, if the IDL does
receive an "unknown database" error, we treat it as a "soft" error that
can be fixed by reconnecting to another server, rather than a "hard"
error that should cause an immediate abort.

This is a Python port of C commit e83ea0d652f2 ("ovsdb-idl: Treat
"unknown database" error as reason to reconnect.").  It relies on
Idl.flag_inconsistency() to force the reconnect and full re-download.

Assisted-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Terry Wilson <twilson@redhat.com>
---
 python/ovs/db/idl.py | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 0a7478e9f..07068407d 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -2260,6 +2260,13 @@  class Transaction(object):
                     if error is not None:
                         if error == "timed out":
                             soft_errors = True
+                        elif error == "unknown database":
+                            # ovsdb-server uses this error message to
+                            # indicate that the database in question was
+                            # removed, converted, etc.  Flag the IDL as
+                            # inconsistent so it reconnects and resyncs.
+                            self.idl.flag_inconsistency()
+                            soft_errors = True
                         elif error == "not owner":
                             lock_errors = True
                         elif error == "aborted":