You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/28 14:37:36 UTC
[14/23] couchdb commit: updated refs/heads/master to aa9f32d
Fix race condition in a replicator db test
There was a race condition where we could end up grabbing repDoc1 before
the replicator manager got around to updating it. Local timespans had
this in the 19ms range. Rather than slap a timeout on it I've added a
call to a longpoll on the changes feed to wait for the update.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/caba8931
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/caba8931
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/caba8931
Branch: refs/heads/master
Commit: caba893128849cf3f497bc19d5abb2b4b2fd9880
Parents: 73ca1f9
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Aug 12 14:09:26 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Aug 12 14:09:26 2014 -0500
----------------------------------------------------------------------
share/www/script/test/replicator_db_identical_continuous.js | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/caba8931/share/www/script/test/replicator_db_identical_continuous.js
----------------------------------------------------------------------
diff --git a/share/www/script/test/replicator_db_identical_continuous.js b/share/www/script/test/replicator_db_identical_continuous.js
index 5e7f151..240c531 100644
--- a/share/www/script/test/replicator_db_identical_continuous.js
+++ b/share/www/script/test/replicator_db_identical_continuous.js
@@ -54,6 +54,13 @@ couchTests.replicator_db_identical_continuous = function(debug) {
T(copy.value === doc.value);
}
+ // Rather than a timeout we're just waiting to hear the
+ // fourth change to the database. Changes 1 and 2 were
+ // us storing repDoc1 and repDoc2. Changes 3 and 4 are
+ // the replicator manager updating each document. This
+ // just waits until the fourth change before continuing.
+ repDb.changes({"feed":"longpoll", "since":3});
+
repDoc1 = repDb.open("foo_dup_cont_rep_doc_1");
T(repDoc1 !== null);
T(repDoc1._replication_state === "triggered");