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

Commitbe92998

Browse files
committed
*: report and save postgres binary version
1 parent9d34b4e commitbe92998

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

‎cmd/keeper/cmd/keeper.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,6 @@ func (p *PostgresKeeper) createPGParameters(db *cluster.DB) common.Parameters {
336336
for_,synchronousStandby:=rangedb.Spec.ExternalSynchronousStandbys {
337337
synchronousStandbys=append(synchronousStandbys,synchronousStandby)
338338
}
339-
// TODO(sgotti) Find a way to detect the pg major version also
340-
// when the instance is empty. Parsing the postgres --version
341-
// is not always reliable (for example we can get `10devel` for
342-
// development version).
343-
// Now this will lead to problems starting the instance (or
344-
// warning reloading the parameters) with postgresql < 9.6
345339

346340
// We deliberately don't use postgres FIRST or ANY methods with N
347341
// different than len(synchronousStandbys) because we need that all the
@@ -533,11 +527,21 @@ func (p *PostgresKeeper) updateKeeperInfo() error {
533527
returnnil
534528
}
535529

530+
maj,min,err:=p.pgm.BinaryVersion()
531+
iferr!=nil {
532+
// in case we fail to parse the binary version then log it and just report maj and min as 0
533+
log.Warnf("failed to get postgres binary version: %v",err)
534+
}
535+
536536
keeperInfo:=&cluster.KeeperInfo{
537-
InfoUID:common.UID(),
538-
UID:keeperUID,
539-
ClusterUID:clusterUID,
540-
BootUUID:p.bootUUID,
537+
InfoUID:common.UID(),
538+
UID:keeperUID,
539+
ClusterUID:clusterUID,
540+
BootUUID:p.bootUUID,
541+
PostgresBinaryVersion: cluster.PostgresBinaryVersion{
542+
Maj:maj,
543+
Min:min,
544+
},
541545
PostgresState:p.getLastPGState(),
542546
}
543547

‎cmd/sentinel/cmd/sentinel.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ func (s *Sentinel) updateKeepersStatus(cd *cluster.ClusterData, keepersInfo clus
248248
s.CleanKeeperError(keeperUID)
249249
// Update keeper status infos
250250
k.Status.BootUUID=ki.BootUUID
251+
k.Status.PostgresBinaryVersion.Maj=ki.PostgresBinaryVersion.Maj
252+
k.Status.PostgresBinaryVersion.Min=ki.PostgresBinaryVersion.Min
251253
}
252254
}
253255

‎internal/cluster/cluster.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ type FollowConfig struct {
9595
StandbySettings*StandbySettings`json:"standbySettings,omitempty"`
9696
}
9797

98+
typePostgresBinaryVersionstruct {
99+
Majint
100+
Minint
101+
}
102+
98103
typeClusterPhasestring
99104

100105
const (
@@ -530,6 +535,8 @@ type KeeperStatus struct {
530535
LastHealthyTime time.Time`json:"lastHealthyTime,omitempty"`
531536

532537
BootUUIDstring`json:"bootUUID,omitempty"`
538+
539+
PostgresBinaryVersionPostgresBinaryVersion`json:"postgresBinaryVersion,omitempty"`
533540
}
534541

535542
typeKeeperstruct {

‎internal/cluster/member.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ type KeeperInfo struct {
4747
ClusterUIDstring`json:"clusterUID,omitempty"`
4848
BootUUIDstring`json:"bootUUID,omitempty"`
4949

50+
PostgresBinaryVersionPostgresBinaryVersion`json:"postgresBinaryVersion,omitempty"`
51+
5052
PostgresState*PostgresState`json:"postgresState,omitempty"`
5153
}
5254

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp