diff --git a/common/dynamicconfig/constants.go b/common/dynamicconfig/constants.go index f5864cdb150..a1caedf6f22 100644 --- a/common/dynamicconfig/constants.go +++ b/common/dynamicconfig/constants.go @@ -491,10 +491,10 @@ const ( HistoryStartupMembershipJoinDelay = "history.startupMembershipJoinDelay" // HistoryShutdownDrainDuration is the duration of traffic drain during shutdown HistoryShutdownDrainDuration = "history.shutdownDrainDuration" - // EventsCacheInitialSize is initial size of events cache - EventsCacheInitialSize = "history.eventsCacheInitialSize" - // EventsCacheMaxSize is max size of events cache - EventsCacheMaxSize = "history.eventsCacheMaxSize" + // EventsCacheInitialSizeBytes is initial size of events cache in bytes + EventsCacheInitialSizeBytes = "history.eventsCacheInitialSizeBytes" + // EventsCacheMaxSizeBytes is max size of events cache in bytes + EventsCacheMaxSizeBytes = "history.eventsCacheMaxSizeBytes" // 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 a940d8a066b..b595624e5da 100644 --- a/service/history/configs/config.go +++ b/service/history/configs/config.go @@ -74,9 +74,9 @@ type Config struct { // EventsCache settings // Change of these configs require shard restart - EventsCacheInitialSize dynamicconfig.IntPropertyFn - EventsCacheMaxSize dynamicconfig.IntPropertyFn - EventsCacheTTL dynamicconfig.DurationPropertyFn + EventsCacheInitialSizeBytes dynamicconfig.IntPropertyFn + EventsCacheMaxSizeBytes dynamicconfig.IntPropertyFn + EventsCacheTTL dynamicconfig.DurationPropertyFn // ShardController settings RangeSizeBits uint @@ -355,9 +355,9 @@ func NewConfig( HistoryCacheTTL: dc.GetDurationProperty(dynamicconfig.HistoryCacheTTL, time.Hour), HistoryCacheNonUserContextLockTimeout: dc.GetDurationProperty(dynamicconfig.HistoryCacheNonUserContextLockTimeout, 500*time.Millisecond), - EventsCacheInitialSize: dc.GetIntProperty(dynamicconfig.EventsCacheInitialSize, 128*1024), // 128KB - EventsCacheMaxSize: dc.GetIntProperty(dynamicconfig.EventsCacheMaxSize, 512*1024), // 512KB - EventsCacheTTL: dc.GetDurationProperty(dynamicconfig.EventsCacheTTL, time.Hour), + EventsCacheInitialSizeBytes: dc.GetIntProperty(dynamicconfig.EventsCacheInitialSizeBytes, 128*1024), // 128KB + EventsCacheMaxSizeBytes: dc.GetIntProperty(dynamicconfig.EventsCacheMaxSizeBytes, 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/history_engine_test.go b/service/history/history_engine_test.go index 4842d1cf259..45b41a1daec 100644 --- a/service/history/history_engine_test.go +++ b/service/history/history_engine_test.go @@ -161,8 +161,8 @@ func (s *engineSuite) SetupTest() { s.eventsCache = events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), 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 461ee60a72b..c7237e1a7f1 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().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), 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().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), 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().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), 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().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), 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 6b041b6612a..7894f103bab 100644 --- a/service/history/shard/context_impl.go +++ b/service/history/shard/context_impl.go @@ -1957,8 +1957,8 @@ func newContext( } shardContext.eventsCache = events.NewEventsCache( shardContext.GetShardID(), - shardContext.GetConfig().EventsCacheInitialSize(), - shardContext.GetConfig().EventsCacheMaxSize(), + shardContext.GetConfig().EventsCacheInitialSizeBytes(), + shardContext.GetConfig().EventsCacheMaxSizeBytes(), shardContext.GetConfig().EventsCacheTTL(), shardContext.GetExecutionManager(), false, diff --git a/service/history/timer_queue_active_task_executor_test.go b/service/history/timer_queue_active_task_executor_test.go index 236beaa94d4..8ebdb2ba0df 100644 --- a/service/history/timer_queue_active_task_executor_test.go +++ b/service/history/timer_queue_active_task_executor_test.go @@ -139,8 +139,8 @@ func (s *timerQueueActiveTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/timer_queue_standby_task_executor_test.go b/service/history/timer_queue_standby_task_executor_test.go index cbf09b53f3f..80456e8a8c8 100644 --- a/service/history/timer_queue_standby_task_executor_test.go +++ b/service/history/timer_queue_standby_task_executor_test.go @@ -142,8 +142,8 @@ func (s *timerQueueStandbyTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/transfer_queue_active_task_executor_test.go b/service/history/transfer_queue_active_task_executor_test.go index 75da157d57e..045ebaa4d99 100644 --- a/service/history/transfer_queue_active_task_executor_test.go +++ b/service/history/transfer_queue_active_task_executor_test.go @@ -175,8 +175,8 @@ func (s *transferQueueActiveTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/transfer_queue_standby_task_executor_test.go b/service/history/transfer_queue_standby_task_executor_test.go index 89274d95dd6..4bd1992d35c 100644 --- a/service/history/transfer_queue_standby_task_executor_test.go +++ b/service/history/transfer_queue_standby_task_executor_test.go @@ -149,8 +149,8 @@ func (s *transferQueueStandbyTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false, diff --git a/service/history/visibility_queue_task_executor_test.go b/service/history/visibility_queue_task_executor_test.go index bc1b83cacd3..89550bef312 100644 --- a/service/history/visibility_queue_task_executor_test.go +++ b/service/history/visibility_queue_task_executor_test.go @@ -121,8 +121,8 @@ func (s *visibilityQueueTaskExecutorSuite) SetupTest() { ) s.mockShard.SetEventsCacheForTesting(events.NewEventsCache( s.mockShard.GetShardID(), - s.mockShard.GetConfig().EventsCacheInitialSize(), - s.mockShard.GetConfig().EventsCacheMaxSize(), + s.mockShard.GetConfig().EventsCacheInitialSizeBytes(), + s.mockShard.GetConfig().EventsCacheMaxSizeBytes(), s.mockShard.GetConfig().EventsCacheTTL(), s.mockShard.GetExecutionManager(), false,