Github user iilyak commented on the issue:
https://github.com/apache/couchdb-couch/pull/228
Tested manually with the following:
```
LL = couch_btree:chunkify(
[{list_to_binary(couch_util:to_hex(crypto:rand_bytes(10))),
binary:copy(<<"x">>, 1300)}
|| _ <- lists:seq(1, 10)]).
length(LL).
Generator = fun(Size, N) ->
[{list_to_binary(couch_util:to_hex(crypto:rand_bytes(10))),
binary:copy(<<"x">>, Size)}
|| _ <- lists:seq(1, N)]
end.
LL = couch_btree:chunkify(Generator(1300, 3)).
[Last | _] = lists:reverse(LL).
[{"Number of chunks", length(LL)}, {"Elements in last chunk",
length(Last)}].
```
The output without this change is:
```
[
{"Number of chunks",5},
{"Elements in last chunk",2}
]
```
The output with this change is:
```
[
{"Number of chunks",1},
{"Elements in last chunk",3}
]
```
+1.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---