witash commented on issue #6118: URL: https://github.com/apache/couchdb/issues/6118#issuecomment-5816467568
@rnewson I don't think #5940 fixes this. The affected instance was already running 3.5.2, which includes #5940 I can also reproduce at least the first error `invalid_start_purge_seq` on a new 3.5.2 instance In any case, can you please provide more detail about what you think the root cause is. Commands to reproduce are below, the summary is: 1. Create a couch 3.5.2 instance with some sample documents 1. create a nouveau index 1. purge more documents than `_purged_infos_limit` 1. trigger compaction to prune history 1. change the signature, or otherwise trigger a rebuild of the nouveau index 1. query the nouveau index and observe the `invalid_start_purge_seq` error in the response 1. (optional) stop nouveau, delete the index files, restart, and query again to observe the same error **#5940 is in 3.5.2** #5940 was merged on 2026-03-25 (fc236b7b3). It reached 3.5.2 through the cherry-pick squash `b1e8718ea`, which lists its purge commits as `cf168c4dc` and `b532e5c2f`. The `initial_purge_seq` sent by the 3.5.2 instance below comes from that code. **Reproduction on 3.5.2** CouchDB 3.5.2 (`5b4d92103`) and a Nouveau server built from 3.5.2, single node. `_purged_infos_limit` is lowered to 10 only to keep the example small. ```sh C=http://admin:[email protected]:5984 H='Content-Type: application/json' ``` 1. Create a Nouveau index on a db with some docs: ```sh curl -X PUT "$C/db?q=1" curl -X PUT "$C/db/_purged_infos_limit" -H "$H" -d 10 curl -X PUT "$C/db/_design/x" -H "$H" -d '{"nouveau":{"idx":{"index":"function(doc){ if (doc.v) { index(\"string\", \"v\", doc.v); } }"}}}' curl -X POST "$C/db/_bulk_docs" -H "$H" -d "$(jq -nc '{docs:[range(50)|{_id:"d\(.)",v:"x"}]}')" curl "$C/db/_design/x/_nouveau/idx?q=*:*" # total_hits: 50 ``` 2. Purge more docs than `_purged_infos_limit`, let the index catch up, and compact ```sh curl -s "$C/db/_all_docs?start_key=%22d%22&limit=30" | jq -c '[.rows[] | {(.id): [.value.rev]}] | add' \ | curl -X POST "$C/db/_purge" -H "$H" -d @- curl "$C/db/_design/x/_nouveau/idx?q=*:*" # total_hits: 20 curl -X POST "$C/db/_compact" -H "$H" ``` 3. Trigger a rebuild of the index, e.g. by changing its signature: ```sh REV=$(curl -s "$C/db/_design/x" | jq -r ._rev) curl -X PUT "$C/db/_design/x" -H "$H" -d '{"_rev":"'"$REV"'","nouveau":{"idx":{"lucene_version":10,"index":"function(doc){ /* v2 */ if (doc.v) { index(\"string\", \"v\", doc.v); } }"}}}' ``` 4. Query the index: ``` $ curl "$C/db/_design/x/_nouveau/idx?q=*:*" {"error":"{invalid_start_purge_seq,0,21}", ...} ``` The CouchDB log has the same stack as the report: ``` nouveau_index_manager: db:db ddoc:_design/x index:idx failed with: {{invalid_start_purge_seq,0,21},[{couch_bt_engine,fold_purge_infos,5,[{file,"src/couch_bt_engine.erl"},{line,601}]},{nouveau_index_updater,purge_index,3,[{file,"src/nouveau_index_updater.erl"},{line,288}]},{nouveau_index_updater,update,1,[{file,"src/nouveau_index_updater.erl"},{line,97}]}]} ``` The new index's `index_definition.json` has `"initial_purge_seq":30`, but Nouveau reports `"purge_seq":0` for it. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
