Skip to content

Commit

Permalink
fix the event cache initialize size and rename the config
Browse files Browse the repository at this point in the history
  • Loading branch information
yujieli-temporal committed Jul 28, 2023
1 parent a13efee commit 64c40ae
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ const (
HistoryShutdownDrainDuration = "history.shutdownDrainDuration"
// XDCCacheMaxSizeBytes is max size of events cache in bytes
XDCCacheMaxSizeBytes = "history.xdcCacheMaxSizeBytes"
// EventsCacheInitialSizeBytes is initial size of events cache in bytes
EventsCacheInitialSizeBytes = "history.eventsCacheInitialSizeBytes"
// EventsCacheInitialKeySize is initial key size of events cache
EventsCacheInitialKeySize = "history.eventsCacheInitialKeySize"
// EventsCacheMaxSizeBytes is max size of events cache in bytes
EventsCacheMaxSizeBytes = "history.eventsCacheMaxSizeBytes"
// EventsCacheTTL is TTL of events cache
Expand Down
12 changes: 6 additions & 6 deletions service/history/configs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ type Config struct {

// EventsCache settings
// Change of these configs require shard restart
EventsCacheInitialSizeBytes dynamicconfig.IntPropertyFn
EventsCacheMaxSizeBytes dynamicconfig.IntPropertyFn
EventsCacheTTL dynamicconfig.DurationPropertyFn
EventsCacheInitialKeySize dynamicconfig.IntPropertyFn
EventsCacheMaxSizeBytes dynamicconfig.IntPropertyFn
EventsCacheTTL dynamicconfig.DurationPropertyFn

// ShardController settings
RangeSizeBits uint
Expand Down Expand Up @@ -360,9 +360,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),
EventsCacheInitialKeySize: dc.GetIntProperty(dynamicconfig.EventsCacheInitialKeySize, 128),
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),
Expand Down
2 changes: 1 addition & 1 deletion service/history/history_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (s *engineSuite) SetupTest() {

s.eventsCache = events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down
8 changes: 4 additions & 4 deletions service/history/replication/ack_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func (s *ackManagerSuite) TestGetTasks_SecondPersistenceErrorReturnsPartialResul

eventsCache := events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down Expand Up @@ -359,7 +359,7 @@ func (s *ackManagerSuite) TestGetTasks_FullPage() {

eventsCache := events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down Expand Up @@ -411,7 +411,7 @@ func (s *ackManagerSuite) TestGetTasks_PartialPage() {

eventsCache := events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down Expand Up @@ -500,7 +500,7 @@ func (s *ackManagerSuite) TestGetTasks_FilterNamespace() {

eventsCache := events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down
2 changes: 1 addition & 1 deletion service/history/shard/context_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1957,7 +1957,7 @@ func newContext(
}
shardContext.eventsCache = events.NewEventsCache(
shardContext.GetShardID(),
shardContext.GetConfig().EventsCacheInitialSizeBytes(),
shardContext.GetConfig().EventsCacheInitialKeySize(),
shardContext.GetConfig().EventsCacheMaxSizeBytes(),
shardContext.GetConfig().EventsCacheTTL(),
shardContext.GetExecutionManager(),
Expand Down
2 changes: 1 addition & 1 deletion service/history/timer_queue_active_task_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (s *timerQueueActiveTaskExecutorSuite) SetupTest() {
)
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down
2 changes: 1 addition & 1 deletion service/history/timer_queue_standby_task_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (s *timerQueueStandbyTaskExecutorSuite) SetupTest() {
)
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *transferQueueActiveTaskExecutorSuite) SetupTest() {
)
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (s *transferQueueStandbyTaskExecutorSuite) SetupTest() {
)
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down
2 changes: 1 addition & 1 deletion service/history/visibility_queue_task_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (s *visibilityQueueTaskExecutorSuite) SetupTest() {
)
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
s.mockShard.GetShardID(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheInitialKeySize(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
Expand Down

0 comments on commit 64c40ae

Please sign in to comment.