Skip to content
New issue

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

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

Already on GitHub? # to your account

m2k_table_copy: Handle existing projection #12

Merged
merged 1 commit into from
May 13, 2024

Conversation

dumbbell
Copy link
Member

Why

Thanks to concurrency, it's possible that the projection is created between the attempt to use it and the call to setup_projection/2. If this happens, the setup fails with an error telling the projection already exists.

This is not a fatal error, we should simply retry to read the projection's table.

How

We handle both the old and the new possible "projection already exists" error terms and retry the function if this occurs.

[Why]
Thanks to concurrency, it's possible that the projection is created
between the attempt to use it and the call to `setup_projection/2`. If
this happens, the setup fails with an error telling the projection
already exists.

This is not a fatal error, we should simply retry to read the
projection's table.

[How]
We handle both the old and the new possible "projection already exists"
error terms and retry the function if this occurs.
@dumbbell dumbbell added the enhancement New feature or request label May 13, 2024
@dumbbell dumbbell self-assigned this May 13, 2024
@dumbbell
Copy link
Member Author

This is similar to what has been done in rabbitmq/rabbitmq-server#10868.

Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 75.26%. Comparing base (95c27d0) to head (75c38c2).

Files Patch % Lines
src/m2k_table_copy.erl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #12      +/-   ##
==========================================
- Coverage   75.49%   75.26%   -0.23%     
==========================================
  Files          13       13              
  Lines         657      659       +2     
==========================================
  Hits          496      496              
- Misses        161      163       +2     
Flag Coverage Δ
erlang-25 75.26% <0.00%> (-0.23%) ⬇️
erlang-26 75.26% <0.00%> (-0.23%) ⬇️
os-ubuntu-latest 75.26% <0.00%> (-0.23%) ⬇️
os-windows-latest 75.26% <0.00%> (-0.23%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dumbbell dumbbell marked this pull request as ready for review May 13, 2024 16:05
@dumbbell dumbbell merged commit 387871c into main May 13, 2024
10 checks passed
@dumbbell dumbbell deleted the handle-existing-projection branch May 13, 2024 16:06
@dumbbell dumbbell added this to the v0.5.0 milestone May 13, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants