From patchwork Thu Nov 25 21:35:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1559902 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=QKlq2qmS; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4J0WQt0F6jz9s0r for ; Fri, 26 Nov 2021 08:36:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id BDA8740561; Thu, 25 Nov 2021 21:36:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 7BiBfUyxLh-s; Thu, 25 Nov 2021 21:36:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 1629B401D4; Thu, 25 Nov 2021 21:36:16 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DFA22C0012; Thu, 25 Nov 2021 21:36:15 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 45753C000A for ; Thu, 25 Nov 2021 21:36:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B115140979 for ; Thu, 25 Nov 2021 21:35:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jbduH34Yc2Ru for ; Thu, 25 Nov 2021 21:35:42 +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.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 128F640906 for ; Thu, 25 Nov 2021 21:35:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637876141; 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=CVjNZK179QchmW4PcNH8h49Q8a/7HSWgEHlDIlrnCNc=; b=QKlq2qmSL8g/bkrKpcnc493A+UCy+0kctAkY6jrQXpq/DvA2lCKVInDNe7Jve1mTKKYhCK 89PJmsxQf8Oc6g1/AJvYeNQevdb1hZCaht68sr7safKsNlEJ20+PohotjwpmPHhO0yxrDi 3MFoDoL9RuU7i1CWRm5snjE1KK9TtNw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-65-OaJVk52jOYuTdyfcEeC4FQ-1; Thu, 25 Nov 2021 16:35:39 -0500 X-MC-Unique: OaJVk52jOYuTdyfcEeC4FQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B66848042EA; Thu, 25 Nov 2021 21:35:38 +0000 (UTC) Received: from dceara.remote.csb (unknown [10.39.195.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 061831000051; Thu, 25 Nov 2021 21:35:31 +0000 (UTC) From: Dumitru Ceara To: ovs-dev@openvswitch.org Date: Thu, 25 Nov 2021 22:35:27 +0100 Message-Id: <20211125213524.11165.87574.stgit@dceara.remote.csb> In-Reply-To: <20211125213334.11165.62799.stgit@dceara.remote.csb> References: <20211125213334.11165.62799.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: blp@ovn.org Subject: [ovs-dev] [RFC PATCH ovn 6/7] northd-ddlog: Split sb::Out_Load_Balancer relation. 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" TODO: this improves performance significantly. Not exactly sure why.. Is it related to FlatMap called "inline"? Is it related to group_by()? Signed-off-by: Dumitru Ceara --- northd/ovn_northd.dl | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/northd/ovn_northd.dl b/northd/ovn_northd.dl index 7f5288d14..90558a7c4 100644 --- a/northd/ovn_northd.dl +++ b/northd/ovn_northd.dl @@ -8875,21 +8875,17 @@ relation PortExists(name: istring) PortExists(name) :- &nb::Logical_Switch_Port(.name = name). PortExists(name) :- &nb::Logical_Router_Port(.name = name). -sb::Out_Load_Balancer(._uuid = lb._uuid, - .name = lb.name, - .vips = lb.vips, - .protocol = lb.protocol, - .datapaths = datapaths, - .external_ids = [i"lb_id" -> uuid2str(lb_uuid).intern()], - .options = options) :- +relation Pre_Out_Load_Balancer(lb_uuid: uuid, dp_uuid: uuid) + +Pre_Out_Load_Balancer(lb_uuid, ls_uuid) :- nb in &nb::Logical_Switch(._uuid = ls_uuid, .load_balancer = lb_uuids), - var lb_uuid = FlatMap(lb_uuids), - var datapaths = ls_uuid.group_by(lb_uuid).to_set(), - lb in &nb::Load_Balancer(._uuid = lb_uuid), - /* Store the fact that northd provides the original (destination IP + - * transport port) tuple. - */ - var options = lb.options.insert_imm(i"hairpin_orig_tuple", i"true"). + var lb_uuid = FlatMap(lb_uuids). + +Pre_Out_Load_Balancer(lb_uuid, ls_uuid) :- + nb in &nb::Logical_Switch(._uuid = ls_uuid, .load_balancer_group = lbg_uuids), + var lbg_uuid = FlatMap(lbg_uuids), + lbg in &nb::Load_Balancer_Group(._uuid = lbg_uuid, .load_balancer = lb_uuids), + var lb_uuid = FlatMap(lb_uuids). sb::Out_Load_Balancer(._uuid = lb._uuid, .name = lb.name, @@ -8898,10 +8894,7 @@ sb::Out_Load_Balancer(._uuid = lb._uuid, .datapaths = datapaths, .external_ids = [i"lb_id" -> uuid2str(lb_uuid).intern()], .options = options) :- - nb in &nb::Logical_Switch(._uuid = ls_uuid, .load_balancer_group = lbg_uuids), - var lbg_uuid = FlatMap(lbg_uuids), - lbg in &nb::Load_Balancer_Group(._uuid = lbg_uuid, .load_balancer = lb_uuids), - var lb_uuid = FlatMap(lb_uuids), + Pre_Out_Load_Balancer(lb_uuid, ls_uuid), var datapaths = ls_uuid.group_by(lb_uuid).to_set(), lb in &nb::Load_Balancer(._uuid = lb_uuid), /* Store the fact that northd provides the original (destination IP +