Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kEB6p-0004Xq-GA for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2020 12:46:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kEB6o-00082V-8A for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2020 12:46:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kEB6o-00082O-1R for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2020 12:46:26 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kEB6l-0003Df-Mj for pgsql-hackers@postgresql.org; Fri, 04 Sep 2020 12:46:25 +0000 Received: by mail-wr1-x443.google.com with SMTP id g4so6626723wrs.5 for ; Fri, 04 Sep 2020 05:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=QcJar3p1kn5/ekO034tUjD6m6FJddV25r6PbH5fbFKU=; b=b6CsuLWZVcZZ2l27pIAeAcZslTtqK7dojeT77zLKsCEVD49N9iMOg1pzU+gIrh0eey TF/RcmguoTcGjCqZA+dzt7FD7+/wTwgAOOdjsC1h30XuMgBKjCS32uzekL5jochYadzC nisLPGilxvosGutxujvULaW6b71iv1AnYZd6y6KeKCt1rrE4PFo2xHUeLix+naGh4Fgi ubksJOsYK3AdK1ZNuXLXw5Fwc/KZ4xsBx6st/V9ldhx4l7LkbBmaZPM16USMyBAxEwiJ KOvMe2KUwo9ybQR8+o3jliPh2FfhIv1vInJkCv8iP+OYlagBauypIZLv5Pn+4bjKiDQ8 DOyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QcJar3p1kn5/ekO034tUjD6m6FJddV25r6PbH5fbFKU=; b=Y1yhu904E/5X94ykj2Pf/fl7QZKNsOe3uqedFCzMKgYYyR0TvTxBXP0jSG4MrPkS8K DGp0lFGhBZ5DQz8StvdwDxkGQ7eVrjDDm9YvejIX1liSzDppdATePMtAFx+v/Vv1/BGa nGXwRhvdWk2ZqaZdFHBHRgYXofF6o4gZ7mDyIJLo/pqJozMGj59GBIn7ssauzcVxJjcX OLhdMY61fNZrL5aWANw9KXg0bV/A3p78H55ueZQ8yvhHUPE7uxlre5F6YuBOAyczSnHC iNLjsF/OV+6bl6nPcVPhJJ1Qt+6eJ7ok5Le/VLXpqLXc3JnnfZnoCRn7n1vIkUlahlxg ZTLw== X-Gm-Message-State: AOAM5301gR76RzrcT2l4bPpQmAQmQVX12mce7MzKpUmsVM4ux2YdKo22 ugx4e+Nx+ha/lEiYtwEHxolHhw== X-Google-Smtp-Source: ABdhPJwuKnPAZ8FuhzD46Cv6HW0ngboh6d/IwIPc9eGR1oEnZI0gtMk8KsgoJZoIQ8BX9mxAZlGUMg== X-Received: by 2002:a05:6000:1ce:: with SMTP id t14mr6990004wrx.195.1599223582018; Fri, 04 Sep 2020 05:46:22 -0700 (PDT) Received: from localhost (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id o2sm12584889wrh.70.2020.09.04.05.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 05:46:21 -0700 (PDT) Date: Fri, 4 Sep 2020 14:46:19 +0200 From: Tomas Vondra To: Kasahara Tatsuhito Cc: Tom Lane , torikoshia , PostgreSQL-development Subject: Re: Get memory contexts of an arbitrary backend process Message-ID: <20200904124619.k2dgu7dty7awb6cu@development> References: <0271f440ac77f2a4180e0e56ebd944d1@oss.nttdata.com> <4a39f13d6496ea4686bbac4254154fe8@oss.nttdata.com> <640735.1599154807@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Sep 04, 2020 at 11:47:30AM +0900, Kasahara Tatsuhito wrote: >On Fri, Sep 4, 2020 at 2:40 AM Tom Lane wrote: >> Kasahara Tatsuhito writes: >> > Yes, but it's not only for future expansion, but also for the >> > usability and the stability of this feature. >> > For example, if you want to read one dumped file multiple times and analyze it, >> > you will want the ability to just read the dump. >> >> If we design it to make that possible, how are we going to prevent disk >> space leaks from never-cleaned-up dump files? >In my thought, with features such as a view that allows us to see a >list of dumped files, >it would be better to have a function that simply deletes the dump >files associated with a specific PID, >or to delete all dump files. >Some files may be dumped with unexpected delays, so I think the >cleaning feature will be necessary. >( Also, as the pgsql_tmp file, it might better to delete dump files >when PostgreSQL start.) > >Or should we try to delete the dump file as soon as we can read it? > IMO making the cleanup a responsibility of the users (e.g. by exposing the list of dumped files through a view and expecting users to delete them in some way) is rather fragile. I don't quite see what's the point of designing it this way. It was suggested this improves stability and usability of this feature, but surely making it unnecessarily complex contradicts both points? IMHO if the user needs to process the dump repeatedly, what's preventing him/her from storing it in a file, or something like that? At that point it's clear it's up to them to remove the file. So I suggest to keep the feature as simple as possible - hand the dump over and delete. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services