use fabric to read/write _replicator docs#6031
Open
rnewson wants to merge 1 commit into
Open
Conversation
f58ad1b to
8e34eee
Compare
nickva
reviewed
Jun 10, 2026
| ioq:maybe_set_io_priority({system, DbName}), | ||
| defer_call(fun() -> | ||
| try | ||
| fabric:update_doc(DbName, Doc, [?CTX]) |
Contributor
There was a problem hiding this comment.
With serialize_worker_startup=false currently we're using at cloudant, wouldn't this make the conflict generation worse?
nickva
reviewed
Jun 10, 2026
| Ret; | ||
| {'DOWN', Ref, process, Pid, {exit_throw, Reason}} -> | ||
| throw(Reason); | ||
| {'DOWN', Ref, process_, Pid, {exit_error, Reason}} -> |
Contributor
There was a problem hiding this comment.
typo :process_ will deadlock on exits
|
|
||
| save_rep_doc(<<"shards/", _/binary>> = ShardDbName, Doc) -> | ||
| DbName = mem3:dbname(ShardDbName), | ||
| ioq:maybe_set_io_priority({system, DbName}), |
Contributor
There was a problem hiding this comment.
This doesn't do anything, same reason as above
|
|
||
| open_rep_doc(<<"shards/", _/binary>> = ShardDbName, DocId) -> | ||
| DbName = mem3:dbname(ShardDbName), | ||
| ioq:maybe_set_io_priority({system, DbName}), |
Contributor
There was a problem hiding this comment.
ioq setting here will fail. It's a pdict setting and since defer spawns a process it won't be applied
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #6029
Overview
serialize_worker_startup=true fixes the "spurious conflict" update case in most circumstances. A prior attempt to address that problem in the replicator now conflicts with that work. The replicator can update replicator docs whenever the state changes. For jobs that crash quickly, stored conflicts could be generated. We changed the replicator to only write to the local copy on the "owner" node, to avoid this. That is fundamentally the same trick that serialize_worker_startup=true does. However these two mechanisms are not coordinated and can easily choose different primary nodes.
This PR returns couch replicator to use fabric:open_doc and fabric:update_doc to align its changes with serialize_worker_startup=true behaviour.
Testing recommendations
covered by existing tests
Related Issues or Pull Requests
#6029
Checklist
rel/overlay/etc/default.inisrc/docsfolder