Skip to content

Commit

Permalink
relase 2.1.1-10
Browse files Browse the repository at this point in the history
  • Loading branch information
vroyer committed May 13, 2016
1 parent be03074 commit 5dcbf0d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,13 @@ public ClusterState execute(ClusterState currentState) throws Exception {
}
// now, put the request settings, so they override templates
indexSettingsBuilder.put(request.settings());
indexSettingsBuilder.put(SETTING_NUMBER_OF_SHARDS, MetaDataCreateIndexService.this.clusterService.state().nodes().size());

String keyspace = (indexSettingsBuilder.get(IndexMetaData.SETTING_KEYSPACE_NAME) == null) ? request.index() : indexSettingsBuilder.get(IndexMetaData.SETTING_KEYSPACE_NAME);
if (Schema.instance != null && Schema.instance.getKeyspaceInstance(keyspace) != null) {
indexSettingsBuilder.put(SETTING_NUMBER_OF_REPLICAS, Schema.instance.getKeyspaceInstance(keyspace).getReplicationStrategy().getReplicationFactor() - 1 );
} else {
int number_of_replicas = Math.min( request.settings().getAsInt(SETTING_NUMBER_OF_REPLICAS, settings.getAsInt(SETTING_NUMBER_OF_REPLICAS, 0)) , MetaDataCreateIndexService.this.clusterService.state().nodes().size());
int number_of_replicas = Math.min( request.settings().getAsInt(SETTING_NUMBER_OF_REPLICAS, settings.getAsInt(SETTING_NUMBER_OF_REPLICAS, 0)) , MetaDataCreateIndexService.this.clusterService.state().nodes().size()-1);
indexSettingsBuilder.put(SETTING_NUMBER_OF_REPLICAS, number_of_replicas);
}

Expand Down

0 comments on commit 5dcbf0d

Please sign in to comment.