On Thu, Mar 13, 2025 at 3:20 PM Amit Kapila <amit.kapil...@gmail.com> wrote: > > On Thu, Mar 13, 2025 at 11:43 AM Dilip Kumar <dilipbal...@gmail.com> wrote: > > > > Looks fine, shall we add the missing publication point as well > > something like below > > > > /* > > * In operations like 'ALTER SUBSCRIPTION ... ADD/SET PUBLICATION' and > > * 'CREATE SUBSCRIPTION', if the specified publication does not exist or > > * if the replication origin is not updated before the worker exits, > > * the WAL start location may point to a position prior to the publication's > > * WAL record. This can cause persistent restarts and errors > > * in the apply worker. > > * > > I think that is too much related to pub-sub model, and ideally, > pgoutput should not care about it. I have written a comment > considering somebody using pgoutput decoding module via APIs.
I agree, here we just need to talk about skipping the missing publication, not different scenarios where that can happen. This comments look much better. > > > * Additionally, dropping a subscription's publication should not > > > * disrupt logical replication. > > * > > > * This ensures that a missing publication is skipped and loaded > > > * when its corresponding WAL record is encountered. > > */ > > > > > > > > > ereport(WARNING, > > > errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), > > > errmsg("skipped loading publication: %s", pubname), > > > errhint("If the publication is missing, create and refresh it. > > > Otherwise, wait for the slot to reach the WAL record, then refresh")); > > > > > > > 2. + errhint("If the publication already exists, ignore it as it will > > > > be loaded upon reaching the corresponding WAL record; otherwise, > > > > create it.")); > > > > > > > > Is this hint correct? This is a question rather than a comment: When > > > > we reach a particular WAL where the publication was created, will the > > > > publication automatically load, or does the user need to REFRESH the > > > > publications? > > > > > > Users need to refresh the publication in case the relation is not > > > already added to pg_subscription_rel and apply incremental changes. > > > How about an error hint like: > > > "If the publication is missing, create and refresh it. Otherwise, wait > > > for the slot to reach the WAL record for the created publication, then > > > refresh" > > > > I have tried to split this information into errdetail and errhint in > the attached. See and let me know what you think of the same. Yes, the errhint also makes sense to me. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com