You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2023/01/10 05:34:45 UTC

[couchdb] 01/01: Fix replication _scheduler/docs total_rows

This is an automated email from the ASF dual-hosted git repository.

jaydoane pushed a commit to branch replication-total-rows
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 5134e7266ae82aa2b5112b5e9dd4df18cf6a7e21
Author: Jay Doane <ja...@apache.org>
AuthorDate: Mon Jan 9 21:34:29 2023 -0800

    Fix replication _scheduler/docs total_rows
    
    The total_rows property was decremented by one to account for the VDU
    that was automatically added to the total. Now that a BDU has replaced
    the VDU [1] total_rows is one less than it should be.
    
    This removes the decrement so that total_rows equals the actual doc
    count.
    
    [1] https://github.com/apache/couchdb/pull/4274
---
 src/couch_replicator/src/couch_replicator_httpd_util.erl | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/couch_replicator/src/couch_replicator_httpd_util.erl b/src/couch_replicator/src/couch_replicator_httpd_util.erl
index ddcc179d4..17efee3b3 100644
--- a/src/couch_replicator/src/couch_replicator_httpd_util.erl
+++ b/src/couch_replicator/src/couch_replicator_httpd_util.erl
@@ -158,7 +158,7 @@ docs_cb({meta, Meta}, #vacc{meta_sent = false, row_sent = false} = Acc) ->
     Parts =
         case couch_util:get_value(total, Meta) of
             undefined -> [];
-            Total -> [io_lib:format("\"total_rows\":~p", [adjust_total(Total)])]
+            Total -> [io_lib:format("\"total_rows\":~p", [Total])]
         end ++
             case couch_util:get_value(offset, Meta) of
                 undefined -> [];
@@ -193,9 +193,3 @@ row_to_json(Row) ->
     Doc0 = couch_util:get_value(doc, Row),
     Doc1 = update_db_name(Doc0),
     ?JSON_ENCODE(Doc1).
-
-%% Adjust Total as there is an automatically created validation design doc
-adjust_total(Total) when is_integer(Total), Total > 0 ->
-    Total - 1;
-adjust_total(Total) when is_integer(Total) ->
-    0.