Re-order log statements to be correct for segment and top level warming.

This commit is contained in:
Martijn van Groningen 2014-04-23 17:13:44 +07:00
parent 640085c45d
commit f8d35d81d8
3 changed files with 35 additions and 4 deletions

View File

@ -88,6 +88,19 @@ public interface IndicesWarmer {
public IndexReader indexReader() {
return indexReader;
}
@Override
public String toString() {
final String value;
if (newSearcher != null) {
value = newSearcher.reader().toString();
} else if (indexReader != null) {
value = indexReader.toString();
} else {
value = "null";
}
return "WarmerContext: " + value;
}
}
void addListener(Listener listener);

View File

@ -93,9 +93,9 @@ public class InternalIndicesWarmer extends AbstractComponent implements IndicesW
}
if (logger.isTraceEnabled()) {
if (topReader) {
logger.trace("[{}][{}] warming [{}]", context.shardId().index().name(), context.shardId().id(), context.newSearcher().reader());
logger.trace("[{}][{}] top warming [{}]", context.shardId().index().name(), context.shardId().id(), context);
} else {
logger.trace("[{}][{}] top warming [{}]", context.shardId().index().name(), context.shardId().id(), context.indexReader());
logger.trace("[{}][{}] warming [{}]", context.shardId().index().name(), context.shardId().id(), context);
}
}
indexShard.warmerService().onPreWarm();
@ -116,9 +116,9 @@ public class InternalIndicesWarmer extends AbstractComponent implements IndicesW
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
if (topReader) {
logger.warn("warming has been interrupted", e);
} else {
logger.warn("top warming has been interrupted", e);
} else {
logger.warn("warming has been interrupted", e);
}
break;
}

View File

@ -49,4 +49,22 @@ public class FieldDataLoadingTests extends ElasticsearchIntegrationTest {
assertThat(response.getIndicesStats().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
}
@Test
public void testEagerGlobalOrdinalsFieldDataLoading() throws Exception {
assertAcked(prepareCreate("test")
.addMapping("type", jsonBuilder().startObject().startObject("type").startObject("properties")
.startObject("name")
.field("type", "string")
.startObject("fielddata").field("loading", "eager_global_ordinals").endObject()
.endObject()
.endObject().endObject().endObject()));
ensureGreen();
client().prepareIndex("test", "type", "1").setSource("name", "name").get();
client().admin().indices().prepareRefresh("test").get();
ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get();
assertThat(response.getIndicesStats().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
}
}