Skip to content

Commit 255ebd4

Browse files
authored
Fix to_bytes.gawk for memory in terabytes (strimzi#10228)
Signed-off-by: Cyprien Huet <[email protected]> Co-authored-by: Cyprien Huet <[email protected]>
1 parent 491cecd commit 255ebd4

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

docker-images/kafka-based/kafka/cruise-control-scripts/dynamic_resources.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function get_heap_size {
66
MAX=$2
77
# Get the max heap used by a jvm which used all the ram available to the container
88
POSSIBLE_HEAP=$(java -XX:MaxRAMPercentage="$PERCENTAGE" -XshowSettings:vm -version \
9-
|& awk '/Max\. Heap Size \(Estimated\): [0-9KMG]+/{ print $5}' \
9+
|& awk '/Max\. Heap Size \(Estimated\): [0-9KMGT]+/{ print $5}' \
1010
| gawk -f to_bytes.gawk)
1111

1212
if [ "${MAX}" ]; then

docker-images/kafka-based/kafka/cruise-control-scripts/to_bytes.gawk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ BEGIN {
44
suffixes["K"]=1024
55
suffixes["M"]=1024**2
66
suffixes["G"]=1024**3
7+
suffixes["T"]=1024**4
78
}
89

9-
match($0, /([0-9.]*)([kKmMgG]?)/, a) {
10+
match($0, /([0-9.]*)([kKmMgGtT]?)/, a) {
1011
printf("%d", a[1] * suffixes[toupper(a[2])])
1112
}

docker-images/kafka-based/kafka/scripts/dynamic_resources.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function get_heap_size {
66
MAX=$2
77
# Get the max heap used by a jvm which used all the ram available to the container
88
POSSIBLE_HEAP=$(java -XX:MaxRAMPercentage="$PERCENTAGE" -XshowSettings:vm -version \
9-
|& awk '/Max\. Heap Size \(Estimated\): [0-9KMG]+/{ print $5}' \
9+
|& awk '/Max\. Heap Size \(Estimated\): [0-9KMGT]+/{ print $5}' \
1010
| gawk -f to_bytes.gawk)
1111

1212
if [ "${MAX}" ]; then

docker-images/kafka-based/kafka/scripts/to_bytes.gawk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ BEGIN {
44
suffixes["K"]=1024
55
suffixes["M"]=1024**2
66
suffixes["G"]=1024**3
7+
suffixes["T"]=1024**4
78
}
89

9-
match($0, /([0-9.]*)([kKmMgG]?)/, a) {
10+
match($0, /([0-9.]*)([kKmMgGtT]?)/, a) {
1011
printf("%d", a[1] * suffixes[toupper(a[2])])
1112
}

0 commit comments

Comments
 (0)