@@ -72,6 +72,9 @@ catchup_collect_info(PGNodeInfo *source_node_info, const char *source_pgdata, co
72
72
/* Get WAL segments size and system ID of source PG instance */
73
73
instance_config .xlog_seg_size = get_xlog_seg_size (source_pgdata );
74
74
instance_config .system_identifier = get_system_identifier (source_pgdata );
75
+ #if PG_VERSION_NUM < 90600
76
+ instance_config .pgdata = source_pgdata ;
77
+ #endif
75
78
current .start_time = time (NULL );
76
79
77
80
StrNCpy (current .program_version , PROGRAM_VERSION , sizeof (current .program_version ));
@@ -113,7 +116,10 @@ catchup_collect_info(PGNodeInfo *source_node_info, const char *source_pgdata, co
113
116
return source_conn ;
114
117
}
115
118
116
- //REVIEW Please add a comment to this function.
119
+ /*
120
+ * Check that catchup can be performed on source and dest
121
+ * this function is for checks, that can be performed without modification of data on disk
122
+ */
117
123
static void
118
124
catchup_preflight_checks (PGNodeInfo * source_node_info , PGconn * source_conn ,
119
125
const char * source_pgdata , const char * dest_pgdata , bool dest_pgdata_is_empty )
@@ -164,16 +170,13 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
164
170
RedoParams dest_redo = { 0 , InvalidXLogRecPtr , 0 };
165
171
pgFile * source_pg_control_file = NULL ;
166
172
167
- //REVIEW please adjust this comment.
168
- /* arrays with meta info for multi threaded backup */
173
+ /* arrays with meta info for multi threaded catchup */
169
174
pthread_t * threads ;
170
175
catchup_thread_runner_arg * threads_args ;
171
176
bool catchup_isok = true;
172
177
173
178
parray * source_filelist = NULL ;
174
179
parray * dest_filelist = NULL ;
175
- //REVIEW We don't handle external_dirs in catchup, do we? Let's clean this up.
176
- parray * external_dirs = NULL ;
177
180
178
181
//REVIEW FIXME Let's fix it before release. It can cause some obscure bugs.
179
182
/* TODO: in case of timeline mistmatch, check that source PG timeline descending from dest PG timeline */
@@ -199,8 +202,6 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
199
202
strncat (label , " with pg_probackup" , lengthof (label ) -
200
203
strlen (" with pg_probackup" ));
201
204
202
- //REVIEW FIXME Let' do that.
203
-
204
205
/* Call pg_start_backup function in PostgreSQL connect */
205
206
pg_start_backup (label , smooth_checkpoint , & current , source_node_info , source_conn );
206
207
elog (LOG , "pg_start_backup START LSN %X/%X" , (uint32 ) (current .start_lsn >> 32 ), (uint32 ) (current .start_lsn ));
@@ -231,8 +232,8 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
231
232
232
233
// new ptrack is more robust and checks Start LSN
233
234
if (ptrack_lsn > dest_redo .lsn || ptrack_lsn == InvalidXLogRecPtr )
234
- elog (ERROR , "LSN from ptrack_control %X/%X is greater than checkpoint LSN %X/%X.\n"
235
- "Create new full backup before an incremental one ." ,
235
+ elog (ERROR , "LSN from ptrack_control in source %X/%X is greater than checkpoint LSN in destination %X/%X.\n"
236
+ "You can perform only FULL catchup ." ,
236
237
(uint32 ) (ptrack_lsn >> 32 ), (uint32 ) (ptrack_lsn ),
237
238
(uint32 ) (dest_redo .lsn >> 32 ),
238
239
(uint32 ) (dest_redo .lsn ));
@@ -255,8 +256,6 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
255
256
current .start_lsn , current .tli );
256
257
}
257
258
258
- //REVIEW please adjust the comment.
259
- /* initialize backup list */
260
259
source_filelist = parray_new ();
261
260
262
261
/* list files with the logical path. omit $PGDATA */
@@ -471,14 +470,14 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
471
470
//REVIEW Hmm. Why do we need this at all?
472
471
//I'd expect that we init pgfile with unset lock...
473
472
//Not related to this patch, though.
473
+ //REVIEW_ANSWER initialization in the pgFileInit function was proposed but was not accepted (see 2c8b7e9)
474
474
/* clear file locks */
475
475
pfilearray_clear_locks (source_filelist );
476
476
477
477
/* Sort by size for load balancing */
478
478
parray_qsort (source_filelist , pgFileCompareSize );
479
479
480
- //REVIEW. This comment looks a bit misleading, since all theads share same filelist.
481
- /* init thread args with own file lists */
480
+ /* init thread args */
482
481
threads = (pthread_t * ) palloc (sizeof (pthread_t ) * num_threads );
483
482
threads_args = (catchup_thread_runner_arg * ) palloc (sizeof (catchup_thread_runner_arg ) * num_threads );
484
483
@@ -539,6 +538,7 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
539
538
pretty_time );
540
539
541
540
//REVIEW The comment looks unrelated to the function. Do I miss something?
541
+ //REVIEW_ANSWER because it is a part of pg_stop_backup() calling
542
542
/* Notify end of backup */
543
543
pg_silent_client_messages (source_conn );
544
544
@@ -681,12 +681,9 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
681
681
parray_walk (dest_filelist , pgFileFree );
682
682
parray_free (dest_filelist );
683
683
}
684
-
685
684
parray_walk (source_filelist , pgFileFree );
686
685
parray_free (source_filelist );
687
686
pgFileFree (source_pg_control_file );
688
- //REVIEW Huh?
689
- // где закрывается conn?
690
687
}
691
688
692
689
/*
0 commit comments