Re: Re: Enabling checksums on a streaming replica

2019-06-27 Thread Michael Paquier
On Wed, Jun 26, 2019 at 02:08:19PM -0400, Brad Nicholson wrote:
> In testing, it doesn't appear to matter.  I've ensured that I've generated
> some full page writes (confirmed via pg_waldump), and those apply
> fine.

Full pages writes are first written from shared buffers to WAL, where
their checksums does not actually apply.  When the WAL records are
read an applied, a full page image is recovered in shared buffers.
The checksum of the page would get updated once the shared buffer page
used is evicted and written back to disk.

> The one thing I'm not sure of, when verifying checksums via pg_checksums I
> see blocks being skipped.  I'm not sure what or why it is skipping blocks,
> and if that indicates a problem or not.

Some files can get skipped entirely, but all the blocks of a file
are basically checked.  Well, except for new pages of course which
have no checksums to look at yet.
--
Michael


signature.asc
Description: PGP signature


Re: patch 11.2 to 11.4

2019-06-27 Thread Prakash Ramakrishnan
Hi Fabrizo,

After applying the update command getting this error ,

postg...@shacoyuhss001.enterprisenet.org:/home/postgres
==> psql
psql (11.4, server 11.3)
Type "help" for help.

postgres=#
postgres=# select version();
 version
-
 PostgreSQL 11.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-36), 64-bit
(1 row)

Please do the needful.

On Thu, Jun 27, 2019 at 7:08 PM Prakash Ramakrishnan <
prakash.ramakrishnan...@nielsen.com> wrote:

> Thanks for your support.
>
> On Thu, Jun 27, 2019, 18:58 Fabrízio de Royes Mello <
> fabri...@timbira.com.br> wrote:
>
>>
>> Em qui, 27 de jun de 2019 às 05:35, Prakash Ramakrishnan <
>> prakash.ramakrishnan...@nielsen.com> escreveu:
>>
>>> Hi Team,
>>>
>>> I done the installation using yum poostgresql 11 server method now i
>>> need to update or apply the patch using repo file how to do this 11.2 to
>>> 11.4 please share me the steps .
>>>
>>>
>> Just run the following command:
>>
>> yum update postgresql11*
>>
>> Regards,
>>
>> --
>>Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/
>>PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
>>
>

-- 
Thanks,
Prakash.R
PostgreSQL - Offshore DBA support TCS / Nielsen Infrastructure Team On call
: +91-8939599426


Re: pg_dump (COPY) hanging intermittently

2019-06-27 Thread Tom Lane
Ben Snaidero  writes:
> Do these stack traces shed help at all?

