public static float updateEstimation(String topic, CompressionType type, float observedRatio) {
        float[] compressionRatioForTopic = getAndCreateEstimationIfAbsent(topic);
        float currentEstimation = compressionRatioForTopic[type.id];
        synchronized (compressionRatioForTopic) {
            if (observedRatio > currentEstimation)
                compressionRatioForTopic[type.id] = Math.max(currentEstimation + COMPRESSION_RATIO_DETERIORATE_STEP, observedRatio);
            else if (observedRatio < currentEstimation) {
                compressionRatioForTopic[type.id] = Math.max(currentEstimation - COMPRESSION_RATIO_IMPROVING_STEP, observedRatio);
            }
        }
        return compressionRatioForTopic[type.id];
    }
Update the compression ratio estimation for a topic and compression type.

@param topic         the topic to update compression ratio estimation.
@param type          the compression type.
@param observedRatio the observed compression ratio.
@return the compression ratio estimation after the update.
clients/src/main/java/org/apache/kafka/common/record/CompressionRatioEstimator.java