Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 83c31c8

Browse files
committed
do not invalidate indexes in case when upgrading from the same version
1 parent 45054c7 commit 83c31c8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ fix_path_separator(char *path)
5959
#endif
6060
}
6161

62+
#define same_version_edition(cluster1, cluster2) \
63+
( \
64+
GET_MAJOR_VERSION((cluster1).major_version) == GET_MAJOR_VERSION((cluster2).major_version) \
65+
&& (cluster1).edition == (cluster2).edition \
66+
)
67+
6268
void
6369
output_check_banner(bool live_check)
6470
{
@@ -113,7 +119,7 @@ check_and_dump_old_cluster(bool live_check)
113119
* PgPro 10 Enterprise requires hash indexes to be reindexed regardless
114120
* of old cluster version
115121
*/
116-
if (user_opts.check)
122+
if (user_opts.check && !same_version_edition(old_cluster, new_cluster))
117123
old_9_6_invalidate_hash_indexes(&old_cluster, true);
118124

119125
/* 9.5 and below should not have roles starting with pg_ */
@@ -206,23 +212,27 @@ issue_warnings_and_set_wal_level(void)
206212
* Reindex hash indexes for old < 10.0
207213
* PgPro 10 Enterprise requires hash indexes to be reindexed
208214
*/
209-
old_9_6_invalidate_hash_indexes(&new_cluster, false);
215+
if (!same_version_edition(old_cluster, new_cluster))
216+
old_9_6_invalidate_hash_indexes(&new_cluster, false);
210217

211218
/* Invalidate incompatible indexes */
212219
/*
213220
* TODO: should we try to convert sp-gist indexes when upgrading from
214221
* previous Enterprise edition?
215222
*/
216-
invalidate_spgist_indexes(&new_cluster, false);
223+
if (!same_version_edition(old_cluster, new_cluster))
224+
invalidate_spgist_indexes(&new_cluster, false);
217225

218-
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 1000
226+
if ((GET_MAJOR_VERSION(old_cluster.major_version) <= 1000
219227
&& old_cluster.edition == PGPRO_ENTERPRISE)
228+
&& !same_version_edition(old_cluster, new_cluster))
220229
invalidate_brin_indexes(&new_cluster, false);
221230

222231
/*
223232
* Invalidate external indexes
224233
*/
225-
invalidate_external_indexes(&new_cluster, false);
234+
if (!same_version_edition(old_cluster, new_cluster))
235+
invalidate_external_indexes(&new_cluster, false);
226236

227237
if (old_cluster.edition != PG_ORIGINAL &&
228238
GET_MAJOR_VERSION(old_cluster.major_version) <= 906)

0 commit comments

Comments
 (0)