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 1npUhO-00045F-ES for pgsql-hackers@arkaria.postgresql.org; Fri, 13 May 2022 12:47:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1npUhN-0002gL-0q for pgsql-hackers@arkaria.postgresql.org; Fri, 13 May 2022 12:47:13 +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 1npUhM-0002gC-No for pgsql-hackers@lists.postgresql.org; Fri, 13 May 2022 12:47:12 +0000 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1npUhJ-000847-TK for pgsql-hackers@postgresql.org; Fri, 13 May 2022 12:47:11 +0000 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-d39f741ba0so10320892fac.13 for ; Fri, 13 May 2022 05:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/GLO06KHhV7kTyY+5hb4VmD8wlOrrLNYgP7JT7+KzWQ=; b=f+TVmouw5rlzOprSPttUK2vwduziB8HTod7NK+aajqs/HIeMqT18gbMeDjoT+C91js kzQ0fKtYSMDwPy2X2r4IHKB905pmJlQ5UsGZSijaLE4sJt2WvTJfjThiwyz7UEOfF/UO LQ2bRnz4ZvorCEbZqj2UYiRHySdXAKD0ejynv5nPWsGENKtRtJLtL+WFVqv3zCHLGRt7 iXY9DvEAiTfCyuuOacL7WjYO23qQq+ZNoNA3OxdPXIgm3Esd+XYcCqKtFy6xKcrxDoRs OLznbPcO9tWHaWXARl8F2uR7r/1kOVNzV4alyAe/z+B+l7wDS9dWBLuNVtbx8lBcHIPa pxiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/GLO06KHhV7kTyY+5hb4VmD8wlOrrLNYgP7JT7+KzWQ=; b=Fg20SuS1/HxGV5Xlf3hW3W5LYb+CWnTAGBLsaTP6KTSZpS7vUdSMP6hc1mekwVEdUl os/ldq6uFoj4I0zhz/KRQed+wYmJipSloljp+uNWzOb8H3utUen2v1Rfyv1MJ3CsfJvl FpOLIAN+YSb+UJAq4BhfJ1KAhIAGI0qcHLYJxaZdI0GdWx5DV3UNqj9rO0FzfIQEHTzd PHrCEhvwqDZMht99UyzDSCUQGz4NFO7z++5v8rW6kpdg6zSpLiS3hxcXmRA0kskcg775 0a/MHVvKJ/jjn1flLk2E6sdCTcJiQxr0AcDLf+9TWAMe+AT/JsOffLO/YI7DyATlsOWi 6h6Q== X-Gm-Message-State: AOAM532TdIl5b0jOAeB0OSZNAijY4L5aCO296grVnlmmRoTeymbO3jpZ ehjuelFiu3t8HCodfy/nCvfXFkFFfs/jQmkY64k2SLdfejE5wX+GxLOf4P7SYE7DUyjDzbUO23m dnaoy32uBrojdwY5AFcWGcDNMVSNQ6YFgFFZJG9bcILrC0WirraaR4t0wIPPNgvk178vrsrmTQr IZCQPVH5JouUajlOZBg6FTvHOoFAGgmkLXBaXJNTatf6f2ZJRZb2bh X-Google-Smtp-Source: ABdhPJwz5hjaZjo5iTaV3a8V7XceHYNucAAK1YlzoeBPxVM8duJvKoK+VXe/SkKBrqF6nv+YaP46w8N9rwAhU0Yy5rg= X-Received: by 2002:a05:6870:e8c1:b0:ed:a4d8:dd6b with SMTP id r1-20020a056870e8c100b000eda4d8dd6bmr2528400oan.224.1652446029056; Fri, 13 May 2022 05:47:09 -0700 (PDT) MIME-Version: 1.0 References: <20220512034010.4oqa76pasrulkw32@alap3.anarazel.de> <20220512234207.pwwp6q33f72byet2@alap3.anarazel.de> In-Reply-To: <20220512234207.pwwp6q33f72byet2@alap3.anarazel.de> From: Simon Riggs Date: Fri, 13 May 2022 13:46:58 +0100 Message-ID: Subject: Re: Comments on Custom RMGRs To: Andres Freund Cc: Jeff Davis , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 13 May 2022 at 00:42, Andres Freund wrote: > > On 2022-05-12 22:26:51 +0100, Simon Riggs wrote: > > On Thu, 12 May 2022 at 04:40, Andres Freund wrote: > > > I'm not happy with the idea of random code being executed in the middle of > > > CheckPointGuts(), without any documentation of what is legal to do at that > > > point. > > > > The "I'm not happy.." ship has already sailed with pluggable rmgrs. > > I don't agree. The ordering within a checkpoint is a lot more fragile than > what you do in an individual redo routine. Example? > > Checkpoints exist for one purpose - as the starting place for recovery. > > > > Why would we allow pluggable recovery without *also* allowing > > pluggable checkpoints? > > Because one can do a lot of stuff with just pluggable WAL records, without > integrating into checkpoints? > > Note that I'm *not* against making checkpoint extensible - I just think it > needs a good bit of design work around when the hook is called etc. When was any such work done previously for any other hook?? That isn't needed. Checkpoints aren't complete until all data structures have checkpointed, so there are no problems from a partial checkpoint being written. As a result, the order of actions in CheckpointGuts() is mostly independent of each other. The SLRUs are all independent of each other, as is CheckPointBuffers(). The use cases I'm trying to support aren't tricksy modifications of existing code, they are just entirely new data structures which are completely independent of other Postgres objects. > I definitely think it's too late in the cycle to add checkpoint extensibility > now. > > > > > To actually be useful we'd likely need multiple calls to such an rmgr > > > callback, with a parameter where in CheckPointGuts() we are. Right now the > > > sequencing is explicit in CheckPointGuts(), but with the proposed callback, > > > that'd not be the case anymore. > > > > It is useful without the extra complexity you mention. > > Shrug. The documentation work definitely is needed. Perhaps we can get away > without multiple callbacks within a checkpoint, I think it'll become more > apparent when writing information about the precise point in time the > checkpoint callback is called. You seem to be thinking in terms of modifying the existing actions in CheckpointGuts(). I don't care about that. Anybody that wishes to do that can work out the details of their actions. There is nothing to document, other than "don't do things that won't work". How can anyone enumerate all the things that wouldn't work?? There is no list of caveats for any other hook. Why is it needed here? > > I see multiple uses for the rm_checkpoint() point proposed and I've > > been asked multiple times for a checkpoint hook. Any rmgr that > > services crash recovery for a non-smgr based storage system would need > > this because the current checkpoint code only handles flushing to disk > > for smgr-based approaches. That is orthogonal to other code during > > checkpoint, so it stands alone quite well. > > FWIW, for that there are much bigger problems than checkpoint > extensibility. Most importantly there's currently no good way to integrate > relation creation / drop with the commit / abort infrastructure... One at a time... -- Simon Riggs http://www.EnterpriseDB.com/