1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-16 16:42:29 +03:00

Refactor pg_rewind for more clear decision making.

Deciding what to do with each file is now a separate step after all the
necessary information has been gathered. It is more clear that way.
Previously, the decision-making was divided between process_source_file()
and process_target_file(), and it was a bit hard to piece together what
the overall rules were.

Reviewed-by: Kyotaro Horiguchi, Soumyadeep Chakraborty
Discussion: https://www.postgresql.org/message-id/0c5b3783-af52-3ee5-f8fa-6e794061f70d%40iki.fi
This commit is contained in:
Heikki Linnakangas
2020-11-04 11:21:09 +02:00
parent ffb4e27e9c
commit eb00f1d4bf
7 changed files with 387 additions and 315 deletions

View File

@@ -369,7 +369,7 @@ main(int argc, char **argv)
chkpttli);
/*
* Build the filemap, by comparing the source and target data directories.
* Collect information about all files in the target and source systems.
*/
filemap_create();
if (showprogress)
@@ -390,8 +390,12 @@ main(int argc, char **argv)
pg_log_info("reading WAL in target");
extractPageMap(datadir_target, chkptrec, lastcommontliIndex,
ControlFile_target.checkPoint, restore_command);
filemap_finalize();
/*
* We have collected all information we need from both systems. Decide
* what to do with each file.
*/
decide_file_actions();
if (showprogress)
calculate_totals();