private synchronized CorruptIndexInfo getOrCreateInfo(String asyncName, String indexPath) { CorruptIndexInfo info = indexes.get(indexPath); if (info == null){ info = new CorruptIndexInfo(asyncName, indexPath); indexes.put(indexPath, info); } return info; }
public String getStats() { return String.format("since %tc ,%d indexing cycles, failed %d times, skipped %d time", corruptSince, getCycleCount(), failureCount, skippedCount); }
public void markWorkingIndexes(Set<String> updatedIndexPaths) { indexerCycleCount++; for (String indexPath : updatedIndexPaths){ CorruptIndexInfo info = indexes.remove(indexPath); if (info != null){ log.info("Index at [{}] which was so far failing {} is now working again.", info.path, info.getStats()); } } }
CompositeDataSupport toCompositeData() { Object[] values = new Object[]{ info.path, info.getStats(), info.isMarkedAsCorrupt(), String.format("%tc", info.getCorruptSinceAsCal().getTimeInMillis()), info.getLastException(), }; try { return new CompositeDataSupport(TYPE, FIELD_NAMES, values); } catch (OpenDataException e) { throw new IllegalStateException(e); } } }
private void markFailingIndexesAsCorrupt(NodeBuilder builder) { for (Map.Entry<String, CorruptIndexInfo> index : corruptIndexHandler.getCorruptIndexData(name).entrySet()){ NodeBuilder indexBuilder = childBuilder(builder, index.getKey()); CorruptIndexInfo info = index.getValue(); if (!indexBuilder.hasProperty(IndexConstants.CORRUPT_PROPERTY_NAME)){ String corruptSince = ISO8601.format(info.getCorruptSinceAsCal()); indexBuilder.setProperty( PropertyStates.createProperty(IndexConstants.CORRUPT_PROPERTY_NAME, corruptSince, Type.DATE)); log.info("Marking [{}] as corrupt. The index is failing {}", info.getPath(), info.getStats()); } else { log.debug("Failing index at [{}] is already marked as corrupt. The index is failing {}", info.getPath(), info.getStats()); } } }
CompositeDataSupport toCompositeData() { Object[] values = new Object[]{ info.path, info.getStats(), info.isMarkedAsCorrupt(), String.format("%tc", info.getCorruptSinceAsCal().getTimeInMillis()), info.getLastException(), }; try { return new CompositeDataSupport(TYPE, FIELD_NAMES, values); } catch (OpenDataException e) { throw new IllegalStateException(e); } } }
private void markFailingIndexesAsCorrupt(NodeBuilder builder) { for (Map.Entry<String, CorruptIndexInfo> index : corruptIndexHandler.getCorruptIndexData(name).entrySet()){ NodeBuilder indexBuilder = childBuilder(builder, index.getKey()); CorruptIndexInfo info = index.getValue(); if (!indexBuilder.hasProperty(IndexConstants.CORRUPT_PROPERTY_NAME)){ String corruptSince = ISO8601.format(info.getCorruptSinceAsCal()); indexBuilder.setProperty( PropertyStates.createProperty(IndexConstants.CORRUPT_PROPERTY_NAME, corruptSince, Type.DATE)); log.info("Marking [{}] as corrupt. The index is failing {}", info.getPath(), info.getStats()); } else { log.debug("Failing index at [{}] is already marked as corrupt. The index is failing {}", info.getPath(), info.getStats()); } } }
CompositeDataSupport toCompositeData() { Object[] values = new Object[]{ info.path, info.getStats(), info.isMarkedAsCorrupt(), String.format("%tc", info.getCorruptSinceAsCal().getTimeInMillis()), info.getLastException(), }; try { return new CompositeDataSupport(TYPE, FIELD_NAMES, values); } catch (OpenDataException e) { throw new IllegalStateException(e); } } }
private void markFailingIndexesAsCorrupt(NodeBuilder builder) { for (Map.Entry<String, CorruptIndexInfo> index : corruptIndexHandler.getCorruptIndexData(name).entrySet()){ NodeBuilder indexBuilder = childBuilder(builder, index.getKey()); CorruptIndexInfo info = index.getValue(); if (!indexBuilder.hasProperty(IndexConstants.CORRUPT_PROPERTY_NAME)){ String corruptSince = ISO8601.format(info.getCorruptSinceAsCal()); indexBuilder.setProperty( PropertyStates.createProperty(IndexConstants.CORRUPT_PROPERTY_NAME, corruptSince, Type.DATE)); log.info("Marking [{}] as corrupt. The index is failing {}", info.getPath(), info.getStats()); } else { log.debug("Failing index at [{}] is already marked as corrupt. The index is failing {}", info.getPath(), info.getStats()); } } }
public String getStats() { return String.format("since %tc ,%d indexing cycles, failed %d times, skipped %d time", corruptSince, getCycleCount(), failureCount, skippedCount); }
@Override public void indexUpdateFailed(String async, String indexPath, Exception e) { getOrCreateInfo(async, indexPath).addFailure(e); }
@Override public void indexUpdateFailed(String async, String indexPath, Exception e) { if (meter != null) { meter.mark(); } getOrCreateInfo(async, indexPath).addFailure(e); }
public Map<String, CorruptIndexInfo> getCorruptIndexData(String asyncName){ if (corruptIntervalMillis <= 0){ return Collections.emptyMap(); } Map<String, CorruptIndexInfo> result = Maps.newHashMap(); for (CorruptIndexInfo info : indexes.values()){ if (asyncName.equals(info.asyncName) && info.isFailingSinceLongTime()){ result.put(info.path, info); } } return result; }
@Override public boolean skippingCorruptIndex(String async, String indexPath, Calendar corruptSince) { CorruptIndexInfo info = getOrCreateInfo(async, indexPath); if (info.skippedIndexing(checkNotNull(corruptSince))) { log.warn("Ignoring corrupt index [{}] which has been marked as corrupt [{}]. This index " + "MUST be reindexed for indexing to work properly", indexPath, info.getStats()); return true; } return false; }
public Map<String, CorruptIndexInfo> getCorruptIndexData(String asyncName){ if (corruptIntervalMillis <= 0){ return Collections.emptyMap(); } Map<String, CorruptIndexInfo> result = Maps.newHashMap(); for (CorruptIndexInfo info : indexes.values()){ if (asyncName.equals(info.asyncName) && info.isFailingSinceLongTime()){ result.put(info.path, info); } } return result; }
public String getStats() { return String.format("since %tc ,%d indexing cycles, failed %d times, skipped %d time", corruptSince, getCycleCount(), failureCount, skippedCount); }
public void markWorkingIndexes(Set<String> updatedIndexPaths) { indexerCycleCount++; for (String indexPath : updatedIndexPaths){ CorruptIndexInfo info = indexes.remove(indexPath); if (info != null){ log.info("Index at [{}] which was so far failing {} is now working again.", info.path, info.getStats()); } } if (meter != null && !indexes.isEmpty()) { meter.mark(indexes.size()); } }
public Map<String, CorruptIndexInfo> getCorruptIndexData(String asyncName){ if (corruptIntervalMillis <= 0){ return Collections.emptyMap(); } Map<String, CorruptIndexInfo> result = Maps.newHashMap(); for (CorruptIndexInfo info : indexes.values()){ if (asyncName.equals(info.asyncName) && info.isFailingSinceLongTime()){ result.put(info.path, info); } } return result; }
public void markWorkingIndexes(Set<String> updatedIndexPaths) { indexerCycleCount++; for (String indexPath : updatedIndexPaths){ CorruptIndexInfo info = indexes.remove(indexPath); if (info != null){ log.info("Index at [{}] which was so far failing {} is now working again.", info.path, info.getStats()); } } if (meter != null && !indexes.isEmpty()) { meter.mark(indexes.size()); } }
private synchronized CorruptIndexInfo getOrCreateInfo(String asyncName, String indexPath) { CorruptIndexInfo info = indexes.get(indexPath); if (info == null){ info = new CorruptIndexInfo(asyncName, indexPath); indexes.put(indexPath, info); } return info; }