use of org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo in project jackrabbit-oak by apache.
the class LuceneIndexInfoProviderTest method info.
@Test
public void info() throws Exception {
IndexDefinitionBuilder defnBuilder = new IndexDefinitionBuilder();
NodeBuilder builder = store.getRoot().builder();
builder.child("oak:index").setChildNode("fooIndex", defnBuilder.build());
store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
when(asyncService.getInfo("async")).thenReturn(new AsyncIndexInfo("async", 0, 0, false, null));
IndexInfo info = provider.getInfo("/oak:index/fooIndex");
assertNotNull(info);
}
use of org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo in project jackrabbit-oak by apache.
the class LuceneIndexInfoProvider method computeAsyncIndexInfo.
private void computeAsyncIndexInfo(NodeState idxState, String indexPath, LuceneIndexInfo info) {
String asyncName = IndexUtils.getAsyncLaneName(idxState, indexPath);
if (asyncName == null) {
log.warn("No 'async' value for index definition at [{}]. Definition {}", indexPath, idxState);
return;
}
AsyncIndexInfo asyncInfo = asyncInfoService.getInfo(asyncName);
checkNotNull(asyncInfo, "No async info found for name [%s] " + "for index at [%s]", asyncName, indexPath);
info.indexedUptoTime = asyncInfo.getLastIndexedTo();
info.asyncName = asyncName;
}
use of org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo in project jackrabbit-oak by apache.
the class IndexPrinter method printAsyncIndexInfo.
private void printAsyncIndexInfo(PrintWriter pw) {
List<String> asyncLanes = ImmutableList.copyOf(asyncIndexInfoService.getAsyncLanes());
String title = "Async Indexers State";
printTitle(pw, title);
pw.printf("Number of async indexer lanes : %d%n", asyncLanes.size());
pw.println();
for (String lane : asyncLanes) {
pw.println(lane);
AsyncIndexInfo info = asyncIndexInfoService.getInfo(lane);
if (info != null) {
pw.printf(" Last indexed to : %s%n", formatTime(info.getLastIndexedTo()));
IndexStatsMBean stats = info.getStatsMBean();
if (stats != null) {
pw.printf(" Status : %s%n", stats.getStatus());
pw.printf(" Failing : %s%n", stats.isFailing());
pw.printf(" Paused : %s%n", stats.isPaused());
if (stats.isFailing()) {
pw.printf(" Failing since : %s%n", stats.getFailingSince());
pw.printf(" Latest error : %s%n", stats.getLatestError());
}
}
pw.println();
}
}
}
use of org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo in project jackrabbit-oak by apache.
the class IndexPrinterTest method asyncIndexInfo.
@Test
public void asyncIndexInfo() throws Exception {
when(indexInfo.getAllIndexInfo()).thenReturn(emptyList());
when(asyncInfo.getAsyncLanes()).thenReturn(asList("foo-async", "bar-async"));
when(asyncInfo.getInfo("foo-async")).thenReturn(new AsyncIndexInfo("foo-async", 0, 0, false, null));
String output = getPrintOutput();
assertThat(output, containsString("foo-async"));
}
Aggregations