From nobody Thu Oct 24 04:26:49 2024 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=patchew-devel-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1649321252; cv=none; d=zohomail.com; s=zohoarc; b=O52AbYo5xZQaFyMedRyC93gDM+YLJk76/bai6Cd/emnOvsN7bDThoKDAffEXdbdCqrq0ZEGSsXwM8m1b6gSSWiRTXRHlKoZS3Sd926ueXiUEPATcm+HZv3BZYpBm4fyb4ZQQxSMubpa729gshz64illRrvu27aZxA0XxI54dGIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649321252; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WGaquhM3xpEops6CEeu+plfJrGCQavOtJLtR9ei/SiY=; b=EmNQSecpgULQEbq8CwylQpWwkwssndM/t1eilgQVXq7NlWo/5rhtJ8ybgKLZ+2zy1jn303y6XI9HLNFlUWzhjkX/vMUOypchuLYcRJ8o1p+bp3rkVKa8waoX/TVtXIF2GUkdYz4cFi0H7bNMmu2v/4q92z5Ui3fnzd7ZL0ZUIOE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1649321252051874.9710334832049; Thu, 7 Apr 2022 01:47:32 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-329-hVI3vtiwNVSSzVRgUCyzCg-1; Thu, 07 Apr 2022 04:47:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 058B43801FF5; Thu, 7 Apr 2022 08:47:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7714840CFD11; Thu, 7 Apr 2022 08:47:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C4BB3194034B; Thu, 7 Apr 2022 08:47:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 54E241949763 for ; Thu, 7 Apr 2022 08:47:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EFF94C28102; Thu, 7 Apr 2022 08:47:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EBD55C27DB3 for ; Thu, 7 Apr 2022 08:47:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9A28E833969 for ; Thu, 7 Apr 2022 08:47:23 +0000 (UTC) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-644-74hKGEKdNgCaEVTt-Qiwww-1; Thu, 07 Apr 2022 04:47:13 -0400 Received: by mail-ej1-f48.google.com with SMTP id a6so9470761ejk.0 for ; Thu, 07 Apr 2022 01:47:13 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id r22-20020a17090638d600b006d584aaa9c9sm7453703ejd.133.2022.04.07.01.47.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 01:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649321251; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=WGaquhM3xpEops6CEeu+plfJrGCQavOtJLtR9ei/SiY=; b=Ia7P/bwfag7+tW2hS8iRKYryd9jyBNwUgmkwcQ4strIR/J+WNjf6HMzD0ppeS0Gl2Vi+s1 9xbynYIN1BIGWDTKc9q2RIoD+ebN6B1x2zlGUwYMA22+aYOLm1BrvUuarJ7SghPFb3koSB WB6havVPFVL7o2nfhiKRTK5vqsGkQ4c= X-MC-Unique: hVI3vtiwNVSSzVRgUCyzCg-1 X-Original-To: patchew-devel@listman.corp.redhat.com X-MC-Unique: 74hKGEKdNgCaEVTt-Qiwww-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=as1AhGprgxV1wSiza/WY07qWiTnB1lqzugpT3BVc8VU=; b=ZElAQ2YA/0+uylQJEMRXlBs7xZ2W5dL9a3i1UGRzZ89HteE8hgNGrEnzodPiZ/oE2b NQmTgWt7uSHzSAemXMLKYSe5n5QgXKVCrikDfTleBFi6yoQJ6CmmXOOVZnHhtYiGMbyC RAtUFrDk0r8R1ACddLndaCDVW4/pwrR7v+OuyYzHJVa+jIK6SdsjCpWkOWbP9xmBeVvx 7GmK45zUFazk0VGrsClS9fztvn5x3aLuLBXq3ktP+pxW3x9Hfq0aCfbDuOH1QjLRhP/a QKu9pVe0cs3Co5dut0Gw/HMvagkswXb9qGCTHt4VS5FQZVnNV9vBTR6nthJ/acBsh+OX cu5A== X-Gm-Message-State: AOAM530CS0GABGfZ+VWjRpfLeKjkQIXzYZlzTSNR8+k9K3kGqcHee7F5 OQn/aZ/C2J/cOPr2854h/BfgW+glbcu94A== X-Google-Smtp-Source: ABdhPJw5HRWbLRF6sIanoSKXwu7k0pTjftxP7KdrLpnq90Az36coJ0ApNmH1vD+Gy6UgTn3bfJe72w== X-Received: by 2002:a17:907:3e95:b0:6e8:358:6b7c with SMTP id hs21-20020a1709073e9500b006e803586b7cmr12352721ejc.236.1649321231636; Thu, 07 Apr 2022 01:47:11 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Thu, 7 Apr 2022 10:47:03 +0200 Message-Id: <20220407084704.78533-5-pbonzini@redhat.com> In-Reply-To: <20220407084704.78533-1-pbonzini@redhat.com> References: <20220407084704.78533-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Subject: [Patchew-devel] [PATCH 4/5] models: remove messages for which the blobs were lost X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchew-devel-bounces@redhat.com Sender: "Patchew-devel" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=patchew-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1649321253839100003 Content-Type: text/plain; charset="utf-8" Messages that do not have an associated blob (typically because their message-id included a slash) have never worked. Remove them from the database. This migration can also be performed directly on the database while the server is running: update api_topic set latest_id =3D null where latest_id in (select id from = api_message where mbox_bytes is null); delete from api_messageresult where message_id in (select id from api_messa= ge where mbox_bytes is null); delete from api_message where mbox_bytes is null; delete from api_topic where not exists (select * from api_message where api= _message.topic_id =3D api_topic.id); Signed-off-by: Paolo Bonzini --- api/migrations/0063_remove_broken_messages.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 api/migrations/0063_remove_broken_messages.py diff --git a/api/migrations/0063_remove_broken_messages.py b/api/migrations= /0063_remove_broken_messages.py new file mode 100644 index 0000000..d160e01 --- /dev/null +++ b/api/migrations/0063_remove_broken_messages.py @@ -0,0 +1,19 @@ +#! /usr/bin/env python3 +from __future__ import unicode_literals + +from django.db import migrations, transaction + +def remove_null_mbox_messages(apps, schema_editor): + Message =3D apps.get_model("api", "Message") + Topic =3D apps.get_model("api", "Topic") + Topic.objects.filter(latest__mbox_bytes=3DNone).update(latest=3DNone) + Message.objects.filter(mbox_bytes=3DNone).delete() + +class Migration(migrations.Migration): + + dependencies =3D [("api", "0062_deblob_messages")] + + operations =3D [ + migrations.RunPython(remove_null_mbox_messages, reverse_code=3Dmig= rations.RunPython.noop) + ] + --=20 2.35.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://listman.redhat.com/mailman/listinfo/patchew-devel