Skip to content

Commit

Permalink
Compacting an empy index creates errors.
Browse files Browse the repository at this point in the history
When you compacted an index that didn't contain any data,
GeoCouch spit out a huge stack trace. This commit fixes
the problem.

Change-Id: I201683ea135bf00841734595024e8c7e436292f0
Reviewed-on: http://review.couchbase.org/9781
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Dale Harvey <daleharvey@arandomurl.com>
Reviewed-by: Dale Harvey <daleharvey@arandomurl.com>
  • Loading branch information
vmx authored and Dale Harvey committed Sep 27, 2011
1 parent 2ccd58c commit 4c489f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/geocouch/couch_spatial_compactor.erl
Expand Up @@ -77,7 +77,11 @@ compact_group(Group, EmptyGroup) ->
{ok, NewIdBtree} = couch_btree:add(Bt3, lists:reverse(Uncopied)),

NewIndexes = lists:map(fun({Index, EmptyIndex}) ->
compact_spatial(Fd, EmptyFd, Index, EmptyIndex)
case Index#spatial.treepos of
% Tree is empty, just grab the the FD
nil -> EmptyIndex#spatial{fd = EmptyFd};
_ -> compact_spatial(Fd, EmptyFd, Index, EmptyIndex)
end
end, lists:zip(Indexes, EmptyIndexes)),

NewGroup = EmptyGroup#spatial_group{
Expand Down

0 comments on commit 4c489f4

Please sign in to comment.