Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Commit 87c4cfa

Browse files
committed
In cases when we have different versions on several servers we see in recommendations only one link to why-upgrade.depesz.com. In this MR have added links for every version.
2 parents 3294ede + dc3d91d commit 87c4cfa

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

pghrep/src/checkup/a002/a002.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,17 @@ func A002CheckMinorVersions(report A002Report, config cfg.Config,
142142
}
143143
curVersions = checkup.GetUniques(curVersions)
144144
if len(curVersions) > 0 {
145-
result.AppendConclusion(
146-
A002_NOT_LAST_MINOR_VERSION,
147-
english.PluralWord(
148-
len(curVersions),
149-
MSG_NOT_LAST_MINOR_VERSION_CONCLUSION_1,
150-
MSG_NOT_LAST_MINOR_VERSION_CONCLUSION_N),
151-
strings.Join(curVersions, "`, `"),
152-
updateVersions[0],
153-
curVersions[0],
154-
updateVersions[0],
155-
curVersions[0],
156-
updateVersions[0])
145+
var changes []string
146+
for _, ver := range curVersions {
147+
changes = append(changes, fmt.Sprintf(MSG_SEE_CHANGES_BETWEEN_VER, ver, updateVersions[0], ver, updateVersions[0]))
148+
}
149+
var conclusion = fmt.Sprintf(english.PluralWord(
150+
len(curVersions),
151+
MSG_NOT_LAST_MINOR_VERSION_CONCLUSION_1,
152+
MSG_NOT_LAST_MINOR_VERSION_CONCLUSION_N),
153+
strings.Join(curVersions, "`, `"), updateVersions[0], english.WordSeries(changes, "and"))
154+
155+
result.AppendConclusion(A002_NOT_LAST_MINOR_VERSION, conclusion)
157156
result.AppendRecommendation(A002_NOT_LAST_MINOR_VERSION, MSG_NOT_LAST_MINOR_VERSION_RECOMMENDATION, updateVersions[0])
158157
result.P2 = true
159158
}

pghrep/src/checkup/a002/a002messages.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package a002
22

33
// Analysis of Postgres major version
44
const MSG_UNKNOWN_VERSION_CONCLUSION string = "[P1] PostgreSQL major version `%s` is unknown (on `%s`). " +
5-
"It means that PostgreSQL Global Development Group does not support your PostgreSQL version. " +
6-
"In case of bugs and security issues you are on your own. \n" // NikolayS: very rare; most likely it's a devel version.
5+
"It means that PostgreSQL Global Development Group does not support your PostgreSQL version. " +
6+
"In case of bugs and security issues you are on your own. \n" // NikolayS: very rare; most likely it's a devel version.
77
const MSG_UNKNOWN_VERSION_RECOMMENDATION string = "[P1] On `%s`, consider using one of supported major versions. \n"
88
const MSG_NOT_SUPPORTED_VERSION_CONCLUSION string = "[P1] Postgres major version being used is `%s` and it is " +
99
"NOT supported by PostgreSQL Global Development Group. The support has ended: `%s`. This is a major issue. New bugs and security " +
@@ -20,14 +20,15 @@ const MSG_SUPPORTED_VERSION_CONCLUSION string = "Postgres major version being us
2020
"of bugs and security issues, updates (new minor versions) with fixes will be released and available for use." +
2121
" Read more: [Versioning Policy](https://www.postgresql.org/support/versioning/). \n"
2222
const MSG_NOT_LAST_MAJOR_VERSION_CONCLUSION string = "[P3] Consider upgrading to the newest major version: %.0f. " +
23-
"It has a lot of new features and improvements. \n"
23+
"It has a lot of new features and improvements. \n"
2424

2525
// Analysis of minor version
2626
const MSG_LAST_MINOR_VERSION_CONCLUSION string = "`%s` is the most up-to-date Postgres minor version in the branch `%s`. \n"
27+
const MSG_SEE_CHANGES_BETWEEN_VER string = "[between %s and %s](https://why-upgrade.depesz.com/show?from=%s&to=%s)"
2728
const MSG_NOT_LAST_MINOR_VERSION_CONCLUSION_1 string = "[P2] The minor version being used (`%s`) is not up-to-date " +
28-
"(the newest version: `%s`). See [the full list of changes between %s and %s](https://why-upgrade.depesz.com/show?from=%s&to=%s). \n"
29+
"(the newest version: `%s`). See the full list of changes %s. \n"
2930
const MSG_NOT_LAST_MINOR_VERSION_CONCLUSION_N string = "[P2] The minor versions being used (`%s`) are not up-to-date " +
30-
"(the newest version: `%s`). See [the full list of changes between %s and %s](https://why-upgrade.depesz.com/show?from=%s&to=%s). \n"
31+
"(the newest version: `%s`). See the full list of changes %s. \n"
3132
const MSG_NOT_ALL_VERSIONS_SAME_CONCLUSION_1 string = "[P2] Postgres minor version on the master and replica(s) differ. Node `%s` uses Postgres `%s`. \n"
3233
const MSG_NOT_ALL_VERSIONS_SAME_CONCLUSION_N string = "[P2] Postgres minor version on the master and replica(s) differ. Nodes `%s` use Postgres `%s`. \n"
3334
const MSG_NOT_ALL_VERSIONS_SAME_RECOMMENDATION string = "[P2] Please upgrade Postgres so its versions on all nodes match. \n"

0 commit comments

Comments
 (0)