55from testgres import QueryException
66import subprocess
77import time
8+ from threading import Thread
89
910
1011module_name = 'delta'
@@ -522,48 +523,40 @@ def test_delta_vacuum_full(self):
522523" as id from generate_series(0,1000000) i"
523524 )
524525
525- # create async connection
526- conn = self .get_async_connect (port = node .port )
526+ pg_connect = node .connect ("postgres" ,autocommit = True )
527527
528- self .wait (conn )
529-
530- acurs = conn .cursor ()
531- acurs .execute ("select pg_backend_pid()" )
532-
533- self .wait (conn )
534- pid = acurs .fetchall ()[0 ][0 ]
535- print (pid )
536-
537- gdb = self .gdb_attach (pid )
528+ gdb = self .gdb_attach (pg_connect .pid )
538529gdb .set_breakpoint ('reform_and_rewrite_tuple' )
539530
540531gdb .continue_execution_until_running ()
541532
542- acurs .execute ("VACUUM FULL t_heap" )
533+ process = Thread (
534+ target = pg_connect .execute ,args = ["VACUUM FULL t_heap" ])
535+ process .start ()
543536
544- if gdb .stopped_in_breakpoint () :
545- gdb . continue_execution_until_break ( 20 )
537+ while not gdb .stopped_in_breakpoint :
538+ sleep ( 1 )
546539
547- self .backup_node (
548- backup_dir ,'node' ,node ,
549- backup_type = 'delta' ,options = ['--stream' ]
550- )
540+ gdb .continue_execution_until_break (20 )
551541
552542self .backup_node (
553543backup_dir ,'node' ,node ,
554- backup_type = 'delta' ,options = ['--stream' ]
555- )
544+ backup_type = 'delta' ,options = ['--stream' ])
545+
556546if self .paranoia :
557547pgdata = self .pgdata_content (node .data_dir )
558548
549+ gdb .remove_all_breakpoints ()
550+ gdb ._execute ('detach' )
551+ process .join ()
552+
559553old_tablespace = self .get_tblspace_path (node ,'somedata' )
560554new_tablespace = self .get_tblspace_path (node_restored ,'somedata_new' )
561555
562556self .restore_node (
563557backup_dir ,'node' ,node_restored ,
564558options = ["-j" ,"4" ,"-T" ,"{0}={1}" .format (
565- old_tablespace ,new_tablespace )]
566- )
559+ old_tablespace ,new_tablespace )])
567560
568561# Physical comparison
569562if self .paranoia :
@@ -1125,7 +1118,6 @@ def test_delta_corruption_heal_via_ptrack_1(self):
11251118backup_type = "delta" ,
11261119options = ["-j" ,"4" ,"--stream" ,'--log-level-file=verbose' ])
11271120
1128-
11291121# open log file and check
11301122with open (os .path .join (backup_dir ,'log' ,'pg_probackup.log' ))as f :
11311123log_content = f .read ()
@@ -1254,9 +1246,9 @@ def test_delta_nullified_heap_page_backup(self):
12541246backup_dir ,'node' ,node )
12551247
12561248# Nullify some block in PostgreSQL
1257- file = os .path .join (node .data_dir ,file_path ).replace ("\\ " ,"/" )
1249+ file = os .path .join (node .data_dir ,file_path ).replace ("\\ " ,"/" )
12581250if os .name == 'nt' :
1259- file = file .replace ("\\ " ,"/" )
1251+ file = file .replace ("\\ " ,"/" )
12601252
12611253with open (file ,'r+b' ,0 )as f :
12621254f .seek (8192 )
@@ -1281,7 +1273,7 @@ def test_delta_nullified_heap_page_backup(self):
12811273content )
12821274self .assertNotIn (
12831275"Skipping blknum: 1 in file: {0}" .format (file ),
1284- content )
1276+ content )
12851277
12861278# Restore DELTA backup
12871279node_restored = self .make_simple_node (