Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/praefect/subcmd_dataloss.go')
-rw-r--r--cmd/praefect/subcmd_dataloss.go33
1 files changed, 15 insertions, 18 deletions
diff --git a/cmd/praefect/subcmd_dataloss.go b/cmd/praefect/subcmd_dataloss.go
index f9c7f2d22..a8c57c465 100644
--- a/cmd/praefect/subcmd_dataloss.go
+++ b/cmd/praefect/subcmd_dataloss.go
@@ -74,27 +74,24 @@ func (cmd *datalossSubcommand) Exec(flags *flag.FlagSet, cfg config.Config) erro
return fmt.Errorf("error checking: %v", err)
}
- mode := "write-enabled"
- if resp.IsReadOnly {
- mode = "read-only"
- }
-
cmd.println(0, "Virtual storage: %s", vs)
- cmd.println(1, "Current %s primary: %s", mode, resp.CurrentPrimary)
- if resp.PreviousWritablePrimary == "" {
- fmt.Fprintln(cmd.output, " No data loss as the virtual storage has not encountered a failover")
- continue
- }
-
- cmd.println(1, "Previous write-enabled primary: %s", resp.PreviousWritablePrimary)
- if len(resp.OutdatedNodes) == 0 {
- cmd.println(2, "No data loss from failing over from %s", resp.PreviousWritablePrimary)
- continue
+ cmd.println(1, "Primary: %s", resp.Primary)
+ if len(resp.Repositories) == 0 {
+ cmd.println(1, "All repositories are consistent!")
+ return nil
}
- cmd.println(2, "Nodes with data loss from failing over from %s:", resp.PreviousWritablePrimary)
- for _, odn := range resp.OutdatedNodes {
- cmd.println(3, "%s: %s", odn.RelativePath, strings.Join(odn.Nodes, ", "))
+ cmd.println(1, "Outdated repositories:")
+ for _, r := range resp.Repositories {
+ cmd.println(2, "%s:", r.RelativePath)
+ for _, s := range r.Storages {
+ plural := ""
+ if s.BehindBy > 1 {
+ plural = "s"
+ }
+
+ cmd.println(3, "%s is behind by %d generation%s or less", s.Name, s.BehindBy, plural)
+ }
}
}