Skip to content

Commit cba733e

Browse files
authored
fix: allow 5% tolerance if snapshot used memory greater than maxmemory limit (#5869)
* fix: allow 5% tollerance if snapshot used memory greater than maxmemory limit * refactor: address comments
1 parent 9ef63db commit cba733e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/server/rdb_load.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2458,7 +2458,8 @@ error_code RdbLoader::HandleAux() {
24582458
int64_t usedmem;
24592459
if (absl::SimpleAtoi(auxval, &usedmem)) {
24602460
VLOG(1) << "RDB memory usage when created " << strings::HumanReadableNumBytes(usedmem);
2461-
if (usedmem > ssize_t(max_memory_limit)) {
2461+
// We allow 5% tolerance for snapshot used memory
2462+
if (usedmem > (max_memory_limit * 1.05)) {
24622463
if (IsClusterEnabled()) {
24632464
LOG(INFO) << "Allowing to load a snapshot of size " << usedmem
24642465
<< ", despite memory limit of " << max_memory_limit << " due to cluster mode";

0 commit comments

Comments
 (0)