You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/10/24 07:15:09 UTC

[GitHub] jiangphcn commented on a change in pull request #1676: Downgrade code for Database partitions

jiangphcn commented on a change in pull request #1676: Downgrade code for Database partitions
URL: https://github.com/apache/couchdb/pull/1676#discussion_r227666512
 
 

 ##########
 File path: src/couch/src/couch_bt_engine.erl
 ##########
 @@ -857,6 +868,59 @@ init_state(FilePath, Fd, Header0, Options) ->
     end.
 
 
+downgrade_partition_info(Header) ->
+    % {db_header,
+    %     disk_version = ?LATEST_DISK_VERSION,
+    %     update_seq = 0,
+    %     unused = 0,
+    %     id_tree_state = nil,
+    %     seq_tree_state = nil,
+    %     local_tree_state = nil,
+    %     purge_tree_state = nil,
+    %     purge_seq_tree_state = nil, %purge tree: purge_seq -> uuid
+    %     security_ptr = nil,
+    %     revs_limit = 1000,
+    %     uuid,
+    %     epochs,
+    %     compacted_seq,
+    %     purge_infos_limit = 1000,
+    %     props_ptr
+    % },
+    {
+        db_header,
+        _DiskVer,
+        UpSeq,
+        _Unused,
+        IdTreeState,
+        SeqTreeState,
+        LocalTreeState,
+        PurgeTreeState,
+        PurgeSeqTreeState,
+        SecurityPtr,
+        RevsLimit,
+        Uuid,
+        Epochs,
+        CompactedSeq,
+        _PDocsLimit,
+        _PropsPtr
+    } = Header,
+     
+    NewHeader = couch_bt_engine_header:new(),
+    couch_bt_engine_header:set(NewHeader, [
+        {update_seq, UpSeq},
+        {id_tree_state, IdTreeState},
+        {seq_tree_state, SeqTreeState},
+        {local_tree_state, LocalTreeState},
+        {purge_tree_state, PurgeTreeState},
+        {purge_seq_tree_state, PurgeSeqTreeState},
+        {security_ptr, SecurityPtr},
+        {revs_limit, RevsLimit},
+        {uuid, Uuid},
+        {epochs, Epochs},
+        {compacted_seq, CompactedSeq}
 
 Review comment:
   The value of `purge_infos_limit` can be changed and may not be default. So there is need to write current value to database header as well. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services