Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validate issue if segment size greater than 4GB. #638

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ThinkJ001
Copy link

If we use segsize>4GB, e.g.
./configure --prefix=/store2/Workspace/bin/pg16 --enable-debug --with-segsize=5 CFLAGS=-O2
the backup or restore will be failed in the validate step:

INFO: Database backup start
INFO: wait for pg_backup_start()
2024-10-17 09:08:02.750 CST [2271890] LOG:  checkpoint starting: immediate force wait
2024-10-17 09:08:02.805 CST [2271890] LOG:  checkpoint complete: wrote 4 buffers (0.0%); 0 WAL file(s) added, 0 removed, 21 recycled; write=0.001 s, sync=0.005 s, total=0.056 s; sync files=3, longest=0.003 s, average=0.002 s; distance=339967 kB, estimate=521292 kB; lsn=3/51000060, redo lsn=3/51000028
INFO: Wait for WAL segment /store2/Workspace/data/probackup/backups/pg16/SLH75E/database/pg_wal/000000010000000300000051 to be streamed
INFO: PGDATA size: 15GB
INFO: Current Start LSN: 3/51000028, TLI: 1
INFO: Start transferring data files
INFO: Data files are transferred, time elapsed: 19s
2024-10-17 09:08:22.381 CST [2271938] LOG:  restore point "pg_probackup, backup_id SLH75E" created at 3/51000178
2024-10-17 09:08:22.381 CST [2271938] STATEMENT:  SELECT pg_catalog.pg_create_restore_point($1)
INFO: wait for pg_stop_backup()
INFO: pg_stop backup() successfully executed
INFO: stop_lsn: 3/510001A0
INFO: Getting the Recovery Time from WAL
INFO: Syncing backup files to disk
INFO: Backup files are synced, time elapsed: 4s
INFO: Validating backup SLH75E
ERROR: Cannot seek block 261889 of "/store2/Workspace/data/probackup/backups/pg16/SLH75E/database/base/5/24632": Invalid argument
ERROR: Data files validation failed

The reason is the block and pos parameter in struct BackupPageHeader2 declared as int32, and when datafile exceed 4G, the variables will overflow.

This patch fixed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant