Skip to content

Commit

Permalink
If the cluster does not contain any indices then index templates do n…
Browse files Browse the repository at this point in the history
…ot survive cluster restart, closes elastic#617.
  • Loading branch information
kimchy committed Jan 11, 2011
1 parent a0a714e commit f5a9f2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Expand Up @@ -152,11 +152,6 @@ public LocalGatewayStartedShards currentStartedShards() {
listener.onSuccess();
return;
}
if (electedState.state().metaData().indices().isEmpty()) {
logger.debug("no indices in metadata");
listener.onSuccess();
return;
}

logger.debug("elected state from [{}]", electedState.node());
final LocalGatewayMetaState state = electedState.state();
Expand All @@ -179,6 +174,10 @@ public LocalGatewayStartedShards currentStartedShards() {
}

@Override public void clusterStateProcessed(ClusterState clusterState) {
if (state.metaData().indices().isEmpty()) {
listener.onSuccess();
return;
}
// go over the meta data and create indices, we don't really need to copy over
// the meta data per index, since we create the index and it will be added automatically
for (final IndexMetaData indexMetaData : state.metaData()) {
Expand Down
Expand Up @@ -149,6 +149,10 @@ private void updateClusterStateFromGateway(final MetaData fMetaData, final Gatew
}

@Override public void clusterStateProcessed(ClusterState clusterState) {
if (fMetaData.indices().isEmpty()) {
listener.onSuccess();
return;
}
// go over the meta data and create indices, we don't really need to copy over
// the meta data per index, since we create the index and it will be added automatically
for (final IndexMetaData indexMetaData : fMetaData) {
Expand Down

0 comments on commit f5a9f2d

Please sign in to comment.