PostgreSQL-12 replication failover, pg_rewind fails

2020-05-10 Thread Mariya Rampurawala
Hi, I am working on providing HA for replication, using automation scripts. My set up consists on two nodes, Master and Slave. When master fails, The slave is promoted to master. But when I try to re-register the old master as slave, the pg_rewind command fails. Details below. Non-default entri

Re: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'

2020-05-10 Thread Matthias Apitz
El día Dienstag, April 28, 2020 a las 10:10:18 +0200, Matthias Apitz escribió: > > I've added the proposed log line to the server code in > src/backend/libpq/pqcomm.c > and restarted the server with this. In the log file > /data/postgresql11/data/serverlog > are other messages about length of p

Re: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'

2020-05-10 Thread Tom Lane
Matthias Apitz writes: > 1. In addition to the above code, can I get somehow the connecting client's > PID? If Not in any portable way. If you believe that the offending client is on the local system, you could try building something involving netstat, lsof, etc. getpeereid() might be useful t

what to log in csvlogs

2020-05-10 Thread Mary Johnson
Hi, Can you please let me know if we can control what to log when log destination is 'csvlog'? Also, can we control when to log to display only select queries of a few specific tables? Thanks, mary

Re: what to log in csvlogs

2020-05-10 Thread Adrian Klaver
On 5/10/20 11:27 AM, Mary Johnson wrote: Hi, Can you please let me know if we can control what to log when log destination is 'csvlog'? No, it is set to the fields described here: https://www.postgresql.org/docs/12/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG What is in those f

Re: Best way to use trigger to email a report ?

2020-05-10 Thread Rory Campbell-Lange
On 09/05/20, Tim Cross (theophil...@gmail.com) wrote: > David G. Johnston writes: > > On Fri, May 8, 2020 at 9:26 AM David Gauthier > > wrote: > >> The idea is to send a report to the list when all the data has been > >> collected for a particular job and the final status of the job is updated >

How to restore database to previous state

2020-05-10 Thread Andrus
Hi! Postgres 12 database is runing on Debian max_wal_size = 5GB is specified in postgres.conf file How to restore database to some previous state, e.q. before important data was accidently deleted. Binary asynchrunous replication with slot is also used. I looks like it is possible to creat

RE: How to restore database to previous state

2020-05-10 Thread Ahmed, Nawaz (Fuji Xerox Australia)
Hi, Have you looked at the recovery parameter as below ? recovery_target_time Using this, you could achieve a PITR of the current database. If the recovery requires WAL that does not exist on disk then you may have to restore it from previous night's backup. Please have a look at the docs for

Re: How to restore database to previous state

2020-05-10 Thread David G. Johnston
On Sun, May 10, 2020 at 2:43 PM Andrus wrote: > Is there simpler solution, e.q reverse playback of wal segments starting > from current data directory contents. > There is no "unwind" or "undo" capability in PostgreSQL. You need to separately get the database state to a point sometime before th

SV: what to log in csvlogs

2020-05-10 Thread Niels Jespersen
Fra: Mary Johnson Sendt: 10. maj 2020 20:27 Til: pgsql-gene...@postgresql.org Emne: what to log in csvlogs Hi, Can you please let me know if we can control what to log when log destination is 'csvlog'? Also, can we control when to log to display only select queries of a few specific tables?

Re: PostgreSQL client hangs sometimes on 'EXEC SQL PREPARE sid_sisisinst FROM :select_anw;'

2020-05-10 Thread Matthias Apitz
El día Sonntag, Mai 10, 2020 a las 11:33:41 -0400, Tom Lane escribió: > Matthias Apitz writes: > > 1. In addition to the above code, can I get somehow the connecting client's > > PID? If > > Not in any portable way. If you believe that the offending client is on > the local system, you could t