None worth mentioning :-(.  Can you rebuild with debug symbols?

regards, tom lane




Re: pg_dump (COPY) hanging intermittently

2019-06-27 Thread Ben Snaidero
On Thu, Jun 27, 2019 at 2:34 PM Tom Lane  wrote:

> Ben Snaidero  writes:
> > I am running into a strange issue with Postgres 10 when using pg_dump
> with
> > the directory format and jobs parameter set it intermittently hangs.
> Seems
> > to occur less frequently the lower I set the jobs parameter but does
> happen
> > eventually even when set to 2 (could not reproduce when jobs=1).  I've
> > tested with Postgres 11 and no matter how high I set the jobs parameter
> it
> > never hangs (tested all the way up to jobs=8).  Also with Postgres 10 and
> > other formats I don't run into the issue.  Here are my server specs and
> > software versions (OS and Postgres)
>
> FWIW, it looks like the hang is on the client side (i.e., pg_dump itself).
> The one active server process is just trying to send COPY data and is
> waiting for the client to take it.  So I'm wondering about deadlocks
> inside parallel pg_dump.
>
> This doesn't present any obvious answer, because there is not much
> difference between the parallel pg_dump logic in 10 and 11.  But
> maybe you could get stack trace(s) out of the stuck pg_dump job on 10?
> (Keep in mind that unlike the backend, the pg_dump process will have
> multiple threads in this situation.)
>
> Another thing you could do to triangulate is to verify that v11 pg_dump
> is okay working against the v10 server.  Unfortunately the other
> combination can't be tested, but this'd be enough to exonerate the v10
> server side.
>
> regards, tom lane
>

Thanks for the suggestion Tom.  I've verified that this looks to be a v10
server side issue as using the Postgres11 pg_dump.exe against the v10
server I still encounter the same hanging issue.

Here are the stack traces from each of the threads of the pg_dump.exe.

ntoskrnl.exe!KiSwapContext+0x76
ntoskrnl.exe!KiSwapThread+0x17d
ntoskrnl.exe!KiCommitThreadWait+0x14f
ntoskrnl.exe!KeWaitForSingleObject+0x377
ntoskrnl.exe!KiSchedulerApc+0x231
ntoskrnl.exe!KiDeliverApc+0x22a
ntoskrnl.exe!KiSwapThread+0x364
ntoskrnl.exe!KiCommitThreadWait+0x14f
ntoskrnl.exe!KeWaitForSingleObject+0x377
ntoskrnl.exe!NtWaitForSingleObject+0xf8
ntoskrnl.exe!KiSystemServiceCopyEnd+0x13
ntdll.dll!NtWaitForSingleObject+0x14
mswsock.dll!SockWaitForSingleObject+0x133
mswsock.dll!WSPSelect+0x7e4
WS2_32.dll!select+0x1d3
pg_dump.exe+0x64ae
pg_dump.exe+0x65bd
pg_dump.exe+0x6228
pg_dump.exe+0x509f
pg_dump.exe+0x980b
pg_dump.exe+0x117cc
pg_dump.exe+0x6f3f
pg_dump.exe+0x30c22
pg_dump.exe+0x3cb77
KERNEL32.DLL!BaseThreadInitThunk+0x14
ntdll.dll!RtlUserThreadStart+0x21

--

ntoskrnl.exe!KiSwapContext+0x76
ntoskrnl.exe!KiSwapThread+0x17d
ntoskrnl.exe!KiCommitThreadWait+0x14f
ntoskrnl.exe!KeWaitForSingleObject+0x377
ntoskrnl.exe!KiSchedulerApc+0x231
ntoskrnl.exe!KiDeliverApc+0x22a
ntoskrnl.exe!KiSwapThread+0x364
ntoskrnl.exe!KiCommitThreadWait+0x14f
ntoskrnl.exe!KeWaitForSingleObject+0x377
ntoskrnl.exe!NtWaitForSingleObject+0xf8
ntoskrnl.exe!KiSystemServiceCopyEnd+0x13
ntdll.dll!NtWaitForSingleObject+0x14
mswsock.dll!SockWaitForSingleObject+0x133
mswsock.dll!WSPRecv+0x5d2
WS2_32.dll!recv+0x16c
pg_dump.exe+0x6746
pg_dump.exe+0x61ab
pg_dump.exe+0x5e57
pg_dump.exe+0x6a22
MSVCR120.dll!_callthreadstartex+0x17
MSVCR120.dll!_threadstartex+0x88
KERNEL32.DLL!BaseThreadInitThunk+0x14
ntdll.dll!RtlUserThreadStart+0x21

--

ntoskrnl.exe!KiSwapContext+0x76
ntoskrnl.exe!KiSwapThread+0x17d
ntoskrnl.exe!KiCommitThreadWait+0x14f
ntoskrnl.exe!KeWaitForSingleObject+0x377
ntoskrnl.exe!KiSchedulerApc+0x231
ntoskrnl.exe!KiDeliverApc+0x22a
ntoskrnl.exe!KiSwapThread+0x364
ntoskrnl.exe!KiCommitThreadWait+0x14f
ntoskrnl.exe!KeWaitForSingleObject+0x377
ntoskrnl.exe!NtWaitForSingleObject+0xf8
ntoskrnl.exe!KiSystemServiceCopyEnd+0x13
ntdll.dll!NtWaitForSingleObject+0x14
mswsock.dll!SockWaitForSingleObject+0x133
mswsock.dll!WSPRecv+0x5d2
WS2_32.dll!recv+0x16c
pg_dump.exe+0x6746
pg_dump.exe+0x61ab
pg_dump.exe+0x5e57
pg_dump.exe+0x6a22
MSVCR120.dll!_callthreadstartex+0x17
MSVCR120.dll!_threadstartex+0x88
KERNEL32.DLL!BaseThreadInitThunk+0x14
ntdll.dll!RtlUserThreadStart+0x21

--

ntoskrnl.exe!KiSwapContext+0x76
ntoskrnl.exe!KiSwapThread+0x17d
ntoskrnl.exe!KiCommitThreadWait+0x14f
ntoskrnl.exe!KeWaitForSingleObject+0x377
ntoskrnl.exe!KiSchedulerApc+0x231
ntoskrnl.exe!KiDeliverApc+0x22a
ntoskrnl.exe!KiSwapThread+0x364
ntoskrnl.exe!KiCommitThreadWait+0x14f
ntoskrnl.exe!KeWaitForSingleObject+0x377
ntoskrnl.exe!NtWaitForSingleObject+0xf8
ntoskrnl.exe!KiSystemServiceCopyEnd+0x13
ntdll.dll!NtWaitForSingleObject+0x14
mswsock.dll!SockWaitForSingleObject+0x133
mswsock.dll!WSPSelect+0x7e4
WS2_32.dll!select+0x1d3
LIBPQ.dll!PQenv2encoding+0x1301
LIBPQ.dll!PQenv2encoding+0x11a3
LIBPQ.dll!PQenv2encoding+0xc7a
LIBPQ.dll!PQprintTuples+0x34b0
pg_dump.exe+0x313df
pg_dump.exe+0x98a0
pg_dump.exe+0x11e89

Re: pg_dump (COPY) hanging intermittently

2019-06-27 Thread Tom Lane
Ben Snaidero  writes:
> I am running into a strange issue with Postgres 10 when using pg_dump with
> the directory format and jobs parameter set it intermittently hangs.  Seems
> to occur less frequently the lower I set the jobs parameter but does happen
> eventually even when set to 2 (could not reproduce when jobs=1).  I've
> tested with Postgres 11 and no matter how high I set the jobs parameter it
> never hangs (tested all the way up to jobs=8).  Also with Postgres 10 and
> other formats I don't run into the issue.  Here are my server specs and
> software versions (OS and Postgres)

FWIW, it looks like the hang is on the client side (i.e., pg_dump itself).
The one active server process is just trying to send COPY data and is
waiting for the client to take it.  So I'm wondering about deadlocks
inside parallel pg_dump.

This doesn't present any obvious answer, because there is not much
difference between the parallel pg_dump logic in 10 and 11.  But
maybe you could get stack trace(s) out of the stuck pg_dump job on 10?
(Keep in mind that unlike the backend, the pg_dump process will have
multiple threads in this situation.)

Another thing you could do to triangulate is to verify that v11 pg_dump
is okay working against the v10 server.  Unfortunately the other
combination can't be tested, but this'd be enough to exonerate the v10
server side.

regards, tom lane




pg_dump (COPY) hanging intermittently

2019-06-27 Thread Ben Snaidero
Hi,

I am running into a strange issue with Postgres 10 when using pg_dump with
the directory format and jobs parameter set it intermittently hangs.  Seems
to occur less frequently the lower I set the jobs parameter but does happen
eventually even when set to 2 (could not reproduce when jobs=1).  I've
tested with Postgres 11 and no matter how high I set the jobs parameter it
never hangs (tested all the way up to jobs=8).  Also with Postgres 10 and
other formats I don't run into the issue.  Here are my server specs and
software versions (OS and Postgres)

Windows Server 2016 DataCenter  10.0.14393
2 cores  4 logical processors
26GB memory

Postgres 11.4 (port 5433)
Postgres 10.9 (port 5432)

---
And here are the psql statements and powershell script to recreate the
issue.

CREATE DATABASE pg_dump_hang;
\c pg_dump_hang
CREATE TABLE series1 AS SELECT i FROM generate_series(1,100) i;
CREATE TABLE series2 AS SELECT i FROM generate_series(1,100) i;
CREATE TABLE series3 AS SELECT i FROM generate_series(1,100) i;
CREATE TABLE series4 AS SELECT i FROM generate_series(1,100) i;
CREATE TABLE series5 AS SELECT i FROM generate_series(1,100) i;
CREATE TABLE series6 AS SELECT i FROM generate_series(1,100) i;
CREATE TABLE series7 AS SELECT i FROM generate_series(1,100) i;
CREATE TABLE series8 AS SELECT i FROM generate_series(1,100) i;


$env:PGPASSWORD='###'
$env:PGUSER='postgres'
$env:PGPORT=5433
set-location "C:\program files\postgresql\11\bin"
$a = 1
DO
{
   remove-item -Recurse D:\dumphangtest
   .\pg_dump.exe --format=directory --jobs=4 --file=D:\dumphangtest
pg_dump_hang
   $a++
   "Completed loop $a at -" + (date)
} While ($a -le 25)

$env:PGPASSWORD='###'
$env:PGUSER='postgres'
$env:PGPORT=5432
set-location "c:\program files\postgresql\10\bin"
$a = 1
DO
{
   remove-item -Recurse D:\dumphangtest
   .\pg_dump.exe --format=directory --jobs=4 --file=D:\dumphangtest
pg_dump_hang
   $a++
   "Completed loop $a at -" + (date)
} While ($a -le 25)

---
Here is the output from pg_stat_activity and the filesystem listing when
the hang occurs.

--jobs=4
postgres=# select
pid,state,state_change,query_start,wait_event,wait_event_type,substring(query,1,35)
from pg_stat_activity where datname like 'pg_dump%';
 pid  |state| state_change  |
 query_start  | wait_event  | wait_event_type |
 substring
--+-+---+---+-+-+-
 5324 | idle in transaction | 2019-06-27 15:29:13.03416+01  | 2019-06-27
15:29:13.03154+01  | ClientRead  | Client  | SELECT at.attname,
(SELECT pg_catal
 4144 | idle in transaction | 2019-06-27 15:29:16.222315+01 | 2019-06-27
15:29:15.070106+01 | ClientRead  | Client  | COPY public.series6
(i) TO stdout;
 5576 | active  | 2019-06-27 15:29:13.642069+01 | 2019-06-27
15:29:13.642068+01 | ClientWrite | Client  | COPY public.series2
(i) TO stdout;
 3860 | idle in transaction | 2019-06-27 15:29:17.109549+01 | 2019-06-27
15:29:16.198842+01 | ClientRead  | Client  | COPY public.series8
(i) TO stdout;
 3120 | idle in transaction | 2019-06-27 15:29:16.350121+01 | 2019-06-27
15:29:15.089817+01 | ClientRead  | Client  | COPY public.series7
(i) TO stdout;
(5 rows)

D:\>dir dumphangtest
 Volume in drive D has no label.
 Volume Serial Number is C635-CDEF

 Directory of D:\dumphangtest

06/27/2019  10:29 AM  .
06/27/2019  10:29 AM  ..
06/27/2019  10:29 AM 2,114,899 2863.dat.gz
06/27/2019  10:29 AM   376,832 2864.dat.gz
06/27/2019  10:29 AM 2,114,899 2865.dat.gz
06/27/2019  10:29 AM 2,114,899 2866.dat.gz
06/27/2019  10:29 AM 2,114,899 2867.dat.gz
06/27/2019  10:29 AM 2,114,899 2868.dat.gz
06/27/2019  10:29 AM 2,114,899 2869.dat.gz
06/27/2019  10:29 AM 2,114,899 2870.dat.gz
06/27/2019  10:29 AM 8,452 toc.dat
   9 File(s) 15,189,577 bytes
   2 Dir(s)  102,021,439,488 bytes free

--jobs=2
postgres=# select
pid,state,state_change,query_start,wait_event,wait_event_type,substring(query,1,35)
from pg_stat_activity where datname like 'pg_dump%';
 pid  |state| state_change  |
 query_start  | wait_event  | wait_event_type |
 substring
--+-+---+---+-+-+-
 3420 | idle in transaction | 2019-06-27 14:37:55.067559+01 | 2019-06-27

Re: Postgresql 12 Beta2 Crashes for any Insert/Update

2019-06-27 Thread Peter Geoghegan
On Thu, Jun 27, 2019 at 1:28 AM Mohsen Bande  wrote:
> i have a working database in PG 12 Beta 1. today i upgraded it to Beta 2. 
> everything goes fine and server is up and running. but trying to 
> INSERT/UPDATE anything, server crashes:

Is it possible for you to send us a stacktrace?

https://wiki.postgresql.org/wiki/Generating_a_stack_trace_of_a_PostgreSQL_backend

Thanks
-- 
Peter Geoghegan




Re: 9.6.11- could not truncate directory "pg_serial": apparent wraparound

2019-06-27 Thread Pavel Suderevsky
Hi,

Got this issue again.
Settings on the platform (PG 9.6.11):
max_pred_locks_per_transaction = 3000
max_connections = 800

Despite the fact that documentation says:
> with the exception of fast-path locks, each lock manager will deliver a
consistent set of results
I've noticed the following:
1. pg_locks showed 2 million SIReadLocks for the pid that has been in the
"idle" state for a dozen of seconds already.
2. pg_locks showed count of 5 million SIReadLock granted although I
expected a limit of 2.4 million SIReadLocks with settings provided above.

And still no any signs of serializable transactions that could live for a 1
billion xids.
--
Pavel Suderevsky
E: psuderevsky(at)gmail(dot)com

вт, 9 апр. 2019 г. в 16:00, Pavel Suderevsky :

> On Sun, Apr 7, 2019 at 2:31 AM Pavel Suderevsky 
>> wrote:
>> > Probably if you advise me what could cause "pg_serial": apparent
>> wraparound messages I would have more chances to handle all the performance
>> issues.
>>
>> Did you see that warning at some point before the later error?
>>
> Thomas,
>
> Thank you for your reply!
>
> No, there have never been such warnings.
>
> I wonder if this condition required you to have a serializable
>> transaction running (or prepared) while you consume 2^30 AKA ~1
>> billion xids.  I think it is unreachable in v11+ because commit
>> e5eb4fa8 allowed for more SLRU pages to avoid this artificially early
>> wrap.
>
>
> Do I understand right that this is about Virtual txids? Have no idea how
> even a something close to a billion of transaction ids could be consumed on
> this system.
>
> --
> Pavel Suderevsky
> E: psuderev...@gmail.com
>


Re: In-depth commercial postgresql training

2019-06-27 Thread Fabrízio de Royes Mello
Em qui, 27 de jun de 2019 às 10:47, Marcelo Lacerda <
marceloslace...@gmail.com> escreveu:

> Our company is looking for commercial training in postgresql. We want a
> training option that's as in-depth as possible (going as far as being able
> to read and patch postgresql source code). Is there any company that offers
> something like that?
>
> Another important thing to mention is that due to legal reasons we can't
> make payments in any currency other than BRL.
>

Hi Marcelo,

Our Brazilian company called Timbira can help you.

Regards,

-- 
   Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento


In-depth commercial postgresql training

2019-06-27 Thread Marcelo Lacerda
Our company is looking for commercial training in postgresql. We want a
training option that's as in-depth as possible (going as far as being able
to read and patch postgresql source code). Is there any company that offers
something like that?

