You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2018/03/26 20:55:57 UTC

[couchdb] 26/33: WIP - update couch_mrview

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

davisp pushed a commit to branch COUCHDB-3326-clustered-purge-davisp-refactor
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit abac0e04805ce57e62c188de3f63f0a7d42540b3
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Mon Mar 26 13:28:46 2018 -0500

    WIP - update couch_mrview
---
 src/couch_mrview/src/couch_mrview_index.erl | 30 ++++++++---------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/src/couch_mrview/src/couch_mrview_index.erl b/src/couch_mrview/src/couch_mrview_index.erl
index 3f04f8f..1b0adf0 100644
--- a/src/couch_mrview/src/couch_mrview_index.erl
+++ b/src/couch_mrview/src/couch_mrview_index.erl
@@ -299,21 +299,7 @@ maybe_create_local_purge_doc(DbName, #doc{}=DDoc) ->
 
 
 update_local_purge_doc(Db, State) ->
-    Sig = couch_index_util:hexsig(get(signature, State)),
-    Doc = couch_doc:from_json_obj({[
-        {<<"_id">>, couch_mrview_util:get_local_purge_doc_id(Sig)},
-        {<<"purge_seq">>, get(purge_seq, State)},
-        {<<"timestamp_utc">>, couch_util:utc_string()},
-        {<<"verify_module">>, <<"couch_mrview_index">>},
-        {<<"verify_function">>, <<"verify_index_exists">>},
-        {<<"verify_options">>, {[
-            {<<"dbname">>, get(db_name, State)},
-            {<<"ddoc_id">>, get(idx_name, State)},
-            {<<"signature">>, Sig}
-        ]}},
-        {<<"type">>, <<"mrview">>}
-    ]}),
-    couch_db:update_doc(Db, Doc, []).
+    update_local_purge_doc(Db, State, get(purge_seq, State)).
 
 
 update_local_purge_doc(Db, State, PSeq) ->
@@ -321,18 +307,18 @@ update_local_purge_doc(Db, State, PSeq) ->
     DocId = couch_mrview_util:get_local_purge_doc_id(Sig),
     case couch_db:open_doc(Db, DocId, []) of
         {not_found, _Reason} ->
+            {Mega, Secs, _} = os:timestamp(),
+            NowSecs = Mega * 1000000 + Secs,
             Doc = couch_doc:from_json_obj({[
                 {<<"_id">>, DocId},
+                {<<"type">>, <<"mrview">>},
                 {<<"purge_seq">>, PSeq},
-                {<<"timestamp_utc">>, couch_util:utc_string()},
+                {<<"updated_on">>, NowSecs},
                 {<<"verify_module">>, <<"couch_mrview_index">>},
                 {<<"verify_function">>, <<"verify_index_exists">>},
-                {<<"verify_options">>, {[
-                    {<<"dbname">>, State#mrst.db_name},
-                    {<<"ddoc_id">>, State#mrst.idx_name},
-                    {<<"signature">>, Sig}
-                ]}},
-                {<<"type">>, <<"mrview">>}
+                {<<"dbname">>, State#mrst.db_name},
+                {<<"ddoc_id">>, State#mrst.idx_name},
+                {<<"signature">>, Sig}
             ]}),
             couch_db:update_doc(Db, Doc, []);
         {ok, _LocalPurgeDoc} ->

-- 
To stop receiving notification emails like this one, please contact
davisp@apache.org.