Revision 636236336130 () - Diff

Link to this snippet: https://friendpaste.com/45AOdi9MkFrS4BPsov7Lg8
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Erlang R14B02 (erts-5.8.3) [source] [smp:2:2] [rq:2] [async-threads:4] [hipe] [kernel-poll:true]

Eshell V5.8.3 (abort with ^G)
1> Apache CouchDB 1.2.0a7a6f6ee-git (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [<0.37.0>] Apache CouchDB has started on http://127.0.0.1:5984/

1> rr("src/couchdb/couch_db.hrl").
[att,btree,changes_args,db,db_header,doc,doc_info,
extern_resp_args,full_doc_info,group,httpd,index_header,
reduce_fold_helper_funs,rev_info,user_ctx,view,
view_fold_helper_funs,view_query_args]
2> {ok, Db} = couch_db:open_int(<<"large1kb">>, []).
{ok,#db{main_pid = <0.179.0>,update_pid = <0.180.0>,
compactor_pid = nil,
instance_start_time = <<"1301861125471547">>,fd = <0.181.0>,
updater_fd = <0.177.0>,fd_ref_counter = <0.183.0>,
header = #db_header{disk_version = 5,update_seq = 341301,
unused = 0,
fulldocinfo_by_id_btree_state = {480339898,{341298,0}},
docinfo_by_seq_btree_state = {480336370,341298},
local_docs_btree_state = {480317540,[]},
purge_seq = 1,purged_docs = 480340016,
security_ptr = 480321636,revs_limit = 1000},
committed_update_seq = 341301,
fulldocinfo_by_id_btree = #btree{fd = <0.177.0>,
root = {480339898,{341298,0}},
extract_kv = #Fun<couch_db_updater.10.91297870>,
assemble_kv = #Fun<couch_db_updater.11.29248762>,
less = #Fun<couch_btree.5.3534514>,
reduce = #Fun<couch_db_updater.12.101621643>},
docinfo_by_seq_btree = #btree{fd = <0.177.0>,
root = {480336370,341298},
extract_kv = #Fun<couch_db_updater.13.112240718>,
assemble_kv = #Fun<couch_db_updater.14.90543234>,
less = #Fun<couch_btree.5.3534514>,
reduce = #Fun<couch_db_updater.15.111854220>},
local_docs_btree = #btree{fd = <0.177.0>,
root = {480317540,[]},
extract_kv = #Fun<couch_btree.0.8709291>,
assemble_kv = #Fun<couch_btree.1.100429438>,
less = #Fun<couch_btree.2.3534514>,reduce = nil},
update_seq = 341301,name = <<"large1kb">>,
filepath = "/home/fdmanana/git/hub/couchdb/tmp/lib/large1kb.couch",
validate_doc_funs = [],
security = [{<<"admins">>,
{[{<<"names">>,[]},{<<"roles">>,[<<...>>|...]}]}},
{<<"members">>,{[{<<"names">>,[]},{<<"role"...>>,[]}]}}],
security_ptr = 480321636,
user_ctx = #user_ctx{name = null,roles = [],
handler = undefined},
waiting_delayed_commit = nil,revs_limit = 1000,
fsync_options = [before_header,after_header,on_file_open],
options = []}}
3>
3> HBin = term_to_binary(Db#db.header).
<<131,104,11,100,0,9,100,98,95,104,101,97,100,101,114,97,
5,98,0,5,53,53,97,0,104,2,98,28,161,...>>
4> byte_size(HBin).
77
5> byte_size(element(2, snappy:compress(HBin))).
69
6> byte_size(element(2, snappy:compress(HBin))).
69
7> {ok, Root} = couch_file:pread_binary(Db#db.fd, 480339898).
{ok,<<131,104,2,100,0,7,107,112,95,110,111,100,101,108,0,
0,0,3,104,2,109,0,0,0,9,100,111,...>>}
8> RootBin = term_to_binary(Root).
<<131,109,0,0,0,114,131,104,2,100,0,7,107,112,95,110,111,
100,101,108,0,0,0,3,104,2,109,0,0,...>>
9> byte_size(RootBin).
120
10> byte_size(element(2, snappy:compress(RootBin))).
104
11> SecBin = term_to_binary(Db#db.security).
<<131,108,0,0,0,2,104,2,109,0,0,0,6,97,100,109,105,110,
115,104,1,108,0,0,0,2,104,2,109,...>>
12> byte_size(SecBin).
127
13> byte_size(element(2, snappy:compress(SecBin))).
80
14> {ok, Doc4Json} = file:read_file("../seatoncouch/doc_4k.json").
{ok,<<"{\n\"data3\":\"ColreUHAtuYoUOx1N4ZloouQt2o6ugnUT6eYtS10gu7niM8i0vEiNufpk1RlMQXaHXlIwQBDsMFDFUQcFeg2vW5eD259Xm\",\n"...>>}
15> DocBin = term_to_binary(couch_util:json_decode(Doc4Json)).
<<131,104,1,108,0,0,0,9,104,2,109,0,0,0,5,100,97,116,97,
51,109,0,0,0,94,67,111,108,114,...>>
16> byte_size(DocBin).
5942
17> byte_size(element(2, snappy:compress(DocBin))).
2930
18>