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:
authorSami Hiltunen <shiltunen@gitlab.com>2020-11-10 11:50:44 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2020-11-16 20:07:54 +0300
commit4fa998517623f98a944ccd9e2aa66230519a1acb (patch)
treecd44c9eb81d0e93150b694ff1a783ddc7adaed81
parentf8ed42e0da6195d28032acb786a28a90eab07e43 (diff)
expose GeneratePraefectName from nodes
Exposes GeneratePraefectName from nodes package so it can be called from Praefect's main when setting up the per repository elector stack.
-rw-r--r--internal/praefect/nodes/sql_elector.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/praefect/nodes/sql_elector.go b/internal/praefect/nodes/sql_elector.go
index f5dbd1c9e..df2e9c4eb 100644
--- a/internal/praefect/nodes/sql_elector.go
+++ b/internal/praefect/nodes/sql_elector.go
@@ -85,7 +85,7 @@ type sqlElector struct {
func newSQLElector(name string, c config.Config, db *sql.DB, log logrus.FieldLogger, ns []*nodeStatus) *sqlElector {
log = log.WithField("virtual_storage", name)
- praefectName := getPraefectName(c, log)
+ praefectName := GeneratePraefectName(c, log)
log = log.WithField("praefectName", praefectName)
log.Info("Using SQL election strategy")
@@ -105,13 +105,13 @@ func newSQLElector(name string, c config.Config, db *sql.DB, log logrus.FieldLog
}
}
-// Generate a Praefect name so that each Praefect process can report
-// node statuses independently. This will enable us to do a SQL
-// election to determine which nodes are active. Ideally this name
+// GeneratePraefectName generates a name so that each Praefect process
+// can report node statuses independently. This will enable us to do a
+// SQL election to determine which nodes are active. Ideally this name
// doesn't change across restarts since that may temporarily make it
// look like there are more Praefect processes active for
// determining a quorum.
-func getPraefectName(c config.Config, log logrus.FieldLogger) string {
+func GeneratePraefectName(c config.Config, log logrus.FieldLogger) string {
name, err := os.Hostname()
if err != nil {