Another important thing to mention is that due to legal reasons we can't
make payments in any currency other than BRL.


Re: patch 11.2 to 11.4

2019-06-27 Thread Prakash Ramakrishnan
Thanks for your support.

On Thu, Jun 27, 2019, 18:58 Fabrízio de Royes Mello 
wrote:

>
> Em qui, 27 de jun de 2019 às 05:35, Prakash Ramakrishnan <
> prakash.ramakrishnan...@nielsen.com> escreveu:
>
>> Hi Team,
>>
>> I done the installation using yum poostgresql 11 server method now i need
>> to update or apply the patch using repo file how to do this 11.2 to 11.4
>> please share me the steps .
>>
>>
> Just run the following command:
>
> yum update postgresql11*
>
> Regards,
>
> --
>Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/
>PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
>


Re: patch 11.2 to 11.4

2019-06-27 Thread Fabrízio de Royes Mello
Em qui, 27 de jun de 2019 às 05:35, Prakash Ramakrishnan <
prakash.ramakrishnan...@nielsen.com> escreveu:

> Hi Team,
>
> I done the installation using yum poostgresql 11 server method now i need
> to update or apply the patch using repo file how to do this 11.2 to 11.4
> please share me the steps .
>
>
Just run the following command:

yum update postgresql11*

Regards,

