@@ -1073,6 +1073,87 @@ def test_replica_toast(self):
10731073 # Clean after yourself
10741074 self .del_test_dir (module_name , fname )
10751075
1076+ # @unittest.skip("skip")
1077+ def test_start_stop_lsn_in_the_same_segno (self ):
1078+ """
1079+ """
1080+ fname = self .id ().split ('.' )[3 ]
1081+ backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
1082+ master = self .make_simple_node (
1083+ base_dir = os .path .join (module_name , fname , 'master' ),
1084+ set_replication = True ,
1085+ initdb_params = ['--data-checksums' ],
1086+ pg_options = {
1087+ 'autovacuum' : 'off' ,
1088+ 'checkpoint_timeout' : '1h' ,
1089+ 'wal_level' : 'replica' ,
1090+ 'shared_buffers' : '128MB' })
1091+
1092+ if self .get_version (master ) < self .version_to_num ('9.6.0' ):
1093+ self .del_test_dir (module_name , fname )
1094+ return unittest .skip (
1095+ 'Skipped because backup from replica is not supported in PG 9.5' )
1096+
1097+ self .init_pb (backup_dir )
1098+ self .add_instance (backup_dir , 'master' , master )
1099+ master .slow_start ()
1100+
1101+ # freeze bgwriter to get rid of RUNNING XACTS records
1102+ bgwriter_pid = master .auxiliary_pids [ProcessType .BackgroundWriter ][0 ]
1103+ gdb_checkpointer = self .gdb_attach (bgwriter_pid )
1104+
1105+ self .backup_node (backup_dir , 'master' , master , options = ['--stream' ])
1106+
1107+ # Create replica
1108+ replica = self .make_simple_node (
1109+ base_dir = os .path .join (module_name , fname , 'replica' ))
1110+ replica .cleanup ()
1111+ self .restore_node (backup_dir , 'master' , replica )
1112+
1113+ # Settings for Replica
1114+ self .add_instance (backup_dir , 'replica' , replica )
1115+ self .set_replica (master , replica , synchronous = True )
1116+
1117+ replica .slow_start (replica = True )
1118+
1119+ self .switch_wal_segment (master )
1120+ self .switch_wal_segment (master )
1121+
1122+ master .safe_psql (
1123+ 'postgres' ,
1124+ 'CREATE TABLE t1 AS '
1125+ 'SELECT i, repeat(md5(i::text),5006056) AS fat_attr '
1126+ 'FROM generate_series(0,10) i' )
1127+
1128+ master .safe_psql (
1129+ 'postgres' ,
1130+ 'CHECKPOINT' )
1131+
1132+ self .wait_until_replica_catch_with_master (master , replica )
1133+
1134+ sleep (60 )
1135+
1136+ self .backup_node (
1137+ backup_dir , 'replica' , replica ,
1138+ options = [
1139+ '--archive-timeout=30' ,
1140+ '--log-level-console=LOG' ,
1141+ '--no-validate' ,
1142+ '--stream' ],
1143+ return_id = False )
1144+
1145+ self .backup_node (
1146+ backup_dir , 'replica' , replica ,
1147+ options = [
1148+ '--archive-timeout=30' ,
1149+ '--log-level-console=LOG' ,
1150+ '--no-validate' ,
1151+ '--stream' ],
1152+ return_id = False )
1153+
1154+ # Clean after yourself
1155+ self .del_test_dir (module_name , fname )
1156+
10761157 @unittest .skip ("skip" )
10771158 def test_replica_promote_1 (self ):
10781159 """
0 commit comments