@VisibleForTesting SweepOutcome runOnce() { Optional<TableToSweep> tableToSweep = getTableToSweep(); if (!tableToSweep.isPresent()) { // Don't change this log statement. It's parsed by test automation code. log.debug( "Skipping sweep because no table has enough new writes to be worth sweeping at the moment."); return SweepOutcome.NOTHING_TO_SWEEP; } SweepBatchConfig batchConfig = sweepBatchConfigSource.getAdjustedSweepConfig(); try { specificTableSweeper.runOnceAndSaveResults(tableToSweep.get(), batchConfig); return SweepOutcome.SUCCESS; } catch (InsufficientConsistencyException e) { log.info("Could not sweep because not all nodes of the database are online.", e); return SweepOutcome.NOT_ENOUGH_DB_NODES_ONLINE; } catch (RuntimeException e) { specificTableSweeper.updateSweepErrorMetric(); return determineCauseOfFailure(e, tableToSweep.get()); } }
private SweepOutcome grabLocksAndRun(SingleLockService locks) throws InterruptedException { try { locks.lockOrRefresh(); if (locks.haveLocks()) { return runOnce(); } else { log.debug("Skipping sweep because sweep is running elsewhere."); closeTableLockIfHeld(); return SweepOutcome.UNABLE_TO_ACQUIRE_LOCKS; } } catch (RuntimeException e) { specificTableSweeper.updateSweepErrorMetric(); log.info("Sweep failed", e); return SweepOutcome.ERROR; } }
@VisibleForTesting SweepOutcome runOnce() { Optional<TableToSweep> tableToSweep = getTableToSweep(); if (!tableToSweep.isPresent()) { // Don't change this log statement. It's parsed by test automation code. log.debug( "Skipping sweep because no table has enough new writes to be worth sweeping at the moment."); return SweepOutcome.NOTHING_TO_SWEEP; } SweepBatchConfig batchConfig = sweepBatchConfigSource.getAdjustedSweepConfig(); try { specificTableSweeper.runOnceAndSaveResults(tableToSweep.get(), batchConfig); return SweepOutcome.SUCCESS; } catch (InsufficientConsistencyException e) { log.info("Could not sweep because not all nodes of the database are online.", e); return SweepOutcome.NOT_ENOUGH_DB_NODES_ONLINE; } catch (RuntimeException e) { specificTableSweeper.updateSweepErrorMetric(); return determineCauseOfFailure(e, tableToSweep.get()); } }
private SweepOutcome grabLocksAndRun(SingleLockService locks) throws InterruptedException { try { locks.lockOrRefresh(); if (locks.haveLocks()) { return runOnce(); } else { log.debug("Skipping sweep because sweep is running elsewhere."); closeTableLockIfHeld(); return SweepOutcome.UNABLE_TO_ACQUIRE_LOCKS; } } catch (RuntimeException e) { specificTableSweeper.updateSweepErrorMetric(); log.info("Sweep failed", e); return SweepOutcome.ERROR; } }