-- 
   Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento


Re: migrating from Oracle to PostgreSQL 11

2019-06-27 Thread Steven Lembark
On Wed, 26 Jun 2019 19:12:07 +0530
Hitesh Chadda  wrote:

> Hi PostgresSQL Support,
> 
> I have to migrate from Oracle 11g to PostgresSQL 11.4. Please suggest
> best solution for doing the migration.

Bit of a broad topic for an answer. Other than "carefully", there
isn't enough of a question to answer.

Issues that will affect the transfer include the quantity of data,
relative locations of the servers, complexity of the data, how much
custom code you have tied up in triggers and local functions, and 
the platforms you will be running with.

For example, moving a 6PB database has downtime and data transfer
issues that you don't have with a few GB; a 7x24 database with 
multiple hot servers accessed via VPN has different challenges than
a single-server on a VM on your LAN; translating a bunch of integer
SK's and some text has different requirements than something you want
to compose arrays, ranges, or JSONB objects out of; the dialaects
of PLSQL are not entirely compatible so you will have to think about
translating triggers, reports, and op's code between dialects; Oracle
only supports "global temporary tables", PG avoids them with the 
added features of drop/truncate on commit...

Your best first step will be to get a basic understanding of PG. I
like the "PostgreSQL: Up and Running", I think it's up to the 3rd 
edition. Grab it on Safari, fairly short read covers the topics you
need to get a running PG database.

