You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/06/01 07:49:08 UTC

[couchdb] branch COUCHDB-3287-pluggable-storage-engines-use-integers-for-local-revs updated (f1db277 -> 96330b6)

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

vatamane pushed a change to branch COUCHDB-3287-pluggable-storage-engines-use-integers-for-local-revs
in repository https://gitbox.apache.org/repos/asf/couchdb.git.

     omits  f1db277   Fix compatibility with master local document revisions
       new  96330b6   Fix compatibility with master local document revisions

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f1db277)
            \
             N -- N -- N   refs/heads/COUCHDB-3287-pluggable-storage-engines-use-integers-for-local-revs (96330b6)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omits" are not gone; other references still
refer to them.  Any revisions marked "discards" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/couch/src/couch_bt_engine.erl  | 17 +++++++----------
 src/couch/src/test_engine_util.erl |  6 +++---
 2 files changed, 10 insertions(+), 13 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].

[couchdb] 01/01: Fix compatibility with master local document revisions

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch COUCHDB-3287-pluggable-storage-engines-use-integers-for-local-revs
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 96330b694c74ab4bd386f62387a0fdc2052863e5
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Wed May 31 18:17:17 2017 -0400

    Fix compatibility with master local document revisions
    
    Previously local doc revisions were integers. Keep them that way to allow
    downgrading back to previous CouchDB version.
---
 src/couch/src/couch_bt_engine.erl  | 17 +++++++----------
 src/couch/src/couch_db_updater.erl |  8 ++++----
 src/couch/src/test_engine_util.erl |  6 +++---
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl
index ca98d01..36636f3 100644
--- a/src/couch/src/couch_bt_engine.erl
+++ b/src/couch/src/couch_bt_engine.erl
@@ -593,27 +593,24 @@ seq_tree_reduce(reduce, DocInfos) ->
 seq_tree_reduce(rereduce, Reds) ->
     lists:sum(Reds).
 
-
-local_tree_split(#doc{} = Doc) ->
+local_tree_split(#doc{revs = {0, [Rev]}} = Doc) when is_binary(Rev) ->
     #doc{
         id = Id,
-        revs = {0, [Rev]},
         body = BodyData
     } = Doc,
-    {Id, {Rev, BodyData}}.
-
-
-local_tree_join(Id, {Rev, BodyData}) when is_binary(Rev) ->
+    {Id, {binary_to_integer(Rev), BodyData}};
+local_tree_split(#doc{revs = {0, [Rev]}} = Doc) when is_integer(Rev) ->
     #doc{
         id = Id,
-        revs = {0, [Rev]},
         body = BodyData
-    };
+    } = Doc,
+    {Id, {Rev, BodyData}}.
+
 
 local_tree_join(Id, {Rev, BodyData}) when is_integer(Rev) ->
     #doc{
         id = Id,
-        revs = {0, [list_to_binary(integer_to_list(Rev))]},
+        revs = {0, [integer_to_binary(Rev)]},
         body = BodyData
     }.
 
diff --git a/src/couch/src/couch_db_updater.erl b/src/couch/src/couch_db_updater.erl
index 4b591b3..7577fe5 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -645,17 +645,17 @@ update_local_doc_revs(Docs) ->
         } = NewDoc,
         case PrevRevs of
             [RevStr | _] ->
-                PrevRev = list_to_integer(?b2l(RevStr));
+                PrevRev = binary_to_integer(RevStr);
             [] ->
                 PrevRev = 0
         end,
         NewRev = case Delete of
             false ->
-                ?l2b(integer_to_list(PrevRev + 1));
+                PrevRev + 1;
             true  ->
-                <<"0">>
+                0
         end,
-        send_result(Client, NewDoc, {ok, {0, NewRev}}),
+        send_result(Client, NewDoc, {ok, {0, integer_to_binary(NewRev)}}),
         NewDoc#doc{
             revs = {0, [NewRev]}
         }
diff --git a/src/couch/src/test_engine_util.erl b/src/couch/src/test_engine_util.erl
index d19b7f1..c81acd0 100644
--- a/src/couch/src/test_engine_util.erl
+++ b/src/couch/src/test_engine_util.erl
@@ -161,13 +161,13 @@ gen_local_write(Engine, St, {Action, {DocId, Body}}) ->
         [#doc{revs = {0, []}}] ->
             0;
         [#doc{revs = {0, [RevStr | _]}}] ->
-            list_to_integer(binary_to_list(RevStr))
+            binary_to_integer(RevStr)
     end,
     {RevId, Deleted} = case Action of
         Action when Action == create; Action == update ->
-            {list_to_binary(integer_to_list(PrevRev + 1)), false};
+            {PrevRev + 1, false};
         delete ->
-            {<<"0">>, true}
+            {0, true}
     end,
     #doc{
         id = DocId,

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.