Removing WALS when replication slot is not busy One query in case of asynchronous replication with replication slots and no wal archiving if a slave node remains disconnected from master for more than wal_keep_segments, it will not be able to do the replication when it comes online. 

Now my question is when the slave connects to the master again will the XLOG in master also keep on building  as the slaves replication is stuck or postgres will remove the replication slot if it is not busy / active?

Postgres Version - 10.4
One query in case of asynchronous replication with replication slots and no wal archiving if a slave node remains disconnected from master for more than wal_keep_segments, it will not be able to do the replication when it comes online.


This is not the case if the slot is being used correctly.  The whole point of a replication slot is to retain the WAL even when the replica is disconnected.  The setting of wal_keep_segments provides a floor, not a ceiling, to WAL retention (wal_keep_segments is also pretty much obsolete now that slots are a mature technology).


  Now my question is when the slave connects to the master again will the XLOG in master also keep on building as the slaves replication is stuck or postgres will remove the replication slot if it is not busy / active?


PostgreSQL will not automatically remove the slot, you need to do it manually using pg_drop_replication_slot.  However, unless you did something incorrectly (or ran into a bug), you should never be in this situation.  If the replica was correctly using the slot before it got disconnected, then the WAL should still be there when it reconnects.