You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by de...@apache.org on 2013/12/17 17:18:08 UTC

[1/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706

Updated Branches:
  refs/heads/1958-only-fetch-db-per-page 25a57313f -> a388706db (forced update)


add Fauxton release info


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/391bbe19
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/391bbe19
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/391bbe19

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: 391bbe19fdd2d50ecb4f9006cf9c9fe988cacd56
Parents: 6bb810f
Author: Garren Smith <ga...@gmail.com>
Authored: Fri Dec 13 11:52:48 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Fri Dec 13 11:53:31 2013 +0200

----------------------------------------------------------------------
 src/fauxton/readme.md | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/391bbe19/src/fauxton/readme.md
----------------------------------------------------------------------
diff --git a/src/fauxton/readme.md b/src/fauxton/readme.md
index 2ee3293..1cc59ab 100644
--- a/src/fauxton/readme.md
+++ b/src/fauxton/readme.md
@@ -31,6 +31,11 @@ A recent of [node.js](http://nodejs.org/) and npm is required.
     # Install all dependencies
     npm install
 
+### Dev Server
+    Using the dev server is the easiest way to use fauxton, specially when developing for it.
+
+    grunt dev
+
 #### (Optional) To avoid a npm global install
     # Add node_modules/.bin to your path
     # export PATH=./node_modules/.bin:$PATH
@@ -42,10 +47,12 @@ A recent of [node.js](http://nodejs.org/) and npm is required.
     # Or fully compiled install
     # ./bin/grunt couchdb
 
-### Dev Server
-    Using the dev server is the easiest way to use fauxton, specially when developing for it.
+### Prepare Fauxton Release
+    Follow the "Fauxton Setup" section then:
 
-    grunt dev
+    ./bin/grunt couchdb
+
+    This will install the latest version of Fauxton into `/share/www/fauxton`
 
 ### Running Tests
     There are two ways to run the tests. `grunt test` will run the tests via the commandline. It is also possible to view them via the url


[8/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706

Posted by de...@apache.org.
Improve docs of use_checkpoints and checkpoint_interval config options.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/d5f09767
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/d5f09767
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/d5f09767

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: d5f0976784ccd70883c8b7c17b1d4503af72f554
Parents: 74e0f08
Author: Alexander Shorin <kx...@apache.org>
Authored: Sat Dec 14 21:55:15 2013 +0400
Committer: Alexander Shorin <kx...@apache.org>
Committed: Sat Dec 14 21:55:22 2013 +0400

----------------------------------------------------------------------
 share/doc/src/config/replicator.rst | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/d5f09767/share/doc/src/config/replicator.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/config/replicator.rst b/share/doc/src/config/replicator.rst
index 515c679..388491c 100644
--- a/share/doc/src/config/replicator.rst
+++ b/share/doc/src/config/replicator.rst
@@ -116,37 +116,33 @@ Replicator Database Configuration
     .. versionadded:: 1.6
 
     Defines replication checkpoint interval in milliseconds. :ref:`Replicator
-    <replication/replicator>` will :get:`requests </{db}>` Source database
-    each time after a specified amount of interval::
+    <replicator>` will :get:`requests </{db}>` from the Source database at
+    the specified interval::
 
       [replicator]
       checkpoint_interval = 5000
 
-    Keeping this value lower raises polling rate to Source database, which
-    may be useful for frequently changing data, while higher value saves
-    traffic usage that is important for mobile clients.
+    Lower intervals may be useful for frequently changing data, while higher
+    values will lower bandwidth and make fewer requests for infrequently
+    updated databases.
 
 
   .. config:option:: use_checkpoints
 
      .. versionadded:: 1.6
 
-     If set as ``true`` CouchDB makes intermediate checkpoints during
-     replication from those it may continue it in case of failure or restart::
+     If ``use_checkpoints`` is set to ``true``, CouchDB will make checkpoints
+     during replication and at the completion of replication. CouchDB can
+     efficiently resume replication from any of these checkpoints::
 
       [replicator]
       use_checkpoints = true
 
-     .. warning:: It's **not recommended** to switch this option off
-        (by setting value ``false`` to it) since without checkpoints there would
-        not be stored any replication history logs both on Source and Target,
-        forcing replication to start from the very beginning.
+     .. note:: Checkpoints are stored in :ref:`local documents <api/local>`
+        on both the source and target databases (which requires write access).
 
-     .. note:: Checkpoints (aka Replication Log) are stored as :ref:`local
-        documents <api/local>` both on Source and Target endpoints. In case,
-        when client has no write permission on Source database you may disable
-        them, but locally for specific replication process.
-        See :ref:`replication-settings` for more info.
+     .. warning:: Disabling checkpoints is **not recommended** as CouchDB
+        will scan the Source database's changes feed from the beginning.
 
 
   .. config:option:: cert_file


[5/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706

Posted by de...@apache.org.
docs: various updates for release notes for 1.6.0

- closes COUCHDB-1795
- closes COUCHDB-1962


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/5e2a4278
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/5e2a4278
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/5e2a4278

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: 5e2a4278ea50d284c75469a4cf3c5a2d26ceb63d
Parents: 7299e71
Author: Dave Cottlehuber <dc...@apache.org>
Authored: Fri Dec 13 18:27:10 2013 +0100
Committer: Dave Cottlehuber <dc...@apache.org>
Committed: Sat Dec 14 11:39:04 2013 +0100

----------------------------------------------------------------------
 share/doc/src/replication/protocol.rst   |  4 ++--
 share/doc/src/replication/replicator.rst | 13 +++++++++++++
 share/doc/src/whatsnew/1.6.rst           |  5 +++++
 3 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/5e2a4278/share/doc/src/replication/protocol.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/replication/protocol.rst b/share/doc/src/replication/protocol.rst
index 10ba243..c5a8181 100644
--- a/share/doc/src/replication/protocol.rst
+++ b/share/doc/src/replication/protocol.rst
@@ -107,7 +107,7 @@ Algorithm
 
 5. GET each revisions from the source Database by calling the URL
    `/<source>/<docid>?revs=true&open_revs`=<revision>` . This
-   will get the document with teh parent revisions. Also don't forget to
+   will get the document with its parent revisions. Also don't forget to
    get attachments that aren't already stored at the target. As an
    optimisation you can use the HTTP multipart api to get all.
 
@@ -190,7 +190,7 @@ Pull Only
 Reference
 ---------
 
-* `TouchDB Ios wiki <https://github.com/couchbaselabs/TouchDB-iOS/wiki/Replication-Algorithm>`_
+* `TouchDB iOS wiki <https://github.com/couchbaselabs/TouchDB-iOS/wiki/Replication-Algorithm>`_
 * `CouchDB documentation
   <http://wiki.apache.org/couchdb/Replication>`_
 * CouchDB `change notifications`_

http://git-wip-us.apache.org/repos/asf/couchdb/blob/5e2a4278/share/doc/src/replication/replicator.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/replication/replicator.rst b/share/doc/src/replication/replicator.rst
index 6700186..e93c579 100644
--- a/share/doc/src/replication/replicator.rst
+++ b/share/doc/src/replication/replicator.rst
@@ -91,6 +91,19 @@ Special fields set by the replicator start with the prefix
 
    If ``replication_state`` is ``error``, this field contains the reason.
 
+.. code-block:: javascript
+
+    {
+    "_id": "my_rep",
+    "_rev": "2-9f2c0d9372f4ee4dc75652ab8f8e7c70",
+    "source": "foodb",
+    "target": "bardb",
+    "_replication_state": "error",
+    "_replication_state_time": "2013-12-13T18:48:00+01:00",
+    "_replication_state_reason": "db_not_found: could not open foodb",
+    "_replication_id": "fe965cdc47b4d5f6c02811d9d351ac3d"
+    }
+
 When the replication finishes, it will update the ``_replication_state``
 field (and ``_replication_state_time``) with the value ``completed``, so
 the document will look like:

http://git-wip-us.apache.org/repos/asf/couchdb/blob/5e2a4278/share/doc/src/whatsnew/1.6.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/whatsnew/1.6.rst b/share/doc/src/whatsnew/1.6.rst
index df57320..2a0fc6e 100644
--- a/share/doc/src/whatsnew/1.6.rst
+++ b/share/doc/src/whatsnew/1.6.rst
@@ -46,3 +46,8 @@ Version 1.6.0
 * :issue:`1922`: Fix CORS exposed headers :commit:`4f619833`
 * Rename ``proxy_authentification_handler`` to ``proxy_authentication_handler``
   :commit:`c66ac4a8`
+* :issue:`1795`: Ensure startup script couchdb clears pid file on termination
+  :commit:`818ef4f9`
+* :issue:`1962`: Various replicator enhancements
+  :commit:`1d5fe2aa` write access for checkpoints is not required on source db
+  :commit:`0693f98e` make the replication checkpoint interval configurable


[9/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706

Posted by de...@apache.org.
Fixing database landing page so that it doesn't fetch the status of every database on load.
Only fetches the # of databases showing per page.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/a388706d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a388706d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a388706d

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: a388706db79031af756f1bb4be6d87a966909a17
Parents: d5f0976
Author: suelockwood <de...@apache.org>
Authored: Thu Dec 12 16:14:10 2013 -0500
Committer: suelockwood <de...@apache.org>
Committed: Tue Dec 17 11:10:19 2013 -0500

----------------------------------------------------------------------
 src/fauxton/app/modules/databases/routes.js | 15 +--------------
 src/fauxton/app/modules/databases/views.js  | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/a388706d/src/fauxton/app/modules/databases/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/routes.js b/src/fauxton/app/modules/databases/routes.js
index ac50b4b..e63c3a7 100644
--- a/src/fauxton/app/modules/databases/routes.js
+++ b/src/fauxton/app/modules/databases/routes.js
@@ -59,20 +59,7 @@ function(app, FauxtonAPI, Databases, Views) {
     },
 
     establish: function() {
-      var databases = this.databases;
-      var deferred = this.deferred;
-
-      databases.fetch().done(function(resp) {
-        FauxtonAPI.when(databases.map(function(database) {
-          return database.status.fetch();
-        })).always(function(resp) {
-          //make this always so that even if a user is not allowed access to a database
-          //they will still see a list of all databases
-          deferred.resolve();
-        });
-      });
-
-      return [deferred];
+     return [this.databases.fetch()];
     }
   });
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/a388706d/src/fauxton/app/modules/databases/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/databases/views.js b/src/fauxton/app/modules/databases/views.js
index 7d59ac4..02b0297 100644
--- a/src/fauxton/app/modules/databases/views.js
+++ b/src/fauxton/app/modules/databases/views.js
@@ -24,7 +24,9 @@ function(app, Components, FauxtonAPI, Databases) {
   Views.Item = FauxtonAPI.View.extend({
     template: "templates/databases/item",
     tagName: "tr",
-
+    establish: function(){
+      return [this.model.fetch()];
+    },
     serialize: function() {
       return {
         encoded: encodeURIComponent(this.model.get("name")),
@@ -54,7 +56,19 @@ function(app, Components, FauxtonAPI, Databases) {
         databases: this.collection
       };
     },
-
+    establish: function(){
+      var currentDBs = this.paginated();
+      var deferred = FauxtonAPI.Deferred();
+
+      FauxtonAPI.when(currentDBs.map(function(database) {
+        return database.status.fetch();
+      })).always(function(resp) {
+        //make this always so that even if a user is not allowed access to a database
+        //they will still see a list of all databases
+        deferred.resolve();
+      });
+      return [deferred];
+    },
     switchDatabase: function(event, selectedName) {
       event && event.preventDefault();
 


[3/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706

Posted by de...@apache.org.
Tests for replicator use_checkpoints option


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/03bc1641
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/03bc1641
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/03bc1641

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: 03bc1641639667f26e219cc36885118448c24158
Parents: 7c23a6e
Author: Volker Mische <vo...@gmail.com>
Authored: Tue Jul 16 00:26:03 2013 +0200
Committer: Robert Newson <rn...@apache.org>
Committed: Sat Dec 14 11:31:32 2013 +0100

----------------------------------------------------------------------
 src/couch_replicator/Makefile.am               |   3 +-
 src/couch_replicator/test/07-use-checkpoints.t | 256 ++++++++++++++++++++
 2 files changed, 258 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/03bc1641/src/couch_replicator/Makefile.am
----------------------------------------------------------------------
diff --git a/src/couch_replicator/Makefile.am b/src/couch_replicator/Makefile.am
index 71d3702..2dcd47d 100644
--- a/src/couch_replicator/Makefile.am
+++ b/src/couch_replicator/Makefile.am
@@ -41,7 +41,8 @@ test_files = \
 	test/03-replication-compact.t \
 	test/04-replication-large-atts.t \
 	test/05-replication-many-leaves.t \
-	test/06-doc-missing-stubs.t
+	test/06-doc-missing-stubs.t \
+	test/07-use-checkpoints.t
 
 compiled_files = \
 	ebin/couch_replicator_api_wrap.beam \

http://git-wip-us.apache.org/repos/asf/couchdb/blob/03bc1641/src/couch_replicator/test/07-use-checkpoints.t
----------------------------------------------------------------------
diff --git a/src/couch_replicator/test/07-use-checkpoints.t b/src/couch_replicator/test/07-use-checkpoints.t
new file mode 100755
index 0000000..cefc1a7
--- /dev/null
+++ b/src/couch_replicator/test/07-use-checkpoints.t
@@ -0,0 +1,256 @@
+#!/usr/bin/env escript
+%% -*- erlang -*-
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+% Verify that compacting databases that are being used as the source or
+% target of a replication doesn't affect the replication and that the
+% replication doesn't hold their reference counters forever.
+
+-define(b2l(B), binary_to_list(B)).
+
+-record(user_ctx, {
+    name = null,
+    roles = [],
+    handler
+}).
+
+-record(doc, {
+    id = <<"">>,
+    revs = {0, []},
+    body = {[]},
+    atts = [],
+    deleted = false,
+    meta = []
+}).
+
+-record(db, {
+    main_pid = nil,
+    update_pid = nil,
+    compactor_pid = nil,
+    instance_start_time, % number of microsecs since jan 1 1970 as a binary string
+    fd,
+    updater_fd,
+    fd_ref_counter,
+    header = nil,
+    committed_update_seq,
+    fulldocinfo_by_id_btree,
+    docinfo_by_seq_btree,
+    local_docs_btree,
+    update_seq,
+    name,
+    filepath,
+    validate_doc_funs = [],
+    security = [],
+    security_ptr = nil,
+    user_ctx = #user_ctx{},
+    waiting_delayed_commit = nil,
+    revs_limit = 1000,
+    fsync_options = [],
+    options = [],
+    compression,
+    before_doc_update,
+    after_doc_read
+}).
+
+-record(rep, {
+    id,
+    source,
+    target,
+    options,
+    user_ctx,
+    doc_id
+}).
+
+
+source_db_name() -> <<"couch_test_rep_db_a">>.
+target_db_name() -> <<"couch_test_rep_db_b">>.
+
+
+main(_) ->
+    test_util:init_code_path(),
+
+    etap:plan(16),
+    case (catch test()) of
+        ok ->
+            etap:end_tests();
+        Other ->
+            etap:diag(io_lib:format("Test died abnormally: ~p", [Other])),
+            etap:bail(Other)
+    end,
+    ok.
+
+
+test() ->
+    couch_server_sup:start_link(test_util:config_files()),
+    ibrowse:start(),
+
+    test_use_checkpoints(false),
+    test_use_checkpoints(true),
+
+    couch_server_sup:stop(),
+    ok.
+
+
+test_use_checkpoints(UseCheckpoints) ->
+    Pairs = [
+        {source_db_name(), target_db_name()},
+        {{remote, source_db_name()}, target_db_name()},
+        {source_db_name(), {remote, target_db_name()}},
+        {{remote, source_db_name()}, {remote, (target_db_name())}}
+    ],
+
+    ListenerFun = case UseCheckpoints of
+    false ->
+        fun({finished, _, {CheckpointHistory}}) ->
+            etap:is(CheckpointHistory,
+            [{<<"use_checkpoints">>,false}],
+            "No checkpoints found");
+        (_) ->
+            ok
+        end;
+    true ->
+        fun({finished, _, {CheckpointHistory}}) ->
+            SessionId = lists:keyfind(
+                <<"session_id">>, 1, CheckpointHistory),
+            etap:isnt(SessionId, false, "There's a checkpoint");
+        (_) ->
+            ok
+        end
+    end,
+    {ok, Listener} = couch_replicator_notifier:start_link(ListenerFun),
+
+    lists:foreach(
+        fun({Source, Target}) ->
+            {ok, SourceDb} = create_db(source_db_name()),
+            etap:diag("Populating source database"),
+            populate_db(SourceDb, 100),
+            ok = couch_db:close(SourceDb),
+
+            etap:diag("Creating target database"),
+            {ok, TargetDb} = create_db(target_db_name()),
+            ok = couch_db:close(TargetDb),
+
+            etap:diag("Setup replicator notifier listener"),
+
+            etap:diag("Triggering replication"),
+            replicate(Source, Target, UseCheckpoints),
+
+            etap:diag("Replication finished, comparing source and target databases"),
+            compare_dbs(SourceDb, TargetDb),
+
+            etap:diag("Deleting databases"),
+            delete_db(TargetDb),
+            delete_db(SourceDb),
+
+            ok = timer:sleep(1000)
+        end,
+        Pairs),
+
+    couch_replicator_notifier:stop(Listener).
+
+
+populate_db(Db, DocCount) ->
+    Docs = lists:foldl(
+        fun(DocIdCounter, Acc) ->
+            Id = iolist_to_binary(["doc", integer_to_list(DocIdCounter)]),
+            Value = iolist_to_binary(["val", integer_to_list(DocIdCounter)]),
+            Doc = #doc{
+                id = Id,
+                body = {[ {<<"value">>, Value} ]}
+            },
+            [Doc | Acc]
+        end,
+        [], lists:seq(1, DocCount)),
+    {ok, _} = couch_db:update_docs(Db, Docs, []).
+
+
+compare_dbs(#db{name = SourceName}, #db{name = TargetName}) ->
+    {ok, SourceDb} = couch_db:open_int(SourceName, []),
+    {ok, TargetDb} = couch_db:open_int(TargetName, []),
+    Fun = fun(FullDocInfo, _, Acc) ->
+        {ok, Doc} = couch_db:open_doc(SourceDb, FullDocInfo),
+        {Props} = DocJson = couch_doc:to_json_obj(Doc, [attachments]),
+        DocId = couch_util:get_value(<<"_id">>, Props),
+        DocTarget = case couch_db:open_doc(TargetDb, DocId) of
+        {ok, DocT} ->
+            DocT;
+        Error ->
+            etap:bail("Error opening document '" ++ ?b2l(DocId) ++
+                "' from target: " ++ couch_util:to_list(Error))
+        end,
+        DocTargetJson = couch_doc:to_json_obj(DocTarget, [attachments]),
+        case DocTargetJson of
+        DocJson ->
+            ok;
+        _ ->
+            etap:bail("Content from document '" ++ ?b2l(DocId) ++
+                "' differs in target database")
+        end,
+        {ok, Acc}
+    end,
+    {ok, _, _} = couch_db:enum_docs(SourceDb, Fun, [], []),
+    etap:diag("Target database has the same documents as the source database"),
+    ok = couch_db:close(SourceDb),
+    ok = couch_db:close(TargetDb).
+
+
+db_url(DbName) ->
+    iolist_to_binary([
+        "http://", couch_config:get("httpd", "bind_address", "127.0.0.1"),
+        ":", integer_to_list(mochiweb_socket_server:get(couch_httpd, port)),
+        "/", DbName
+    ]).
+
+
+create_db(DbName) ->
+    {ok, Db} = couch_db:create(
+        DbName,
+        [{user_ctx, #user_ctx{roles = [<<"_admin">>]}}, overwrite]),
+    couch_db:close(Db),
+    {ok, Db}.
+
+
+delete_db(#db{name = DbName, main_pid = Pid}) ->
+    ok = couch_server:delete(
+        DbName, [{user_ctx, #user_ctx{roles = [<<"_admin">>]}}]),
+    MonRef = erlang:monitor(process, Pid),
+    receive
+    {'DOWN', MonRef, process, Pid, _Reason} ->
+        ok
+    after 30000 ->
+        etap:bail("Timeout deleting database")
+    end.
+
+
+replicate({remote, Db}, Target, UseCheckpoints) ->
+    replicate(db_url(Db), Target, UseCheckpoints);
+
+replicate(Source, {remote, Db}, UseCheckpoints) ->
+    replicate(Source, db_url(Db), UseCheckpoints);
+
+replicate(Source, Target, UseCheckpoints) ->
+    RepObject = {[
+        {<<"source">>, Source},
+        {<<"target">>, Target},
+        {<<"use_checkpoints">>, UseCheckpoints}
+    ]},
+    {ok, Rep} = couch_replicator_utils:parse_rep_doc(
+        RepObject, #user_ctx{roles = [<<"_admin">>]}),
+    {ok, Pid} = couch_replicator:async_replicate(Rep),
+    MonRef = erlang:monitor(process, Pid),
+    receive
+    {'DOWN', MonRef, process, Pid, Reason} ->
+        etap:is(Reason, normal, "Replication finished successfully")
+    after 300000 ->
+        etap:bail("Timeout waiting for replication to finish")
+    end.


[6/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706

Posted by de...@apache.org.
Document use_checkpoints and checkpoint_interval config options.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/cb909505
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/cb909505
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/cb909505

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: cb9095053b3f5bddaae9dae9721d4d29a01734f9
Parents: 5e2a427
Author: Alexander Shorin <kx...@apache.org>
Authored: Sat Dec 14 15:37:13 2013 +0400
Committer: Alexander Shorin <kx...@apache.org>
Committed: Sat Dec 14 15:38:19 2013 +0400

----------------------------------------------------------------------
 share/doc/src/config/replicator.rst      | 37 +++++++++++++++++++++++++++
 share/doc/src/json-structure.rst         |  2 ++
 share/doc/src/replication/replicator.rst |  4 +--
 3 files changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/cb909505/share/doc/src/config/replicator.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/config/replicator.rst b/share/doc/src/config/replicator.rst
index 45451c1..515c679 100644
--- a/share/doc/src/config/replicator.rst
+++ b/share/doc/src/config/replicator.rst
@@ -111,6 +111,43 @@ Replicator Database Configuration
     .. _inet: http://www.erlang.org/doc/man/inet.html#setopts-2
 
 
+  .. config:option:: checkpoint_interval
+
+    .. versionadded:: 1.6
+
+    Defines replication checkpoint interval in milliseconds. :ref:`Replicator
+    <replication/replicator>` will :get:`requests </{db}>` Source database
+    each time after a specified amount of interval::
+
+      [replicator]
+      checkpoint_interval = 5000
+
+    Keeping this value lower raises polling rate to Source database, which
+    may be useful for frequently changing data, while higher value saves
+    traffic usage that is important for mobile clients.
+
+
+  .. config:option:: use_checkpoints
+
+     .. versionadded:: 1.6
+
+     If set as ``true`` CouchDB makes intermediate checkpoints during
+     replication from those it may continue it in case of failure or restart::
+
+      [replicator]
+      use_checkpoints = true
+
+     .. warning:: It's **not recommended** to switch this option off
+        (by setting value ``false`` to it) since without checkpoints there would
+        not be stored any replication history logs both on Source and Target,
+        forcing replication to start from the very beginning.
+
+     .. note:: Checkpoints (aka Replication Log) are stored as :ref:`local
+        documents <api/local>` both on Source and Target endpoints. In case,
+        when client has no write permission on Source database you may disable
+        them, but locally for specific replication process.
+        See :ref:`replication-settings` for more info.
+
 
   .. config:option:: cert_file
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/cb909505/share/doc/src/json-structure.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/json-structure.rst b/share/doc/src/json-structure.rst
index 042df59..7d22f1e 100644
--- a/share/doc/src/json-structure.rst
+++ b/share/doc/src/json-structure.rst
@@ -274,6 +274,8 @@ Replication Settings
 | use_checkpoints (optional)     | Whether to use replication checkpoints      |
 |                                | or not                                      |
 +--------------------------------+---------------------------------------------+
+| checkpoint_interval (optional) | Specifies checkpoint interval in ms.        |
++--------------------------------+---------------------------------------------+
 
 .. _replication-status:
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/cb909505/share/doc/src/replication/replicator.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/replication/replicator.rst b/share/doc/src/replication/replicator.rst
index e93c579..5117752 100644
--- a/share/doc/src/replication/replicator.rst
+++ b/share/doc/src/replication/replicator.rst
@@ -22,8 +22,8 @@ cancel an ongoing replication.
 
 These documents have exactly the same content as the JSON objects we use to
 ``POST`` to ``_replicate`` (fields ``source``, ``target``, ``create_target``,
-``continuous``, ``doc_ids``, ``filter``, ``query_params``,
-``use_checkpoints``).
+``continuous``, ``doc_ids``, ``filter``, ``query_params``, ``use_checkpoints``,
+``checkpoint_interval``).
 
 Replication documents can have a user defined ``_id`` (handy for finding a
 specific replication request later). Design Documents


[7/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706

Posted by de...@apache.org.
don't crash if ibrowse is already started

fix #COUCHDB-1986


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/74e0f08f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/74e0f08f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/74e0f08f

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: 74e0f08f72f8c002674159a4f765991f101abddc
Parents: cb90950
Author: Benoit Chesneau <bc...@gmail.com>
Authored: Sat Dec 14 17:21:26 2013 +0100
Committer: Benoit Chesneau <bc...@gmail.com>
Committed: Sat Dec 14 17:21:26 2013 +0100

----------------------------------------------------------------------
 src/couch_replicator/test/04-replication-large-atts.t | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/74e0f08f/src/couch_replicator/test/04-replication-large-atts.t
----------------------------------------------------------------------
diff --git a/src/couch_replicator/test/04-replication-large-atts.t b/src/couch_replicator/test/04-replication-large-atts.t
index 5386179..a7063c7 100755
--- a/src/couch_replicator/test/04-replication-large-atts.t
+++ b/src/couch_replicator/test/04-replication-large-atts.t
@@ -64,8 +64,8 @@ main(_) ->
 
 test() ->
     couch_server_sup:start_link(test_util:config_files()),
-    ibrowse:start(),
-    crypto:start(),
+    application:start(ibrowse),
+    application:start(crypto),
     couch_config:set("attachments", "compressible_types", "text/*", false),
 
     Pairs = [


[2/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706

Posted by de...@apache.org.
Run a directory full of tests

It's now possible to supply a directory to the JavaScript
test runner and it will run all the .js files in that
direcotry.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/7c23a6ed
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/7c23a6ed
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/7c23a6ed

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: 7c23a6ed848ecec2518b352462a8c7f0c98369cf
Parents: 391bbe1
Author: Volker Mische <vo...@gmail.com>
Authored: Fri Dec 13 18:44:40 2013 +0100
Committer: Volker Mische <vo...@gmail.com>
Committed: Fri Dec 13 18:44:40 2013 +0100

----------------------------------------------------------------------
 test/javascript/run.tpl | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/7c23a6ed/test/javascript/run.tpl
----------------------------------------------------------------------
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 5f19b36..75192da 100644
--- a/test/javascript/run.tpl
+++ b/test/javascript/run.tpl
@@ -88,6 +88,18 @@ run() {
 
 }
 
+run_files() {
+    COUNTER=1
+    FILE_COUNT=$(ls -l $1 | wc -l)
+    FILE_COUNT=$(expr $FILE_COUNT + 0)
+    for TEST_SRC in $1
+    do
+        /bin/echo -n "$COUNTER/$FILE_COUNT "
+        COUNTER=$(expr $COUNTER + 1)
+        run $TEST_SRC
+    done
+}
+
 # start CouchDB
 if [ -z $COUCHDB_NO_START ]; then
     $MAKE dev
@@ -98,25 +110,20 @@ echo "Running javascript tests ..."
 
 if [ "$#" -eq 0 ];
 then
-    COUNTER=1
-    FILES="$SCRIPT_DIR/test/*.js"
-    FILE_COUNT=$(ls -l $FILES | wc -l)
-    FILE_COUNT=$(expr $FILE_COUNT + 0)
-    for TEST_SRC in $FILES
-    do
-        /bin/echo -n "$COUNTER/$FILE_COUNT "
-        COUNTER=$(expr $COUNTER + 1)
-        run $TEST_SRC
-    done
+    run_files "$SCRIPT_DIR/test/*.js"
 else
-    TEST_SRC="$1"
-    if [ ! -f $TEST_SRC ]; then
-        TEST_SRC="$SCRIPT_DIR/test/$1"
+    if [ -d $1 ]; then
+        run_files "$1/*.js"
+    else
+        TEST_SRC="$1"
         if [ ! -f $TEST_SRC ]; then
-            TEST_SRC="$SCRIPT_DIR/test/$1.js"
+            TEST_SRC="$SCRIPT_DIR/test/$1"
             if [ ! -f $TEST_SRC ]; then
-                echo "file $1 does not exist"
-                exit 1
+                TEST_SRC="$SCRIPT_DIR/test/$1.js"
+                if [ ! -f $TEST_SRC ]; then
+                    echo "file $1 does not exist"
+                    exit 1
+                fi
             fi
         fi
     fi


[4/9] git commit: updated refs/heads/1958-only-fetch-db-per-page to a388706

Posted by de...@apache.org.
Add documentation for use_checkpoints replicator option


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/7299e71f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/7299e71f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/7299e71f

Branch: refs/heads/1958-only-fetch-db-per-page
Commit: 7299e71f33d1d09de9707d7f5a46c82290537876
Parents: 03bc164
Author: Volker Mische <vo...@gmail.com>
Authored: Tue Jul 16 00:34:31 2013 +0200
Committer: Robert Newson <rn...@apache.org>
Committed: Sat Dec 14 11:34:09 2013 +0100

----------------------------------------------------------------------
 share/doc/src/json-structure.rst         | 3 +++
 share/doc/src/replication/replicator.rst | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/7299e71f/share/doc/src/json-structure.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/json-structure.rst b/share/doc/src/json-structure.rst
index c124e44..042df59 100644
--- a/share/doc/src/json-structure.rst
+++ b/share/doc/src/json-structure.rst
@@ -271,6 +271,9 @@ Replication Settings
 |                                | filter function; value should be a document |
 |                                | containing parameters as members            |
 +--------------------------------+---------------------------------------------+
+| use_checkpoints (optional)     | Whether to use replication checkpoints      |
+|                                | or not                                      |
++--------------------------------+---------------------------------------------+
 
 .. _replication-status:
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/7299e71f/share/doc/src/replication/replicator.rst
----------------------------------------------------------------------
diff --git a/share/doc/src/replication/replicator.rst b/share/doc/src/replication/replicator.rst
index 0413bce..6700186 100644
--- a/share/doc/src/replication/replicator.rst
+++ b/share/doc/src/replication/replicator.rst
@@ -22,7 +22,8 @@ cancel an ongoing replication.
 
 These documents have exactly the same content as the JSON objects we use to
 ``POST`` to ``_replicate`` (fields ``source``, ``target``, ``create_target``,
-``continuous``, ``doc_ids``, ``filter``, ``query_params``).
+``continuous``, ``doc_ids``, ``filter``, ``query_params``,
+``use_checkpoints``).
 
 Replication documents can have a user defined ``_id`` (handy for finding a
 specific replication request later). Design Documents