1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2026-06-21 01:34:15 +02:00
Commit Graph

3915 Commits

Author SHA1 Message Date
Yura Sokolov 7c93d72043 [PBCKP-434] page's lsn is end of record too
therefore if it is equal to stop_lsn then it is not from future.
2022-12-26 01:50:35 +03:00
Yura Sokolov 84f4ac9e23 [PBCKP-434] fix get_prior_record_lsn
When start_segno matched current segno we pretend to start from start_lsn.
But due to copy-paste mistake we started from segment start.
This was catch by introduced special (almost redundant) check.

This check were introduced to match behaviour previously provided by
XLogBeginRead + WalRecordRead. It doesn't provide much value, but lets
keep it.
2022-12-26 01:30:56 +03:00
Yura Sokolov 2a1fb6f4de [PBCKP-434] prefer to RunXLogThreads with consistent_read=true
I doubt 'false' is ever usable.
2022-12-25 22:10:57 +03:00
Yura Sokolov 7d12d5fb39 [PBCKP-434] fix replica_test.py
There are a lot less messages to check for.
And in fact backup in test_archive_replica_not_null_offset starts to
succeed.
2022-12-25 21:33:43 +03:00
Yura Sokolov 82d2941347 [PBCKP-434] stabilize backup_test
there was some nose-to-nose timing, so it could sporadically fail.
And in fact timeouts need no to be so large. Reduce them a bit.
2022-12-25 21:31:10 +03:00
Yura Sokolov 6e83fa07ea [PBCKP-434] greatly simplify stop_lsn handling
It was long believed `stop_lsn` should point on start of last record.
But in fact it points to end of last record (because XLogInsert(BACKUP_END)
returns pointer to end of record, and that is what pg_backup_stop/
pg_stop_backup returns).

So we don't need to lookup `stop_lsn` record in WAL log, but rather check
existence of record which ends on `stop_lsn` (which is what
`get_prior_record_lsn` does).

And there is no need to raise error on `stop_lsn` which points on block end
- it is very valid when xlog record ends at block end.

So:
- we simplify wait_wal_lsn to just wait for `get_prior_record_lsn` returns
  "ok" (ie find such previous record). But now we don't overwrite stop_lsn
  with lsn of this record.
- we use `wait_wal_lsn` only in "ARCHIVE" mode/directory.
  So get rid of `in_stream_dir` argument.
- and `wait_wal_lsn` now waits only for previous record even for
  `is_start_lsn`, since there is no much gain in waiting for it.
  Even for PAGE mode we need only records before `start_lsn`, since
  `start_lsn` record is considered as part of backup.
- "STREAM" mode now waits for lsn by hooking streamer. We don't need to
  calculate stop_backup_lsn since we may use stop_backup_result.lsn
  directly to stop streamer.
  After streamer stopped, we just check wal with `get_prior_record_lsn`. We
  don't need to, but just for sanity.
- therefore `wait_wal_and_calculate_stop_lsn` become obsolete. Lets get rid
  of it.
  Without it, there is no need in get_first_record_lsn and
  get_next_record_lsn. Lets delete them too.
- Instead of using XRecOffIsValid and XRecOffIsNull use added
  XRecPtrLooksGood and XRecEndLooksGood.
  XRecPtrLooksGood validates record start more rigidly than XRecOffIsValid,
  and XRecEndLooksGood validates record end, which could be on block end.
- In fact, some of `XRecOffIsValid(x)` had to be `!XLogRecPtrIsInvalid(x)`
- Since stop_lsn is not inclusive now, RunXLogThreads doesn't need
  `inclusive_endpoint` parameter.
  (And because Page mode needs just till start_lsn)
- PAGE_LSN_FROM_FUTURE must be considered as error, btw.

(And by the way there's no need to XLogBeginRead before XLogFindNextRecord.
 Cleanup such calls)
2022-12-25 21:26:42 +03:00
Yura Sokolov dc9cfb86b3 fix pioRemoteDrive_pioOpenRewrite 2022-12-25 19:24:59 +03:00
Yura Sokolov b0182bd5ed fix test_pgpro560_control_file_loss 2022-12-25 03:57:51 +03:00
Yura Sokolov 6a9850be62 fix test_options_5 2022-12-25 03:52:01 +03:00
Yura Sokolov 21c811c87a [PBCKP-365] jentlier 2022-12-25 03:50:25 +03:00
Victor Spirin a65902c2e0 [PBCKP-365] Fixed test help_6 test. Added check_locale function for check that locale is installed. 2022-12-24 14:50:14 +03:00
Yura Sokolov ffc8566097 [PBCKP-428] read_recovery_info don't need XRecOffIsValid(stop_lsn)
since it uses XLogFindNextRecord, it could use stop_lsn with no valid
offset. In fact, it uses truncated stop_lsn with invalid offset always.

Also fix getting timestamp from possible record in a future.
We could not to not enter the loop since we need record->xl_prev to
correctly walk backward. So we need to add condition before
getRecordTimestamp.
2022-12-24 04:57:10 +03:00
Yura Sokolov 12b8bfbc4c try to speedup test_replica_archive_page_backup 2022-12-24 04:45:02 +03:00
Yura Sokolov 4ddf8a1dfe speedup test_archive_replica_not_null_offset 2022-12-24 04:06:23 +03:00
Yura Sokolov cfcba44f97 [PBCKP-330] fix test_archive_replica_not_null_offset
postgrespro enterprise has dirrerent xlog record size due to 64bit xid.
ee15 changed this size again.
2022-12-24 03:23:55 +03:00
Yura Sokolov b70d76ec4a fix warning 2022-12-23 17:25:17 +03:00
Yura Sokolov c3430a685f [PBCKP-270] fetch current log position directly from streamer.
We have streamer in our hand, so we may ask it directly, what are it
streaming now.

