@@ -780,6 +780,7 @@ def test_pg_dump(self):
780780con .commit ()
781781
782782# compare strategies
783+ CMP_OK ,PLANS_MISMATCH ,CONTENTS_MISMATCH = range (3 )
783784def cmp_full (con1 ,con2 ):
784785"""Compare selection partitions in plan and contents in partitioned tables"""
785786
@@ -794,11 +795,15 @@ def cmp_full(con1, con2):
794795for table_ref in table_refs :
795796plan_initial = con1 .execute (plan_query % table_ref )[0 ][0 ][0 ]['Plan' ]
796797plan_copy = con2 .execute (plan_query % table_ref )[0 ][0 ][0 ]['Plan' ]
797- self .assertEqual (ordered (plan_initial ),ordered (plan_copy ))
798+ if ordered (plan_initial )!= ordered (plan_copy ):
799+ return PLANS_MISMATCH
798800
799801content_initial = [x [0 ]for x in con1 .execute (content_query % table_ref )]
800802content_copy = [x [0 ]for x in con2 .execute (content_query % table_ref )]
801- self .assertEqual (content_initial ,content_copy )
803+ if content_initial != content_copy :
804+ return CONTENTS_MISMATCH
805+
806+ return CMP_OK
802807
803808def turnoff_pathman (node ):
804809node .psql ('initial' ,'alter system set pg_pathman.enable to off' )
@@ -845,12 +850,15 @@ def turnon_pathman(node):
845850]
846851for preproc ,postproc ,pg_dump_params ,pg_restore_params ,cmp_dbs in test_params :
847852
853+ dump_restore_cmd = " | " .join ((' ' .join (pg_dump_params ),' ' .join (pg_restore_params )))
854+
848855if (preproc != None ):
849856preproc (node )
850857
851858# transfer and restore data
859+ FNULL = open (os .devnull ,'w' )
852860p1 = subprocess .Popen (pg_dump_params ,stdout = subprocess .PIPE )
853- p2 = subprocess .Popen (pg_restore_params ,stdin = p1 .stdout ,stdout = subprocess . PIPE )
861+ p2 = subprocess .Popen (pg_restore_params ,stdin = p1 .stdout ,stdout = FNULL , stderr = FNULL )
854862p1 .stdout .close ()# Allow p1 to receive a SIGPIPE if p2 exits.
855863p2 .communicate ()
856864
@@ -861,7 +869,11 @@ def turnon_pathman(node):
861869with node .connect ('initial' )as con1 ,node .connect ('copy' )as con2 :
862870
863871# compare plans and contents of initial and copy
864- cmp_dbs (con1 ,con2 )
872+ cmp_result = cmp_dbs (con1 ,con2 )
873+ self .assertNotEqual (cmp_result ,PLANS_MISMATCH ,
874+ "mismatch in plans of select query on partitioned tables under the command: %s" % dump_restore_cmd )
875+ self .assertNotEqual (cmp_result ,CONTENTS_MISMATCH ,
876+ "mismatch in contents of partitioned tables under the command: %s" % dump_restore_cmd )
865877
866878# compare enable_parent flag and callback function
867879config_params_query = """
@@ -872,7 +884,8 @@ def turnon_pathman(node):
872884config_params_initial [row [0 ]]= row [1 :]
873885for row in con2 .execute (config_params_query ):
874886config_params_copy [row [0 ]]= row [1 :]
875- self .assertEqual (config_params_initial ,config_params_copy )
887+ self .assertEqual (config_params_initial ,config_params_copy , \
888+ "mismatch in pathman_config_params under the command: %s" % dump_restore_cmd )
876889
877890# compare constraints on each partition
878891constraints_query = """
@@ -885,7 +898,8 @@ def turnon_pathman(node):
885898constraints_initial [row [0 ]]= row [1 :]
886899for row in con2 .execute (constraints_query ):
887900constraints_copy [row [0 ]]= row [1 :]
888- self .assertEqual (constraints_initial ,constraints_copy )
901+ self .assertEqual (constraints_initial ,constraints_copy , \
902+ "mismatch in partitions' constraints under the command: %s" % dump_restore_cmd )
889903
890904# clear copy database
891905node .psql ('copy' ,'drop schema public cascade' )