Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change the history cache key name to *Bytes #4649

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions common/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
EventsCacheInitialSize dynamicconfig.IntPropertyFn
EventsCacheMaxSize dynamicconfig.IntPropertyFn
EventsCacheTTL dynamicconfig.DurationPropertyFn
EventsCacheInitialSizeBytes dynamicconfig.IntPropertyFn
EventsCacheMaxSizeBytes dynamicconfig.IntPropertyFn
EventsCacheTTL dynamicconfig.DurationPropertyFn

// ShardController settings
RangeSizeBits uint
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions service/history/history_engine_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().EventsCacheInitialSize(),
s.mockShard.GetConfig().EventsCacheMaxSize(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
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().EventsCacheInitialSize(),
s.mockShard.GetConfig().EventsCacheMaxSize(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
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().EventsCacheInitialSize(),
s.mockShard.GetConfig().EventsCacheMaxSize(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
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().EventsCacheInitialSize(),
s.mockShard.GetConfig().EventsCacheMaxSize(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
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().EventsCacheInitialSize(),
s.mockShard.GetConfig().EventsCacheMaxSize(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
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 @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/timer_queue_active_task_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/timer_queue_standby_task_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/transfer_queue_active_task_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/transfer_queue_standby_task_executor_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().EventsCacheInitialSize(),
s.mockShard.GetConfig().EventsCacheMaxSize(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
false,
Expand Down
4 changes: 2 additions & 2 deletions service/history/visibility_queue_task_executor_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().EventsCacheInitialSize(),
s.mockShard.GetConfig().EventsCacheMaxSize(),
s.mockShard.GetConfig().EventsCacheInitialSizeBytes(),
s.mockShard.GetConfig().EventsCacheMaxSizeBytes(),
s.mockShard.GetConfig().EventsCacheTTL(),
s.mockShard.GetExecutionManager(),
false,
Expand Down