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

Ignoring pr value from bucket type. #1835

Closed
systream opened this issue Nov 9, 2022 · 6 comments
Closed

Ignoring pr value from bucket type. #1835

systream opened this issue Nov 9, 2022 · 6 comments

Comments

@systream
Copy link
Contributor

systream commented Nov 9, 2022

PR value set in bucket type ignored when reading data.

We set PR to 4 but unfortunately it is ignored by get_fsm.
https://github.com/basho/riak_kv/blob/develop-3.0/src/riak_kv_get_fsm.erl#L313

It caused data loss, because we got data from non primary vnodes what leads us to not found, we created a new object and overwrite it.

@martinsumner
Copy link
Contributor

martinsumner commented Nov 9, 2022

Is this specifically about setting in bucket types? I know there is a test for the 'PR' value here, but it is passed in as a GET option - https://github.com/basho/riak_test/blob/develop-3.0/tests/pr_pw.erl

In theory the bucket properties should be checked here, and then that is added to the get_core. The get_core checks, and only gives a positive response when satisfied.

This shouldn't change however PR is set. Do you have an idea where this is breaking down?

@systream
Copy link
Contributor Author

systream commented Nov 9, 2022

The issue is on line 313 in riak_kv_get_fsm. The DEFAULT_PR is 0 instead of default.

To reproduce: have 3 riak nodes.
Test bucket properties:

test_pw is active

young_vclock: 20
w: 3
sync_on_write: backend
small_vclock: 50
rw: quorum
r: 3
pw: 3
precommit: []
pr: 3
postcommit: []
old_vclock: 86400
notfound_ok: true
node_confirms: 0
n_val: 3
linkfun: {modfun,riak_kv_wm_link_walker,mapreduce_linkfun}
last_write_wins: false
dw: quorum
dvv_enabled: true
chash_keyfun: {riak_core_util,chash_std_keyfun}
big_vclock: 50
basic_quorum: false
allow_mult: true
active: true
claimant: 'dev1@127.0.0.1'

Stop one riak node.

Do a get:
I expect this to return with an pr_val_unsatisfied error:

 riakc_pb_socket:get(poolboy:checkout(riakc_pool), {<<"test_pw">>, <<"test">>}, <<"fooo1">>).
{error,notfound}
riakc_pb_socket:get(poolboy:checkout(riakc_pool), {<<"test_pw">>, <<"test">>}, <<"fooo1">>, [{pr, 3}]).
{error,<<"{pr_val_unsatisfied,3,2}">>}

@martinsumner
Copy link
Contributor

Thanks, I see it now.

I've done a quick check of the PUT fsm as well as the GET fsm, and it looks like it is only this value where the error exists.

I'm testing some leveled changes at the moment which may require a 3.0.12 release, so I will bundle a fix for this in as well. Target is to have 3.0.12 with this fix by the end of the week.

@systream
Copy link
Contributor Author

systream commented Nov 9, 2022

Thanks, I could issue a pull request if it helps.

@martinsumner
Copy link
Contributor

If you have time, that would help a great deal.

@martinsumner
Copy link
Contributor

Included in Riak 3.0.12

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

No branches or pull requests

2 participants