From 4bb45ac3664f0339875ad091a822b811523bbd41 Mon Sep 17 00:00:00 2001
From: Jakub Wartak <jakub.wartak@enterprisedb.com>
Date: Thu, 5 Nov 2026 12:06:57 +0100
Subject: [PATCH v0005_05112026 7/7] add warning just in case

---
 src/backend/backup/basebackup.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/backend/backup/basebackup.c b/src/backend/backup/basebackup.c
index cb7b968df78..3466750822d 100644
--- a/src/backend/backup/basebackup.c
+++ b/src/backend/backup/basebackup.c
@@ -1838,6 +1838,16 @@ sendRelFile(bbsink *sink, const char *readfilename, const char *tarfilename,
 	total_blocks = filestat.st_size / BLCKSZ;
 	blocks_done = 0;
 	ibindex = 0;
+
+	/*
+	 * We read only whole blocks and that is harmless, but segment size not being
+	 * multiple of BLCKSZ is unusual sign.
+	 */
+	if (incremental_blocks == NULL && filestat.st_size % BLCKSZ != 0)
+		ereport(WARNING,
+				(errmsg("file \"%s\" has size %lld which is not a multiple of block size %d",
+						readfilename, (long long) filestat.st_size, BLCKSZ)));
+
 	while (1)
 	{
 		size_t		cnt;
-- 
2.43.0

