Skip to content

Commit

Permalink
Fix incorrect stats warning when swap is disabled (#57983)
Browse files Browse the repository at this point in the history
  • Loading branch information
danhermann committed Jun 11, 2020
1 parent bb66d59 commit e990c0a
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -220,7 +220,9 @@ public ByteSizeValue getUsed() {
//
// We intentionally check for (total == 0) rather than (total - free < 0) so as not to hide
// cases where (free > total) which would be a different bug.
logger.warn("cannot compute used swap when total swap is 0 and free swap is " + free);
if (free > 0) {
logger.warn("cannot compute used swap when total swap is 0 and free swap is " + free);
}
return new ByteSizeValue(0);
}
return new ByteSizeValue(total - free);
Expand Down Expand Up @@ -280,7 +282,9 @@ public ByteSizeValue getUsed() {
//
// We intentionally check for (total == 0) rather than (total - free < 0) so as not to hide
// cases where (free > total) which would be a different bug.
logger.warn("cannot compute used memory when total memory is 0 and free memory is " + free);
if (free > 0) {
logger.warn("cannot compute used memory when total memory is 0 and free memory is " + free);
}
return new ByteSizeValue(0);
}
return new ByteSizeValue(total - free);
Expand Down

0 comments on commit e990c0a

Please sign in to comment.