Revert read replica POC (#93551)

* Revert "chore: add replDB to team service (#91799)"

This reverts commit c6ae2d7999.

* Revert "experiment: use read replica for Get and Find Dashboards (#91706)"

This reverts commit 54177ca619.

* Revert "QuotaService: refactor to use ReplDB for Get queries (#91333)"

This reverts commit 299c142f6a.

* Revert "refactor replCfg to look more like plugins/plugin config (#91142)"

This reverts commit ac0b4bb34d.

* Revert "chore (replstore): fix registration with multiple sql drivers, again (#90990)"

This reverts commit daedb358dd.

* Revert "Chore (sqlstore): add validation and testing for repl config (#90683)"

This reverts commit af19f039b6.

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

This reverts commit 27b52b1507.

* Revert "DashboardStore: Use ReplDB and get dashboard quotas from the ReadReplica (#90235)"

This reverts commit 8a6107cd35.

* Revert "accesscontrol service read replica (#89963)"

This reverts commit 77a4869fca.

* Revert "Fix: add mapping for the new mysqlRepl driver (#89551)"

This reverts commit ab5a079bcc.

* Revert "fix: sql instrumentation dual registration error (#89508)"

This reverts commit d988f5c3b0.

* Revert "Experimental Feature Toggle: databaseReadReplica (#89232)"

This reverts commit 50244ed4a1.
This commit is contained in:
Jeff Levin
2024-09-25 15:21:39 -08:00
committed by GitHub
parent 25ca760ee1
commit a21a232a8e
88 changed files with 416 additions and 1010 deletions
@@ -48,7 +48,6 @@ func TestIntegrationListPublicDashboard(t *testing.T) {
}
var sqlStore db.DB
var replStore db.ReplDB
var cfg *setting.Cfg
var aDash *dashboards.Dashboard
@@ -64,10 +63,9 @@ func TestIntegrationListPublicDashboard(t *testing.T) {
var publicdashboardStore *PublicDashboardStoreImpl
setup := func() {
replStore, cfg = db.InitTestReplDBWithCfg(t, db.InitTestDBOpt{})
sqlStore = replStore.DB()
sqlStore, cfg = db.InitTestDBWithCfg(t, db.InitTestDBOpt{})
quotaService := quotatest.New(false, nil)
dashboardStore, err := dashboardsDB.ProvideDashboardStore(replStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
dashboardStore, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
require.NoError(t, err)
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
@@ -173,19 +171,19 @@ func TestIntegrationExistsEnabledByAccessToken(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
var sqlStore db.ReplDB
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
var publicdashboardStore *PublicDashboardStoreImpl
var savedDashboard *dashboards.Dashboard
setup := func() {
sqlStore, cfg = db.InitTestReplDBWithCfg(t)
sqlStore, cfg = db.InitTestDBWithCfg(t)
quotaService := quotatest.New(false, nil)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore.DB()), quotaService)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
require.NoError(t, err)
dashboardStore = store
publicdashboardStore = ProvideStore(sqlStore.DB(), cfg, featuremgmt.WithFeatures())
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
savedDashboard = insertTestDashboard(t, dashboardStore, "testDashie", 1, "", true)
}
t.Run("ExistsEnabledByAccessToken will return true when at least one public dashboard has a matching access token", func(t *testing.T) {
@@ -246,19 +244,19 @@ func TestIntegrationExistsEnabledByDashboardUid(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
var sqlStore db.ReplDB
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
var publicdashboardStore *PublicDashboardStoreImpl
var savedDashboard *dashboards.Dashboard
setup := func() {
sqlStore, cfg = db.InitTestReplDBWithCfg(t)
sqlStore, cfg = db.InitTestDBWithCfg(t)
quotaService := quotatest.New(false, nil)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore.DB()), quotaService)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
require.NoError(t, err)
dashboardStore = store
publicdashboardStore = ProvideStore(sqlStore.DB(), cfg, featuremgmt.WithFeatures())
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
savedDashboard = insertTestDashboard(t, dashboardStore, "testDashie", 1, "", true)
}
@@ -311,19 +309,19 @@ func TestIntegrationFindByDashboardUid(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
var sqlStore db.ReplDB
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
var publicdashboardStore *PublicDashboardStoreImpl
var savedDashboard *dashboards.Dashboard
setup := func() {
sqlStore, cfg = db.InitTestReplDBWithCfg(t)
sqlStore, cfg = db.InitTestDBWithCfg(t)
quotaService := quotatest.New(false, nil)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore.DB()), quotaService)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
require.NoError(t, err)
dashboardStore = store
publicdashboardStore = ProvideStore(sqlStore.DB(), cfg, featuremgmt.WithFeatures())
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
savedDashboard = insertTestDashboard(t, dashboardStore, "testDashie", 1, "", true)
}
@@ -379,7 +377,7 @@ func TestIntegrationFindByAccessToken(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
var sqlStore db.ReplDB
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
var publicdashboardStore *PublicDashboardStoreImpl
@@ -387,10 +385,10 @@ func TestIntegrationFindByAccessToken(t *testing.T) {
var err error
setup := func() {
sqlStore, cfg = db.InitTestReplDBWithCfg(t)
dashboardStore, err = dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore.DB()), quotatest.New(false, nil))
sqlStore, cfg = db.InitTestDBWithCfg(t)
dashboardStore, err = dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotatest.New(false, nil))
require.NoError(t, err)
publicdashboardStore = ProvideStore(sqlStore.DB(), cfg, featuremgmt.WithFeatures())
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
savedDashboard = insertTestDashboard(t, dashboardStore, "testDashie", 1, "", true)
}
@@ -447,7 +445,7 @@ func TestIntegrationCreatePublicDashboard(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
var sqlStore db.ReplDB
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
var publicdashboardStore *PublicDashboardStoreImpl
@@ -455,12 +453,12 @@ func TestIntegrationCreatePublicDashboard(t *testing.T) {
var savedDashboard2 *dashboards.Dashboard
setup := func() {
sqlStore, cfg = db.InitTestReplDBWithCfg(t, db.InitTestDBOpt{})
sqlStore, cfg = db.InitTestDBWithCfg(t, db.InitTestDBOpt{})
quotaService := quotatest.New(false, nil)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore.DB()), quotaService)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
require.NoError(t, err)
dashboardStore = store
publicdashboardStore = ProvideStore(sqlStore.DB(), cfg, featuremgmt.WithFeatures())
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
savedDashboard = insertTestDashboard(t, dashboardStore, "testDashie", 1, "", true)
savedDashboard2 = insertTestDashboard(t, dashboardStore, "testDashie2", 1, "", true)
insertPublicDashboard(t, publicdashboardStore, savedDashboard2.UID, savedDashboard2.OrgID, false, PublicShareType)
@@ -526,7 +524,7 @@ func TestIntegrationUpdatePublicDashboard(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
var sqlStore db.ReplDB
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
var publicdashboardStore *PublicDashboardStoreImpl
@@ -535,11 +533,11 @@ func TestIntegrationUpdatePublicDashboard(t *testing.T) {
var err error
setup := func() {
sqlStore, cfg = db.InitTestReplDBWithCfg(t, db.InitTestDBOpt{})
sqlStore, cfg = db.InitTestDBWithCfg(t, db.InitTestDBOpt{})
quotaService := quotatest.New(false, nil)
dashboardStore, err = dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore.DB()), quotaService)
dashboardStore, err = dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
require.NoError(t, err)
publicdashboardStore = ProvideStore(sqlStore.DB(), cfg, featuremgmt.WithFeatures())
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
savedDashboard = insertTestDashboard(t, dashboardStore, "testDashie", 1, "", true)
anotherSavedDashboard = insertTestDashboard(t, dashboardStore, "test another Dashie", 1, "", true)
}
@@ -631,7 +629,7 @@ func TestIntegrationGetOrgIdByAccessToken(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
var sqlStore db.ReplDB
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
var publicdashboardStore *PublicDashboardStoreImpl
@@ -639,11 +637,11 @@ func TestIntegrationGetOrgIdByAccessToken(t *testing.T) {
var err error
setup := func() {
sqlStore, cfg = db.InitTestReplDBWithCfg(t)
sqlStore, cfg = db.InitTestDBWithCfg(t)
quotaService := quotatest.New(false, nil)
dashboardStore, err = dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore.DB()), quotaService)
dashboardStore, err = dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
require.NoError(t, err)
publicdashboardStore = ProvideStore(sqlStore.DB(), cfg, featuremgmt.WithFeatures())
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
savedDashboard = insertTestDashboard(t, dashboardStore, "testDashie", 1, "", true)
}
t.Run("GetOrgIdByAccessToken will OrgId when enabled", func(t *testing.T) {
@@ -703,7 +701,7 @@ func TestIntegrationDelete(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
var sqlStore db.ReplDB
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
var publicdashboardStore *PublicDashboardStoreImpl
@@ -712,10 +710,10 @@ func TestIntegrationDelete(t *testing.T) {
var err error
setup := func() {
sqlStore, cfg = db.InitTestReplDBWithCfg(t)
dashboardStore, err = dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore.DB()), quotatest.New(false, nil))
sqlStore, cfg = db.InitTestDBWithCfg(t)
dashboardStore, err = dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotatest.New(false, nil))
require.NoError(t, err)
publicdashboardStore = ProvideStore(sqlStore.DB(), cfg, featuremgmt.WithFeatures())
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
savedDashboard = insertTestDashboard(t, dashboardStore, "testDashie", 1, "", true)
savedPublicDashboard = insertPublicDashboard(t, publicdashboardStore, savedDashboard.UID, savedDashboard.OrgID, true, PublicShareType)
}
@@ -763,7 +761,7 @@ func TestFindByFolder(t *testing.T) {
})
t.Run("can get all pubdashes for dashboard folder and org", func(t *testing.T) {
sqlStore, cfg := db.InitTestReplDBWithCfg(t)
sqlStore, cfg := db.InitTestDBWithCfg(t)
quotaService := quotatest.New(false, nil)
dashboardStore, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
require.NoError(t, err)
@@ -792,7 +790,7 @@ func TestGetMetrics(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
var sqlStore db.ReplDB
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
var publicdashboardStore *PublicDashboardStoreImpl
@@ -802,12 +800,12 @@ func TestGetMetrics(t *testing.T) {
var savedDashboard4 *dashboards.Dashboard
setup := func() {
sqlStore, cfg = db.InitTestReplDBWithCfg(t, db.InitTestDBOpt{})
sqlStore, cfg = db.InitTestDBWithCfg(t, db.InitTestDBOpt{})
quotaService := quotatest.New(false, nil)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore.DB()), quotaService)
store, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore), quotaService)
require.NoError(t, err)
dashboardStore = store
publicdashboardStore = ProvideStore(sqlStore.DB(), cfg, featuremgmt.WithFeatures())
publicdashboardStore = ProvideStore(sqlStore, cfg, featuremgmt.WithFeatures())
savedDashboard = insertTestDashboard(t, dashboardStore, "testDashie", 1, "", false)
savedDashboard2 = insertTestDashboard(t, dashboardStore, "testDashie2", 1, "", false)
savedDashboard3 = insertTestDashboard(t, dashboardStore, "testDashie3", 2, "", false)