diff mbox series

[ovs-dev,11/22] ovsdb: replication: Automatically switch read-only mode.

Message ID 20231214010431.1664005-12-i.maximets@ovn.org
State Superseded
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev,01/22] ovsdb-server.at: Enbale debug logs in active-backup tests. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Ilya Maximets Dec. 14, 2023, 1:04 a.m. UTC
When database is added to the replication, it should no longer
accept transactions that can modify it.  When it's removed from
the replication, it should be writable again.  Add this logic
to the replication module itself, so it can be removed from the
main ovsdb-server later.

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 ovsdb/replication.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/ovsdb/replication.c b/ovsdb/replication.c
index d0d48aad5..3c59d4039 100644
--- a/ovsdb/replication.c
+++ b/ovsdb/replication.c
@@ -150,6 +150,7 @@  replication_set_db(struct ovsdb *db, const char *sync_from,
     jsonrpc_session_set_probe_interval(rdb->session, probe_interval);
 
     rdb->state = RPL_S_INIT;
+    rdb->db->read_only = true;
 }
 
 void
@@ -743,6 +744,7 @@  replication_db_destroy(struct replication_db *rdb)
     }
 
     rdb->schema_version_higher = false;
+    rdb->db->read_only = false;
 }
 
 /* Return true if replication just started or is ongoing.