@@ -16,6 +16,7 @@ static void check_old_cluster_has_new_cluster_dbs(void);
16
16
static void check_locale_and_encoding (ControlData * oldctrl ,
17
17
ControlData * newctrl );
18
18
static void check_is_super_user (ClusterInfo * cluster );
19
+ static void check_for_prepared_transactions (ClusterInfo * cluster );
19
20
static void check_for_isn_and_int8_passing_mismatch (ClusterInfo * cluster );
20
21
static void check_for_reg_data_type_usage (ClusterInfo * cluster );
21
22
@@ -65,6 +66,7 @@ check_old_cluster(bool live_check,
65
66
* Check for various failure cases
66
67
*/
67
68
check_is_super_user (& old_cluster );
69
+ check_for_prepared_transactions (& old_cluster );
68
70
check_for_reg_data_type_usage (& old_cluster );
69
71
check_for_isn_and_int8_passing_mismatch (& old_cluster );
70
72
@@ -117,6 +119,7 @@ check_new_cluster(void)
117
119
get_db_and_rel_infos (& new_cluster );
118
120
119
121
check_new_cluster_is_empty ();
122
+ check_for_prepared_transactions (& new_cluster );
120
123
check_old_cluster_has_new_cluster_dbs ();
121
124
122
125
check_loadable_libraries ();
@@ -506,6 +509,36 @@ check_is_super_user(ClusterInfo *cluster)
506
509
}
507
510
508
511
512
+ /*
513
+ * check_for_prepared_transactions()
514
+ *
515
+ * Make sure there are no prepared transactions because the storage format
516
+ * might have changed.
517
+ */
518
+ static void
519
+ check_for_prepared_transactions (ClusterInfo * cluster )
520
+ {
521
+ PGresult * res ;
522
+ PGconn * conn = connectToServer (cluster , "template1" );
523
+
524
+ prep_status ("Checking for prepared transactions" );
525
+
526
+ res = executeQueryOrDie (conn ,
527
+ "SELECT * "
528
+ "FROM pg_catalog.pg_prepared_xact()" );
529
+
530
+ if (PQntuples (res ) != 0 )
531
+ pg_log (PG_FATAL , "The %s cluster contains prepared transactions\n" ,
532
+ CLUSTER_NAME (cluster ));
533
+
534
+ PQclear (res );
535
+
536
+ PQfinish (conn );
537
+
538
+ check_ok ();
539
+ }
540
+
541
+
509
542
/*
510
543
* check_for_isn_and_int8_passing_mismatch()
511
544
*
0 commit comments