Search in sources :

Example 1 with UpdateConcurrencyAdjusterParameters

use of com.linkedin.kafka.cruisecontrol.servlet.parameters.UpdateConcurrencyAdjusterParameters in project cruise-control by linkedin.

the class AdminRequest method processUpdateConcurrencyAdjusterRequest.

protected void processUpdateConcurrencyAdjusterRequest(Map<ConcurrencyType, Boolean> concurrencyAdjusterBefore, Map<ConcurrencyType, Boolean> concurrencyAdjusterAfter, StringBuilder minIsrBasedConcurrencyAdjustmentRequest) {
    UpdateConcurrencyAdjusterParameters updateConcurrencyAdjusterParameters = _parameters.updateConcurrencyAdjusterParameters();
    if (updateConcurrencyAdjusterParameters != null) {
        Set<ConcurrencyType> disableConcurrencyAdjusterFor = updateConcurrencyAdjusterParameters.disableConcurrencyAdjusterFor();
        Set<ConcurrencyType> enableConcurrencyAdjusterFor = updateConcurrencyAdjusterParameters.enableConcurrencyAdjusterFor();
        Boolean minIsrBasedConcurrencyAdjustment = updateConcurrencyAdjusterParameters.minIsrBasedConcurrencyAdjustment();
        if (minIsrBasedConcurrencyAdjustment != null) {
            boolean oldValue = _kafkaCruiseControl.setConcurrencyAdjusterMinIsrCheck(minIsrBasedConcurrencyAdjustment);
            minIsrBasedConcurrencyAdjustmentRequest.append(String.format("MinISR-based concurrency adjustment is modified (before: %s after: %s).", oldValue, minIsrBasedConcurrencyAdjustment));
            LOG.info("MinISR-based concurrency adjustment is modified by user (before: {} after: {}).", oldValue, minIsrBasedConcurrencyAdjustment);
        }
        for (ConcurrencyType type : disableConcurrencyAdjusterFor) {
            concurrencyAdjusterBefore.put(type, _kafkaCruiseControl.setConcurrencyAdjusterFor(type, false));
            concurrencyAdjusterAfter.put(type, false);
        }
        for (ConcurrencyType adjusterType : enableConcurrencyAdjusterFor) {
            concurrencyAdjusterBefore.put(adjusterType, _kafkaCruiseControl.setConcurrencyAdjusterFor(adjusterType, true));
            concurrencyAdjusterAfter.put(adjusterType, true);
        }
        if (!disableConcurrencyAdjusterFor.isEmpty() || !enableConcurrencyAdjusterFor.isEmpty()) {
            LOG.info("Concurrency adjuster state is modified by user (before: {} after: {}).", concurrencyAdjusterBefore, concurrencyAdjusterAfter);
        }
    }
}
Also used : UpdateConcurrencyAdjusterParameters(com.linkedin.kafka.cruisecontrol.servlet.parameters.UpdateConcurrencyAdjusterParameters) ConcurrencyType(com.linkedin.kafka.cruisecontrol.executor.ConcurrencyType)

Aggregations

ConcurrencyType (com.linkedin.kafka.cruisecontrol.executor.ConcurrencyType)1 UpdateConcurrencyAdjusterParameters (com.linkedin.kafka.cruisecontrol.servlet.parameters.UpdateConcurrencyAdjusterParameters)1