From patchwork Thu Nov 15 06:05:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 998090 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=none (p=none dis=none) header.from=ovn.org 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 42wW8G6Vptz9s8F for ; Thu, 15 Nov 2018 17:06:22 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 858A9B6A; Thu, 15 Nov 2018 06:05:45 +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 01BC3AF8 for ; Thu, 15 Nov 2018 06:05:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 71CD18B for ; Thu, 15 Nov 2018 06:05:43 +0000 (UTC) Received: from sigabrt.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 05016240003; Thu, 15 Nov 2018 06:05:40 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Wed, 14 Nov 2018 22:05:26 -0800 Message-Id: <20181115060534.7146-2-blp@ovn.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181115060534.7146-1-blp@ovn.org> References: <20181115060534.7146-1-blp@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH 02/10] ovsdb-idl: Treat "unknown database" error as reason to reconnect. 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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. Signed-off-by: Ben Pfaff --- lib/ovsdb-idl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index a1f246d6f7b7..a7274dea2a8b 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -4686,6 +4686,10 @@ ovsdb_idl_db_txn_process_reply(struct ovsdb_idl_db *db, if (error->type == JSON_STRING) { if (!strcmp(error->string, "timed out")) { soft_errors++; + } else if (!strcmp(error->string, + "unknown database")) { + ovsdb_idl_retry(db->idl); + soft_errors++; } else if (!strcmp(error->string, "not owner")) { lock_errors++; } else if (!strcmp(error->string, "not allowed")) {