Fix unlogged_extend

This commit is contained in:
Konstantin Knizhnik
2024-06-06 09:56:28 +03:00
parent ab8f127fc8
commit 6d694f2983
2 changed files with 16 additions and 3 deletions

View File

@@ -1396,11 +1396,14 @@ PageIsEmptyHeapPage(char *buffer)
static void
unlogged_extend(SMgrRelation reln, ForkNumber forknum, BlockNumber old_relsize, BlockNumber new_relsize)
{
if (new_relsize > old_relsize)
{
#if PG_MAJORVERSION_NUM < 16
mdextend(reln, forknum, new_relsize, (char *) zero_buffer.data, true);
mdextend(reln, forknum, new_relsize, (char *) zero_buffer.data, true);
#else
mdzeroextend(reln, forknum, old_relsize, new_relsize - old_relsize, true);
mdzeroextend(reln, forknum, old_relsize, new_relsize - old_relsize, true);
#endif
}
}

View File

@@ -4305,10 +4305,20 @@ def check_restored_datadir_content(
if pgdata_files != restored_files:
# filter pg_xact and multixact files which are downloaded on demand
# also filter files with zero size which can remain after aborted unlogged build
pgdata_files = [
f
for f in pgdata_files
if not f.startswith("pg_xact") and not f.startswith("pg_multixact")
if f in restored_files
or (
not f.startswith("pg_xact")
and not f.startswith("pg_multixact")
and f != "./pg_dynshmem"
and (
not Path(os.path.join(endpoint.pgdata_dir, f)).exists()
or os.path.getsize(os.path.join(endpoint.pgdata_dir, f)) != 0
)
)
]
if ignored_files: