Skip to content

Commit

Permalink
Fix node crash issue caused by unhandled non-error
Browse files Browse the repository at this point in the history
When deleting an index, we were only considering 200 a success.
However, if we tried to delete an index that didn't exist, solr
would return a 404, which we didn't handle. Now we consider that
a success as well.
  • Loading branch information
Paul Henrich authored and paulhenrich committed Oct 14, 2016
1 parent 912c22a commit 356c9bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/yz_index.erl
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ remove_non_owned_data(Index, Ring) ->
LNonOwned = yz_cover:logical_partitions(Ring, NonOwned),
Queries = [{'query', <<?YZ_PN_FIELD_S, ":", (?INT_TO_BIN(LP))/binary>>}
|| LP <- LNonOwned],
ok = yz_solr:delete(Index, Queries),
case yz_solr:delete(Index, Queries) of
ok -> ok;
{error, nothing_to_delete} -> ok
end,
NonOwned.

-spec schema_name(index_info()) -> schema_name().
Expand Down
1 change: 1 addition & 0 deletions src/yz_solr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ delete(Index, Ops) ->
case ibrowse:send_req(URL, Headers, post, JSON, Opts,
?YZ_SOLR_REQUEST_TIMEOUT) of
{ok, "200", _, _} -> ok;
{ok, "404", _, _} -> {error, nothing_to_delete};
Err -> {error, Err}
end.

Expand Down

0 comments on commit 356c9bb

Please sign in to comment.