PG is a moving target: 11 supports all sorts of nice, new things;
12 has even more of them. Pick a PG version (suggest 11, it's 
stable), look at what it does, investigate the specific applications 
you have on site, document them, and start porting them to PG 
from smallest to largest. 

If you have specific questions about the PG version, its features,
or how to translate specific Oracle-isms into PG please feel free
to ask -- that's what we're here for :-) 

-- 
Steven Lembark 3920 10th Ave South
Workhorse Computing   Birmingham, AL 35222
lemb...@wrkhors.com+1 888 359 3508




Re: pg_receivelwal vs synchronous

2019-06-27 Thread Jesper Pedersen

Hi Magnus,

On 6/27/19 8:37 AM, Magnus Hagander wrote:

What am I missing here ?



I believe your problem is remote_apply.

pg_receivewal never *applies* any WAL, so it just updates the write and
flush locations. Notice how the replay_lsn remains NULL.

So you need synchronous_commit to be 'on' or 'remote_write', not
'remote_apply'.



Yeah, remote_write works :)

I'll a patch for the pg_receivewal documentation to make this more clear.

Thanks !

Best regards,
 Jesper




Re: pg_receivelwal vs synchronous

2019-06-27 Thread Magnus Hagander
On Wed, Jun 26, 2019 at 5:06 PM Jesper Pedersen 
wrote:

