From: | pavan95 <pavan(dot)postgresdba(at)gmail(dot)com> |
---|---|
To: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Hick ups in Postgresql Logical Replication |
Date: | 2018-10-15 10:11:03 |
Message-ID: | 1539598263562-0.post@n3.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi Mark,
Thanks for your response.
> We'd probably need to see how you actually did your set up, and also how
> you are deducing that there is a lag (e.g pg_stat_subscription)?
*Setup*:
*Publisher *:
Out of n number of tables n-1 tables are opted for replication of DML
changes.
*Subscriber *:
Subscription is created on the subscriber for the corresponding publication.
*At times, I find(developer complains) about difference in records between
some of the published tables.*
For example, after successful configuration of replication, say it was
configured successfully on Oct 1'st 2018 and verified that it is
replicating. Then some n days in future, a developer complains a table named
abc is not getting replicated(meaning the data inserted/updated/deleted for
that table abc on publisher is not getting synced with subscriber).
*Findings*:
Here I found that for 1 of the published table the row count is not same on
both publisher and subscriber:
Publisher : select count(*) from table_A; No.of Rows= 3598
Subscriber: select count(*) from table_A: No.of Rows= 3590
*Then my analysis will go like* :
1) Check the error log for any kind of errors-----------*No errors found*
2) Validate that the table structure(no.of.columns) on both primary and
subscriber.
As it is production, I need to to restore the data with minimum time. So I
will go for methods:
1). Truncate the table with cascade option--------which truncates the
records and resyncs the table and sometimes it will not work out.
2). If first approach will not work out, then I will go with dropping the
subscription and again configure the replication with copy_data=false
option.-----It works out.
As this can't be the baselined approach to be followed whenever this
complaint arises, a doubt raised in my head.
1) Can we restore that only 3 records(or more from other tables) on the
online subscriber???
In this case LSN's on both the primary and secondary are different. So how
to identify the difference LSN's for that 3 records in that table?
Assuming for 3 records there are 3 different LSN's, is there a way to
restore that only 3 LSN's data??
Can we list what all the LSN's are present in a single archive log
segment(000000010000000200000003). And how can I restore that archive
segment alone on the subscriber.
To be in specific,
1) Can I get List of LSN's in an archive WAL segment file?
2) How to find that 3 records are in which archive file based on the LSN?
3) How can I restore that 3 records alone, in this case ?
Please ask if there is something which I needed to explain on my part.
Looking forward to hear from you. Thanks in Advance.
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html
From | Date | Subject | |
---|---|---|---|
Next Message | Achilleas Mantzios | 2018-10-15 10:34:41 | Re: pgpool versus which tool? |
Previous Message | Prince Pathria | 2018-10-15 10:00:44 | Re: pgpool versus which tool? |