summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2021-03-02 22:17:47 -0500
committerNick Vatamaniuc <nickva@users.noreply.github.com>2021-03-23 15:24:27 -0400
commita1a3ca02b16c7175d05863468ef7398a44707818 (patch)
tree97da61b09e9522110be2657ff579b559f468145e
parentc777fc3544a10d1c8f38c3c95b8542a68b055cd3 (diff)
downloadcouchdb-a1a3ca02b16c7175d05863468ef7398a44707818.tar.gz
Require subscribers to wait until indexer finishes
This clause allowed a subscriber to start reading a view as soon as the indexer made it past the sequence of interest. The trouble with that approach is the resulting view is not directly related to any snapshot of the underlying DB. Waiting until the indexer finishes allows us to provide better semantics, where the view observes a consistent snapshot of the database at some point in time >= the requested sequence. In order to see this work through the view reader should explicitly set the read version of FDB to match the commit version introduced by the indexer, to avoid seeing partial results from a follow-on indexing job.
-rw-r--r--src/couch_views/src/couch_views_jobs.erl4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/couch_views/src/couch_views_jobs.erl b/src/couch_views/src/couch_views_jobs.erl
index 6e5111862..022d27c7f 100644
--- a/src/couch_views/src/couch_views_jobs.erl
+++ b/src/couch_views/src/couch_views_jobs.erl
@@ -122,10 +122,6 @@ wait_for_job(JobId, Subscription, DDocId, UpdateSeq) ->
{ok, idx_vstamps(JobData)};
{finished, _} ->
wait_for_job(JobId, DDocId, UpdateSeq);
- {_State, #{<<"view_seq">> := ViewSeq} = JobData}
- when ViewSeq >= UpdateSeq ->
- couch_jobs:unsubscribe(Subscription),
- {ok, idx_vstamps(JobData)};
{_, _} ->
wait_for_job(JobId, Subscription, DDocId, UpdateSeq)
end.