private TrackingCorruptIndexHandler createCorruptIndexHandler(Configuration config) { long failingIndexTimeoutSeconds = config.failingIndexTimeoutSeconds(); long errorWarnIntervalSeconds = config.errorWarnIntervalSeconds(); TrackingCorruptIndexHandler corruptIndexHandler = new TrackingCorruptIndexHandler(); corruptIndexHandler.setCorruptInterval(failingIndexTimeoutSeconds, TimeUnit.SECONDS); corruptIndexHandler.setErrorWarnInterval(errorWarnIntervalSeconds, TimeUnit.SECONDS); if (failingIndexTimeoutSeconds <= 0){ log.info("[failingIndexTimeoutSeconds] is set to {}. Auto corrupt index isolation handling is disabled, warning log would be " + "logged every {} s", failingIndexTimeoutSeconds, errorWarnIntervalSeconds); } else { log.info("Auto corrupt index isolation handling is enabled. Any async index which fails for {}s would " + "be marked as corrupted and would be skipped from further indexing. A warning log would be " + "logged every {} s", failingIndexTimeoutSeconds, errorWarnIntervalSeconds); } return corruptIndexHandler; }
private TrackingCorruptIndexHandler createCorruptIndexHandler(Configuration config) { long failingIndexTimeoutSeconds = config.failingIndexTimeoutSeconds(); long errorWarnIntervalSeconds = config.errorWarnIntervalSeconds(); TrackingCorruptIndexHandler corruptIndexHandler = new TrackingCorruptIndexHandler(); corruptIndexHandler.setCorruptInterval(failingIndexTimeoutSeconds, TimeUnit.SECONDS); corruptIndexHandler.setErrorWarnInterval(errorWarnIntervalSeconds, TimeUnit.SECONDS); corruptIndexHandler.setMeterStats(statisticsProvider.getMeter("corrupt-index", StatsOptions.METRICS_ONLY)); if (failingIndexTimeoutSeconds <= 0){ log.info("[failingIndexTimeoutSeconds] is set to {}. Auto corrupt index isolation handling is disabled, warning log would be " + "logged every {} s", failingIndexTimeoutSeconds, errorWarnIntervalSeconds); } else { log.info("Auto corrupt index isolation handling is enabled. Any async index which fails for {}s would " + "be marked as corrupted and would be skipped from further indexing. A warning log would be " + "logged every {} s", failingIndexTimeoutSeconds, errorWarnIntervalSeconds); } return corruptIndexHandler; }
private TrackingCorruptIndexHandler createCorruptIndexHandler(Configuration config) { long failingIndexTimeoutSeconds = config.failingIndexTimeoutSeconds(); long errorWarnIntervalSeconds = config.errorWarnIntervalSeconds(); TrackingCorruptIndexHandler corruptIndexHandler = new TrackingCorruptIndexHandler(); corruptIndexHandler.setCorruptInterval(failingIndexTimeoutSeconds, TimeUnit.SECONDS); corruptIndexHandler.setErrorWarnInterval(errorWarnIntervalSeconds, TimeUnit.SECONDS); corruptIndexHandler.setMeterStats(statisticsProvider.getMeter(TrackingCorruptIndexHandler.CORRUPT_INDEX_METER_NAME, StatsOptions.METRICS_ONLY)); if (failingIndexTimeoutSeconds <= 0){ log.info("[failingIndexTimeoutSeconds] is set to {}. Auto corrupt index isolation handling is disabled, warning log would be " + "logged every {} s", failingIndexTimeoutSeconds, errorWarnIntervalSeconds); } else { log.info("Auto corrupt index isolation handling is enabled. Any async index which fails for {}s would " + "be marked as corrupted and would be skipped from further indexing. A warning log would be " + "logged every {} s", failingIndexTimeoutSeconds, errorWarnIntervalSeconds); } return corruptIndexHandler; }
@Test public void disbaled() throws Exception{ handler.setClock(clock); handler.indexUpdateFailed("async", "/oak:index/foo", new Exception()); clock.waitUntil(clock.getTime() + handler.getCorruptIntervalMillis() + 1); assertTrue(handler.getCorruptIndexData("async").containsKey("/oak:index/foo")); handler.setCorruptInterval(0, TimeUnit.SECONDS); //With timeout set to zero no corrupt index should be reported assertFalse(handler.getCorruptIndexData("async").containsKey("/oak:index/foo")); }