pg_dump -Fd -j2 on standby in 9.6.6 - Mailing list pgsql-general

From Stefan Petrea
Subject pg_dump -Fd -j2 on standby in 9.6.6
Date
Msg-id MWHPR12MB1904D349E9897629C25F1BFB91A30@MWHPR12MB1904.namprd12.prod.outlook.com
Whole thread Raw
Responses RE: [EXTERNAL]pg_dump -Fd -j2 on standby in 9.6.6  (Stefan Petrea <Stefan.Petrea@tangoe.com>)
Re: pg_dump -Fd -j2 on standby in 9.6.6  (Andreas Kretschmer <andreas@a-kretschmer.de>)
List pgsql-general
Hi,

I downloaded the code from this github tag https://github.com/postgres/postgres/archive/REL9_6_8.tar.gz
I unpacked the code on disk where gdb was looking for it /build/postgresql-9.6-9VrjLn/postgresql-9.6-9.6.8

Then I ran this oneliner which is a summary of my debug process. So, apparently pg_dump -Fd -j2 does not work
in the case of pre-9.2 but it also doesn't work for standby servers.

gdb /usr/lib/postgresql/9.6/bin/pg_dump -ex 'set confirm off' -ex 'set listsize 30' -ex 'set pagination off' -ex 'b
1131'-ex 'r -Fd -j2 -d TIMS_SOMEDB -h /var/run/postgresql/pg-prod-7 -f /tmp/TIMS_SOMEDB_fd.dmp' -ex 'l' -ex 'p
AH->numWorkers' -ex 'p AH->remoteVersion' -ex 'p dopt->no_synchronized_snapshots'  -ex 'q' 


1131        else if (AH->numWorkers > 1 &&
1116         * worker, we'll be passed dumpsnapshot == NULL, but AH->sync_snapshot_id
1117         * is already set (if the server can handle it) and we should use that.
1118         */
1119        if (dumpsnapshot)
1120            AH->sync_snapshot_id = pg_strdup(dumpsnapshot);
1121
1122        if (AH->sync_snapshot_id)
1123        {
1124            PQExpBuffer query = createPQExpBuffer();
1125
1126            appendPQExpBuffer(query, "SET TRANSACTION SNAPSHOT ");
1127            appendStringLiteralConn(query, AH->sync_snapshot_id, conn);
1128            ExecuteSqlStatement(AH, query->data);
1129            destroyPQExpBuffer(query);
1130        }
1131        else if (AH->numWorkers > 1 &&
1132                 AH->remoteVersion >= 90200 &&
1133                 !dopt->no_synchronized_snapshots)
1134        {
1135            if (AH->isStandby)
1136                exit_horribly(NULL,
1137                 "Synchronized snapshots are not supported on standby servers.\n"
1138                              "Run with --no-synchronized-snapshots instead if you do not need\n"
1139                              "synchronized snapshots.\n");
1140
1141
1142            AH->sync_snapshot_id = get_synchronized_snapshot(AH);
1143        }
1144    }
1145
$1 = 2
$2 = 90606
$3 = 0

I was expecting the code to be the same as the one in [1], but it seems to be different (I don't know why)
I wonder why synchronized snapshots are not supported on standby servers. The code in [1] says they should
work for standby servers.

My master is 9.6.6 and my slave is 9.6.6 as well.
Any ideas would be appreciated.

Thank you,
Stefan

[1] https://github.com/postgres/postgres/blob/REL9_6_STABLE/src/bin/pg_dump/pg_dump.c#L689




Stefan Petrea
System Engineer/DBA, Network Engineering


stefan.petrea@tangoe.com

         

tangoe.com



This e-mail message, including any attachments, is for the sole use of the intended recipient of this message, and may
containinformation that is confidential or legally protected. If you are not the intended recipient or have received
thismessage in error, you are not authorized to copy, distribute, or otherwise use this message or its attachments.
Pleasenotify the sender immediately by return e-mail and permanently delete this message and any attachments. Tangoe
makesno warranty that this e-mail or its attachments are error or virus free. 



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: connection dropped from the backend server
Next
From: Stefan Petrea
Date:
Subject: RE: [EXTERNAL]pg_dump -Fd -j2 on standby in 9.6.6