From patchwork Sun Mar 25 15:17:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 890647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 408LW025rsz9ryk for ; Mon, 26 Mar 2018 02:17:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="TEWVp5eD"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 408LW00TcyzF1vq for ; Mon, 26 Mar 2018 02:17:48 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="TEWVp5eD"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=23.83.209.66; helo=gecko.birch.relay.mailchannels.net; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="TEWVp5eD"; dkim-atps=neutral Received: from gecko.birch.relay.mailchannels.net (gecko.birch.relay.mailchannels.net [23.83.209.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 408LVt2y7TzF1vG for ; Mon, 26 Mar 2018 02:17:41 +1100 (AEDT) X-Sender-Id: 5xi41l16bi|x-authuser|stephen@that.guru Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id C0D0B121FDB for ; Sun, 25 Mar 2018 15:17:38 +0000 (UTC) Received: from one.mxroute.com (unknown [100.96.18.70]) (Authenticated sender: 5xi41l16bi) by relay.mailchannels.net (Postfix) with ESMTPA id 56D1D121F61 for ; Sun, 25 Mar 2018 15:17:38 +0000 (UTC) X-Sender-Id: 5xi41l16bi|x-authuser|stephen@that.guru Received: from one.mxroute.com (one-outgoing.mxroute.com [172.18.49.137]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.14.1); Sun, 25 Mar 2018 15:17:38 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: 5xi41l16bi|x-authuser|stephen@that.guru X-MailChannels-Auth-Id: 5xi41l16bi X-Scare-Fearful: 07ab92e96d3c9171_1521991058611_1597967369 X-MC-Loop-Signature: 1521991058611:151570013 X-MC-Ingress-Time: 1521991058610 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=SIjc5VtOSzdZRdnZR8SBjQiqgY6m9CUcUhg8mJRlOv0=; b=TEWVp5eD2MZrnjVX54w5gSk6WZ LQD1ucP7HWlWKyLO7qEwkqLuupmrEfjkKfQSq3NUBzSkBdwdQ3emnP4mQxuhvVnWE8o0UBAIQkX9H /9jydyAKNEXx3nQVVll4fJjyIjbcWoLnNlBxaRQysBsRWf4HCEfYxGSJI0BIJ/Oz6Ilao0sPYfKSL E1Wffdt9S5R0JMyWtYIZhV0ESD11RPSTFu/GaE4pGCO3mZyiyhKQ6ufwc3wu6C0y0ssSvyGCQsPBC 8UehfZkr0JZnAGy4a/CmkQdnwXGfeV5PWDq9761BHle1J5lVQlHejv0PCMMNTof+aXeLpCB3M3pkX d84CG3pA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 0/4] Add 'Event.payload' field Date: Sun, 25 Mar 2018 16:17:27 +0100 Message-Id: <20180325151731.29959-1-stephen@that.guru> X-Mailer: git-send-email 2.14.3 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The '/event' API endpoint is really slow due to the amount of JOINs necessary to retrieve records from the database. Resolve this by a static JSON representation of any embedded data in the database. This has some disadvantages, noted in the patches, but the performance improvement is huge and users will not notice a thing. As a necessary side-effect of this change, events now require the REST API be enabled. To be honest, this should have been the case from day 1 as events are currently only exposed over this API. Stephen Finucane (4): REST: Support embedded serializers without context signals: Only enable events when REST API enabled models: Migrate event fields to JSON field REST: Only fetch required fields event filtering patchwork/api/embedded.py | 60 ++++++++--- patchwork/api/event.py | 110 +++++++++++++-------- patchwork/api/filters.py | 7 ++ patchwork/fields.py | 32 ++++++ .../migrations/0025_add_event_payload_field.py | 21 ++++ ...26_migrate_data_from_event_fields_to_payload.py | 63 ++++++++++++ .../migrations/0027_remove_old_event_fields.py | 34 +++++++ patchwork/models.py | 28 +----- patchwork/signals.py | 70 +++++++++++-- patchwork/tests/test_events.py | 110 +++++++++++++-------- .../events-require-rest-api-47eab4a3be745f75.yaml | 5 + 11 files changed, 413 insertions(+), 127 deletions(-) create mode 100644 patchwork/migrations/0025_add_event_payload_field.py create mode 100644 patchwork/migrations/0026_migrate_data_from_event_fields_to_payload.py create mode 100644 patchwork/migrations/0027_remove_old_event_fields.py create mode 100644 releasenotes/notes/events-require-rest-api-47eab4a3be745f75.yaml