pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Will unused replication slots prevent the server from deleting WAL segments?
2+ messages / 2 participants
[nested] [flat]

* Will unused replication slots prevent the server from deleting WAL segments?
@ 2018-03-19 07:34 Nagy László Zsolt <gandalf@shopzeus.com>
  2018-03-19 08:53 ` Re: Will unused replication slots prevent the server from deleting WAL segments? Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 2+ messages in thread

From: Nagy László Zsolt @ 2018-03-19 07:34 UTC (permalink / raw)
  To: pgsql-admin

I have accidentally created an extra replication slot on a server. It
was a long time ago, and it is not used (active=false). I'm planning to
add another replication slave, but I can only do it later. I wonder if
it prevents the server to recycle old WAL segments?


template1=# select * from pg_replication_slots;
 slot_name | plugin | slot_type | datoid | database | temporary | active
| active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn
-----------+--------+-----------+--------+----------+-----------+--------+------------+------+--------------+-------------+---------------------
 eke       |        | physical  |        |          | f         | f     
|            |      |              |             |
 docker02  |        | physical  |        |          | f         | t     
|         66 |      |              | 0/7000000   |
(2 rows)

template1=#

There is only one row in pg_stat_replication:

template1=# select * from pg_stat_replication ;
 pid | usesysid |     usename     | application_name | client_addr |
client_hostname | client_port |         backend_start         |
backend_xmin |   state   | sent_lsn  | write_lsn | flush_lsn |
replay_lsn | write_lag | flush_lag | replay_lag | sync_priority |
sync_state
-----+----------+-----------------+------------------+-------------+-----------------+-------------+-------------------------------+--------------+-----------+-----------+-----------+-----------+------------+-----------+-----------+------------+---------------+------------
  66 |    16386 | phb_replication | walreceiver      | 10.0.0.84  
|                 |       58318 | 2018-03-01 08:27:07.044626+00
|              | streaming | 0/7000000 | 0/7000000 | 0/7000000 |
0/7000000  |           |           |            |             0 | async
(1 row)

template1=# 

Should I delete this slot and add it again later, when the new slave
becomes available?

Thanks,

   Laszlo



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Will unused replication slots prevent the server from deleting WAL segments?
  2018-03-19 07:34 Will unused replication slots prevent the server from deleting WAL segments? Nagy László Zsolt <gandalf@shopzeus.com>
@ 2018-03-19 08:53 ` Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 0 replies; 2+ messages in thread

From: Laurenz Albe @ 2018-03-19 08:53 UTC (permalink / raw)
  To: Nagy László Zsolt <gandalf@shopzeus.com>; pgsql-admin

Nagy László Zsolt wrote:
> I have accidentally created an extra replication slot on a server. It
> was a long time ago, and it is not used (active=false). I'm planning to
> add another replication slave, but I can only do it later. I wonder if
> it prevents the server to recycle old WAL segments?
> 
> 
> template1=# select * from pg_replication_slots;
>  slot_name | plugin | slot_type | datoid | database | temporary | active
> > active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn
> 
> -----------+--------+-----------+--------+----------+-----------+--------+------------+------+--------------+-------------+---------------------
>  eke       |        | physical  |        |          | f         | f     
> >             |      |              |             |
> 
>  docker02  |        | physical  |        |          | f         | t     
> >          66 |      |              | 0/7000000   |
> 
> (2 rows)
>  
> 
> Should I delete this slot and add it again later, when the new slave
> becomes available?

I'm not 100% certain if it can do any harm or not, but I'd drop the
replication slot and create a new one later if you need it.

Creating a replication slot is fast and simple.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-03-19 08:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 07:34 Will unused replication slots prevent the server from deleting WAL segments? Nagy László Zsolt <gandalf@shopzeus.com>
2018-03-19 08:53 ` Laurenz Albe <laurenz.albe@cybertec.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox