8000 pglogical_drop_node should release the LWLock it acquires by carbonin · Pull Request #3 · 2ndQuadrant/postgres · GitHub
[go: up one dir, main page]

Skip to content

pglogical_drop_node should release the LWLock it acquires #3

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

Merged

Conversation

carbonin
Copy link

Failing to release these locks causes subsequent acquires for exclusive access to fail.

This can be reproduced with the following steps:

  • Create a provider node
  • Drop the node
  • Recreate the node
  • Create a subscription to that node

That subscription will never be able to complete the sync because it will be blocked while trying to acquire the ReplicationSlotControlLock in exclusive mode while creating the replication slot on the provider

cc @ringerc

I'll make this change locally and rebuild my rpms to verify the fix.

Failing to release these locks causes subsequent acquires for
exclusive access to fail.

This can be reproduced with the following steps:

Create a provider node
Drop the node
Recreate the node
Create a subscription to that node

That subscription will never be able to complete the sync because
it will be blocked while trying to acquire the ReplicationSlotControlLock
in exclusive mode while creating the replication slot on the provider
@carbonin
Copy link
8000 Author

Was able to verify this fix with newly built rpms.

@carbonin
Copy link
Author

Also, I'm not sure of a good workaround for this. It feels like the postgres service on the provider would have to be restarted to release the locks, but something less heavy handed would be nice.

@ringerc
Copy link
ringerc commented May 17, 2016

BTW, there's now a public repo at https://github.com/2ndQuadrant/pglogical

@carbonin
Copy link
Author
carbonin commented May 17, 2016

Yeah I also have a PR open there.

@ringerc If there are other changes I want to contribute, where should I go with them first? Here or https://github.com/2ndQuadrant/pglogical? I made this PR in both places because I found the pglogical repo after I had already created this one.

@carbonin carbonin deleted the release_lw_locks_in_drop_node branch June 10, 2016 13:11
ringerc pushed a commit that referenced this pull request Sep 11, 2018
refresh_by_match_merge() has some issues in the way it builds a SQL
query to construct the "diff" table:

1. It doesn't require the selected unique index(es) to be indimmediate.
2. It doesn't pay attention to the particular equality semantics enforced
by a given index, but just assumes that they must be those of the column
datatype's default btree opclass.
3. It doesn't check that the indexes are btrees.
4. It's insufficiently careful to ensure that the parser will pick the
intended operator when parsing the query.  (This would have been a
security bug before CVE-2018-1058.)
5. It's not careful about indexes on system columns.

The way to fix postgres#4 is to make use of the existing code in ri_triggers.c
for generating an arbitrary binary operator clause.  I chose to move
that to ruleutils.c, since that seems a more reasonable place to be
exporting such functionality from than ri_triggers.c.

While #1, #3, and postgres#5 are just latent given existing feature restrictions,
and #2 doesn't arise in the core system for lack of alternate opclasses
with different equality behaviors, postgres#4 seems like an issue worth
back-patching.  That's the bulk of the change anyway, so just back-patch
the whole thing to 9.4 where this code was introduced.

Discussion: https://postgr.es/m/13836.1521413227@sss.pgh.pa.us
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0