Uploaded image for project: 'AMQ Streams'
  1. AMQ Streams
  2. ENTMQST-3955

Add support for parsing storage in millibyte units

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.2.0.GA
    • None
    • None
    • None
    • False
    • None
    • False

      Currently, the StorageUtils class which is used when working with storage capacity supports only comon units such as Mi, Gi, M, T. But it does not support the m unit (millibytes). It might seem that millibytes do not male sense as you cannot have for example 0,2 bytes of capacity. However, when expressing the capacity of storage as decimal, it can easily happen that such unit is needed. For example, 0.2Ti looks relatively normal, but it actually is 219902325555,2 bytes which is 219902325555200 millibytes. Kubernetes automatically convert the value and use 219902325555200m. But Strimzi currently doesn't know how to parse it. So it starts throwing errors such as:

      2022-04-18 22:57:16 WARN AbstractOperator:532 - Reconciliation #11(watch) Kafka(myproject/my-cluster): Failed to reconcile
      java.lang.IllegalArgumentException: Invalid memory suffix: m
      at io.strimzi.operator.cluster.model.StorageUtils.memoryFactor(StorageUtils.java:124) ~[io.strimzi.cluster-operator-0.29.0-SNAPSHOT.jar:0.29.0-SNAPSHOT]
      at io.strimzi.operator.cluster.model.StorageUtils.parseMemory(StorageUtils.java:65) ~[io.strimzi.cluster-operator-0.29.0-SNAPSHOT.jar:0.29.0-SNAPSHOT]
      at io.strimzi.operator.cluster.model.StorageUtils.parseMemory(StorageUtils.java:42) ~[io.strimzi.cluster-operator-0.29.0-SNAPSHOT.jar:0.29.0-SNAPSHOT]
      at io.strimzi.operator.cluster.operator.assembly.PvcReconciler.lambda$resizeAndReconcilePvcs$2(PvcReconciler.java:90) ~[io.strimzi.cluster-operator-0.29.0-SNAPSHOT.jar:0.29.0-SNAPSHOT]
      at io.vertx.core.impl.future.Composition.onSuccess(Composition.java:38) ~[io.vertx.vertx-core-4.2.4.jar:4.2.4]
      at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60) ~[io.vertx.vertx-core-4.2.4.jar:4.2.4]
      at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211) ~[io.vertx.vertx-core-4.2.4.jar:4.2.4]
      at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23) ~[io.vertx.vertx-core-4.2.4.jar:4.2.4]
      at io.vertx.core.impl.future.PromiseImpl.onSuccess(PromiseImpl.java:49) ~[io.vertx.vertx-core-4.2.4.jar:4.2.4]
      at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54) ~[io.vertx.vertx-core-4.2.4.jar:4.2.4]
      at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[io.netty.netty-common-4.1.74.Final.jar:4.1.74.Final]
      at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) ~[io.netty.netty-common-4.1.74.Final.jar:4.1.74.Final]
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503) ~[io.netty.netty-transport-4.1.74.Final.jar:4.1.74.Final]
      at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[io.netty.netty-common-4.1.74.Final.jar:4.1.74.Final]
      at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[io.netty.netty-common-4.1.74.Final.jar:4.1.74.Final]
      at io.netty.util.concurrent.FastThreadLocal[?:?]Runnable.run(FastThreadLocalRunnable.java:30) ~[io.netty.netty-common-4.1.74.Final.jar:4.1.74.Final]
      at java.lang.Thread.run(Thread.java:829) ~[?:?] 

      and the user needs to resolve this manually.

      We seem to use the storage conversion form StorageUtils only to compare different capacties but we do not pass the ocnversion results anywhere. So maybe we can instead of converting things into bytes convert everything into millibytes for comparison?

      Created by Strimzi#6700

              Unassigned Unassigned
              scholzj JAkub Scholz
              Jan Kalinic Jan Kalinic
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: