Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rifrw-000yBo-B1 for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2024 19:27:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rifrt-00FHJl-NC for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2024 19:26:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rifrt-00FHJd-B0 for pgsql-hackers@lists.postgresql.org; Fri, 08 Mar 2024 19:26:57 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rifrl-003U6d-89 for pgsql-hackers@lists.postgresql.org; Fri, 08 Mar 2024 19:26:56 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5135486cfccso1667422e87.0 for ; Fri, 08 Mar 2024 11:26:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1709926008; x=1710530808; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=NS9E3VOgz1e+qMk8eU2CiUYUyn7ywVyeoUg3DyWZ93A=; b=RDW5Dor9w3EabMWd3muRS6Ug9GHrsstNnYUcqKvyWdjDquSXhTFnzYf9alUwcoRW9j 6ttrBOxMZxkwZy5pWufuSvxfdrto6VrWHAoNH5N4ZdI6iZ4Wv+/essEI7bdAlnGGPs6Y FWSsyE2S8ltlGWH0G23YUUz0D4FHbi8fdZQv5kE76TNUDdTR916bAiIRvI4h1Dssjmr2 ORzlD3AOECwZj66heWUzFalUGSJdbrLY6w5HysSnNsFeWPRyRwxYWg7ye53S+Lap6zNb b9apq6m77rZhKWsSvPQTY5xkfMCdSc51rGf/CGTg/eNCWQ01YYlmB4bHqhbyQduaW4aA /0Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709926008; x=1710530808; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NS9E3VOgz1e+qMk8eU2CiUYUyn7ywVyeoUg3DyWZ93A=; b=dXrsQkFBecpWqoFGpfr0u4pVB8daUt3Mgo8rDU1Vvlu3riv7yLJjxVTVErdOs7S+EO uhlZRpOhKgrGihdHFM1S6AO67Yz1mUSDlSxh3AJubUkfddN23OumTaPOZ1vCdiqnJrze 8IbjFoE4hO99d7QgbNIRN+pvW+oe2U9zwTsj3IjeQ7OllCh9zN+uKDYLC18dv6+fj43X WD4/HgZuKbofNCBHQsBxslCCFljzZJSQ2E1v6bL505A1gVekoeoG1U797o/zklOWyQDI rGqEQKR7sZFSAvlWr3D+qHXlFBJ8DDTCzDBX544AQnB8wGOdUkcyrdE7WbzOaEAMaqeF 8O5g== X-Gm-Message-State: AOJu0YxZzRKWUNylOuaX73pk+gHywk302yHwUNuLI3qw5j/q0fR9Bdte tNXjQevPVnCj+MUF6VjmL1WyW7q4GKNVjDjPANBtKUcBP1vChksJZflYbziH5Q== X-Google-Smtp-Source: AGHT+IHBpkXJ3vJ73J7DioY+48wQP0Gw2MlmvhX549H+57wleB8VjKoahw9KHmAqHXxiiiO9WvLuJg== X-Received: by 2002:ac2:5f7b:0:b0:512:e58c:7bf1 with SMTP id c27-20020ac25f7b000000b00512e58c7bf1mr8803lfc.40.1709926007903; Fri, 08 Mar 2024 11:26:47 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-226-7.bb.vodafone.cz. [86.49.226.7]) by smtp.gmail.com with ESMTPSA id j5-20020a056512028500b00512f6d88354sm29038lfp.131.2024.03.08.11.26.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Mar 2024 11:26:47 -0800 (PST) Message-ID: <8d52c226-7e34-44f7-a919-759bf8d81541@enterprisedb.com> Date: Fri, 8 Mar 2024 20:26:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: speed up a logical replica setup To: "Hayato Kuroda (Fujitsu)" , Euler Taveira Cc: "pgsql-hackers@lists.postgresql.org" , Michael Paquier , Peter Eisentraut , Andres Freund , Ashutosh Bapat , Amit Kapila , Shlok Kyal , =?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= , vignesh C References: <9a9c7e65-c47b-4400-a63e-ac6169c0860e@app.fastmail.com> <2edde173-5ff9-45fd-b881-cd04eb13049f@app.fastmail.com> <2231a04b-f2d4-4a4e-b5cd-56be8b002427@app.fastmail.com> <40595e73-c7e1-463a-b8be-49792e870007@app.fastmail.com> <6423dfeb-a729-45d3-b71e-7bf1b3adb0c9@enterprisedb.com> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/8/24 10:44, Hayato Kuroda (Fujitsu) wrote: > Dear Tomas, Euler, > > Thanks for starting to read the thread! Since I'm not an original author, > I want to reply partially. > >> I decided to take a quick look on this patch today, to see how it works >> and do some simple tests. I've only started to get familiar with it, so >> I have only some comments / questions regarding usage, not on the code. >> It's quite possible I didn't understand some finer points, or maybe it >> was already discussed earlier in this very long thread, so please feel >> free to push back or point me to the past discussion. >> >> Also, some of this is rather opinionated, but considering I didn't see >> this patch before, my opinions may easily be wrong ... > > I felt your comments were quit valuable. > >> 1) SGML docs >> >> It seems the SGML docs are more about explaining how this works on the >> inside, rather than how to use the tool. Maybe that's intentional, but >> as someone who didn't work with pg_createsubscriber before I found it >> confusing and not very helpful. >> >> For example, the first half of the page is prerequisities+warning, and >> sure those are useful details, but prerequisities are checked by the >> tool (so I can't really miss this) and warnings go into a lot of details >> about different places where things may go wrong. Sure, worth knowing >> and including in the docs, but maybe not right at the beginning, before >> I learn how to even run the tool? > > Hmm, right. I considered below improvements. Tomas and Euler, how do you think? > > * Adds more descriptions in "Description" section. > * Moves prerequisities+warning to "Notes" section. > * Adds "Usage" section which describes from a single node. > >> I'm not sure FOR ALL TABLES is a good idea. Or said differently, I'm >> sure it won't work for a number of use cases. I know large databases >> it's common to create "work tables" (not necessarily temporary) as part >> of a batch job, but there's no need to replicate those tables. > > Indeed, the documentation does not describe that all tables in the database > would be included in the publication. > >> I do understand that FOR ALL TABLES is the simplest approach, and for v1 >> it may be an acceptable limitation, but maybe it'd be good to also >> support restricting which tables should be replicated (e.g. blacklist or >> whitelist based on table/schema name?). > > May not directly related, but we considered that accepting options was a next-step [1]. > >> Note: I now realize this might fall under the warning about DDL, which >> says this: >> >> Executing DDL commands on the source server while running >> pg_createsubscriber is not recommended. If the target server has >> already been converted to logical replica, the DDL commands must >> not be replicated so an error would occur. > > Yeah, they would not be replicated, but not lead ERROR. > So should we say like "Creating tables on the source server..."? > Perhaps. Clarifying the docs would help, but it depends on the wording. For example, I doubt this should talk about "creating tables" because there are other DDL that (probably) could cause issues (like adding a column to the table, or something like that). >> 5) slot / publication / subscription name >> >> I find it somewhat annoying it's not possible to specify names for >> objects created by the tool - replication slots, publication and >> subscriptions. If this is meant to be a replica running for a while, >> after a while I'll have no idea what pg_createsubscriber_569853 or >> pg_createsubscriber_459548_2348239 was meant for. >> >> This is particularly annoying because renaming these objects later is >> either not supported at all (e.g. for replication slots), or may be >> quite difficult (e.g. publications). >> >> I do realize there are challenges with custom names (say, if there are >> multiple databases to replicate), but can't we support some simple >> formatting with basic placeholders? So we could specify >> >> --slot-name "myslot_%d_%p" >> >> or something like that? > > Not sure we can do in the first version, but looks nice. One concern is that I > cannot find applications which accepts escape strings like log_line_prefix. > (It may just because we do not have use-case.) Do you know examples? > I can't think of a tool already doing that, but I think that's simply because it was not needed. Why should we be concerned about this? >> BTW what will happen if we convert multiple standbys? Can't they all get >> the same slot name (they all have the same database OID, and I'm not >> sure how much entropy the PID has)? > > I tested and the second try did not work. The primal reason was the name of publication > - pg_createsubscriber_%u (oid). > FYI - previously we can reuse same publications, but based on my comment [2] the > feature was removed. It might be too optimistic. > OK. I could be convinced the other limitations are reasonable for v1 and can be improved later, but this seems like something that needs fixing. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company