Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07d17a7

Browse files
committed
In pg_upgrade, check there are no prepared transactions.
1 parent8cfd59d commit07d17a7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

‎contrib/pg_upgrade/check.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ static void check_old_cluster_has_new_cluster_dbs(void);
1616
staticvoidcheck_locale_and_encoding(ControlData*oldctrl,
1717
ControlData*newctrl);
1818
staticvoidcheck_is_super_user(ClusterInfo*cluster);
19+
staticvoidcheck_for_prepared_transactions(ClusterInfo*cluster);
1920
staticvoidcheck_for_isn_and_int8_passing_mismatch(ClusterInfo*cluster);
2021
staticvoidcheck_for_reg_data_type_usage(ClusterInfo*cluster);
2122

@@ -65,6 +66,7 @@ check_old_cluster(bool live_check,
6566
* Check for various failure cases
6667
*/
6768
check_is_super_user(&old_cluster);
69+
check_for_prepared_transactions(&old_cluster);
6870
check_for_reg_data_type_usage(&old_cluster);
6971
check_for_isn_and_int8_passing_mismatch(&old_cluster);
7072

@@ -117,6 +119,7 @@ check_new_cluster(void)
117119
get_db_and_rel_infos(&new_cluster);
118120

119121
check_new_cluster_is_empty();
122+
check_for_prepared_transactions(&new_cluster);
120123
check_old_cluster_has_new_cluster_dbs();
121124

122125
check_loadable_libraries();
@@ -506,6 +509,36 @@ check_is_super_user(ClusterInfo *cluster)
506509
}
507510

508511

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+
staticvoid
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+
509542
/*
510543
*check_for_isn_and_int8_passing_mismatch()
511544
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp