File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -315,6 +315,8 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
315
315
{
316
316
total_files_num ++ ;
317
317
}
318
+
319
+ __sync_lock_release (& file -> lock );
318
320
}
319
321
320
322
if (num_threads < 1 )
@@ -329,20 +331,12 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
329
331
backup_files_args * arg = pg_malloc (sizeof (backup_files_args ));
330
332
arg -> from_root = pgdata ;
331
333
arg -> to_root = path ;
332
- arg -> files = parray_new () ;
334
+ arg -> files = backup_files_list ;
333
335
arg -> prev_files = prev_files ;
334
336
arg -> lsn = lsn ;
335
337
backup_threads_args [i ] = arg ;
336
338
}
337
339
338
- /* balance load between threads */
339
- for (i = 0 ; i < parray_num (backup_files_list ); i ++ )
340
- {
341
- int cur_thread = i % num_threads ;
342
- parray_append (backup_threads_args [cur_thread ]-> files ,
343
- parray_get (backup_files_list , i ));
344
- }
345
-
346
340
total_copy_files_increment = 0 ;
347
341
348
342
/* Run threads */
@@ -935,6 +929,8 @@ backup_files(void *arg)
935
929
struct stat buf ;
936
930
937
931
pgFile * file = (pgFile * ) parray_get (arguments -> files , i );
932
+ if (__sync_lock_test_and_set (& file -> lock , 1 ) != 0 )
933
+ continue ;
938
934
939
935
/* If current time is rewinded, abort this backup. */
940
936
if (tv .tv_sec < file -> mtime )
Original file line number Diff line number Diff line change @@ -56,11 +56,12 @@ typedef struct pgFile
56
56
that the file existed but was not backed up
57
57
because not modified since last backup. */
58
58
pg_crc32 crc ; /* CRC value of the file, regular file only */
59
- char * linked ; /* path of the linked file */
59
+ char * linked ; /* path of the linked file */
60
60
bool is_datafile ; /* true if the file is PostgreSQL data file */
61
61
char * path ; /* path of the file */
62
62
char * ptrack_path ;
63
63
int segno ; /* Segment number for ptrack */
64
+ volatile uint32 lock ;
64
65
datapagemap_t pagemap ;
65
66
} pgFile ;
66
67
You can’t perform that action at this time.
0 commit comments