mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Add LastWAL in leader/health output (#5523)
This commit is contained in:
@@ -36,4 +36,5 @@ type HealthResponse struct {
|
|||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
ClusterName string `json:"cluster_name,omitempty"`
|
ClusterName string `json:"cluster_name,omitempty"`
|
||||||
ClusterID string `json:"cluster_id,omitempty"`
|
ClusterID string `json:"cluster_id,omitempty"`
|
||||||
|
LastWAL uint64 `json:"last_wal,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,5 @@ type LeaderResponse struct {
|
|||||||
LeaderClusterAddress string `json:"leader_cluster_address"`
|
LeaderClusterAddress string `json:"leader_cluster_address"`
|
||||||
PerfStandby bool `json:"performance_standby"`
|
PerfStandby bool `json:"performance_standby"`
|
||||||
PerfStandbyLastRemoteWAL uint64 `json:"performance_standby_last_remote_wal"`
|
PerfStandbyLastRemoteWAL uint64 `json:"performance_standby_last_remote_wal"`
|
||||||
|
LastWAL uint64 `json:"last_wal"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,6 +379,10 @@ func OutputSealStatus(ui cli.Ui, client *api.Client, status *api.SealStatusRespo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if leaderStatus.LastWAL != 0 {
|
||||||
|
out = append(out, fmt.Sprintf("Last WAL | %d", leaderStatus.LastWAL))
|
||||||
|
}
|
||||||
|
|
||||||
ui.Output(tableOutput(out, nil))
|
ui.Output(tableOutput(out, nil))
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,11 @@ func getSysHealth(core *vault.Core, r *http.Request) (int, *HealthResponse, erro
|
|||||||
ClusterName: clusterName,
|
ClusterName: clusterName,
|
||||||
ClusterID: clusterID,
|
ClusterID: clusterID,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if init && !sealed && !standby {
|
||||||
|
body.LastWAL = vault.LastWAL(core)
|
||||||
|
}
|
||||||
|
|
||||||
return code, body, nil
|
return code, body, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,4 +198,5 @@ type HealthResponse struct {
|
|||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
ClusterName string `json:"cluster_name,omitempty"`
|
ClusterName string `json:"cluster_name,omitempty"`
|
||||||
ClusterID string `json:"cluster_id,omitempty"`
|
ClusterID string `json:"cluster_id,omitempty"`
|
||||||
|
LastWAL uint64 `json:"last_wal,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ func handleSysLeaderGet(core *vault.Core, w http.ResponseWriter, r *http.Request
|
|||||||
}
|
}
|
||||||
if resp.PerfStandby {
|
if resp.PerfStandby {
|
||||||
resp.PerfStandbyLastRemoteWAL = vault.LastRemoteWAL(core)
|
resp.PerfStandbyLastRemoteWAL = vault.LastRemoteWAL(core)
|
||||||
|
} else if isLeader || !haEnabled {
|
||||||
|
resp.LastWAL = vault.LastWAL(core)
|
||||||
}
|
}
|
||||||
|
|
||||||
respondOk(w, resp)
|
respondOk(w, resp)
|
||||||
@@ -50,4 +52,5 @@ type LeaderResponse struct {
|
|||||||
LeaderClusterAddress string `json:"leader_cluster_address"`
|
LeaderClusterAddress string `json:"leader_cluster_address"`
|
||||||
PerfStandby bool `json:"performance_standby"`
|
PerfStandby bool `json:"performance_standby"`
|
||||||
PerfStandbyLastRemoteWAL uint64 `json:"performance_standby_last_remote_wal"`
|
PerfStandbyLastRemoteWAL uint64 `json:"performance_standby_last_remote_wal"`
|
||||||
|
LastWAL uint64 `json:"last_wal,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ var (
|
|||||||
enterprisePreSeal = enterprisePreSealImpl
|
enterprisePreSeal = enterprisePreSealImpl
|
||||||
startReplication = startReplicationImpl
|
startReplication = startReplicationImpl
|
||||||
stopReplication = stopReplicationImpl
|
stopReplication = stopReplicationImpl
|
||||||
|
LastWAL = lastWALImpl
|
||||||
LastRemoteWAL = lastRemoteWALImpl
|
LastRemoteWAL = lastRemoteWALImpl
|
||||||
WaitUntilWALShipped = waitUntilWALShippedImpl
|
WaitUntilWALShipped = waitUntilWALShippedImpl
|
||||||
)
|
)
|
||||||
@@ -1514,6 +1515,10 @@ func waitUntilWALShippedImpl(ctx context.Context, c *Core, index uint64) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func lastWALImpl(c *Core) uint64 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func lastRemoteWALImpl(c *Core) uint64 {
|
func lastRemoteWALImpl(c *Core) uint64 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user