Skip to content
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

Add cets:insert_serial/2 #33

Merged
merged 5 commits into from
Oct 6, 2023
Merged

Add cets:insert_serial/2 #33

merged 5 commits into from
Oct 6, 2023

Conversation

arcusfelis
Copy link
Contributor

@arcusfelis arcusfelis commented Oct 2, 2023

All `insert_serial' calls are sent to the leader node first.

Similar to insert_new/2, but overwrites the data silently on conflict.
It could be used to update entries, which use not node-specific keys.

This function ensures that all nodes would agree on the value, if they try to insert (OR overwrite) a record with the same key at once.

It is used by esl/MongooseIM#4136

@codecov
Copy link

codecov bot commented Oct 2, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (def7da2) 97.38% compared to head (1a27de2) 97.38%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #33   +/-   ##
=======================================
  Coverage   97.38%   97.38%           
=======================================
  Files           9        9           
  Lines         612      613    +1     
=======================================
+ Hits          596      597    +1     
  Misses         16       16           
Files Coverage Δ
src/cets.erl 100.00% <100.00%> (ø)

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

@arcusfelis
Copy link
Contributor Author

arcusfelis commented Oct 5, 2023

@chrzaszcz Propose better name for insert_serial, if you want. insert_serialized? upsert_though_the_main_node? :)
insert_leader? leader_insert? insert_at_leader? insert_though_leader?

Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

I added some comments.

src/cets.erl Show resolved Hide resolved
test/cets_SUITE.erl Show resolved Hide resolved
@arcusfelis arcusfelis requested a review from chrzaszcz October 6, 2023 09:07
src/cets_call.erl Outdated Show resolved Hide resolved
Copy link
Member

@chrzaszcz chrzaszcz left a comment

Choose a reason for hiding this comment

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

👌

@chrzaszcz chrzaszcz merged commit e3ad43f into main Oct 6, 2023
@chrzaszcz chrzaszcz deleted the feature/insert-serial branch October 6, 2023 09:48
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