From patchwork Wed Sep 1 16:15:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Terry Wilson X-Patchwork-Id: 1523264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=One+V5Mm; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H08LG2y1Xz9sX3 for ; Thu, 2 Sep 2021 02:15:50 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 759F080D4A; Wed, 1 Sep 2021 16:15:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UJ8fWQVSOO5H; Wed, 1 Sep 2021 16:15:43 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id D154580D51; Wed, 1 Sep 2021 16:15:42 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A4329C0010; Wed, 1 Sep 2021 16:15:42 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7E563C000E for ; Wed, 1 Sep 2021 16:15:41 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6002E40158 for ; Wed, 1 Sep 2021 16:15:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IzsyBmakBTvk for ; Wed, 1 Sep 2021 16:15:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 1077E40146 for ; Wed, 1 Sep 2021 16:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630512935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NcADywkrHwVD8XGqk2YI0/YOW5ozlhUMVVgFvmPpoHQ=; b=One+V5MmKqKzjq9vNmNka6pZ7orhGBE71b0YxdWFb0anuh4D2UAkOSO1sK7ZfdjOzIVYGZ yodSK9zWiJ9+WHuXl718CzmuZeAGPDE5xAm1v/bTAhRxSSYsSnm7lTtFbSfeUnTBMAQyh9 ncq41q3QpA75NKvN+rvi2SeOMh/jf1M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-376-kje-phn4MjKEQWfYLntyRw-1; Wed, 01 Sep 2021 12:15:34 -0400 X-MC-Unique: kje-phn4MjKEQWfYLntyRw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EF529102CB80 for ; Wed, 1 Sep 2021 16:15:33 +0000 (UTC) Received: from centos8.localdomain (unknown [10.22.18.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 957C360C05; Wed, 1 Sep 2021 16:15:33 +0000 (UTC) From: Terry Wilson To: dev@openvswitch.org Date: Wed, 1 Sep 2021 16:15:26 +0000 Message-Id: <20210901161526.237479-1-twilson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=twilson@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] [python] Avoid sending transactions when the DB is not synced up 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" This ports the C IDL change f50714b to the Python IDL: Until now the code here would happily try to send transactions to the database server even if the database connection was not in the correct state. In some cases this could lead to strange behavior, such as sending a database transaction for a database that the IDL had just learned did not exist on the server. Signed-off-by: Terry Wilson --- python/ovs/db/idl.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py index ecae5e143..0be0064de 100644 --- a/python/ovs/db/idl.py +++ b/python/ovs/db/idl.py @@ -1500,6 +1500,12 @@ class Transaction(object): the IDL's copy of the database. If the transaction commits successfully, then the database server will send an update and, thus, the IDL will be updated with the committed changes.""" + + if self.idl.state != Idl.IDL_S_MONITORING: + self._status = Transaction.TRY_AGAIN + self.__disassemble() + return self._status + # The status can only change if we're the active transaction. # (Otherwise, our status will change only in Idl.run().) if self != self.idl.txn: