cloudant/bigcouch — Issue #85: Having purge problems
Author: bdionne
Created: 2011-12-03 11:28:31+00:00
State: open

Hi,

I using bigcouch and ran into a purge problem very similar to that purge problem posted back on May 3, 2010 with the same subject title. I'm wondering if the 'bug' that Chris referred to has been fixed.

In my case, I have a bigcouch db with the standard 8 shards and 3 replicas each. I issued a purge to one of the deleted document in one of the replica as follows:

curl -d '{"kai_test1" : ["28-c3e23a0804e4a083e34e433037dfecf9" ] }' -H "Content-Type: application/json" -X POST http://172.26.172.20:5986/shards%2F80000000-9fffffff%2Fkai_testdb.1320702717/_purge

and got:

{"error":"{{badarity,{#Fun,\n [{16,<<10,23,147,107,229,215,213,57,146,60,126,44,5,163,29,166>>},\n {leaf,true,790623,37,4,[]}]}},\n [{couch_key_tree,map_leafs_simple,3},\n {couch_key_tree,map_leafs_simple,3},\n {couch_key_tree,map_leafs,2},\n {couch_db_updater,'-handle_call/3-fun-2-',2},\n {lists,mapfoldl,3},\n {couch_db_updater,handle_call,3},\n {gen_server,handle_msg,5},\n {proc_lib,init_p_do_apply,3}]}","reason":"{gen_server,call,\n [<0.173.0>,\n {purge_docs,[{<<\"kai_test1\">>,\n [{28,\n <<195,226,58,8,4,228,160,131,227,78,67,48,\n 55,223,236,249>>}]}]}]}"}

Inspecting the log file I found:

Log entries start --------------->
[Fri, 02 Dec 2011 19:16:01 GMT] [error] [<0.173.0>] [--------] ** Generic server <0.173.0> terminating
** Last message in was {purge_docs,[{<<"kai_test1">>,
[{28,
<<195,226,58,8,4,228,160,131,227,
78,67,48,55,223,236,249>>}]}]}
** When Server state == {db,<0.173.0>,nil,nil,<<"1321573786451211">>,
<0.172.0>,#Ref<0.0.0.323>,
{db_header,5,38,0,
{816239,{1,1,244}},
{816190,2},
{823388,[]},
4,816293,nil,1000},
38,
{btree,<0.172.0>,
{816239,{1,1,244}},
#Fun,
#Fun,
undefined,
#Fun},
{btree,<0.172.0>,
{816190,2},
#Fun,
#Fun,
undefined,
#Fun},
{btree,<0.172.0>,
{823388,[]},
undefined,undefined,undefined,nil},
38,
<<"shards/80000000-9fffffff/kai_testdb.1320702717">>,
"/ghostcache/edgedata/data/shards/80000000-9fffffff/kai_testdb.1320702717.couch",
[],[],nil,
{user_ctx,null,[],undefined},
nil,1000,
[before_header,after_header,on_file_open],
false}
** Reason for termination ==
** {{badarity,{#Fun,
[{16,
<<10,23,147,107,229,215,213,57,146,60,126,44,5,163,29,166>>},
{leaf,true,790623,37,4,[]}]}},
[{couch_key_tree,map_leafs_simple,3},
{couch_key_tree,map_leafs_simple,3},
{couch_key_tree,map_leafs,2},
{couch_db_updater,'-handle_call/3-fun-2-',2},
{lists,mapfoldl,3},
{couch_db_updater,handle_call,3},
{gen_server,handle_msg,5},
{proc_lib,init_p_do_apply,3}]}

[Fri, 02 Dec 2011 19:16:01 GMT] [error] [<0.173.0>] [--------] {error_report,<0.78.0>,
{<0.173.0>,crash_report,
[[{initial_call,{couch_db_updater,init,['Argument__1']}},
{pid,<0.173.0>},
{registered_name,[]},
{error_info,
{exit,
{{badarity,
{#Fun,
[{16,
<<10,23,147,107,229,215,213,57,146,60,126,44,5,163,29,
166>>},
{leaf,true,790623,37,4,[]}]}},
[{couch_key_tree,map_leafs_simple,3},
{couch_key_tree,map_leafs_simple,3},
{couch_key_tree,map_leafs,2},
{couch_db_updater,'-handle_call/3-fun-2-',2},
{lists,mapfoldl,3},
{couch_db_updater,handle_call,3},
{gen_server,handle_msg,5},
{proc_lib,init_p_do_apply,3}]},
[{gen_server,terminate,6},{proc_lib,init_p_do_apply,3}]}},
{ancestors,[<0.171.0>]},
{messages,[{'DOWN',#Ref<0.0.0.323>,process,<0.172.0>,normal}]},
{links,[<0.86.0>]},
{dictionary,[]},
{trap_exit,false},
{status,running},
{heap_size,6765},
{stack_size,24},
{reductions,296138}],
[]]}}

[Fri, 02 Dec 2011 19:16:01 GMT] [error] [<0.32544.39>] [--------] Uncaught error in HTTP request: {exit,
{{{badarity,
{#Fun,
[{16,
<<10,23,147,107,229,215,213,57,146,60,
126,44,5,163,29,166>>},
{leaf,true,790623,37,4,[]}]}},
[{couch_key_tree,map_leafs_simple,3},
{couch_key_tree,map_leafs_simple,3},
{couch_key_tree,map_leafs,2},
{couch_db_updater,
'-handle_call/3-fun-2-',2},
{lists,mapfoldl,3},
{couch_db_updater,handle_call,3},
{gen_server,handle_msg,5},
{proc_lib,init_p_do_apply,3}]},
{gen_server,call,
[<0.173.0>,
{purge_docs,
[{<<"kai_test1">>,
[{28,
<<195,226,58,8,4,228,160,131,
227,78,67,48,55,223,236,249>>}]}]}]}}}

[Fri, 02 Dec 2011 19:16:01 GMT] [info] [<0.30348.2>] [--------] Shutting down group server <<"_design/kai_test">>, db <0.173.0> closing w/ reason
{{badarity,{#Fun,
[{16,<<10,23,147,107,229,215,213,57,146,60,126,44,5,163,29,166>>},
{leaf,true,790623,37,4,[]}]}},
[{couch_key_tree,map_leafs_simple,3},
{couch_key_tree,map_leafs_simple,3},
{couch_key_tree,map_leafs,2},
{couch_db_updater,'-handle_call/3-fun-2-',2},
{lists,mapfoldl,3},
{couch_db_updater,handle_call,3},
{gen_server,handle_msg,5},
{proc_lib,init_p_do_apply,3}]}

[Fri, 02 Dec 2011 19:16:01 GMT] [info] [<0.86.0>] [--------] db shards/80000000-9fffffff/kai_testdb.1320702717 died with reason {{badarity,
{#Fun,
[{16,
<<10,23,
147,107,
229,215,
213,57,
146,60,
126,44,
5,163,
29,166>>},
{leaf,
true,
790623,
37,4,
[]}]}},
[{couch_key_tree,
map_leafs_simple,
{couch_key_tree,
map_leafs_simple,
3},
{couch_key_tree,
map_leafs,
2},
{couch_db_updater,
'-handle_call/3-fun-2-',
2},
{lists,
mapfoldl,
3},
{couch_db_updater,
handle_call,
3},
{gen_server,
handle_msg,
5},
{proc_lib,
init_p_do_apply,
3}]}

[Fri, 02 Dec 2011 19:16:01 GMT] [info] [<0.32544.39>] [--------] Stacktrace: [{gen_server,call,2},
{couch_httpd_db,db_req,2},
{couch_httpd_db,do_db_req,2},
{couch_httpd,handle_request_int,5},
{mochiweb_http,headers,5},
{proc_lib,init_p_do_apply,3}]
<--------------- Log entries end

Retrying the purge on the same and different nodes resulted in the same error:

curl -d '{"kai_test1" : ["28-c3e23a0804e4a083e34e433037dfecf9" ] }' -H "Content-Type: application/json" -X POST http://172.26.172.23:5986/shards%2F80000000-9fffffff%2Fkai_testdb.1320702717/_purge
{"error":"{{badarity,{#Fun,\n [{16,<<10,23,147,107,229,215,213,57,146,60,126,44,5,163,29,166>>},\n {leaf,true,331871,16,4,[]}]}},\n [{couch_key_tree,map_leafs_simple,3},\n {couch_key_tree,map_leafs_simple,3},\n {couch_key_tree,map_leafs,2},\n {couch_db_updater,'-handle_call/3-fun-2-',2},\n {lists,mapfoldl,3},\n {couch_db_updater,handle_call,3},\n {gen_server,handle_msg,5},\n {proc_lib,init_p_do_apply,3}]}","reason":"{gen_server,call,\n [<0.27970.1>,\n {purge_docs,[{<<\"kai_test1\">>,\n [{28,\n <<195,226,58,8,4,228,160,131,227,78,67,48,\n 55,223,236,249>>}]}]}]}"}

curl http://172.26.172.20:5986/shards%2F80000000-9fffffff%2Fkai_testdb.1320702717/_changes
{"results":[
{"seq":26,"id":"_design/kai_test","changes":[{"rev":"1-d0cfa677bd2318976b9e8b647df25cf6"}]},
{"seq":37,"id":"kai_test1","changes":[{"rev":"28-c3e23a0804e4a083e34e433037dfecf9"}],"deleted":true}
],
"last_seq":37}

curl http://172.26.172.20:5986/shards%2F80000000-9fffffff%2Fkai_testdb.1320702717/_all_docs
{"total_rows":1,"offset":0,"rows":[
{"id":"_design/kai_test","key":"_design/kai_test","value":{"rev":"1-d0cfa677bd2318976b9e8b647df25cf6"}}
]}

curl http://172.26.172.20:5986/shards%2F80000000-9fffffff%2Fkai_testdb.1320702717/_changes
{"results":[
{"seq":26,"id":"_design/kai_test","changes":[{"rev":"1-d0cfa677bd2318976b9e8b647df25cf6"}]},
{"seq":37,"id":"kai_test1","changes":[{"rev":"28-c3e23a0804e4a083e34e433037dfecf9"}],"deleted":true}
],
"last_seq":37}

curl -d '{"kai_test1" : ["28-c3e23a0804e4a083e34e433037dfecf9" ] }' -H "Content-Type: application/json" -X POST http://172.26.172.20:5986/shards%2F80000000-9fffffff%2Fkai_testdb.1320702717/_purge
{"error":"{{badarity,{#Fun,\n [{16,<<10,23,147,107,229,215,213,57,146,60,126,44,5,163,29,166>>},\n {leaf,true,790623,37,4,[]}]}},\n [{couch_key_tree,map_leafs_simple,3},\n {couch_key_tree,map_leafs_simple,3},\n {couch_key_tree,map_leafs,2},\n {couch_db_updater,'-handle_call/3-fun-2-',2},\n {lists,mapfoldl,3},\n {couch_db_updater,handle_call,3},\n {gen_server,handle_msg,5},\n {proc_lib,init_p_do_apply,3}]}","reason":"{gen_server,call,\n [<0.32635.39>,\n {purge_docs,[{<<\"kai_test1\">>,\n [{28,\n <<195,226,58,8,4,228,160,131,227,78,67,48,\n 55,223,236,249>>}]}]}]}"}

Any idea why this is still happening?

Thanks,

Kai