From patchwork Fri Apr 2 15:49:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1461779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) 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=AGtqZ6Pu; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.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 4FBkyY4VQvz9sRK for ; Sat, 3 Apr 2021 02:49:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 656EC84A99; Fri, 2 Apr 2021 15:49:55 +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 WbGUy3pNZO0L; Fri, 2 Apr 2021 15:49:54 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTP id A0D3E84AB1; Fri, 2 Apr 2021 15:49:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 79C37C000C; Fri, 2 Apr 2021 15:49:53 +0000 (UTC) X-Original-To: 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 1DD4FC000C for ; Fri, 2 Apr 2021 15:49:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id DB3256078D for ; Fri, 2 Apr 2021 15:49:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com 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 67j7BPtVwqDC for ; Fri, 2 Apr 2021 15:49:44 +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 [216.205.24.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8CCD7605FF for ; Fri, 2 Apr 2021 15:49:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617378583; 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: in-reply-to:in-reply-to:references:references; bh=7XeQAi4YRYtwAZhhkLjHYHSHfkaDgHO2l3QIbupWzyA=; b=AGtqZ6PuPv9+y+d695HS0fK7PbASn3NjOzIQXDZMc8Ohts/AHScC2bRpIZwiSJYZDBZOmO itHxC6R5Zvolr/8rLCqWk08jWbreczdekcNuBnPgMh4OsV2K26LBDtWQYEwL3Z0WpjzzYn gXUgAVlBL4PiF7cNs0qxLDhjMejOMxE= 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-481-nW-9tGpXNE2X19l5etcd0A-1; Fri, 02 Apr 2021 11:49:41 -0400 X-MC-Unique: nW-9tGpXNE2X19l5etcd0A-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 AFD771005D4F; Fri, 2 Apr 2021 15:49:40 +0000 (UTC) Received: from dceara.remote.csb (ovpn-112-193.ams2.redhat.com [10.36.112.193]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA9D65FCA6; Fri, 2 Apr 2021 15:49:37 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Fri, 2 Apr 2021 17:49:34 +0200 Message-Id: <20210402154931.7879.26974.stgit@dceara.remote.csb> In-Reply-To: <20210402154605.7879.66878.stgit@dceara.remote.csb> References: <20210402154605.7879.66878.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty 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=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: i.maximets@ovn.org, dceara@redhat.com Subject: [ovs-dev] [PATCH branch-2.13 4/4] ovsdb-idl: Mark arc sources as updated when destination is deleted. 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" Considering two DB rows, 'a' from table A and 'b' from table B (with column 'ref_a' a reference to table A): a = {A._uuid=} b = {B._uuid=, B.ref_a=} When the IDL client processes an update that deletes row 'a', row 'b' is also marked as 'updated' if change tracking is enabled for table B. Fixes: 102781cc02c6 ("ovsdb-idl: Track changes for table references.") Signed-off-by: Dumitru Ceara Acked-by: Han Zhou Signed-off-by: Ilya Maximets (cherry picked from commit ac85cdb38c1f33e7952bc4c0347d6c7873fb56a1) --- lib/ovsdb-idl.c | 3 +++ tests/ovsdb-idl.at | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index d6439a2151..2fc8a91e37 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -445,6 +445,8 @@ ovsdb_idl_db_init(struct ovsdb_idl_db *db, const struct ovsdb_idl_class *class, ovs_list_init(&db->deleted_untracked_rows); } +static void add_tracked_change_for_references(struct ovsdb_idl_row *); + /* Creates and returns a connection to database 'remote', which should be in a * form acceptable to jsonrpc_session_open(). The connection will maintain an * in-memory replica of the remote database whose schema is described by @@ -2561,6 +2563,7 @@ ovsdb_idl_reparse_deleted(struct ovsdb_idl_db *db) LIST_FOR_EACH_SAFE (row, next, track_node, &db->deleted_untracked_rows) { ovsdb_idl_row_untrack_change(row); + add_tracked_change_for_references(row); ovsdb_idl_row_reparse_backrefs(row); /* Orphan rows that are still unreferenced or are part of tables that diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index 97c3ff5d76..a1daf9a137 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -1286,6 +1286,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, orphan rows, cond 003: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 003: table simple: updated columns: s 004: change conditions +005: table simple6: name=first_row weak_ref=[] uuid=<0> 005: table simple: deleted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1> 005: table simple: inserted row: i=0 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3> 005: table simple: updated columns: s @@ -1497,6 +1498,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, strong references 001: table simple4: inserted row: name=row0_s4 uuid=<0> 001: table simple4: updated columns: name 002: change conditions +003: table simple3: name=row0_s3 uset=[] uref=[] uuid=<1> 003: table simple4: deleted row: name=row0_s4 uuid=<0> 004: {"error":null,"result":[{"uuid":["uuid","<2>"]}]} 005: table simple3: name=row0_s3 uset=[] uref=[] uuid=<1>