From 40bad60b33f9ad67807dbb6010dd4ee5dfac2c89 Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Tue, 27 Aug 2024 17:01:06 +0200 Subject: [PATCH] cmd: add check to make sure metrics and main db are not the same --- cmd/renterd/node.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/renterd/node.go b/cmd/renterd/node.go index 9defbc127..a9758439c 100644 --- a/cmd/renterd/node.go +++ b/cmd/renterd/node.go @@ -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,