Skip to content

Commit

Permalink
Revert "change the history cache key name to *Bytes (#4649)"
Browse files Browse the repository at this point in the history
This reverts commit 67de6df.
  • Loading branch information
dnr committed Jul 28, 2023
1 parent 55c4d36 commit 5dbbc45
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 @@ -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
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions service/history/historyEngine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions service/history/replication/ack_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/shard/context_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/timerQueueActiveTaskExecutor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/timerQueueStandbyTaskExecutor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/transferQueueActiveTaskExecutor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/transferQueueStandbyTaskExecutor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/visibilityQueueTaskExecutor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5dbbc45

Please sign in to comment.