But in case we looks into previous segment, we fallback to log reading
since it is already flushed.
2022-12-23 17:11:37 +03:00
Yura Sokolov 3e75df6db5 [PBCKP-270] fixes 2022-12-23 16:24:32 +03:00
Victor Spirin 71e6895935 [PBCKP-270] Updated wait_wal_lsn function for begin backup without wal file for streaming WAL. 2022-12-23 13:34:06 +03:00
Victor Spirin 8b46c8af63 [PBCKP-270] Fixed some functions for WAL stream 2022-12-23 13:34:06 +03:00
Victor Spirin 2904405a5f [PBCKP-270] Added pio file functions for compatibility/walmethods.c 2022-12-23 13:34:06 +03:00
Yura Sokolov 4418ec9572 [PBCKP-428] fix "optimize read_recovery_info"
Well, we couldn't easily step back be 1MB, since it could be in
uninitialized tail of previous segment.

We need to use valid pointer in record->xl_prev.
2022-12-23 12:31:43 +03:00
Yura Sokolov fe82f4e45e test_recovery_target_lsn_backup_victim - looks like it should pass
and not fail
2022-12-23 09:20:42 +03:00
Yura Sokolov c83d69c359 fix test_continue_failed_merge_2 2022-12-23 09:00:51 +03:00
Yura Sokolov f9615aeb6b fix test_merge_external_dir_is_missing 2022-12-23 08:47:56 +03:00
Yura Sokolov d8c41ae1eb fix init tests 2022-12-23 08:41:53 +03:00
Yura Sokolov a394ea3a5d fix test_missing_replication_permission_1 : fix freing xlogFile
xlogFile did contain pgFile in its start. Therefore pgFileFree were used
to free it.

Not xlogFile doesn't contain pgFile, so its free procedure should be fixed.
2022-12-23 08:18:02 +03:00
Yura Sokolov eecba5f4aa fix test_remove_instance_config 2022-12-23 08:04:50 +03:00
Yura Sokolov 46517a2fa0 fix test_backup_concurrent_drop_table 2022-12-23 07:59:15 +03:00
Yura Sokolov 80caef108b fix auth_test.test_backup_via_unprivileged_user 2022-12-23 07:47:22 +03:00
Yura Sokolov cc82beecd1 [PBCKP-428] optimize read_recovery_info
Instead of stepping back by one record, step back by megabyte and then go
forward. This is much better both for gzipped wal and for S3.
2022-12-23 07:46:49 +03:00
Yura Sokolov 6b8d3df368 [PBCKP-427] cache header map files 2022-12-23 06:49:03 +03:00
Yura Sokolov 7eed384934 [PBCKP-427] introduce pgFile hashtable
We want to sort files be offset in page header map file.
But it breaks searching with binary search by filename.
Therefore make and use hashtable instead of binary search.
2022-12-23 06:48:16 +03:00
Yura Sokolov c675380503 backup: descending sort by file size
it is better suited for load balancing among threads
2022-12-23 03:24:43 +03:00
Yura Sokolov be6ceac93a [PBCKP-426] use pioLocalFile in pioLocalPagesIterator
I believe it better handles buffering with seeks than FILE*.
2022-12-23 03:05:22 +03:00
Yura Sokolov d0b5e19bb9 [PBCKP-426] add special method pioFileStat for pioLocalReadFile
It will be useful in pioLocalPagesIterator.
2022-12-23 02:56:27 +03:00
Yura Sokolov 06326900a5 [PBCKP-426] buffer pioLocalReadFile 2022-12-23 02:50:49 +03:00
Yura Sokolov dd20305c5a [PBCKP-426] rename pioLocalFile->pioLocalReadFile
just for symmetry with pioLocalWriteFile
2022-12-23 01:15:23 +03:00
Yura Sokolov da99c02582 speedup pgpro434_3 and pgpro434_4 a bit 2022-12-22 17:35:15 +03:00
Yura Sokolov 7b375352ee improvement to ptrack_helpers.GDBobj
autoclose it __del__
2022-12-22 17:34:05 +03:00
Yura Sokolov 86609c2d30 archive.c: allow to overwrite broken gz file 2022-12-22 15:31:52 +03:00
Yura Sokolov a10d19a640 more complete send of error through remote connection 2022-12-22 15:31:52 +03:00
Yura Sokolov bc7a88b92f ability to alloc completely custom error 2022-12-22 15:31:52 +03:00
Sergey Fukanchik c6132c1f8a PBCKP-80 free memory 2022-12-22 12:22:31 +03:00
Yura Sokolov 67b406cc2b adapt do_validate_all to pio: use pioOpenDir 2022-12-22 06:20:50 +03:00
Yura Sokolov 4e4e76da07 Merge branch 'REL_2_5' into REL_2_6 2022-12-22 06:06:30 +03:00
Yura Sokolov 8f4e7d6e5f [PBCKP-346] archive-get doesn't need -D/--pgdata argument at all 2022-12-22 06:05:51 +03:00
Yura Sokolov dfc7f0466b fix show command: use pioOpenDir in catalog_get_instance_list 2022-12-22 05:35:37 +03:00
Yura Sokolov 1da2b77f92 remove fio_sync 2022-12-22 05:00:03 +03:00
Yura Sokolov 90cd7250a2 use pioSyncTree in restore_chain 2022-12-22 04:57:39 +03:00