Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e5dbec

Browse files
committed
Set default max_replication_slots number
1 parent 0dda2ff commit 3e5dbec

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

testgres/consts.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@
2424
PG_LOG_FILE = "postgresql.log"
2525
UTILS_LOG_FILE = "utils.log"
2626
BACKUP_LOG_FILE = "backup.log"
27+
28+
# default replication slots number
29+
REPLICATION_SLOTS = 10

testgres/node.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
RECOVERY_CONF_FILE, \
3333
PG_LOG_FILE, \
3434
UTILS_LOG_FILE, \
35-
PG_PID_FILE
35+
PG_PID_FILE, \
36+
REPLICATION_SLOTS
3637

3738
from .decorators import \
3839
method_decorator, \
@@ -208,7 +209,7 @@ def _create_recovery_conf(self, username, slot_name=None):
208209
).format(conninfo)
209210

210211
if slot_name:
211-
line += "primary_slot_name={}".format()
212+
line += "primary_slot_name={}\n".format()
212213

213214
self.append_conf(RECOVERY_CONF_FILE, line)
214215

@@ -343,11 +344,14 @@ def get_auth_method(t):
343344
conf.write(u"fsync = off\n")
344345

345346
# yapf: disable
346-
conf.write(u"log_statement = {}\n"
347-
u"listen_addresses = '{}'\n"
348-
u"port = {}\n".format(log_statement,
349-
self.host,
350-
self.port))
347+
conf.write(
348+
u"log_statement = {}\n"
349+
u"listen_addresses = '{}'\n"
350+
u"port = {}\n"
351+
u"max_replication_slots = {}\n".format(log_statement,
352+
self.host,
353+
self.port,
354+
REPLICATION_SLOTS))
351355

352356
# replication-related settings
353357
if allow_streaming:

0 commit comments

Comments
 (0)