Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E3406299 for ; Fri, 8 Jul 2011 18:03:21 +0000 (UTC) Received: (qmail 68982 invoked by uid 500); 8 Jul 2011 18:03:21 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 68848 invoked by uid 500); 8 Jul 2011 18:03:19 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 68841 invoked by uid 99); 8 Jul 2011 18:03:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jul 2011 18:03:19 +0000 X-ASF-Spam-Status: No, hits=-1996.4 required=5.0 tests=ALL_TRUSTED,FS_REPLICA X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jul 2011 18:03:18 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 63C6823888CB for ; Fri, 8 Jul 2011 18:02:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1144407 - in /couchdb/trunk: share/www/script/test/replication.js src/couchdb/couch_httpd_replicator.erl Date: Fri, 08 Jul 2011 18:02:58 -0000 To: commits@couchdb.apache.org From: fdmanana@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110708180258.63C6823888CB@eris.apache.org> Author: fdmanana Date: Fri Jul 8 18:02:58 2011 New Revision: 1144407 URL: http://svn.apache.org/viewvc?rev=1144407&view=rev Log: Fix replication.js failures in OTP R14B03 The fix to make the test work on OTP releases older than R14B03 (revision 1143805) actually broke the test on R14B03. Now verified it works on R14B03 and previous releases. Modified: couchdb/trunk/share/www/script/test/replication.js couchdb/trunk/src/couchdb/couch_httpd_replicator.erl Modified: couchdb/trunk/share/www/script/test/replication.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/replication.js?rev=1144407&r1=1144406&r2=1144407&view=diff ============================================================================== --- couchdb/trunk/share/www/script/test/replication.js (original) +++ couchdb/trunk/share/www/script/test/replication.js Fri Jul 8 18:02:58 2011 @@ -523,11 +523,16 @@ couchTests.replication = function(debug) // after the child terminates, so cancel the replication to delete the // child spec in those OTP releases, otherwise since_seq will have no // effect. - CouchDB.replicate( - dbPairs[i].source, - dbPairs[i].target, - {body: {cancel: true}} - ); + try { + CouchDB.replicate( + dbPairs[i].source, + dbPairs[i].target, + {body: {cancel: true}} + ); + } catch (x) { + // OTP R14B03 onwards + TEquals("not found", x.error); + } repResult = CouchDB.replicate( dbPairs[i].source, dbPairs[i].target, @@ -536,11 +541,16 @@ couchTests.replication = function(debug) // Same reason as before. But here we don't want since_seq to affect // subsequent replications, so we need to delete the child spec from the // supervisor (since_seq is not used to calculate the replication ID). - CouchDB.replicate( - dbPairs[i].source, - dbPairs[i].target, - {body: {cancel: true}} - ); + try { + CouchDB.replicate( + dbPairs[i].source, + dbPairs[i].target, + {body: {cancel: true}} + ); + } catch (x) { + // OTP R14B03 onwards + TEquals("not found", x.error); + } TEquals(true, repResult.ok); TEquals(2, repResult.history[0].missing_checked); TEquals(2, repResult.history[0].missing_found); Modified: couchdb/trunk/src/couchdb/couch_httpd_replicator.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_replicator.erl?rev=1144407&r1=1144406&r2=1144407&view=diff ============================================================================== --- couchdb/trunk/src/couchdb/couch_httpd_replicator.erl (original) +++ couchdb/trunk/src/couchdb/couch_httpd_replicator.erl Fri Jul 8 18:02:58 2011 @@ -36,6 +36,9 @@ handle_req(#httpd{method = 'POST', user_ send_json( Req, 404, {[{error, to_binary(Error)}, {reason, to_binary(Reason)}]}); + {error, not_found} -> + % Tried to cancel a replication that didn't exist. + send_json(Req, 404, {[{error, <<"not found">>}]}); {error, Reason} -> send_json(Req, 500, {[{error, to_binary(Reason)}]}); {ok, {cancelled, RepId}} ->