Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Session wal_sender_timeout for PG12 (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-pie authored Mar 10, 2020
1 parent ecf04e5 commit 68e8cb5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
long_description = f.read()

setup(name='pipelinewise-tap-postgres',
version='1.5.0',
version='1.5.1',
description='Singer.io tap for extracting data from PostgresSQL - PipelineWise compatible',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down
15 changes: 2 additions & 13 deletions tap_postgres/sync_strategies/logical_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,19 +395,8 @@ def sync_tables(conn_info, logical_streams, state, end_lsn, state_file):
# Set session wal_sender_timeout for PG12 and above
version = get_pg_version(cur)
if (version >= 120000):
wal_sender_timeout = 10800 #3 hours

# Detect if the source is amazon-rds and convert to milliseconds
cur.execute("SELECT count(*) FROM pg_settings where name ilike '%rds%'")
is_rds = cur.fetchone()[0]

if is_rds == 0:
wal_sender_timeout = wal_sender_timeout
LOGGER.info("Set session wal_sender_timeout = {} seconds".format(wal_sender_timeout))
else:
wal_sender_timeout = wal_sender_timeout * 1000
LOGGER.info("Set session wal_sender_timeout = {} milliseconds".format(wal_sender_timeout))

wal_sender_timeout = 10800000 #10800000ms = 3 hours
LOGGER.info("Set session wal_sender_timeout = {} milliseconds".format(wal_sender_timeout))
cur.execute("SET SESSION wal_sender_timeout = {}".format(wal_sender_timeout))

try:
Expand Down

0 comments on commit 68e8cb5

Please sign in to comment.