Skip to content

Commit

Permalink
fix: didn't include new replication set in subscription call
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeeva committed Feb 2, 2024
1 parent 61ca5fe commit 1cb62f6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pgbelt/util/pglogical.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ async def configure_replication_set(
except Exception as e:
logger.debug(f"Could not create replication set 'pgbelt': {e}")

logger.info(f"Configuring default replication set with tables: {tables}")
logger.info(f"Configuring 'pgbelt' replication set with tables: {tables}")
for table in tables:
async with pool.acquire() as conn:
async with conn.transaction():
try:
await conn.execute(
f"SELECT pglogical.replication_set_add_table('pgbelt', '\"{table}\"');"
)
logger.debug(f"{table} added to default replication set")
logger.debug(f"Table '{table}' added to 'pgbelt' replication set")
except UniqueViolationError:
logger.debug(f"{table} already in default replication set")
logger.debug(f"Table '{table}' already in 'pgbelt' replication set")


async def configure_node(pool: Pool, name: str, dsn: str, logger: Logger) -> None:
Expand Down Expand Up @@ -153,6 +153,7 @@ async def configure_subscription(
await conn.execute(
f"""SELECT pglogical.create_subscription(
subscription_name:='{name}',
replication_sets:='{{pgbelt}}',
provider_dsn:='{provider_dsn}',
synchronize_structure:=false,
synchronize_data:={'true' if name.startswith('pg1') else 'false'},
Expand Down

0 comments on commit 1cb62f6

Please sign in to comment.