ReplStore: Add support for round robin load balancing between multiple read replicas (#90530)

* ReplStore: Add support for multiple replicas and round-robin load balancing

* add check for zero-length repls list
This commit is contained in:
Kristin Laemmert
2024-07-18 08:20:28 -04:00
committed by GitHub
parent 2d152b7ec1
commit 27b52b1507
4 changed files with 154 additions and 40 deletions
+5
View File
@@ -10,6 +10,7 @@ import (
"strings"
"github.com/go-sql-driver/mysql"
"gopkg.in/ini.v1"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
@@ -70,6 +71,10 @@ func NewDatabaseConfig(cfg *setting.Cfg, features featuremgmt.FeatureToggles) (*
// section to the configuration file while using the same cfg struct.
func (dbCfg *DatabaseConfig) readConfigSection(cfg *setting.Cfg, section string) error {
sec := cfg.Raw.Section(section)
return dbCfg.parseConfigIni(sec)
}
func (dbCfg *DatabaseConfig) parseConfigIni(sec *ini.Section) error {
cfgURL := sec.Key("url").String()
if len(cfgURL) != 0 {
dbURL, err := url.Parse(cfgURL)