> Hi,
>
> PostgreSQL 11.4
>
> Given,
>
> postgresql.conf:
> 
> wal_level = replica
> synchronous_commit = remote_apply
> synchronous_standby_names = '*'
>
>
> CREATE ROLE repluser WITH LOGIN REPLICATION PASSWORD 'mypwd';
> SELECT pg_create_physical_replication_slot('replica1');
>
>
> Execute
>
> pg_receivewal -D /tmp/wal/ -S replica1 --synchronous -p 5432 -h
> localhost -U repluser -W --dbname="application_name=replica1"
>
> gives
>
> LOG:  standby "replica1" is now a synchronous standby with priority 1
>
> Then
>
> psql -c 'CREATE DATABASE test' postgres
>
> which hangs (committed locally).
>
> postgres=# SELECT * FROM pg_replication_slots ;
>   slot_name | plugin | slot_type | datoid | database | temporary |
> active | active_pid | xmin | catalog_xmin | restart_lsn |
> confirmed_flush_lsn
>
> ---++---++--+---+++--+--+-+-
>   replica1  || physical  ||  | f | t
>   |  12502 |  |  | 0/1655508   |
> (1 row)
>
> postgres=# SELECT * FROM pg_stat_replication;
>pid  | usesysid | usename  | application_name | client_addr |
> client_hostname | client_port | backend_start |
> backend_xmin |   state   | sen
> t_lsn  | write_lsn | flush_lsn | replay_lsn |write_lag|
> flush_lag|   replay_lag| sync_priority | sync_state
>
> ---+--+--+--+-+-+-+---+--+---+
>
> ---+---+---++-+-+-+---+
>   12502 |16384 | repluser | replica1 | ::1 |
>  |   45816 | 2019-06-26 11:00:45.098276-04 |  |
> streaming | 0/1
> 655508 | 0/1655508 | 0/1655508 || 00:00:00.000267 |
> 00:00:00.000267 | 00:02:14.938836 | 1 | sync
> (1 row)
>
>
> So, replica1 is active and in sync mode, but replay_lsn is never
> updated, and replay_lag keeps increasing.
>
>
> What am I missing here ?
>

