Skip to content

Make pg_local:member_died/2 more resilient #1700

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
merged 3 commits into from
Sep 17, 2018
Merged

Conversation

michaelklishin
Copy link
Collaborator

Proposed Changes

This makes pg_local:member_died/2 more defensive and resilient, avoiding failed assertions where they aren't productive or helpful in troubleshooting.

See #1699 for background.

Types of Changes

  • Bug fix (non-breaking change which fixes issue pg_local:member_died/1 should be more resilient #1699)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, appearance)

Checklist

  • I have read the CONTRIBUTING.md document
  • I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in related repositories

Further Comments

[#160530707]

See #1699 for background.

[#160530707]
member_died(Ref) ->
[{{ref, Ref}, Pid}] = ets:lookup(pg_local_table, {ref, Ref}),
member_died(Ref, Pid) ->
case ets:lookup(?TABLE, {ref, Ref}) of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this lookup if we always call leave_all_groups with the same Pid? The three case clauses do exactly the same. Or am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is many years old so I can only guess the intent here. I think it tries to assert that the ref/pid combination is known. I'd leave it as is for now, this is not a hot code path event.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clauses simply demonstrate what 3 scenarios are possible. We can combine the latter two.

@michaelklishin michaelklishin merged commit 8f71523 into master Sep 17, 2018
@michaelklishin michaelklishin deleted the rabbitmq-server-1699 branch September 17, 2018 08:41
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