#5584 Please allow executing DDL on BDR in STG
Closed 7 years ago Opened 7 years ago by msimacek.

I would like to be able to run migrations, but the DB rejects any DDL statement with:
bdr.permit_ddl_locking is false and the attempted command would require the global lock to be acquired. Command rejected.


So, let me point to the upstream docs here:

http://bdr-project.org/docs/stable/ddl-replication.html

We set this vairable to prevent un-intended changes. Ie, we wanted to make sure changes were known to be happening and done correctly.

That said, I think you should be able to do them by:

BEGIN;
SET LOCAL bdr.permit_ddl_locking = true;
-- Do your schema changes here
COMMIT;

But I am not sure we have the permissions set correctly for that.

Note that there's some things you need to be careful of when doing schema changes on replicated clusters:

http://bdr-project.org/docs/stable/ddl-replication-statements.html

I tried it and koscheiadmin has the permission to do that. That's what I needed. Thank you.

ok, then do you need us to do https://pagure.io/fedora-infrastructure/issue/5585 or you can handle it with a playbook.

Unfortunately, I cannot. It contains statements that are forbidden on BDR (CREATE OPERATOR CLASS) and cannot be rewritten using allowed operations.

Ah, this is the other case. Yes, you can do this:

  • Make sure ALL applications are stopped. ie, no client access to db

  • Run your change on all nodes (so in stg, this would be pgbdr01 and pgbdr02) with:

SET LOCAL bdr.do_not_replicate = true;

I think this process should work. Can you please test it and confirm?

:chocolate_bar:

koschei=> SET LOCAL bdr.do_not_replicate = true;
ERROR:  parameter "bdr.do_not_replicate" cannot be set after connection start

Please try:

PGOPTIONS="-c bdr.do_not_replicate=on -c bdr.permit_unsafe_ddl_commands=on" psql koschei
[root@koschei-backend01 msimacek][STG]# PGOPTIONS="-c bdr.do_not_replicate=on -c bdr.permit_unsafe_ddl_commands=on" koschei-admin psql
psql: FATAL:  permission denied to set parameter "bdr.permit_unsafe_ddl_commands"

Can you try without the permit_unsafe_ddl_commands?

It still needs superuser priviledges to execute the actual statement. But never mind, I figured out this would be too difficult and rewrote the feature in a different way, so that it doesn't need the prohibited statement for now. With that, I can finally run the migration.

@msimacek changed the status to Closed

7 years ago

ok. It would be nice to come to some way to do this in general moving forward, but glad you got your feature ready. Sorry for the long delay on this.

Login to comment on this ticket.

Metadata