Skip to content

Commit

Permalink
Add check to make sure metrics and main db are not the same (#1489)
Browse files Browse the repository at this point in the history
Closes #956
  • Loading branch information
ChrisSchinnerl authored Aug 28, 2024
2 parents d0fb3f1 + 40bad60 commit 21dbc91
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/renterd/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ func buildStoreConfig(am alerts.Alerter, cfg config.Config, pk types.PrivateKey,
var dbMain sql.Database
var dbMetrics sql.MetricsDatabase
if cfg.Database.MySQL.URI != "" {
// check that both main and metrics databases are not the same
if cfg.Database.MySQL.Database == cfg.Database.MySQL.MetricsDatabase {
return stores.Config{}, errors.New("main and metrics databases cannot be the same")
}

// create MySQL connections
connMain, err := mysql.Open(
cfg.Database.MySQL.User,
Expand Down

0 comments on commit 21dbc91

Please sign in to comment.