I believe your problem is remote_apply.

pg_receivewal never *applies* any WAL, so it just updates the write and
flush locations. Notice how the replay_lsn remains NULL.

So you need synchronous_commit to be 'on' or 'remote_write', not
'remote_apply'.

-- 
 Magnus Hagander
 Me: https://www.hagander.net/ 
 Work: https://www.redpill-linpro.com/ 


patch 11.2 to 11.4

2019-06-27 Thread Prakash Ramakrishnan
Hi Team,

I done the installation using yum poostgresql 11 server method now i need
to update or apply the patch using repo file how to do this 11.2 to 11.4
please share me the steps .

-- 
Thanks,
Prakash.R


Postgresql 12 Beta2 Crashes for any Insert/Update

2019-06-27 Thread Mohsen Bande
i have a working database in PG 12 Beta 1. today i upgraded it to Beta 2.
everything goes fine and server is up and running. but trying to
INSERT/UPDATE anything, server crashes:

=# select id from user where id=0;
 id 
  0(1 row)=# UPDATE user SET is_deleted = true WHERE id = 0;
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

and the server log has nothing more:

2019-06-27 12:49:07.348  [16336] LOG:  server process (PID 17680) was
terminated by signal 11: Segmentation fault2019-06-27 12:49:07.348
[16336] DETAIL:  Failed process was running: UPDATE user SET
is_deleted = true WHERE id = 0;2019-06-27 12:49:07.348  [16336] LOG:
terminating any other active server processes2019-06-27 12:49:07.348
[16436] WARNING:  terminating connection because of crash of another
server process2019-06-27 12:49:07.348  [16436] DETAIL:  The postmaster
has commanded this server process to roll back the current transaction
and exit, because another server process exited abnormally and
possibly corrupted shared memory.2019-06-27 12:49:07.348  [16436]
HINT:  In a moment you should be able to reconnect to the database and
repeat your command.2019-06-27 12:49:07.350  [17787] postgres@db_01
FATAL:  the database system is in recovery mode2019-06-27 12:49:07.363
 [16336] LOG:  all server processes terminated;
reinitializing2019-06-27 12:49:07.821  [17788] LOG:  database system
was interrupted; last known up at 2019-06-27 12:39:53 2019-06-27
12:49:07.858  [17788] LOG:  database system was not properly shut
down; automatic recovery in progress2019-06-27 12:49:07.868  [17788]
LOG:  redo starts at 4B2/5A000AF82019-06-27 12:49:07.868  [17788] LOG:
 invalid record length at 4B2/5A000B30: wanted 24, got 02019-06-27
12:49:07.868  [17788] LOG:  redo done at 4B2/5A000AF82019-06-27
12:49:08.063  [16336] LOG:  database system is ready to accept
connections


Re: migrating from Oracle to PostgreSQL 11

2019-06-27 Thread Enrico Pirozzi

Hi,

I think you can start from:

- https://wiki.postgresql.org/wiki/Oracle_to_Postgres_Conversion

- 
https://severalnines.com/blog/migrating-oracle-postgresql-what-you-should-know


- http://ora2pg.darold.net/

- https://pgxn.org/dist/orafce/

Regards,

Enrico


Il 26/06/2019 15:42, Hitesh Chadda ha scritto:

Hi PostgresSQL Support,

I have to migrate from Oracle 11g to PostgresSQL 11.4. Please suggest 
best solution for doing the migration.


Regards

H.Kumar


--
Questo messaggio è stato analizzato con Libra ESVA ed è risultato non 
infetto.



--
Enrico Pirozzi
NBS Group S.r.l.
via Val Tiberina 23/A
63074, San Benedetto del Tronto (AP)
Tel. 0735-7626201






migrating from Oracle to PostgreSQL 11

2019-06-27 Thread Hitesh Chadda
Hi PostgresSQL Support,

I have to migrate from Oracle 11g to PostgresSQL 11.4. Please suggest best
solution for doing the migration.

Regards

H.Kumar