Skip to content

Commit 2b212ec

Browse files
yujieli-temporaldnr
authored andcommitted
change the history cache key name to *Bytes (#4649)
<!-- Describe what has changed in this PR --> **What changed?** change history cache key from history.eventsCache*Size to history.eventsCache*SizeBytes <!-- Tell your future self why have you made these changes --> It will remove the key name confusion since cache size definition changed in: #4621 <!-- How have you verified this change? Tested locally? Added a unit test? Checked in staging env? --> unittests <!-- Assuming the worst case, what can be broken when deploying this change to production? --> **Potential risks** <!-- Is this PR a hotfix candidate or require that a notification be sent to the broader community? (Yes/No) --> **Is hotfix candidate?**
1 parent 51fabed commit 2b212ec

10 files changed

+32
-32
lines changed

common/dynamicconfig/constants.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,10 @@ const (
486486
HistoryStartupMembershipJoinDelay = "history.startupMembershipJoinDelay"
487487
// HistoryShutdownDrainDuration is the duration of traffic drain during shutdown
488488
HistoryShutdownDrainDuration = "history.shutdownDrainDuration"
489-
// EventsCacheInitialSize is initial size of events cache
490-
EventsCacheInitialSize = "history.eventsCacheInitialSize"
491-
// EventsCacheMaxSize is max size of events cache
492-
EventsCacheMaxSize = "history.eventsCacheMaxSize"
489+
// EventsCacheInitialSizeBytes is initial size of events cache in bytes
490+
EventsCacheInitialSizeBytes = "history.eventsCacheInitialSizeBytes"
491+
// EventsCacheMaxSizeBytes is max size of events cache in bytes
492+
EventsCacheMaxSizeBytes = "history.eventsCacheMaxSizeBytes"
493493
// EventsCacheTTL is TTL of events cache
494494
EventsCacheTTL = "history.eventsCacheTTL"
495495
// AcquireShardInterval is interval that timer used to acquire shard

service/history/configs/config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ type Config struct {
7272

7373
// EventsCache settings
7474
// Change of these configs require shard restart
75-
EventsCacheInitialSize dynamicconfig.IntPropertyFn
76-
EventsCacheMaxSize dynamicconfig.IntPropertyFn
77-
EventsCacheTTL dynamicconfig.DurationPropertyFn
75+
EventsCacheInitialSizeBytes dynamicconfig.IntPropertyFn
76+
EventsCacheMaxSizeBytes dynamicconfig.IntPropertyFn
77+
EventsCacheTTL dynamicconfig.DurationPropertyFn
7878

7979
// ShardController settings
8080
RangeSizeBits uint
@@ -352,9 +352,9 @@ func NewConfig(
352352
HistoryCacheTTL: dc.GetDurationProperty(dynamicconfig.HistoryCacheTTL, time.Hour),
353353
HistoryCacheNonUserContextLockTimeout: dc.GetDurationProperty(dynamicconfig.HistoryCacheNonUserContextLockTimeout, 500*time.Millisecond),
354354

355-
EventsCacheInitialSize: dc.GetIntProperty(dynamicconfig.EventsCacheInitialSize, 128*1024), // 128KB
356-
EventsCacheMaxSize: dc.GetIntProperty(dynamicconfig.EventsCacheMaxSize, 512*1024), // 512KB
357-
EventsCacheTTL: dc.GetDurationProperty(dynamicconfig.EventsCacheTTL, time.Hour),
355+
EventsCacheInitialSizeBytes: dc.GetIntProperty(dynamicconfig.EventsCacheInitialSizeBytes, 128*1024), // 128KB
356+
EventsCacheMaxSizeBytes: dc.GetIntProperty(dynamicconfig.EventsCacheMaxSizeBytes, 512*1024), // 512KB
357+
EventsCacheTTL: dc.GetDurationProperty(dynamicconfig.EventsCacheTTL, time.Hour),
358358

359359
RangeSizeBits: 20, // 20 bits for sequencer, 2^20 sequence number for any range
360360
AcquireShardInterval: dc.GetDurationProperty(dynamicconfig.AcquireShardInterval, time.Minute),

service/history/historyEngine_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ func (s *engineSuite) SetupTest() {
161161

162162
s.eventsCache = events.NewEventsCache(
163163
s.mockShard.GetShardID(),
164-
s.mockShard.GetConfig().EventsCacheInitialSize(),
165-
s.mockShard.GetConfig().EventsCacheMaxSize(),
164+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
165+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
166166
s.mockShard.GetConfig().EventsCacheTTL(),
167167
s.mockShard.GetExecutionManager(),
168168
false,

service/history/replication/ack_manager_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ func (s *ackManagerSuite) TestGetTasks_SecondPersistenceErrorReturnsPartialResul
307307

308308
eventsCache := events.NewEventsCache(
309309
s.mockShard.GetShardID(),
310-
s.mockShard.GetConfig().EventsCacheInitialSize(),
311-
s.mockShard.GetConfig().EventsCacheMaxSize(),
310+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
311+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
312312
s.mockShard.GetConfig().EventsCacheTTL(),
313313
s.mockShard.GetExecutionManager(),
314314
false,
@@ -359,8 +359,8 @@ func (s *ackManagerSuite) TestGetTasks_FullPage() {
359359

360360
eventsCache := events.NewEventsCache(
361361
s.mockShard.GetShardID(),
362-
s.mockShard.GetConfig().EventsCacheInitialSize(),
363-
s.mockShard.GetConfig().EventsCacheMaxSize(),
362+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
363+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
364364
s.mockShard.GetConfig().EventsCacheTTL(),
365365
s.mockShard.GetExecutionManager(),
366366
false,
@@ -411,8 +411,8 @@ func (s *ackManagerSuite) TestGetTasks_PartialPage() {
411411

412412
eventsCache := events.NewEventsCache(
413413
s.mockShard.GetShardID(),
414-
s.mockShard.GetConfig().EventsCacheInitialSize(),
415-
s.mockShard.GetConfig().EventsCacheMaxSize(),
414+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
415+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
416416
s.mockShard.GetConfig().EventsCacheTTL(),
417417
s.mockShard.GetExecutionManager(),
418418
false,
@@ -500,8 +500,8 @@ func (s *ackManagerSuite) TestGetTasks_FilterNamespace() {
500500

501501
eventsCache := events.NewEventsCache(
502502
s.mockShard.GetShardID(),
503-
s.mockShard.GetConfig().EventsCacheInitialSize(),
504-
s.mockShard.GetConfig().EventsCacheMaxSize(),
503+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
504+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
505505
s.mockShard.GetConfig().EventsCacheTTL(),
506506
s.mockShard.GetExecutionManager(),
507507
false,

service/history/shard/context_impl.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,8 +1935,8 @@ func newContext(
19351935
}
19361936
shardContext.eventsCache = events.NewEventsCache(
19371937
shardContext.GetShardID(),
1938-
shardContext.GetConfig().EventsCacheInitialSize(),
1939-
shardContext.GetConfig().EventsCacheMaxSize(),
1938+
shardContext.GetConfig().EventsCacheInitialSizeBytes(),
1939+
shardContext.GetConfig().EventsCacheMaxSizeBytes(),
19401940
shardContext.GetConfig().EventsCacheTTL(),
19411941
shardContext.GetExecutionManager(),
19421942
false,

service/history/timerQueueActiveTaskExecutor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ func (s *timerQueueActiveTaskExecutorSuite) SetupTest() {
138138
)
139139
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
140140
s.mockShard.GetShardID(),
141-
s.mockShard.GetConfig().EventsCacheInitialSize(),
142-
s.mockShard.GetConfig().EventsCacheMaxSize(),
141+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
142+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
143143
s.mockShard.GetConfig().EventsCacheTTL(),
144144
s.mockShard.GetExecutionManager(),
145145
false,

service/history/timerQueueStandbyTaskExecutor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ func (s *timerQueueStandbyTaskExecutorSuite) SetupTest() {
141141
)
142142
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
143143
s.mockShard.GetShardID(),
144-
s.mockShard.GetConfig().EventsCacheInitialSize(),
145-
s.mockShard.GetConfig().EventsCacheMaxSize(),
144+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
145+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
146146
s.mockShard.GetConfig().EventsCacheTTL(),
147147
s.mockShard.GetExecutionManager(),
148148
false,

service/history/transferQueueActiveTaskExecutor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ func (s *transferQueueActiveTaskExecutorSuite) SetupTest() {
174174
)
175175
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
176176
s.mockShard.GetShardID(),
177-
s.mockShard.GetConfig().EventsCacheInitialSize(),
178-
s.mockShard.GetConfig().EventsCacheMaxSize(),
177+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
178+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
179179
s.mockShard.GetConfig().EventsCacheTTL(),
180180
s.mockShard.GetExecutionManager(),
181181
false,

service/history/transferQueueStandbyTaskExecutor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ func (s *transferQueueStandbyTaskExecutorSuite) SetupTest() {
149149
)
150150
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
151151
s.mockShard.GetShardID(),
152-
s.mockShard.GetConfig().EventsCacheInitialSize(),
153-
s.mockShard.GetConfig().EventsCacheMaxSize(),
152+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
153+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
154154
s.mockShard.GetConfig().EventsCacheTTL(),
155155
s.mockShard.GetExecutionManager(),
156156
false,

service/history/visibilityQueueTaskExecutor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ func (s *visibilityQueueTaskExecutorSuite) SetupTest() {
121121
)
122122
s.mockShard.SetEventsCacheForTesting(events.NewEventsCache(
123123
s.mockShard.GetShardID(),
124-
s.mockShard.GetConfig().EventsCacheInitialSize(),
125-
s.mockShard.GetConfig().EventsCacheMaxSize(),
124+
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
125+
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
126126
s.mockShard.GetConfig().EventsCacheTTL(),
127127
s.mockShard.GetExecutionManager(),
128128
false,

0 commit comments

Comments
 (0)