On Thu, Apr 26, 2012 at 1:10 PM, Benoit Chesneau <[email protected]> wrote: > On Thu, Apr 26, 2012 at 2:05 PM, Filipe David Manana <[email protected]> > wrote: >> On Thu, Apr 26, 2012 at 12:26 PM, Benoit Chesneau <[email protected]> >> wrote: >>> On Thu, Apr 26, 2012 at 12:18 AM, <[email protected]> wrote: >>>> Fixing the replicator_db JS test >>>> >>>> >>>> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo >>>> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6c976bd9 >>>> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6c976bd9 >>>> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6c976bd9 >>>> >>>> Branch: refs/heads/master >>>> Commit: 6c976bd948565305c006746f449dc8cd21a749e1 >>>> Parents: 7d2fe95 >>>> Author: Paul Joseph Davis <[email protected]> >>>> Authored: Mon Mar 26 15:17:02 2012 -0500 >>>> Committer: Paul Joseph Davis <[email protected]> >>>> Committed: Wed Apr 25 16:54:08 2012 -0500 >>>> >>>> ---------------------------------------------------------------------- >>>> share/www/script/test/replicator_db.js | 4 ++++ >>>> src/couch_replicator/src/couch_replicator.erl | 5 ++++- >>>> 2 files changed, 8 insertions(+), 1 deletions(-) >>>> ---------------------------------------------------------------------- >>>> >>>> >>>> http://git-wip-us.apache.org/repos/asf/couchdb/blob/6c976bd9/share/www/script/test/replicator_db.js >>>> ---------------------------------------------------------------------- >>>> diff --git a/share/www/script/test/replicator_db.js >>>> b/share/www/script/test/replicator_db.js >>>> index 48ca341..edc85f4 100644 >>>> --- a/share/www/script/test/replicator_db.js >>>> +++ b/share/www/script/test/replicator_db.js >>>> @@ -1076,6 +1076,10 @@ couchTests.replicator_db = function(debug) { >>>> }); >>>> TEquals(200, xhr.status); >>>> >>>> + // Temporary band-aid, give the replicator db some >>>> + // time to make the switch >>>> + wait(500); >>>> + >>>> new_doc = { >>>> _id: "foo666", >>>> value: 666 >>>> >>>> http://git-wip-us.apache.org/repos/asf/couchdb/blob/6c976bd9/src/couch_replicator/src/couch_replicator.erl >>>> ---------------------------------------------------------------------- >>>> diff --git a/src/couch_replicator/src/couch_replicator.erl >>>> b/src/couch_replicator/src/couch_replicator.erl >>>> index 1f7c08a..e91e1ae 100644 >>>> --- a/src/couch_replicator/src/couch_replicator.erl >>>> +++ b/src/couch_replicator/src/couch_replicator.erl >>>> @@ -112,7 +112,7 @@ async_replicate(#rep{id = {BaseId, Ext}, source = Src, >>>> target = Tgt} = Rep) -> >>>> RepChildId, >>>> {gen_server, start_link, [?MODULE, Rep, [{timeout, Timeout}]]}, >>>> temporary, >>>> - 1, >>>> + 250, >>>> worker, >>>> [?MODULE] >>>> }, >>>> @@ -333,6 +333,9 @@ do_init(#rep{options = Options, id = {BaseId, Ext}} = >>>> Rep) -> >>>> }. >>>> >>>> >>>> +handle_info(shutdown, St) -> >>>> + {stop, shutdown, St}; >>>> + >>>> handle_info({'DOWN', Ref, _, _, Why}, #rep_state{source_monitor = Ref} = >>>> St) -> >>>> ?LOG_ERROR("Source database is down. Reason: ~p", [Why]), >>>> {stop, source_db_down, St}; >>>> >>> >>> >>> Never had an issue there. What was the problem? I have the feeling it >>> may be related to >>> >>> https://issues.apache.org/jira/browse/COUCHDB-1461 >> >> Why? >> >> Afaik Paul's changes are to increase the shutdown time (from 1ms to >> 250ms) and to avoid the noisy OTP error messages when a running >> replication is cancelled (shutdown handle_info clause). >> However I would be highly surprised if it fixes the issue you reported. > > I understand the change, but I don't know what is the problem . I may > have misinterpreted what was the switch in question. But this is quite > similar since stopping (deleting a doc) or canceling are both calling > the same function, aren't they?
Right. But the issue you reported before is unrelated. The problem there is that 2 processes are calling 2 functions of the same supervisor (start_child and delete_child). Those supervisor functions are synchronous, meaning that one has to wait for the other to finish. > > - benoît -- Filipe David Manana, "Reasonable men adapt themselves to the world. Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men."
