You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "nickva (via GitHub)" <gi...@apache.org> on 2025/02/19 18:09:26 UTC

[I] purge_infos throws a function clause error when there are more infos than purge_info_limit [couchdb]

nickva opened a new issue, #5438:
URL: https://github.com/apache/couchdb/issues/5438

   Something like this reproduces it on a q=2 (default) dev cluster on main:
   
   
   ```
   #!/bin/bash
   
   # ./dev/run --admin=adm:pass -n1
   # "http" is httpie (https://httpie.io)
   
   DB=http://adm:pass@127.0.0.1:15984
   
   http -q delete $DB/db
   http -q put $DB/db
   
   
   
   http -b $DB/db/_purged_infos
   # {
   #     "purged_infos": []
   # }
   
   for DOC in {1..3000}; do
      echo "doc ${DOC}"
      REV=$(http put $DB/db/${DOC} a=b | jq -r '.rev')
      http -q post $DB/db/_purge ${DOC}:="[\"${REV}\"]"
   done
   
   # [error] 2025-02-19T18:04:57.333061Z node1@127.0.0.1 <0.18552.4> 187d99d1d9 rpc couch_db:fold_purge_infos/4 {invalid_start_purge_seq,0} [{couch_bt_engine,fold_purge_infos,5,[{file,"src/couch_bt_engine.erl"},{line,611}]},{fabric_rpc,with_db,3,[{file,"src/fabric_rpc.erl"},{line,360}]},{rexi_server,init_p,3,[{file,"src/rexi_server.erl"},{line,141}]}]
   # [error] 2025-02-19T18:04:57.333172Z node1@127.0.0.1 <0.18553.4> 187d99d1d9 rpc couch_db:fold_purge_infos/4 {invalid_start_purge_seq,0} [{couch_bt_engine,fold_purge_infos,5,[{file,"src/couch_bt_engine.erl"},{line,611}]},{fabric_rpc,with_db,3,[{file,"src/fabric_rpc.erl"},{line,360}]},{rexi_server,init_p,3,[{file,"src/rexi_server.erl"},{line,141}]}]
   
   http -b $DB/db/_purged_infos
   # {
   #     "purged_infos": [
   #         {
   #             "id": "doc1",
   #             "revs": [
   #                 "1-4b8a35d3f70a5962f86c6dd06ceb599c"
   #             ]
   #         },
   #         {
   #             "id": "doc2",
   #             "revs": [
   #                 "1-43ca4ac5f035a3057752750224f3c1d1"
   #             ]
   #         }
   #     ], ...
   # }
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] purge_infos throws a function clause error when there are more infos than purge_info_limit [couchdb]

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on issue #5438:
URL: https://github.com/apache/couchdb/issues/5438#issuecomment-2669408920

   The error
   
   ```
   [error] 2025-02-19T18:04:57.333061Z node1@127.0.0.1 <0.18552.4> 187d99d1d9 rpc 
    couch_db:fold_purge_infos/4 {invalid_start_purge_seq,0} 
     [{couch_bt_engine,fold_purge_infos,5,[{file,"src/couch_bt_engine.erl"},{line,611}]},
     {fabric_rpc,with_db,3,[{file,"src/fabric_rpc.erl"},{line,360}]},{rexi_server,init_p,3,[{file,"src/rexi_server.erl"},{line,141}]}]
   
   [error] 2025-02-19T18:04:57.333172Z node1@127.0.0.1 <0.18553.4> 187d99d1d9 rpc 
    couch_db:fold_purge_infos/4 {invalid_start_purge_seq,0} 
     [{couch_bt_engine,fold_purge_infos,5,[{file,"src/couch_bt_engine.erl"},{line,611}]},
     {fabric_rpc,with_db,3,[{file,"src/fabric_rpc.erl"},{line,360}]},{rexi_server,init_p,3,[{file,"src/rexi_server.erl"},{line,141}]}]
   ```
   
   Indicates that we're at least not properly fetching the lowest (min) sequence before iterating/returning purged_infos


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] purge_infos throws a function clause error when there are more infos than purge_info_limit [couchdb]

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on issue #5438:
URL: https://github.com/apache/couchdb/issues/5438#issuecomment-2676007273

   In the meantime I got a quick fix for the `purges_infos` error at least https://github.com/apache/couchdb/pull/5440. With a few improvements discussed in dev slack with ideas from Paul and Jan (add a comment, add min value in the error, add a helper).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] purge_infos throws a function clause error when there are more infos than purge_info_limit [couchdb]

Posted by "rnewson (via GitHub)" <gi...@apache.org>.
rnewson commented on issue #5438:
URL: https://github.com/apache/couchdb/issues/5438#issuecomment-2670835628

   we should also ponder if
   
   ```
   src/dreyfus/src/dreyfus_index_updater.erl:        {ok, {ExcludeList, NewPurgeSeq}} = couch_db:fold_purge_infos(
   src/dreyfus/src/dreyfus_index_updater.erl-            Db, IdxPurgeSeq, FoldFun, {[], 0}, []
   src/dreyfus/src/dreyfus_index_updater.erl-        ),
   ```
   
   is correct (the `{[], 0}` initial acc).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] purge_infos throws a function clause error when there are more infos than purge_info_limit [couchdb]

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva closed issue #5438: purge_infos throws a function clause error when there are more infos than purge_info_limit
URL: https://github.com/apache/couchdb/issues/5438


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] purge_infos throws a function clause error when there are more infos than purge_info_limit [couchdb]

Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on issue #5438:
URL: https://github.com/apache/couchdb/issues/5438#issuecomment-2676006724

   Good idea to check dreyfus and nouveau indexes.
   
   I took a quick look and noticed a few odd things yeah that issue in dreyfus looks suspicious
   
   1) Yeah that issue in dreyfus looks you pointed you looks suspicious: https://github.com/apache/couchdb/blob/86fec4e924e4718981f3a804e68ad41506ef9127/src/dreyfus/src/dreyfus_index_updater.erl#L116-L118 We get the purge start sequence from the index in https://github.com/apache/couchdb/blob/86fec4e924e4718981f3a804e68ad41506ef9127/src/dreyfus/src/dreyfus_index_updater.erl#L91 and then iterate starting from that. However, if we call that function and do not process any purges it seem the accumulator would return `0` and then we'd be setting a `0` purge sequence in the index in `clouseau_rpc:set_purge_seq(IndexPid, 0)`. Then, next time we have to purge anything, and we moved past the purge infos limit, we may be in trouble since we'd be starting from `0` suddenly.
   
   2) In MR views we initialize the view header with the current db purge sequence in https://github.com/apache/couchdb/blob/86fec4e924e4718981f3a804e68ad41506ef9127/src/couch_mrview/src/couch_mrview_util.erl#L352-L359 we do that in dreyfus https://github.com/apache/couchdb/blob/86fec4e924e4718981f3a804e68ad41506ef9127/src/dreyfus/src/dreyfus_util.erl#L351 but I am not sure if we do that for the nouveau? I couldn't find it.
   
   3) In nouveau purge index when we update the index I am not sure why we're not recording the purge sequence: https://github.com/apache/couchdb/blob/86fec4e924e4718981f3a804e68ad41506ef9127/src/nouveau/src/nouveau_index_updater.erl#L253-L256


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org