Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: cloudant/bigcouch
...
head fork: cloudant/bigcouch
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 7 additions and 4 deletions.
  1. +7 −4 apps/couch/src/couch_btree.erl
11 apps/couch/src/couch_btree.erl
View
@@ -21,6 +21,7 @@
root,
extract_kv,
assemble_kv,
+ chunk_size = 1279,
less,
reduce = nil
}).
@@ -48,6 +49,8 @@ set_options(Bt, []) ->
Bt;
set_options(Bt, [{split, Extract}|Rest]) ->
set_options(Bt#btree{extract_kv=Extract}, Rest);
+set_options(Bt, [{chunk_size, Size}|Rest]) ->
+ set_options(Bt#btree{chunk_size=Size}, Rest);
set_options(Bt, [{join, Assemble}|Rest]) ->
set_options(Bt#btree{assemble_kv=Assemble}, Rest);
set_options(Bt, [{less, Less}|Rest]) ->
@@ -281,9 +284,9 @@ complete_root(Bt, KPs) ->
% written. Plus with the "case byte_size(term_to_binary(InList)) of" code
% it's probably really inefficient.
-chunkify(InList) ->
- BaseChunkSize = list_to_integer(couch_config:get("couchdb",
- "btree_chunk_size", "1279")),
+chunkify(InList, BaseChunkSize) ->
+ %% BaseChunkSize = list_to_integer(couch_config:get("couchdb",
+ %% "btree_chunk_size", "1279")),
case byte_size(term_to_binary(InList)) of
Size when Size > BaseChunkSize ->
NumberOfChunksLikely = ((Size div BaseChunkSize) + 1),
@@ -345,7 +348,7 @@ get_node(#btree{fd = Fd}, NodePos) ->
write_node(Bt, NodeType, NodeList) ->
% split up nodes into smaller sizes
- NodeListList = chunkify(NodeList),
+ NodeListList = chunkify(NodeList, Bt#btree.chunk_size),
% now write out each chunk and return the KeyPointer pairs for those nodes
ResultList = [
begin

No commit comments for this range

Something went wrong with that request. Please try again.