@@ -1714,8 +1714,30 @@ def pgdata_content(self, pgdata, ignore_ptrack=True, exclude_dirs=None):
1714
1714
1715
1715
return directory_dict
1716
1716
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
+ """
1719
1741
fail = False
1720
1742
error_message = 'Restored PGDATA is not equal to original!\n '
1721
1743
@@ -1777,16 +1799,17 @@ def compare_pgdata(self, original_pgdata, restored_pgdata):
1777
1799
original_pgdata ['files' ][file ]['md5' ] !=
1778
1800
restored_pgdata ['files' ][file ]['md5' ]
1779
1801
):
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
+ )
1790
1813
1791
1814
if original_pgdata ['files' ][file ]['is_datafile' ]:
1792
1815
for page in original_pgdata ['files' ][file ]['md5_per_page' ]:
@@ -1802,13 +1825,16 @@ def compare_pgdata(self, original_pgdata, restored_pgdata):
1802
1825
)
1803
1826
continue
1804
1827
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
1808
1834
error_message += (
1809
- '\n Page checksumm mismatch: {0}\n '
1810
- ' PAGE Checksumm_old : {1}\n '
1811
- ' PAGE Checksumm_new : {2}\n '
1835
+ '\n Page checksum mismatch: {0}\n '
1836
+ ' PAGE Checksum_old : {1}\n '
1837
+ ' PAGE Checksum_new : {2}\n '
1812
1838
' File: {3}\n '
1813
1839
).format (
1814
1840
page ,
0 commit comments