From 2b50ed564c47ab9f075d32978db1725d9c5f3161 Mon Sep 17 00:00:00 2001 From: ishan tyagi Date: Sat, 12 Jun 2021 23:20:28 +0530 Subject: [PATCH] Set the auto-compaction fields for Embedded-Etcd. --- pkg/miscellaneous/miscellaneous.go | 2 ++ pkg/snapshot/restorer/restorer_test.go | 2 +- test/utils/utils.go | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/miscellaneous/miscellaneous.go b/pkg/miscellaneous/miscellaneous.go index 13a58c2e1..227892598 100644 --- a/pkg/miscellaneous/miscellaneous.go +++ b/pkg/miscellaneous/miscellaneous.go @@ -81,6 +81,8 @@ func StartEmbeddedEtcd(logger *logrus.Entry, ro *brtypes.RestoreOptions) (*embed cfg.QuotaBackendBytes = ro.Config.EmbeddedEtcdQuotaBytes cfg.MaxRequestBytes = ro.Config.MaxRequestBytes cfg.MaxTxnOps = ro.Config.MaxTxnOps + cfg.AutoCompactionMode = ro.Config.AutoCompactionMode + cfg.AutoCompactionRetention = ro.Config.AutoCompactionRetention cfg.Logger = "zap" e, err := embed.StartEtcd(cfg) if err != nil { diff --git a/pkg/snapshot/restorer/restorer_test.go b/pkg/snapshot/restorer/restorer_test.go index 6a47a156c..53872ef4e 100644 --- a/pkg/snapshot/restorer/restorer_test.go +++ b/pkg/snapshot/restorer/restorer_test.go @@ -65,7 +65,7 @@ var _ = Describe("Running Restorer", func() { maxTxnOps = 2 * 1024 embeddedEtcdQuotaBytes int64 = 8 * 1024 * 1024 * 1024 autoCompactionMode string = "periodic" - autoCompactionRetention string = "2m" + autoCompactionRetention string = "5m" ) BeforeEach(func() { diff --git a/test/utils/utils.go b/test/utils/utils.go index 06fd2a8e7..f63135164 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -65,6 +65,8 @@ func StartEmbeddedEtcd(ctx context.Context, etcdDir string, logger *logrus.Entry cfg.ACUrls = []url.URL{*acurl} cfg.InitialCluster = cfg.InitialClusterFromName(cfg.Name) cfg.Logger = "zap" + cfg.AutoCompactionMode = "periodic" + cfg.AutoCompactionRetention = "5m" e, err := embed.StartEtcd(cfg) if err != nil { return nil, err