Testing hot standby on same server sharing same tablespace directory

From: Sreekanth Palluru <Sreekanth(dot)Palluru(at)superchoice(dot)com(dot)au>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Testing hot standby on same server sharing same tablespace directory
Date: 2016-04-27 23:45:18
Message-ID: 4CCCD44C0EB1284FA34A4FDD88B7E4E8E64654@abel.nb.superchoice.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


Hi

I am testing hot standby on same server (version 9.5.2) , everything works well. I have a doubt regarding sharing of tablespace directory by these two databases .
I have created a tablespace and moved few objects and I happen to see that same directory was being used by standby node aka slave node and to my surprise it still works without any issues.

Is this expected ? I was expecting some sort of warnings from Postgres or am I missing something

Master $PGDATA

[pg952(at)pdb-poc01 pg_tblspc]$ pwd
/opt/v9.5.2/data/pg_tblspc
[pg952(at)pdb-poc01 pg_tblspc]$ ls -ltr
total 0
lrwxrwxrwx. 1 pg952 dba 17 Apr 27 16:10 16495 -> /opt/v9.5.2/tbsp1
[pg952(at)pdb-poc01 pg_tblspc]$

I can access the tables

[pg952(at)pdb-poc01 pg_tblspc]$ psql -d abcd -p 5432
psql (9.5.2)
Type "help" for help.

ssint=# select count(*) from t_random;
count
---------
8000000
(1 row)

ssint=#

Standby/Slave $PGDATA

[pg952(at)pdb-poc01 pg_tblspc]$ pwd
/home/postgres95/data/pg_tblspc
[pg952(at)pdb-poc01 pg_tblspc]$ ls -ltr
total 0
lrwxrwxrwx. 1 pg952 dba 17 Apr 27 16:10 16495 -> /opt/v9.5.2/tbsp1
[pg952(at)pdb-poc01 pg_tblspc]$

[pg952(at)pdb-poc01 16412]$ psql -d abcd -p 54321
psql (9.5.2)
Type "help" for help.

ssint=# delete from t_random;
ERROR: cannot execute DELETE in a read-only transaction
ssint=# select count(*) from t_random;
count
---------
8000000
(1 row)

ssint=#

-Sreekanth

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ian Barwick 2016-04-28 01:55:26 Re: Testing hot standby on same server sharing same tablespace directory
Previous Message Keith 2016-04-27 20:45:26 Re: Deadlock when inserting from multiple processes