If the cluster does not contain any indices then index templates do not survive cluster restart, closes #617.

This commit is contained in:
kimchy 2011-01-11 23:38:46 +02:00
parent a0a714e6a5
commit f5a9f2d948
2 changed files with 8 additions and 5 deletions

View File

@ -152,11 +152,6 @@ public class LocalGateway extends AbstractLifecycleComponent<Gateway> implements
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();
@ -179,6 +174,10 @@ public class LocalGateway extends AbstractLifecycleComponent<Gateway> implements
}
@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()) {

View File

@ -149,6 +149,10 @@ public abstract class SharedStorageGateway extends AbstractLifecycleComponent<Ga
}
@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) {