/** * Invoked to mark a local index as bad i.e. where exception was thrown when index was * opened for query. It can h */ public void markBadIndexForRead(String path, Throwable e) { BadIndexInfo badIndex = badIndexesForRead.get(path); if (badIndex == null) { badIndexesForRead.put(path, new BadIndexInfo(path, e, false)); log.error("Could not access the Fulltext index at [{}]", path, e); } else { badIndex.failedAccess(e); log.error("Could not access the Fulltext index at [{}] . {}", path, badIndex.getStats(), e); } }
public boolean isIgnoredBadIndex(String path) { BadIndexInfo badIdx = badIndexesForRead.get(path); if (badIdx == null) { return false; } return !badIdx.tryAgain(); }
assertEquals(0, badIdxInfo.getAccessCount()); assertEquals(1, badIdxInfo.getAccessCount()); assertEquals(0, badIdxInfo.getFailedAccessCount()); assertEquals(2, badIdxInfo.getAccessCount()); assertEquals(0, badIdxInfo.getFailedAccessCount()); assertEquals(3, badIdxInfo.getAccessCount()); assertEquals(1, badIdxInfo.getFailedAccessCount());
/** * Invoked to mark a persisted index as bad i.e. where exception is thrown when index is reopened * after update * * @param path index path * @param e exception */ public void markBadPersistedIndex(String path, Throwable e) { BadIndexInfo badIndex = badPersistedIndexes.get(path); if (badIndex == null) { badPersistedIndexes.put(path, new BadIndexInfo(path, e, true)); log.error("Could not open the Fulltext index at [{}]", path, e); } else { badIndex.failedAccess(e); log.error("Could not open the Fulltext index at [{}] . {}", path, badIndex.getStats(), e); } }
CompositeDataSupport toCompositeData() { Object[] values = new Object[]{ info.path, info.getStats(), String.format("%tc", info.getCreatedTime()), info.getException(), }; try { return new CompositeDataSupport(TYPE, FIELD_NAMES, values); } catch (OpenDataException e) { throw new IllegalStateException(e); } } }
CompositeDataSupport toCompositeData() { Object[] values = new Object[]{ info.path, info.getStats(), String.format("%tc", info.getCreatedTime()), info.getException(), }; try { return new CompositeDataSupport(TYPE, FIELD_NAMES, values); } catch (OpenDataException e) { throw new IllegalStateException(e); } } }
public String getStats() { return String.format("since %s ,%d indexing cycles, accessed %d times", created, getCycleCount(), accessCount); }
public boolean tryAgain() { accessCount++; if (watch.elapsed(TimeUnit.MILLISECONDS) > recheckIntervalMillis) { watch.reset().start(); return true; } if (log.isDebugEnabled()) { log.debug("Ignoring index [{}] which is not working correctly {}", path, getStats()); } return false; }
public void markGoodIndex(String indexPath) { BadIndexInfo info = badIndexesForRead.remove(indexPath); badPersistedIndexes.remove(indexPath); if (info != null) { log.info("Index [{}] which was not working {} is found to be healthy again", indexPath, info.getStats()); } }