Core: clarify index removal log message
This commit is contained in:
parent
08521a4066
commit
7e0b75625b
|
@ -227,7 +227,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
||||||
@Override
|
@Override
|
||||||
public ClusterState execute(ClusterState currentState) throws Exception {
|
public ClusterState execute(ClusterState currentState) throws Exception {
|
||||||
boolean indexCreated = false;
|
boolean indexCreated = false;
|
||||||
String failureReason = null;
|
String removalReason = null;
|
||||||
try {
|
try {
|
||||||
validate(request, currentState);
|
validate(request, currentState);
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
||||||
try {
|
try {
|
||||||
mapperService.merge(MapperService.DEFAULT_MAPPING, new CompressedString(XContentFactory.jsonBuilder().map(mappings.get(MapperService.DEFAULT_MAPPING)).string()), false);
|
mapperService.merge(MapperService.DEFAULT_MAPPING, new CompressedString(XContentFactory.jsonBuilder().map(mappings.get(MapperService.DEFAULT_MAPPING)).string()), false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
failureReason = "failed on parsing default mapping on index creation";
|
removalReason = "failed on parsing default mapping on index creation";
|
||||||
throw new MapperParsingException("mapping [" + MapperService.DEFAULT_MAPPING + "]", e);
|
throw new MapperParsingException("mapping [" + MapperService.DEFAULT_MAPPING + "]", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
||||||
// apply the default here, its the first time we parse it
|
// apply the default here, its the first time we parse it
|
||||||
mapperService.merge(entry.getKey(), new CompressedString(XContentFactory.jsonBuilder().map(entry.getValue()).string()), true);
|
mapperService.merge(entry.getKey(), new CompressedString(XContentFactory.jsonBuilder().map(entry.getValue()).string()), true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
failureReason = "failed on parsing mappings on index creation";
|
removalReason = "failed on parsing mappings on index creation";
|
||||||
throw new MapperParsingException("mapping [" + entry.getKey() + "]", e);
|
throw new MapperParsingException("mapping [" + entry.getKey() + "]", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
||||||
try {
|
try {
|
||||||
indexMetaData = indexMetaDataBuilder.build();
|
indexMetaData = indexMetaDataBuilder.build();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
failureReason = "failed to build index metadata";
|
removalReason = "failed to build index metadata";
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,11 +466,12 @@ public class MetaDataCreateIndexService extends AbstractComponent {
|
||||||
RoutingAllocation.Result routingResult = allocationService.reroute(ClusterState.builder(updatedState).routingTable(routingTableBuilder).build());
|
RoutingAllocation.Result routingResult = allocationService.reroute(ClusterState.builder(updatedState).routingTable(routingTableBuilder).build());
|
||||||
updatedState = ClusterState.builder(updatedState).routingResult(routingResult).build();
|
updatedState = ClusterState.builder(updatedState).routingResult(routingResult).build();
|
||||||
}
|
}
|
||||||
|
removalReason = "cleaning up after validating index on master";
|
||||||
return updatedState;
|
return updatedState;
|
||||||
} finally {
|
} finally {
|
||||||
if (indexCreated) {
|
if (indexCreated) {
|
||||||
// Index was already partially created - need to clean up
|
// Index was already partially created - need to clean up
|
||||||
indicesService.removeIndex(request.index(), failureReason != null ? failureReason : "failed to create index");
|
indicesService.removeIndex(request.index(), removalReason != null ? removalReason : "failed to create index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue