nickva commented on pull request #3909:
URL: https://github.com/apache/couchdb/pull/3909#issuecomment-1020646304
> I'm trying to figure out in what situations where we wouldn't want to
forbid the document even if the replies were not `noreply`.
>
I was thinking of the case if we had some other errors - node crashed, other
unspecified errors, etc. and we wouldn't want to ignore those in favor of a
`forbidden`. Unless perhaps we're explicit and can say two node crashes and one
forbidden should resolve to forbidden, but not if they are arbitrary errors?
> `[{_, {forbidden, _}, Reply2, Reply3]`
> Reply2, and Reply3 can override forbidden only if they are equal to
successful Reply1 = {ok, Doc1}, Reply2 = {ok, Doc2}. That doesn't seem like it
can happen because a successful update implies an update to the revision tree,
and the VDU would prevent it.
For regular doc updates when revision trees don't match, we'd probably get
conflicts for some and forbidden for other responses. It could be that the VDU
is out of sync on the nodes as well. So I agree it's a bit unusual if we see a
`[forbidden, {ok, _}, {ok, _}]` but then why not pick the `{ok, _}` response
and ignore the forbidden? To be on the safe side, we should probably crash or
highlight that as an odd mismatch. I think the current quorum logic currently
would return a success if there are 2 successes at least? (I haven't verified
it yet). What about `[forbidden, forbidden, {ok, _}]`, this is where we get
the mismatch error and a 500 I think, and I think we should still get it.
Ideally we'd probably want to inspect the revision tree to see which node saw a
more recent revision tree (if it can even be determined), then we'd trust the
node with the most recent revision doc and VDU revision, but that maybe a
harder thing to do.
Because it's a bit hard to decide what to do in case of `new_edits:true`
when we get those mismatches, I think we should instead of focus on the
`new_edits:false` only, and restrict the PR to that. Because there, we have the
corner case that `noreply` would be returned when the VDU [is not run because
when revision tree is not
extended](https://github.com/apache/couchdb/blob/3.x/src/couch/src/couch_db.erl#L1239-L1242).
In that case I could see returning `forbidden` for the doc when we have
either`[forbidden, noreply, noreply]` or `[forbidden, forbidden, noreply]`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]