[Bug]: View requests fail with a 500 compaction error if queried in between purges
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- erlang, javascript
- Ambito
- databases
Direzione di ricerca
Start with src/couch_mrview_compactor.erl at swap_compacted/2, then trace the commit_compacted call in src/couch_index.erl. Run the linked purge-and-query reproduction script against CouchDB main and observe the purge/view-compaction race. Done means repeated view requests during batched purges no longer return the 500 enoent compaction error.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version
3.5.2
Describe the problem you're encountering
I am seeing this error sporadically (6 out of 3000) when I am doing mass purging and querying a view between purge batches:
GET /purge-view-ghosts-1790228958432/_design/d/_view/v?limit=1
{badmatch,{error,enoent}} | ref 4180022058 | couch_mrview_compactor:swap_compacted/2 (src/couch_mrview_compactor.erl:258)
[{couch_mrview_compactor,swap_compacted,2, [{file,"src/couch_mrview_compactor.erl"},{line,258}]}, {couch_index,commit_compacted,2,[{file,"src/couch_index.erl"},{line,393}]}, {couch_index,handle_call,3,[{file,"src/couch_index.erl"},{line,190}]}, {gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,1131}]}, {gen_server,handle_msg,6,[{file,"gen_server.erl"},{line,1160}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]
Expected Behaviour
View requests should succeed.
Steps to Reproduce
This repro script can be used: https://gist.github.com/dianabarsan/5e21753d6545e6f61429ed31ebe79714
Steps:
- create throwaway db
- create one design doc and one view that would index every doc
- seed db with 300k documents
- with a batch size of 1000, purge all documents, querying the view after each batch
- log any view query errors
Sample result:
attempt 1: 0 ghost view rows, retrying
attempt 2: 0 ghost view rows, retrying
Compaction error during view query
Error: GET /purge-view-ghosts-1790235371583/_design/d/_view/v?limit=1 -> 500 {"error":"{badmatch,{error,enoent}}","reason":"[{couch_mrview_compactor,swap_compacted,2,\n [{file,\"src/couch_mrview_compactor.erl\"},{line,267}]},\n {couch_index,commit_compacted,2,[{file,\"src/couch_index.erl\"},{line,393}]},\n {couch_index,handle_call,3,[{file,\"src/couch_index.erl\"},{line,190}]},\n {gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,2470}]},\n {gen_server,handle_msg,3,[{file,\"gen_server.erl\"},{line,2499}]},\n {proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,333}]}]","ref":106889267}
at async /home/.../scratches/couch-purge-view-ghosts-minimal.js:106:5
attempt 3: 0 ghost view rows, retrying
attempt 4: 0 ghost view rows, retrying
attempt 5: 0 ghost view rows, retrying
Compaction error during view query
Error: GET /purge-view-ghosts-1790235494953/_design/d/_view/v?limit=1 -> 500 {"error":"{badmatch,{error,enoent}}","reason":"[{couch_mrview_compactor,swap_compacted,2,\n [{file,\"src/couch_mrview_compactor.erl\"},{line,267}]},\n {couch_index,commit_compacted,2,[{file,\"src/couch_index.erl\"},{line,393}]},\n {couch_index,handle_call,3,[{file,\"src/couch_index.erl\"},{line,190}]},\n {gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,2470}]},\n {gen_server,handle_msg,3,[{file,\"gen_server.erl\"},{line,2499}]},\n {proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,333}]}]","ref":106889267}
at async /home/.../scratches/couch-purge-view-ghosts-minimal.js:106:5
attempt 6: 0 ghost view rows, retrying
Compaction error during view query
Error: GET /purge-view-ghosts-1790235537142/_design/d/_view/v?limit=1 -> 500 {"error":"{badmatch,{error,enoent}}","reason":"[{couch_mrview_compactor,swap_compacted,2,\n [{file,\"src/couch_mrview_compactor.erl\"},{line,267}]},\n {couch_index,commit_compacted,2,[{file,\"src/couch_index.erl\"},{line,393}]},\n {couch_index,handle_call,3,[{file,\"src/couch_index.erl\"},{line,190}]},\n {gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,2470}]},\n {gen_server,handle_msg,3,[{file,\"gen_server.erl\"},{line,2499}]},\n {proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,333}]}]","ref":106889267}
at async /home/.../scratches/couch-purge-view-ghosts-minimal.js:106:5
attempt 7: 0 ghost view rows, retrying
Compaction error during view query
Error: GET /purge-view-ghosts-1790235581055/_design/d/_view/v?limit=1 -> 500 {"error":"{badmatch,{error,enoent}}","reason":"[{couch_mrview_compactor,swap_compacted,2,\n [{file,\"src/couch_mrview_compactor.erl\"},{line,267}]},\n {couch_index,commit_compacted,2,[{file,\"src/couch_index.erl\"},{line,393}]},\n {couch_index,handle_call,3,[{file,\"src/couch_index.erl\"},{line,190}]},\n {gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,2470}]},\n {gen_server,handle_msg,3,[{file,\"gen_server.erl\"},{line,2499}]},\n {proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,333}]}]","ref":106889267}
at async /home/.../scratches/couch-purge-view-ghosts-minimal.js:106:5
attempt 8: 0 ghost view rows, retrying
Compaction error during view query
Error: GET /purge-view-ghosts-1790235628307/_design/d/_view/v?limit=1 -> 500 {"error":"{badmatch,{error,enoent}}","reason":"[{couch_mrview_compactor,swap_compacted,2,\n [{file,\"src/couch_mrview_compactor.erl\"},{line,267}]},\n {couch_index,commit_compacted,2,[{file,\"src/couch_index.erl\"},{line,393}]},\n {couch_index,handle_call,3,[{file,\"src/couch_index.erl\"},{line,190}]},\n {gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,2470}]},\n {gen_server,handle_msg,3,[{file,\"gen_server.erl\"},{line,2499}]},\n {proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,333}]}]","ref":106889267}
at async /home/.../scratches/couch-purge-view-ghosts-minimal.js:106:5
attempt 9: 0 ghost view rows, retrying
Compaction error during view query
Error: GET /purge-view-ghosts-1790235673510/_design/d/_view/v?limit=1 -> 500 {"error":"{badmatch,{error,enoent}}","reason":"[{couch_mrview_compactor,swap_compacted,2,\n [{file,\"src/couch_mrview_compactor.erl\"},{line,267}]},\n {couch_index,commit_compacted,2,[{file,\"src/couch_index.erl\"},{line,393}]},\n {couch_index,handle_call,3,[{file,\"src/couch_index.erl\"},{line,190}]},\n {gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,2470}]},\n {gen_server,handle_msg,3,[{file,\"gen_server.erl\"},{line,2499}]},\n {proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,333}]}]","ref":106889267}
at async /home/.../scratches/couch-purge-view-ghosts-minimal.js:106:5
attempt 10: 0 ghost view rows, retrying
no ghost rows in 10 attempts
Your Environment
Manjaro Linux, CouchDB main ~ 3.5.2 (to include this commit https://github.com/apache/couchdb/commit/1582cf98c5ac97f701c809ee2668026ff8a9a5b1) in Docker
Additional Context
Branched out of https://github.com/apache/couchdb/issues/6128#issuecomment-5818101233
- Lingua principale
- Erlang
- Stelle
- 7k
- Fork
- 1.1k
- Merge medio
- 1g 18h
- PR unite (30g)
- 15
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/couchdb
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
apache/couchdb#6120 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
apache/couchdb#6118 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement needs-triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
bug needs-triage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Build system smellsApertabug needs-triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
apache/couchdb#6109 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/couchdb
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Add: Prima Sport 5 LogoApertacheck:passed logos:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
request-theme
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
LizardByte/ThemerrDB#8693 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
rohitg00/agentmemory#1428 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno