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 1pAIZT-0003gz-5o for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Dec 2022 22:37:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pAIZR-0007kd-Lv for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Dec 2022 22:37:17 +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 1pAIZR-0007jM-C0 for pgsql-hackers@lists.postgresql.org; Tue, 27 Dec 2022 22:37:17 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pAIZP-0002UQ-18 for pgsql-hackers@postgresql.org; Tue, 27 Dec 2022 22:37:16 +0000 Received: by mail-pj1-x102f.google.com with SMTP id n12so1616332pjp.1 for ; Tue, 27 Dec 2022 14:37:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SozoHF4x/TGzG0S/4DE2kL4UmyiIW8rilCwgBNpfP+c=; b=MvwD3RCE7xRJJgS2X9WbVgsNMwgXyfclZiT2tGmwrjbqkICLRNE3ftzFEjtvTV6lFF 8MAgkM+xNuoyIlaDn/akRF5xQg5PL2qMK/4Ss5QSFPJ6esR9tzmctVR9eqyYGGTVPy2Y s5j4DT+oQ58N64WuYoGLn1U9PG1nCB8EE6uMR3WxbmVya5wNXxjSSFR6jiKNp4jKuoSW 0b8yFx1Ve2hu7ZT8tzBeTZWeD5J/fytH5IU7oKkLM0ksNqusF3fPFDWLSz9NP4xSeB5q IikipmkUOeVpmpk6mj62xgwBlyLtiNGTr6tY5ut4WvXCAhsqhvZE0GcaieLSt5XJOxqy EFbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SozoHF4x/TGzG0S/4DE2kL4UmyiIW8rilCwgBNpfP+c=; b=UkLYO6Wj0PqPcNOTYe8m3FgbwkGM2ViGZfhS7+H8Bjipkm9SDFYQraTPd2cd7zwGMn VkV0qrR+f5/jHzm5QVcAuEHI98FRW+FM5WluxhpKnW+UnQj3lBjBeKzv86CoiP0BK9Na j0qFCPh9LGPSL5X3BmidTqw64ne2OGRvl/zehjr7zaOJgZUj7L02J1YikoVDOydZ9h5M wsFpgBOoiIAhidNuDc5P9XpM7yeyEOzMTqOJacbuIA9J7uHSh0LYCD+riCvrh/zwFqKi mKjVGTBKhC6+jFXbx2CfBDifBiWn70dIVaWj7ce+O9L09FOCD6D4aNpKWJNyX70UxVqp JzIA== X-Gm-Message-State: AFqh2kodknmZMYnqFLKHFsriWzFKJa9YQsefYG/X2eQlnCNBaMyKXq7N rRf7GMh3lcAuD+6x4BA6evU= X-Google-Smtp-Source: AMrXdXsyItL2L5Us5e7M8Ptttq1IC+x1HGTD3cc7kTVG1jNicI5ebaZxL94tK4CWdv6e5YIvxOeppA== X-Received: by 2002:a05:6a21:1507:b0:ac:1cf0:61e2 with SMTP id nq7-20020a056a21150700b000ac1cf061e2mr33188907pzb.3.1672180633919; Tue, 27 Dec 2022 14:37:13 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id 13-20020a170902e9cd00b00188fdae6e0esm9620115plk.44.2022.12.27.14.37.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Dec 2022 14:37:13 -0800 (PST) Date: Tue, 27 Dec 2022 14:37:11 -0800 From: Nathan Bossart To: Andres Freund Cc: pgsql-hackers@postgresql.org Subject: Re: recovery modules Message-ID: <20221227223711.GA3779714@nathanxps13> References: <20221227192449.GA3672473@nathanxps13> <20221227221111.xjw5hc3fqzt773gu@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221227221111.xjw5hc3fqzt773gu@awork3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Dec 27, 2022 at 02:11:11PM -0800, Andres Freund wrote: > On 2022-12-27 11:24:49 -0800, Nathan Bossart wrote: >> I've attached a patch set that adds the restore_library, >> archive_cleanup_library, and recovery_end_library parameters to allow >> archive recovery via loadable modules. This is a follow-up to the >> archive_library parameter added in v15 [0] [1]. > > Why do we need N parameters for this? To me it seems more sensible to have one > parameter that then allows a library to implement all these (potentially > optionally). The main reason is flexibility. Separate parameters allow using a library for one thing and a command for another, or different libraries for different things. If that isn't a use-case we wish to support, I don't mind combining all three into a single recovery_library parameter. >> * Unlike archive modules, recovery libraries cannot be changed at runtime. >> There isn't a safe way to unload a library, and archive libraries work >> around this restriction by restarting the archiver process. Since recovery >> libraries are loaded via the startup and checkpointer processes (which >> cannot be trivially restarted like the archiver), the same workaround is >> not feasible. > > I don't think that's a convincing reason to not support configuration > changes. Sure, libraries cannot be unloaded, but an unnecessarily loaded > library is cheap. All that's needed is to redirect the relevant function > calls. This might leave some stuff around (e.g., GUCs, background workers), but if that isn't a concern, I can adjust it to work as you describe. >> * pg_rewind uses restore_command, but there isn't a straightforward path to >> support restore_library. I haven't addressed this in the attached patches, >> but perhaps this is a reason to allow specifying both restore_command and >> restore_library at the same time. pg_rewind would use restore_command, and >> the server would use restore_library. > > That seems problematic, leading to situations where one might not be able to > use restore_command anymore, because it's not feasible to do > segment-by-segment restoration. I'm not following why this would make segment-by-segment restoration infeasible. Would you mind elaborating? -- Nathan Bossart Amazon Web Services: https://aws.amazon.com