Jira (PDB-4637) Lock out the puppetdb databse user during migration

2 views
Skip to first unread message

Austin Blatt (JIRA)

unread,
Jan 27, 2020, 5:10:03 PM1/27/20
to puppe...@googlegroups.com
Austin Blatt created an issue
 
PuppetDB / New Feature PDB-4637
Lock out the puppetdb databse user during migration
Issue Type: New Feature New Feature
Assignee: Unassigned
Created: 2020/01/27 2:09 PM
Priority: Normal Normal
Reporter: Austin Blatt

When the puppetdb migrator is performing a migration it needs to ensure the data role is not connected to the database.

The new migration workflow should look like

  • Begin a transaction,
  • Lock the migration table with access exclusive
  • Check to see if migrations are needed, and if so,
  • Revoke connection access for data role,
  • Disconnect any in-flight connections
  • Perform migrations,
  • Commit transaction,
  • Reallow access for the data role

To disconnect the data role's database connection(s)

SELECT pid
FROM pg_stat_activity
WHERE datname='<puppetdb/pe-puppetdb>'
      AND usename='<puppetdb data role>';

For each pid returned by the above query call either

SELECT pg_cancel_backend( <pid> );

or

SELECT pg_terminate_backend( <pid> );

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages