@@ -1767,7 +1767,7 @@ def test_hexadecimal_timeline(self):
17671767 # Clean after yourself
17681768 self .del_test_dir (module_name , fname )
17691769
1770- # @unittest.skip("skip")
1770+ @unittest .skip ("skip" )
17711771 # @unittest.expectedFailure
17721772 def test_archiving_and_slots (self ):
17731773 """
@@ -1905,6 +1905,101 @@ def test_archive_push_sanity(self):
19051905 # Clean after yourself
19061906 self .del_test_dir (module_name , fname )
19071907
1908+ # @unittest.expectedFailure
1909+ # @unittest.skip("skip")
1910+ def test_archive_pg_receivexlog_partial_handling (self ):
1911+ """check that archive-get delivers .partial and .gz.partial files"""
1912+ fname = self .id ().split ('.' )[3 ]
1913+ backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
1914+ node = self .make_simple_node (
1915+ base_dir = os .path .join (module_name , fname , 'node' ),
1916+ set_replication = True ,
1917+ initdb_params = ['--data-checksums' ])
1918+
1919+ self .init_pb (backup_dir )
1920+ self .add_instance (backup_dir , 'node' , node )
1921+
1922+ node .slow_start ()
1923+
1924+ self .backup_node (backup_dir , 'node' , node , options = ['--stream' ])
1925+
1926+ replica = self .make_simple_node (
1927+ base_dir = os .path .join (module_name , fname , 'replica' ))
1928+ replica .cleanup ()
1929+
1930+ self .restore_node (
1931+ backup_dir , 'node' , replica , replica .data_dir , options = ['-R' ])
1932+ self .set_auto_conf (replica , {'port' : replica .port })
1933+ self .set_replica (node , replica )
1934+
1935+ self .add_instance (backup_dir , 'replica' , replica )
1936+ # self.set_archiving(backup_dir, 'replica', replica, replica=True)
1937+
1938+ replica .slow_start (replica = True )
1939+
1940+ node .safe_psql ('postgres' , 'CHECKPOINT' )
1941+
1942+ if self .get_version (replica ) < 100000 :
1943+ pg_receivexlog_path = self .get_bin_path ('pg_receivexlog' )
1944+ else :
1945+ pg_receivexlog_path = self .get_bin_path ('pg_receivewal' )
1946+
1947+ cmdline = [
1948+ pg_receivexlog_path , '-p' , str (replica .port ), '--synchronous' ,
1949+ '-D' , os .path .join (backup_dir , 'wal' , 'replica' )]
1950+
1951+ if self .archive_compress and node .major_version >= 10 :
1952+ cmdline += ['-Z' , '1' ]
1953+
1954+ pg_receivexlog = self .run_binary (cmdline , asynchronous = True )
1955+
1956+ if pg_receivexlog .returncode :
1957+ self .assertFalse (
1958+ True ,
1959+ 'Failed to start pg_receivexlog: {0}' .format (
1960+ pg_receivexlog .communicate ()[1 ]))
1961+
1962+ node .safe_psql (
1963+ "postgres" ,
1964+ "create table t_heap as select i as id, md5(i::text) as text, "
1965+ "md5(repeat(i::text,10))::tsvector as tsvector "
1966+ "from generate_series(0,1000000) i" )
1967+
1968+ # FULL
1969+ self .backup_node (backup_dir , 'replica' , replica , options = ['--stream' ])
1970+
1971+ node .safe_psql (
1972+ "postgres" ,
1973+ "insert into t_heap select i as id, md5(i::text) as text, "
1974+ "md5(repeat(i::text,10))::tsvector as tsvector "
1975+ "from generate_series(1000000,2000000) i" )
1976+
1977+ node_restored = self .make_simple_node (
1978+ base_dir = os .path .join (module_name , fname , 'node_restored' ))
1979+ node_restored .cleanup ()
1980+
1981+ self .restore_node (
1982+ backup_dir , 'replica' , node_restored ,
1983+ node_restored .data_dir , options = ['--recovery-target=latest' , '--recovery-target-action=promote' ])
1984+ self .set_auto_conf (node_restored , {'port' : node_restored .port })
1985+ self .set_auto_conf (node_restored , {'hot_standby' : 'off' })
1986+
1987+ node_restored .slow_start ()
1988+
1989+ result = node .safe_psql (
1990+ "postgres" ,
1991+ "select sum(id) from t_heap" )
1992+
1993+ result_new = node_restored .safe_psql (
1994+ "postgres" ,
1995+ "select sum(id) from t_heap" )
1996+
1997+ self .assertEqual (result , result_new )
1998+
1999+ # Clean after yourself
2000+ pg_receivexlog .kill ()
2001+ self .del_test_dir (module_name , fname )
2002+
19082003# TODO test with multiple not archived segments.
19092004
19102005# important - switchpoint may be NullOffset LSN and not actually existing in archive to boot.
0 commit comments