From 5dbbc4522ff1d43c4002b9850b5b678054ac5aaf Mon Sep 17 00:00:00 2001 From: David Reiss Date: Fri, 28 Jul 2023 15:55:46 -0700 Subject: [PATCH] Revert "change the history cache key name to *Bytes (#4649)" This reverts commit 67de6dfef9e854e661a4f108761fa6ec0c782a73. --- common/dynamicconfig/constants.go | 8 ++++---- service/history/configs/config.go | 12 ++++++------ service/history/historyEngine_test.go | 4 ++-- service/history/replication/ack_manager_test.go | 16 ++++++++-------- service/history/shard/context_impl.go | 4 ++-- .../history/timerQueueActiveTaskExecutor_test.go | 4 ++-- .../timerQueueStandbyTaskExecutor_test.go | 4 ++-- .../transferQueueActiveTaskExecutor_test.go | 4 ++-- .../transferQueueStandbyTaskExecutor_test.go | 4 ++-- .../history/visibilityQueueTaskExecutor_test.go | 4 ++-- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/common/dynamicconfig/constants.go b/common/dynamicconfig/constants.go index 02d6fbce903..77d838afce3 100644 --- a/common/dynamicconfig/constants.go +++ b/common/dynamicconfig/constants.go @@ -486,10 +486,10 @@ const ( HistoryStartupMembershipJoinDelay = "history.startupMembershipJoinDelay" // HistoryShutdownDrainDuration is the duration of traffic drain during shutdown HistoryShutdownDrainDuration = "history.shutdownDrainDuration" - // EventsCacheInitialSizeBytes is initial size of events cache in bytes - EventsCacheInitialSizeBytes = "history.eventsCacheInitialSizeBytes" - // EventsCacheMaxSizeBytes is max size of events cache in bytes - EventsCacheMaxSizeBytes = "history.eventsCacheMaxSizeBytes" + // EventsCacheInitialSize is initial size of events cache + EventsCacheInitialSize = "history.eventsCacheInitialSize" + // EventsCacheMaxSize is max size of events cache + EventsCacheMaxSize = "history.eventsCacheMaxSize" // EventsCacheTTL is TTL of events cache EventsCacheTTL = "history.eventsCacheTTL" // AcquireShardInterval is interval that timer used to acquire shard diff --git a/service/history/configs/config.go b/service/history/configs/config.go index fc83b4a4321..43bba3d129f 100644 --- a/service/history/configs/config.go +++ b/service/history/configs/config.go @@ -72,9 +72,9 @@ type Config struct { // EventsCache settings // Change of these configs require shard restart - EventsCacheInitialSizeBytes dynamicconfig.IntPropertyFn - EventsCacheMaxSizeBytes dynamicconfig.IntPropertyFn - EventsCacheTTL dynamicconfig.DurationPropertyFn + EventsCacheInitialSize dynamicconfig.IntPropertyFn + EventsCacheMaxSize dynamicconfig.IntPropertyFn + EventsCacheTTL dynamicconfig.DurationPropertyFn // ShardController settings RangeSizeBits uint @@ -352,9 +352,9 @@ func NewConfig( HistoryCacheTTL: dc.GetDurationProperty(dynamicconfig.HistoryCacheTTL, time.Hour), HistoryCacheNonUserContextLockTimeout: dc.GetDurationProperty(dynamicconfig.HistoryCacheNonUserContextLockTimeout, 500*time.Millisecond), - EventsCacheInitialSizeBytes: dc.GetIntProperty(dynamicconfig.EventsCacheInitialSizeBytes, 128*1024), // 128KB - EventsCacheMaxSizeBytes: dc.GetIntProperty(dynamicconfig.EventsCacheMaxSizeBytes, 512*1024), // 512KB - EventsCacheTTL: dc.GetDurationProperty(dynamicconfig.EventsCacheTTL, time.Hour), + EventsCacheInitialSize: dc.GetIntProperty(dynamicconfig.EventsCacheInitialSize, 128*1024), // 128KB + EventsCacheMaxSize: dc.GetIntProperty(dynamicconfig.EventsCacheMaxSize, 512*1024), // 512KB + EventsCacheTTL: dc.GetDurationProperty(dynamicconfig.EventsCacheTTL, time.Hour), RangeSizeBits: 20, // 20 bits for sequencer, 2^20 sequence number for any range AcquireShardInterval: dc.GetDurationProperty(dynamicconfig.AcquireShardInterval, time.Minute), diff --git a/service/history/historyEngine_test.go b/service/history/historyEngine_test.go index a8715e53d8c..0268f2cc079 100644 --- a/service/history/historyEngine_test.go +++ b/service/history/historyEngine_test.go @@ -161,8 +161,8 @@ func (s *engineSuite) SetupTest() { s.eventsCache = events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/replication/ack_manager_test.go b/service/history/replication/ack_manager_test.go index c7237e1a7f1..461ee60a72b 100644 --- a/service/history/replication/ack_manager_test.go +++ b/service/history/replication/ack_manager_test.go @@ -307,8 +307,8 @@ func (s *ackManagerSuite) TestGetTasks_SecondPersistenceErrorReturnsPartialResul eventsCache := events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, @@ -359,8 +359,8 @@ func (s *ackManagerSuite) TestGetTasks_FullPage() { eventsCache := events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, @@ -411,8 +411,8 @@ func (s *ackManagerSuite) TestGetTasks_PartialPage() { eventsCache := events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, @@ -500,8 +500,8 @@ func (s *ackManagerSuite) TestGetTasks_FilterNamespace() { eventsCache := events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/shard/context_impl.go b/service/history/shard/context_impl.go index 2edc7c1f1c9..bc16fda4778 100644 --- a/service/history/shard/context_impl.go +++ b/service/history/shard/context_impl.go @@ -1935,8 +1935,8 @@ func newContext( } shardContext.eventsCache = events.NewEventsCache( shardContext.GetShardID(), - shardContext.GetConfig().EventsCacheInitialSizeBytes(), - shardContext.GetConfig().EventsCacheMaxSizeBytes(), + shardContext.GetConfig().EventsCacheInitialSize(), + shardContext.GetConfig().EventsCacheMaxSize(), shardContext.GetConfig().EventsCacheTTL(), shardContext.GetExecutionManager(), false, diff --git a/service/history/timerQueueActiveTaskExecutor_test.go b/service/history/timerQueueActiveTaskExecutor_test.go index 547c9343d08..feaa20a6ff7 100644 --- a/service/history/timerQueueActiveTaskExecutor_test.go +++ b/service/history/timerQueueActiveTaskExecutor_test.go @@ -138,8 +138,8 @@ func (s *timerQueueActiveTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/timerQueueStandbyTaskExecutor_test.go b/service/history/timerQueueStandbyTaskExecutor_test.go index 493b0708c05..137a75b3597 100644 --- a/service/history/timerQueueStandbyTaskExecutor_test.go +++ b/service/history/timerQueueStandbyTaskExecutor_test.go @@ -141,8 +141,8 @@ func (s *timerQueueStandbyTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/transferQueueActiveTaskExecutor_test.go b/service/history/transferQueueActiveTaskExecutor_test.go index 40e452730f9..78d80c606eb 100644 --- a/service/history/transferQueueActiveTaskExecutor_test.go +++ b/service/history/transferQueueActiveTaskExecutor_test.go @@ -174,8 +174,8 @@ func (s *transferQueueActiveTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/transferQueueStandbyTaskExecutor_test.go b/service/history/transferQueueStandbyTaskExecutor_test.go index 4bd1992d35c..89274d95dd6 100644 --- a/service/history/transferQueueStandbyTaskExecutor_test.go +++ b/service/history/transferQueueStandbyTaskExecutor_test.go @@ -149,8 +149,8 @@ func (s *transferQueueStandbyTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/visibilityQueueTaskExecutor_test.go b/service/history/visibilityQueueTaskExecutor_test.go index 89550bef312..bc1b83cacd3 100644 --- a/service/history/visibilityQueueTaskExecutor_test.go +++ b/service/history/visibilityQueueTaskExecutor_test.go @@ -121,8 +121,8 @@ func (s *visibilityQueueTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), - s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), + s.mockShard.GetConfig().EventsCacheInitialSize(), + s.mockShard.GetConfig().EventsCacheMaxSize(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false,