Re: Hick ups in Postgresql Logical Replication

Поиск
Список
Период
Сортировка
От pavan95
Тема Re: Hick ups in Postgresql Logical Replication
Дата
Msg-id 1539598263562-0.post@n3.nabble.com
обсуждение исходный текст
Ответ на Re: Hick ups in Postgresql Logical Replication  (Mark Kirkwood <mark.kirkwood@catalyst.net.nz>)
Ответы Re: Hick ups in Postgresql Logical Replication  (Mark Kirkwood <mark.kirkwood@catalyst.net.nz>)
Список 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


В списке pgsql-admin по дате отправления:

Предыдущее
От: Prince Pathria
Дата:
Сообщение: Re: pgpool versus which tool?
Следующее
От: Achilleas Mantzios
Дата:
Сообщение: Re: pgpool versus which tool?