From patchwork Thu Dec 14 01:04:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1875925 X-Patchwork-Delegate: i.maximets@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SrDgz60DMz1ySd for ; Thu, 14 Dec 2023 12:06:23 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 14310420F2; Thu, 14 Dec 2023 01:06:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 14310420F2 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b-67R6aSyegj; Thu, 14 Dec 2023 01:06:21 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5BE0041E79; Thu, 14 Dec 2023 01:06:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5BE0041E79 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 260C9C0072; Thu, 14 Dec 2023 01:06:20 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8DADDC0037 for ; Thu, 14 Dec 2023 01:06:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id F0B6B61B06 for ; Thu, 14 Dec 2023 01:05:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org F0B6B61B06 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id P_B3IBm7kxP8 for ; Thu, 14 Dec 2023 01:05:12 +0000 (UTC) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3034060F2C for ; Thu, 14 Dec 2023 01:05:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3034060F2C Received: by mail.gandi.net (Postfix) with ESMTPSA id 07D1F240002; Thu, 14 Dec 2023 01:05:09 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Thu, 14 Dec 2023 02:04:13 +0100 Message-ID: <20231214010431.1664005-12-i.maximets@ovn.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231214010431.1664005-1-i.maximets@ovn.org> References: <20231214010431.1664005-1-i.maximets@ovn.org> MIME-Version: 1.0 X-GND-Sasl: i.maximets@ovn.org Cc: Vladislav Odintsov , Dumitru Ceara , Ilya Maximets Subject: [ovs-dev] [PATCH 11/22] ovsdb: replication: Automatically switch read-only mode. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 --- ovsdb/replication.c | 2 ++ 1 file changed, 2 insertions(+) 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.