mirror of
https://github.com/postgres/postgres.git
synced 2025-12-16 16:42:29 +03:00
pg_rewind: Replace the hybrid list+array data structure with simplehash.
Now that simplehash can be used in frontend code, let's make use of it. 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:
@@ -129,6 +129,7 @@ main(int argc, char **argv)
|
||||
TimeLineID endtli;
|
||||
ControlFileData ControlFile_new;
|
||||
bool writerecoveryconf = false;
|
||||
filemap_t *filemap;
|
||||
|
||||
pg_logging_init(argv[0]);
|
||||
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_rewind"));
|
||||
@@ -368,13 +369,16 @@ main(int argc, char **argv)
|
||||
(uint32) (chkptrec >> 32), (uint32) chkptrec,
|
||||
chkpttli);
|
||||
|
||||
/* Initialize the hash table to track the status of each file */
|
||||
filehash_init();
|
||||
|
||||
/*
|
||||
* Collect information about all files in the target and source systems.
|
||||
*/
|
||||
filemap_create();
|
||||
if (showprogress)
|
||||
pg_log_info("reading source file list");
|
||||
fetchSourceFileList();
|
||||
|
||||
if (showprogress)
|
||||
pg_log_info("reading target file list");
|
||||
traverse_datadir(datadir_target, &process_target_file);
|
||||
@@ -395,13 +399,13 @@ main(int argc, char **argv)
|
||||
* We have collected all information we need from both systems. Decide
|
||||
* what to do with each file.
|
||||
*/
|
||||
decide_file_actions();
|
||||
filemap = decide_file_actions();
|
||||
if (showprogress)
|
||||
calculate_totals();
|
||||
calculate_totals(filemap);
|
||||
|
||||
/* this is too verbose even for verbose mode */
|
||||
if (debug)
|
||||
print_filemap();
|
||||
print_filemap(filemap);
|
||||
|
||||
/*
|
||||
* Ok, we're ready to start copying things over.
|
||||
@@ -421,7 +425,7 @@ main(int argc, char **argv)
|
||||
* modified the target directory and there is no turning back!
|
||||
*/
|
||||
|
||||
executeFileMap();
|
||||
execute_file_actions(filemap);
|
||||
|
||||
progress_report(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user