Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Merge pull request #57 from aiven/ettanany-change-prefix-of-db-object-names" #60

Merged
merged 1 commit into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ Databases:
```

By default logical replication is left running and the created pub/sub objects need to be cleaned up once workloads have been
moved to the new server. Objects created by this tool are named like `managed_db_migrate_<dbname>_<sub|pub|slot>`.
moved to the new server. Objects created by this tool are named like `aiven_db_migrate_<dbname>_<sub|pub|slot>`.

Starting from the target (using `aiven-extras` extension), get first the subscription name:
```
defaultdb= > SELECT * FROM aiven_extras.pg_list_all_subscriptions();
```
and then drop it:
```
defaultdb= > SELECT * FROM aiven_extras.pg_drop_subscription('managed_db_migrate_defaultdb_sub');
defaultdb= > SELECT * FROM aiven_extras.pg_drop_subscription('aiven_db_migrate_defaultdb_sub');
```

Note that with `aiven-extras` dropping subscription in target also drops replication slot in source (`dblink`).
Expand All @@ -111,13 +111,13 @@ defaultdb=> SELECT * FROM pg_publication;
```
and then drop it:
```
defaultdb=> DROP PUBLICATION managed_db_migrate_defaultdb_pub;
defaultdb=> DROP PUBLICATION aiven_db_migrate_defaultdb_pub;
```

In case that `aiven-extras` is not used clean up replication slot too:
```
defaultdb=> SELECT * FROM pg_replication_slots;
defaultdb=> SELECT * FROM pg_drop_replication_slot('managed_db_migrate_defaultdb_slot');
defaultdb=> SELECT * FROM pg_drop_replication_slot('aiven_db_migrate_defaultdb_slot');
```

Using `--max-replication-lag` waits until replication lag in bytes is less than/equal to given max replication lag. This
Expand Down
2 changes: 1 addition & 1 deletion aiven_db_migrate/migrate/pgmigrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class PGRole:

class PGCluster:
"""PGCluster is a collection of databases managed by a single PostgreSQL server instance"""
DB_OBJECT_PREFIX = "managed_db_migrate"
DB_OBJECT_PREFIX = "aiven_db_migrate"
conn_info: Dict[str, Any]
_databases: Dict[str, PGDatabase]
_params: Dict[str, str]
Expand Down
4 changes: 2 additions & 2 deletions test/test_table_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ def test_replicate_filter_with(pg_source_and_target: Tuple[PGRunner, PGRunner],
for db in [db_name, other_db_name, "postgres"]:
try:
with target.cursor(username=target.superuser, dbname=db, autocommit=True) as cur:
cur.execute(f"ALTER SUBSCRIPTION managed_db_migrate_{db}_sub DISABLE")
cur.execute(f"DROP SUBSCRIPTION IF EXISTS managed_db_migrate_{db}_sub CASCADE")
cur.execute(f"ALTER SUBSCRIPTION aiven_db_migrate_{db}_sub DISABLE")
cur.execute(f"DROP SUBSCRIPTION IF EXISTS aiven_db_migrate_{db}_sub CASCADE")
except psycopg2.Error:
pass
try:
Expand Down