Thread: A query in Streaming Replication

A query in Streaming Replication

From
Sreerama Manoj
Date:
Hello,
      I use streaming replication in async mode. When master gets down, slave will be promoted using a trigger file. During this process ".partial" file will be created and a WAL file with same ID will be created in a different time line in slave. When master comes back as slave, it will be synced to the current master. This is the normal procedure as far as I understood. But in some cases, ".partial" file is not getting created and peer DB which comes back as slave is unable to sync when this happens.. Please suggest if this happens in any scenario and how to overcome this.

Thanks & Regards:
Manoj.


Re: A query in Streaming Replication

From
Sreerama Manoj
Date:
Hello,

Forgot to add the version details. I'm using postgres 10.7 . 

On Sat, Jun 13, 2020, 20:26 Sreerama Manoj <manoj.sreerama973@gmail.com> wrote:
Hello,
      I use streaming replication in async mode. When master gets down, slave will be promoted using a trigger file. During this process ".partial" file will be created and a WAL file with same ID will be created in a different time line in slave. When master comes back as slave, it will be synced to the current master. This is the normal procedure as far as I understood. But in some cases, ".partial" file is not getting created and peer DB which comes back as slave is unable to sync when this happens.. Please suggest if this happens in any scenario and how to overcome this.

Thanks & Regards:
Manoj.


Re: A query in Streaming Replication

From
Sreerama Manoj
Date:
Hello, 

          Can anyone check this and respond please!!

Thanks and regards,
Manoj.


On Sat, Jun 13, 2020, 20:26 Sreerama Manoj <manoj.sreerama973@gmail.com> wrote:
Hello,
      I use streaming replication in async mode. When master gets down, slave will be promoted using a trigger file. During this process ".partial" file will be created and a WAL file with same ID will be created in a different time line in slave. When master comes back as slave, it will be synced to the current master. This is the normal procedure as far as I understood. But in some cases, ".partial" file is not getting created and peer DB which comes back as slave is unable to sync when this happens.. Please suggest if this happens in any scenario and how to overcome this.

Thanks & Regards:
Manoj.


Re: A query in Streaming Replication

From
Kyotaro Horiguchi
Date:
At Sat, 13 Jun 2020 23:12:25 +0530, Sreerama Manoj <manoj.sreerama973@gmail.com> wrote in 
> Hello,
> 
> Forgot to add the version details. I'm using postgres 10.7 .
> 
> On Sat, Jun 13, 2020, 20:26 Sreerama Manoj <manoj.sreerama973@gmail.com>
> wrote:
> 
> > Hello,
> >       I use streaming replication in async mode. When master gets down,
> > slave will be promoted using a trigger file. During this process ".partial"
> > file will be created and a WAL file with same ID will be created in a
> > different time line in slave. When master comes back as slave, it will be
> > synced to the current master. This is the normal procedure as far as I
> > understood. But in some cases, ".partial" file is not getting created and

It is not guaranteed that a crashed master can be used as a new
standby as-is, since there can be unsent WAL records on the old master
after the LSN where the new master promoted.  If files are assumed to
be sound, pg_rewind will adjust the old master as  a new standby.

The .partial file is created when timeline diverges at midst of a WAL
segment. It is useful when performing PITR to the end of the same
timeline, rather than going into the next timeline.  I don't have an
idea at hand of how this can be relevant to the reusability of the old
master..

> > peer DB which comes back as slave is unable to sync when this happens..
> > Please suggest if this happens in any scenario and how to overcome this.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



Re: A query in Streaming Replication

From
Sreerama Manoj
Date:
Hello,

Thanks for you reply

>> If files are assumed to
>> be sound, pg_rewind will adjust the old master as  a new standby

To use pg_rewind, we should either enable wal_log_hints  or initialize data directory with checksum enabled. These are not default and will not be enabled in most of the cases. In those scenarios, we cannot pg_rewind to sync data.

>> The .partial file is created when timeline diverges at midst of a WAL segment

I read somewhere that a .partial file will definitely be created during promotion of the slave database and is introduced from the postgres 9.5 version. Please correct me if I am wrong. But in my scenario, it is not getting generated.

Thanks and Regards,
Manoj.