From patchwork Fri Dec 4 01:11:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 552511 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 0612F1402A9 for ; Fri, 4 Dec 2015 12:12:08 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id DCD7810AFD; Thu, 3 Dec 2015 17:12:07 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 6335210AF4 for ; Thu, 3 Dec 2015 17:12:06 -0800 (PST) Received: from bar4.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id C66591610D6 for ; Thu, 3 Dec 2015 18:12:04 -0700 (MST) X-ASG-Debug-ID: 1449191524-03dc21603f8f01d0001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar4.cudamail.com with ESMTP id FMPQ5YAugG0e2EAg (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 03 Dec 2015 18:12:04 -0700 (MST) X-Barracuda-Envelope-From: joe@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO relay2-d.mail.gandi.net) (217.70.183.194) by mx3-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 4 Dec 2015 01:12:03 -0000 Received-SPF: pass (mx3-pf2.cudamail.com: SPF record at ovn.org designates 217.70.183.194 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.194 X-Barracuda-RBL-IP: 217.70.183.194 Received: from mfilter25-d.gandi.net (mfilter25-d.gandi.net [217.70.178.153]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 04AEEC5A5A; Fri, 4 Dec 2015 02:11:59 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter25-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter25-d.gandi.net (mfilter25-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 3jmo3xOq4eR5; Fri, 4 Dec 2015 02:11:57 +0100 (CET) X-Originating-IP: 208.91.1.34 Received: from localhost.localdomain (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 429DAC5A55; Fri, 4 Dec 2015 02:11:54 +0100 (CET) X-CudaMail-Envelope-Sender: joe@ovn.org From: Joe Stringer To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V2-1202066808 X-CudaMail-DTE: 120315 X-CudaMail-Originating-IP: 217.70.183.194 Date: Thu, 3 Dec 2015 17:11:49 -0800 X-ASG-Orig-Subj: [##CM-V2-1202066808##][PATCH] ovn-northd: Only run idl loop if something changed. Message-Id: <1449191509-12824-1-git-send-email-joe@ovn.org> X-Mailer: git-send-email 2.1.4 X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1449191524 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH] ovn-northd: Only run idl loop if something changed. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Before refactoring the main loop to reuse ovsdb_idl_loop_* functions, we would use a sequence to see if anything changed in NB database to compute and notify the SB database, and vice versa. This logic got dropped with the refactor, causing a testsuite failure in the ovn-sbctl test. Reintroduce the IDL sequence number checking. Fixes: 331e7aefe1c6 ("ovn-northd: Refactor main loop to use ovsdb_idl_loop_* functions") Suggested-by: Numan Siddique Signed-off-by: Joe Stringer Tested-by: Thadeu Lima de Souza Cascardo Acked-by: Ben Pfaff --- ovn/northd/ovn-northd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 01f289d1c746..7f3a92e3539d 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -1799,6 +1799,7 @@ int main(int argc, char *argv[]) { extern struct vlog_module VLM_reconnect; + unsigned int ovnnb_seqno, ovnsb_seqno; int res = EXIT_SUCCESS; struct unixctl_server *unixctl; int retval; @@ -1868,6 +1869,9 @@ main(int argc, char *argv[]) add_column_noalert(ovnsb_idl_loop.idl, &sbrec_port_binding_col_mac); ovsdb_idl_add_column(ovnsb_idl_loop.idl, &sbrec_port_binding_col_chassis); + ovnnb_seqno = ovsdb_idl_get_seqno(ovnnb_idl_loop.idl); + ovnsb_seqno = ovsdb_idl_get_seqno(ovnsb_idl_loop.idl); + /* Main loop. */ exiting = false; while (!exiting) { @@ -1878,8 +1882,14 @@ main(int argc, char *argv[]) .ovnsb_txn = ovsdb_idl_loop_run(&ovnsb_idl_loop), }; - ovnnb_db_run(&ctx); - ovnsb_db_run(&ctx); + if (ovnnb_seqno != ovsdb_idl_get_seqno(ctx.ovnnb_idl)) { + ovnnb_seqno = ovsdb_idl_get_seqno(ctx.ovnnb_idl); + ovnnb_db_run(&ctx); + } + if (ovnsb_seqno != ovsdb_idl_get_seqno(ctx.ovnsb_idl)) { + ovnsb_seqno = ovsdb_idl_get_seqno(ctx.ovnsb_idl); + ovnsb_db_run(&ctx); + } unixctl_server_run(unixctl); unixctl_server_wait(unixctl);