From patchwork Wed Oct 2 00:05:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: aginwala aginwala X-Patchwork-Id: 1170317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kD5/zf3/"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46jbyV1Bddz9sDB for ; Wed, 2 Oct 2019 10:06:09 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id B7DFE2B2C; Wed, 2 Oct 2019 00:05:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 3AA292B23 for ; Wed, 2 Oct 2019 00:05:32 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id AEF405D0 for ; Wed, 2 Oct 2019 00:05:31 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id a3so10815562pgm.13 for ; Tue, 01 Oct 2019 17:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lv6otN4zTcPlbrGR8wNH9jiAf8jwhe28P6JA90RfLo8=; b=kD5/zf3/r1521deQD84DACSg/2orzd7Lx6nxuy6bHDTlw/JqSCKx0Rn0Gdz9t4+nJg 9aMBa4A12x4gLfecvmd56oTjFeQeHVR/rfJZqxLJb1IkkIUc1Rcx8PvKDzcfG02NPBGa PVN9HyMatSnIY9Smshdsyp/wOMLkdHcTrAjh60hDQCMTmqIFADoxkFnTha2/bSXWDpju B3WPPc+gIxniCIuMVoMPbrU2Xm3soV06+C+m/B64cug9VvEWE1WCo6YJSkeMEFxctlg1 vn2kPw7IbcW2hGgBvy55EzXRnzIB+cp+sEF5g8PUOKPpQnvyO3jLZYf3gdxpDgZ+u0ZU uPgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lv6otN4zTcPlbrGR8wNH9jiAf8jwhe28P6JA90RfLo8=; b=bwCkzEpZbtv/79HlMxxOrfjo8nTfEjLfEcuI8E+BLr0BQ/X6/JjrpyftWoYLdPSG6a 2IXnooEjpNgIxW6bRDE5tT9PHOIo2gWnvhClS9VBcdsNc8dqKcFXUwpcZK1R+A1GBmA0 MHIVwg5y2bOj1KMFl6Gx+YHAOh/OtbDw7lv83Scu4yjSBjNjCKzcZp2shrzNzNiWRTTl l1EFtbAGMjuxYWsDJKbIyG0PTBmUwat9dU41pQOj6vpbvTMfhJ83LEipei0QdFh5m8cB LM5jROon4xOtdsdvQNpzDYlHf3ydq3w0rI+FFVwMcWOuxt7M1ClQx3eMEunw2spfhrOZ En9g== X-Gm-Message-State: APjAAAXgVboyLS0wsG1sv+PZ3KLoX/JBJCWio/2Fm6bJ2JBMZIP8pN0N PTLSTl3dN0ZydJsGDl9Kate62FzA X-Google-Smtp-Source: APXvYqzRbCfdBVERSeMUAiBax+UZU+bsxZyQ/qCEH/QYvfg75rtt8aqR+KlkvUhjINR06QzUahfeMA== X-Received: by 2002:a63:e853:: with SMTP id a19mr572122pgk.296.1569974730819; Tue, 01 Oct 2019 17:05:30 -0700 (PDT) Received: from LM-SJC-11015761.corp.ebay.com ([216.113.160.77]) by smtp.gmail.com with ESMTPSA id 16sm15336919pfn.35.2019.10.01.17.05.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Oct 2019 17:05:30 -0700 (PDT) From: amginwal@gmail.com To: dev@openvswitch.org Date: Tue, 1 Oct 2019 17:05:28 -0700 Message-Id: <20191002000528.68566-1-amginwal@gmail.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Aliasgar Ginwala Subject: [ovs-dev] [PATCH v1 ovn] ovn-nb/sbctl.c: Set no-leader-only as default for clustered dbs X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Aliasgar Ginwala When using ovn-nb/sbctl running in cluster, one can use local socket to run different commands. It is very inconvenient to pass no-leader-only in different tools using ovn-nb/sbctl instead of allowing one to to connect to any nodes in the cluster including itself. e.g common usage ovn-nb/sbctl show. Hence, this commit handles the same. Signed-off-by: Aliasgar Ginwala Acked-by: Han Zhou --- utilities/ovn-nbctl.8.xml | 17 +++++++++-------- utilities/ovn-nbctl.c | 3 ++- utilities/ovn-sbctl.8.in | 18 +++++++++--------- utilities/ovn-sbctl.c | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/utilities/ovn-nbctl.8.xml b/utilities/ovn-nbctl.8.xml index fd75c0e44..3dd05fa65 100644 --- a/utilities/ovn-nbctl.8.xml +++ b/utilities/ovn-nbctl.8.xml @@ -1192,14 +1192,15 @@
--leader-only
--no-leader-only
- By default, or with --leader-only, when the database server - is a clustered database, ovn-nbctl will avoid servers other - than the cluster leader. This ensures that any data that - ovn-nbctl reads and reports is up-to-date. With - --no-leader-only, ovn-nbctl will use any server - in the cluster, which means that for read-only transactions it can report - and act on stale data (transactions that modify the database are always - serialized even with --no-leader-only). Refer to + By default, or with --no-leader-only, when the database + server is a clustered database, ovn-nbctl may connect to + any server in the cluster, which means that for read-only transactions + it can report and act on stale data (transactions that modify the + database are always serialized even with --no-leader-only). + To avoid reading stale data, one can specify --leader-only, + so that ovn-nbctl will avoid servers other than the cluster + leader. For daemon mode, since it is for long running connections, + default is set to --leader-only. Refer to Understanding Cluster Consistency in ovsdb(7) for more information.
diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index a89a9cb4d..3804dd25a 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -81,7 +81,7 @@ static struct ovsdb_idl_txn *the_idl_txn; OVS_NO_RETURN static void nbctl_exit(int status); /* --leader-only, --no-leader-only: Only accept the leader in a cluster. */ -static int leader_only = true; +static int leader_only = false; /* --shuffle-remotes, --no-shuffle-remotes: Shuffle the order of remotes that * are specified in the connetion method string. */ @@ -188,6 +188,7 @@ main(int argc, char *argv[]) "(use --help for help)"); } daemon_mode = true; + leader_only = true; } /* Initialize IDL. */ idl = the_idl = ovsdb_idl_create_unconnected(&nbrec_idl_class, true); diff --git a/utilities/ovn-sbctl.8.in b/utilities/ovn-sbctl.8.in index 2aaa457e8..f52412812 100644 --- a/utilities/ovn-sbctl.8.in +++ b/utilities/ovn-sbctl.8.in @@ -53,16 +53,16 @@ e.g. \fBssl:192.168.10.5:6640\fR, as described in \fBovsdb\fR(7). . .IP "\fB\-\-leader\-only\fR" .IQ "\fB\-\-no\-leader\-only\fR" -By default, or with \fB\-\-leader\-only\fR, when the database server -is a clustered database, \fBovn\-sbctl\fR will avoid servers other -than the cluster leader. This ensures that any data that -\fBovn\-sbctl\fR reads and reports is up-to-date. With -\fB\-\-no\-leader\-only\fR, \fBovn\-sbctl\fR will use any server in -the cluster, which means that for read-only transactions it can report +By default, or with \fB\-\-no\-leader\-only\fR, when the database server +is a clustered database, \fBovn\-sbctl\fR may connect to any server +in the cluster, which means that for read-only transactions it can report and act on stale data (transactions that modify the database are -always serialized even with \fB\-\-no\-leader\-only\fR). Refer to -\fBUnderstanding Cluster Consistency\fR in \fBovsdb\fR(7) for more -information. +always serialized even with \fB\-\-no\-leader\-only\fR). To avoid reading +stale data, one can specify \fB\-\-leader\-only\fR, so that +\fBovn\-sbctl\fR will avoid servers other than the cluster leader. For daemon +mode, since it is for long running connections, default is set to +\fB\-\-leader\-only\fR. Refer to \fBUnderstanding Cluster Consistency\fR in +\fBovsdb\fR(7) for more information. . .IP "\fB\-\-no\-syslog\fR" By default, \fBovn\-sbctl\fR logs its arguments and the details of any diff --git a/utilities/ovn-sbctl.c b/utilities/ovn-sbctl.c index 9a9b6f0ec..f1cb8790f 100644 --- a/utilities/ovn-sbctl.c +++ b/utilities/ovn-sbctl.c @@ -82,7 +82,7 @@ static struct ovsdb_idl_txn *the_idl_txn; OVS_NO_RETURN static void sbctl_exit(int status); /* --leader-only, --no-leader-only: Only accept the leader in a cluster. */ -static int leader_only = true; +static int leader_only = false; static void sbctl_cmd_init(void); OVS_NO_RETURN static void usage(void);