@@ -20,7 +20,6 @@ static void check_is_super_user(ClusterInfo *cluster);
20
20
static void check_for_prepared_transactions (ClusterInfo * cluster );
21
21
static void check_for_isn_and_int8_passing_mismatch (ClusterInfo * cluster );
22
22
static void check_for_reg_data_type_usage (ClusterInfo * cluster );
23
- static void check_for_invalid_indexes (ClusterInfo * cluster );
24
23
static void get_bin_version (ClusterInfo * cluster );
25
24
static char * get_canonical_locale_name (int category , const char * locale );
26
25
@@ -97,7 +96,6 @@ check_and_dump_old_cluster(bool live_check, char **sequence_script_file_name)
97
96
check_is_super_user (& old_cluster );
98
97
check_for_prepared_transactions (& old_cluster );
99
98
check_for_reg_data_type_usage (& old_cluster );
100
- check_for_invalid_indexes (& old_cluster );
101
99
check_for_isn_and_int8_passing_mismatch (& old_cluster );
102
100
103
101
/* old = PG 8.3 checks? */
@@ -956,95 +954,6 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
956
954
}
957
955
958
956
959
- /*
960
- * check_for_invalid_indexes()
961
- *
962
- * CREATE INDEX CONCURRENTLY can create invalid indexes if the index build
963
- * fails. These are dumped as valid indexes by pg_dump, but the
964
- * underlying files are still invalid indexes. This checks to make sure
965
- * no invalid indexes exist, either failed index builds or concurrent
966
- * indexes in the process of being created.
967
- */
968
- static void
969
- check_for_invalid_indexes (ClusterInfo * cluster )
970
- {
971
- int dbnum ;
972
- FILE * script = NULL ;
973
- bool found = false;
974
- char output_path [MAXPGPATH ];
975
-
976
- prep_status ("Checking for invalid indexes from concurrent index builds" );
977
-
978
- snprintf (output_path , sizeof (output_path ), "invalid_indexes.txt" );
979
-
980
- for (dbnum = 0 ; dbnum < cluster -> dbarr .ndbs ; dbnum ++ )
981
- {
982
- PGresult * res ;
983
- bool db_used = false;
984
- int ntups ;
985
- int rowno ;
986
- int i_nspname ,
987
- i_relname ;
988
- DbInfo * active_db = & cluster -> dbarr .dbs [dbnum ];
989
- PGconn * conn = connectToServer (cluster , active_db -> db_name );
990
-
991
- res = executeQueryOrDie (conn ,
992
- "SELECT n.nspname, c.relname "
993
- "FROM pg_catalog.pg_class c, "
994
- " pg_catalog.pg_namespace n, "
995
- " pg_catalog.pg_index i "
996
- "WHERE (i.indisvalid = false OR "
997
- " i.indisready = false) AND "
998
- " i.indexrelid = c.oid AND "
999
- " c.relnamespace = n.oid AND "
1000
- /* we do not migrate these, so skip them */
1001
- " n.nspname != 'pg_catalog' AND "
1002
- " n.nspname != 'information_schema' AND "
1003
- /* indexes do not have toast tables */
1004
- " n.nspname != 'pg_toast'" );
1005
-
1006
- ntups = PQntuples (res );
1007
- i_nspname = PQfnumber (res , "nspname" );
1008
- i_relname = PQfnumber (res , "relname" );
1009
- for (rowno = 0 ; rowno < ntups ; rowno ++ )
1010
- {
1011
- found = true;
1012
- if (script == NULL && (script = fopen_priv (output_path , "w" )) == NULL )
1013
- pg_log (PG_FATAL , "Could not open file \"%s\": %s\n" ,
1014
- output_path , getErrorText (errno ));
1015
- if (!db_used )
1016
- {
1017
- fprintf (script , "Database: %s\n" , active_db -> db_name );
1018
- db_used = true;
1019
- }
1020
- fprintf (script , " %s.%s\n" ,
1021
- PQgetvalue (res , rowno , i_nspname ),
1022
- PQgetvalue (res , rowno , i_relname ));
1023
- }
1024
-
1025
- PQclear (res );
1026
-
1027
- PQfinish (conn );
1028
- }
1029
-
1030
- if (script )
1031
- fclose (script );
1032
-
1033
- if (found )
1034
- {
1035
- pg_log (PG_REPORT , "fatal\n" );
1036
- pg_log (PG_FATAL ,
1037
- "Your installation contains invalid indexes due to failed or\n"
1038
- "currently running CREATE INDEX CONCURRENTLY operations. You\n"
1039
- "cannot upgrade until these indexes are valid or removed. A\n"
1040
- "list of the problem indexes is in the file:\n"
1041
- " %s\n\n" , output_path );
1042
- }
1043
- else
1044
- check_ok ();
1045
- }
1046
-
1047
-
1048
957
static void
1049
958
get_bin_version (ClusterInfo * cluster )
1050
959
{
0 commit comments