Re: psql dones't reflect exit status if input command via stdin

2019-05-14 Thread magodo
On Mon, 2019-05-13 at 23:39 -0700, David G. Johnston wrote: > On Mon, May 13, 2019 at 11:24 PM magodo wrote: > > I found when running command like `# echo "xxx" | psql postgres > > > > postgres`, the return code is always 0 even though the command > > (&quo

psql dones't reflect exit status if input command via stdin

2019-05-13 Thread magodo
Hello, I found when running command like `# echo "xxx" | psql postgres postgres`, the return code is always 0 even though the command ("xxx") here is of invalid syntax. While the `psql -c` way handled exit code correctly. In the meanwhile, mysql client handled both cases correctly. --- Zhaotin

pg9.6 when is a promoted cluster ready to accept "rewind" request?

2018-11-11 Thread magodo
ote. Is there anything I need to wait before I rewind the old primary against this promoted cluster? Thank you in advance! --- magodo

Re: how to identify the timeline of specified recovery_target_time when do multiple PITR

2018-10-12 Thread magodo
xlogdump -r Transaction`, and try to find the first least earliest WAL against the specified time. This is a linear search, which has complexity of O(n). So if you want to recover to that point of time, how do you choose the timeline? --- Magodo

parallel PITR for HA setup

2018-10-11 Thread magodo
restart it, which will end up with standby's LSN newer than the current flushed one on primary. My solution to this problem is to do a restart also on primary. I wonder if this is a proper way. Thank you in advance! --- Magodo

Re: how to identify the timeline of specified recovery_target_time when do multiple PITR

2018-10-11 Thread magodo
On Thu, 2018-10-11 at 06:35 +0200, Laurenz Albe wrote: > magodo wrote: > > OK... Just take another example: > > > > A B > > BASE-+-+--o1 (recover to > > A) 1 > > | | C > &

Re: how to identify the timeline of specified recovery_target_time when do multiple PITR

2018-10-10 Thread magodo
On Wed, 2018-10-10 at 18:21 +0200, Laurenz Albe wrote: > magodo wrote: > > > By default, recovery will stay on the timeline where it started. > > > If you want to go to timeline 2 or 3, you have to specify > > > recovery_target_timeline. > > > > &g

Re: how to identify the timeline of specified recovery_target_time when do multiple PITR

2018-10-10 Thread magodo
On Wed, 2018-10-03 at 08:06 +0200, Laurenz Albe wrote: > magodo wrote: > > I read the document about recovery configuration, it says: > > [...] > > > Therefore, suppose I am going to recover to a point of some child > > timeline, to identify the p

how to cleanup archive based on datetime

2018-10-10 Thread magodo
to parse each wal and compare with the specified datetime in a binary-search way, but it is based on the fact that every COMMIT time in wal is sequential, but it looks like not the case.. Hence I wonder what is the best practice for this task? Thank you in advance! --- Magodo

Re: pg9.6: PITR paused just after failover, need manual resume

2018-10-10 Thread magodo
On Wed, 2018-10-10 at 11:24 +0800, magodo wrote: > Hello, > > I'm figuring out how to do PITR on a HA setup for postgres 9.6. I > almost manage to do it, while I faced following issue: > > > [1. create basebackup] > > [2. insert 2 rows] > >

pg9.6: PITR paused just after failover, need manual resume

2018-10-10 Thread magodo
3:09:57.119 UTC > DEBUG: archived transaction log file "00020005" < 2018-10-10 03:09:57.759 UTC > DEBUG: forked new backend, pid=254 socket=11 < 2018-10-10 03:09:57.771 UTC > DEBUG: server process (PID 254) exited with exit code 0 And I have to execute `pg_xlog_replay_resume()` on the new primary so that it will branch out to new timeline 3 and work normally... Would anyone please tell me what's going on here? How can I avoid doing a manual resume? --- Magodo

Re: pg9.6: no backup history file (*.backup) created on hot standby

2018-10-09 Thread magodo
On Tue, 2018-10-09 at 16:55 +0900, Michael Paquier wrote: > On Tue, Oct 09, 2018 at 03:26:35PM +0800, magodo wrote: > > Yes, but does this differ whether I'm archiving a general WAL or > > archiving the backup history? I mean if user doesn't handle > > duplicat

Re: pg9.6: no backup history file (*.backup) created on hot standby

2018-10-09 Thread magodo
On Tue, 2018-10-09 at 12:53 +0900, Michael Paquier wrote: > On Tue, Oct 09, 2018 at 11:45:50AM +0800, magodo wrote: > > Yet, I am still not so clear how does the bloat of pg_wal happen? > > Do > > you mean pg_wal will be filled up by many .backup(s)? > > If your archi

Re: pg9.6: no backup history file (*.backup) created on hot standby

2018-10-09 Thread magodo
On Tue, 2018-10-09 at 11:45 +0900, Michael Paquier wrote: > (Please do not forget to add the community mailing list in CC.) > > On Tue, Oct 09, 2018 at 10:33:56AM +0800, magodo wrote: > > Since the backup history aims to aid administrator to identify the > > point from whi

pg9.6: no backup history file (*.backup) created on hot standby

2018-10-08 Thread magodo
primary. Is this as expected? If so, in which case should I do backup on primary and in which case should I do it on standby? Thank you in advance! Magodo

how to identify the timeline of specified recovery_target_time when do multiple PITR

2018-10-02 Thread magodo
I read the document about recovery configuration, it says: recovery_target_timeline (string) ... Other than that you only need to set this parameter in complex re- recovery situations, where you need to return to a state that itself was reached after a point-in-time recovery. Se

how to know current xlog location on standby after primary is down

2018-09-09 Thread magodo
Hello, I'm working on a high availability project for PG(v9.6). Suppose I have a priamry-standby setup, I need to do promote once primary is down, but only when standby is as new as primary (before it is down). Therefore, I need a way to know the wal replay location on standby. I tried to set