Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle more information units (Mi, Gi, Ti), add rabbitmq.conf validation for IU values #10348

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

michaelklishin
Copy link
Member

@michaelklishin michaelklishin commented Jan 16, 2024

This revisits the information system conversion,
that is, support for suffixes like GiB, GB.

When configuration values like disk_free_limit.absolute, vm_memory_high_watermark.absolute are set, the value can contain an information unit (IU) suffix.

We now support several new suffixes and the meaning a few more changes.

First, the changes:

  • k, K now mean kilobytes and not kibibytes
  • m, M now mean megabytes and not mebibytes
  • g, G now means gigabytes and not gibibytes

This is to match the system used by Kubernetes.
There is no consensus in the industry about how
"k", "m", "g", and similar single letter suffixes
should be treated. Previously it was a power of 2, now a power of 10 to align with a very popular OSS project that explicitly documents what suffixes it supports.

Now, the additions:

  • T, TB (terabytes) and Ti, TiB (tebibytes)
  • P, PB (petabytes) and Pi, PiB (pebibytes)

Finally, the node will now validate these suffixes at boot time, so an unsupported value will cause
the node to stop with a rabbitmq.conf validation
error.

The message logged will look like this:

2024-01-15 22:11:17.829272-05:00 [error] <0.164.0> disk_free_limit.absolute invalid, supported formats: 500MB, 500MiB, 10GB, 10GiB, 2TB, 2TiB, 10000000000
2024-01-15 22:11:17.829376-05:00 [error] <0.164.0> Error preparing configuration in phase validation:
2024-01-15 22:11:17.829387-05:00 [error] <0.164.0>   - disk_free_limit.absolute invalid, supported formats: 500MB, 500MiB, 10GB, 10GiB, 2TB, 2TiB, 10000000000

Closes #10310.

How to Test It

Using the following rabbitmq.conf lines:

disk_free_limit.absolute = 5LOLWUT

# disk_free_limit.absolute = 5G

# disk_free_limit.absolute = 5GB

# disk_free_limit.absolute = 5Gi

# disk_free_limit.absolute = 5GiB

# disk_free_limit.absolute = 5000000000
bazel run broker RABBITMQ_ENABLED_PLUGINS=rabbitmq_management RABBITMQ_CONFIG_FILE=/path/to/disk_free_limit.absolute.conf

Then run rabbitmq-diagnostics status against it:

./bazel-bin/broker-home/sbin/rabbitmq-diagnostics status

This revisits the information system conversion,
that is, support for suffixes like GiB, GB.

When configuration values like disk_free_limit.absolute,
vm_memory_high_watermark.absolute are set, the value
can contain an information unit (IU) suffix.

We now support several new suffixes and the meaning
a few more changes.

First, the changes:

 * k, K now mean kilobytes and not kibibytes
 * m, M now mean megabytes and not mebibytes
 * g, G now means gigabytes and not gibibytes

This is to match the system used by Kubernetes.
There is no consensus in the industry about how
"k", "m", "g", and similar single letter suffixes
should be treated. Previously it was a power of 2,
now a power of 10 to align with a very popular OSS
project that explicitly documents what suffixes it supports.

Now, the additions:

Finally, the node will now validate these suffixes
at boot time, so an unsupported value will cause
the node to stop with a rabbitmq.conf validation
error.

The message logged will look like this:

````
2024-01-15 22:11:17.829272-05:00 [error] <0.164.0> disk_free_limit.absolute invalid, supported formats: 500MB, 500MiB, 10GB, 10GiB, 2TB, 2TiB, 10000000000
2024-01-15 22:11:17.829376-05:00 [error] <0.164.0> Error preparing configuration in phase validation:
2024-01-15 22:11:17.829387-05:00 [error] <0.164.0>   - disk_free_limit.absolute invalid, supported formats: 500MB, 500MiB, 10GB, 10GiB, 2TB, 2TiB, 10000000000
````

Closes #10310
@michaelklishin michaelklishin added this to the 3.13.0 milestone Jan 16, 2024
@michaelklishin
Copy link
Member Author

For context: K8S docs, #10308.

@michaelklishin michaelklishin merged commit ac9c943 into main Jan 16, 2024
19 checks passed
@michaelklishin michaelklishin deleted the mk-information-units-kubernetes-style branch January 16, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vm_memory_high_watermark.absolute validator accepts unsupported information units (e.g. Mi and not MB or MiB)
2 participants