From 1e44cb5fbc777d7786623171629ddbb34192aa77 Mon Sep 17 00:00:00 2001 From: wuyuechuan Date: Thu, 30 Jun 2022 16:06:37 +0800 Subject: [PATCH] Reserve 160kb where backup compressed file --- src/gausskernel/storage/replication/basebackup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gausskernel/storage/replication/basebackup.cpp b/src/gausskernel/storage/replication/basebackup.cpp index a84becd7d..ed9e05adf 100755 --- a/src/gausskernel/storage/replication/basebackup.cpp +++ b/src/gausskernel/storage/replication/basebackup.cpp @@ -1988,8 +1988,8 @@ static void SendCompressedFile(char* readFileName, int basePathLen, struct stat& BlockNumber totalBlockNum = (BlockNumber)pg_atomic_read_u32(&map->nblocks); /* some chunks may have been allocated but not used. - * Reserve 0 chunks for avoiding the error when the size of a compressed block extends */ - auto reservedChunks = 0; + * Reserve 160kb for avoiding the error when the size of a compressed block extends */ + int reservedChunks = (BLCKSZ / chunkSize) * 20; securec_check(memcpy_s(transfer, pcaFileLen, map, pcaFileLen), "", ""); decltype(statbuf.st_size) realSize = (map->allocated_chunks + reservedChunks) * chunkSize; statbuf.st_size = statbuf.st_size >= realSize ? statbuf.st_size : realSize;