Skip to content
Browse files

Clear schema cache after schema update

After updating the schema make sure to clear the cache on all nodes to
make sure the update propagates to all nodes immediately.  If one of
the remote calls fails then that node will still use the old schema so
it's not perfect.  In the future the schema should be gossiped in a
manner similar to the ring in order to get convergence.
  • Loading branch information...
1 parent 16813be commit 90aeb8bdba8cbebe88d363faa165762d651f1dd5 @rzezeski rzezeski committed May 21, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/riak_search_cmd.erl
6 src/riak_search_cmd.erl
@@ -137,6 +137,12 @@ set_schema(Index, SchemaFile) ->
{ok, B} ->
case riak_search_config:put_raw_schema(Index, B) of
ok ->
+ %% Immediately clear the schema cache to avoid
+ %% using old schema.
+ %%
+ %% TODO: Eventually the schema should be gossiped like
+ %% the ring
+ clear_schema_cache(),
io:format(" :: Done.~n");
Error ->
io:format(" :: ERROR: ~p~n", [Error]),

0 comments on commit 90aeb8b

Please sign in to comment.
Something went wrong with that request. Please try again.