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; }
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; }
@Override public Map<String, Long> getIndexedUptoPerLane() { Map<String, Long> result = new HashMap<>(); for (AsyncIndexInfo info : infos.values()) { result.put(info.getName(), info.getLastIndexedTo()); } return result; }
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(); } } }
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(); } } }
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(); } } }
@Test public void info() throws Exception{ AsyncIndexUpdate async = new AsyncIndexUpdate("foo-async", store, provider); async.run(); Set<String> names = ImmutableSet.copyOf(service.getAsyncLanes()); assertThat(names, containsInAnyOrder("foo-async")); service.bindStatsMBeans(async.getIndexStats()); AsyncIndexInfo info = service.getInfo("foo-async"); assertNotNull(info); assertEquals("foo-async", info.getName()); assertNotNull(info.getStatsMBean()); assertTrue(info.getLastIndexedTo() > -1); assertFalse(info.isRunning()); assertEquals(-1, info.getLeaseExpiryTime()); System.out.println(info); service.unbindStatsMBeans(async.getIndexStats()); AsyncIndexInfo info2 = service.getInfo("foo-async"); assertNull(info2.getStatsMBean()); }