@@ -1714,8 +1714,30 @@ def pgdata_content(self, pgdata, ignore_ptrack=True, exclude_dirs=None):
17141714
17151715return directory_dict
17161716
1717- def compare_pgdata (self ,original_pgdata ,restored_pgdata ):
1718- """ return dict with directory content. DO IT BEFORE RECOVERY"""
1717+ def get_known_bugs_comparision_exclusion_dict (self ,node ):
1718+ """ get dict of known datafiles difference, that can be used in compare_pgdata() """
1719+ comparision_exclusion_dict = dict ()
1720+
1721+ # bug in spgist metapage update (PGPRO-5707)
1722+ spgist_filelist = node .safe_psql (
1723+ "postgres" ,
1724+ "SELECT pg_catalog.pg_relation_filepath(pg_class.oid) "
1725+ "FROM pg_am, pg_class "
1726+ "WHERE pg_am.amname = 'spgist' "
1727+ "AND pg_class.relam = pg_am.oid"
1728+ ).decode ('utf-8' ).rstrip ().splitlines ()
1729+ for filename in spgist_filelist :
1730+ comparision_exclusion_dict [filename ]= set ([0 ])
1731+
1732+ return comparision_exclusion_dict
1733+
1734+
1735+ def compare_pgdata (self ,original_pgdata ,restored_pgdata ,exclusion_dict = dict ()):
1736+ """
1737+ return dict with directory content. DO IT BEFORE RECOVERY
1738+ exclusion_dict is used for exclude files (and it block_no) from comparision
1739+ it is a dict with relative filenames as keys and set of block numbers as values
1740+ """
17191741fail = False
17201742error_message = 'Restored PGDATA is not equal to original!\n '
17211743
@@ -1777,16 +1799,17 @@ def compare_pgdata(self, original_pgdata, restored_pgdata):
17771799original_pgdata ['files' ][file ]['md5' ]!=
17781800restored_pgdata ['files' ][file ]['md5' ]
17791801 ):
1780- fail = True
1781- error_message += (
1782- '\n File Checksumm mismatch.\n '
1783- 'File_old: {0}\n Checksumm_old: {1}\n '
1784- 'File_new: {2}\n Checksumm_new: {3}\n ' ).format (
1785- os .path .join (original_pgdata ['pgdata' ],file ),
1786- original_pgdata ['files' ][file ]['md5' ],
1787- os .path .join (restored_pgdata ['pgdata' ],file ),
1788- restored_pgdata ['files' ][file ]['md5' ]
1789- )
1802+ if file not in exclusion_dict :
1803+ fail = True
1804+ error_message += (
1805+ '\n File Checksum mismatch.\n '
1806+ 'File_old: {0}\n Checksum_old: {1}\n '
1807+ 'File_new: {2}\n Checksum_new: {3}\n ' ).format (
1808+ os .path .join (original_pgdata ['pgdata' ],file ),
1809+ original_pgdata ['files' ][file ]['md5' ],
1810+ os .path .join (restored_pgdata ['pgdata' ],file ),
1811+ restored_pgdata ['files' ][file ]['md5' ]
1812+ )
17901813
17911814if original_pgdata ['files' ][file ]['is_datafile' ]:
17921815for page in original_pgdata ['files' ][file ]['md5_per_page' ]:
@@ -1802,13 +1825,16 @@ def compare_pgdata(self, original_pgdata, restored_pgdata):
18021825 )
18031826continue
18041827
1805- if original_pgdata ['files' ][file ][
1806- 'md5_per_page' ][page ]!= restored_pgdata [
1807- 'files' ][file ]['md5_per_page' ][page ]:
1828+ if not (file in exclusion_dict and page in exclusion_dict [file ]):
1829+ if (
1830+ original_pgdata ['files' ][file ]['md5_per_page' ][page ]!=
1831+ restored_pgdata ['files' ][file ]['md5_per_page' ][page ]
1832+ ):
1833+ fail = True
18081834error_message += (
1809- '\n Pagechecksumm mismatch: {0}\n '
1810- ' PAGEChecksumm_old : {1}\n '
1811- ' PAGEChecksumm_new : {2}\n '
1835+ '\n Pagechecksum mismatch: {0}\n '
1836+ ' PAGEChecksum_old : {1}\n '
1837+ ' PAGEChecksum_new : {2}\n '
18121838' File: {3}\n '
18131839 ).format (
18141840page ,