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

Remove failover levels #3854

Merged
merged 1 commit into from
Jan 27, 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
2 changes: 0 additions & 2 deletions common/metrics/metric_defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1412,8 +1412,6 @@ var (
ShardInfoVisibilityLagHistogram = NewDimensionlessHistogramDef("shardinfo_visibility_lag")
ShardInfoImmediateQueueLagHistogram = NewDimensionlessHistogramDef("shardinfo_immediate_queue_lag")
ShardInfoScheduledQueueLagTimer = NewTimerDef("shardinfo_scheduled_queue_lag")
ShardInfoTransferFailoverLatencyTimer = NewTimerDef("shardinfo_transfer_failover_latency")
ShardInfoTimerFailoverLatencyTimer = NewTimerDef("shardinfo_timer_failover_latency")
SyncShardFromRemoteCounter = NewCounterDef("syncshard_remote_count")
SyncShardFromRemoteFailure = NewCounterDef("syncshard_remote_failed")
TaskRequests = NewCounterDef("task_requests")
Expand Down
17 changes: 0 additions & 17 deletions common/persistence/dataInterfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,23 +163,6 @@ type (
Msg string
}

// ShardInfoWithFailover describes a shard
ShardInfoWithFailover struct {
*persistencespb.ShardInfo
FailoverLevels map[tasks.Category]map[string]FailoverLevel // uuid -> FailoverLevel
}

// FailoverLevel contains corresponding start / end level
// TODO: remove FailoverLevel definition, they are only used by
// old queue processing logic
FailoverLevel struct {
StartTime time.Time
MinLevel tasks.Key
CurrentLevel tasks.Key
MaxLevel tasks.Key
NamespaceIDs map[string]struct{}
}

// TaskQueueKey is the struct used to identity TaskQueues
TaskQueueKey struct {
NamespaceID string
Expand Down
9 changes: 4 additions & 5 deletions service/history/historyEngine2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,10 @@ func (s *engine2Suite) SetupTest() {
s.config = tests.NewDynamicConfig()
mockShard := shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 1,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 1,
RangeId: 1,
},
s.config,
)
s.mockShard = mockShard
Expand Down
4 changes: 2 additions & 2 deletions service/history/historyEngine3_eventsv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ func (s *engine3Suite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{ShardInfo: &persistencespb.ShardInfo{
&persistencespb.ShardInfo{
ShardId: 1,
RangeId: 1,
}},
},
s.config,
)
s.mockShard.Resource.ShardMgr.EXPECT().AssertShardOwnership(gomock.Any(), gomock.Any()).AnyTimes()
Expand Down
9 changes: 4 additions & 5 deletions service/history/historyEngine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,10 @@ func (s *engineSuite) SetupTest() {
s.config = tests.NewDynamicConfig()
s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 1,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 1,
RangeId: 1,
},
s.config,
)
s.workflowCache = wcache.NewCache(s.mockShard)
Expand Down
9 changes: 4 additions & 5 deletions service/history/ndc/activity_replicator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,10 @@ func (s *activityReplicatorSuite) SetupTest() {
s.mockTimerProcessor.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes()
s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 1,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 1,
RangeId: 1,
},
tests.NewDynamicConfig(),
)
s.workflowCache = wcache.NewCache(s.mockShard).(*wcache.CacheImpl)
Expand Down
9 changes: 4 additions & 5 deletions service/history/ndc/branch_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ func (s *branchMgrSuite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
},
tests.NewDynamicConfig(),
)

Expand Down
10 changes: 4 additions & 6 deletions service/history/ndc/conflict_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
"go.temporal.io/server/common/convert"
"go.temporal.io/server/common/definition"
"go.temporal.io/server/common/log"
"go.temporal.io/server/common/persistence"
"go.temporal.io/server/common/persistence/versionhistory"
"go.temporal.io/server/service/history/shard"
"go.temporal.io/server/service/history/tests"
Expand Down Expand Up @@ -82,11 +81,10 @@ func (s *conflictResolverSuite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
},
tests.NewDynamicConfig(),
)

Expand Down
9 changes: 4 additions & 5 deletions service/history/ndc/history_replicator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ func (s *historyReplicatorSuite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
},
tests.NewDynamicConfig(),
)

Expand Down
9 changes: 4 additions & 5 deletions service/history/ndc/resetter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ func (s *resetterSuite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
},
tests.NewDynamicConfig(),
)

Expand Down
9 changes: 4 additions & 5 deletions service/history/ndc/state_rebuilder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ func (s *stateRebuilderSuite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
},
tests.NewDynamicConfig(),
)

Expand Down
9 changes: 4 additions & 5 deletions service/history/ndc/transaction_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@ func (s *transactionMgrSuite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 10,
RangeId: 1,
},
tests.NewDynamicConfig(),
)

Expand Down
9 changes: 4 additions & 5 deletions service/history/ndc/workflow_resetter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ func (s *workflowResetterSuite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 1,
},
tests.NewDynamicConfig(),
)
s.mockExecutionMgr = s.mockShard.Resource.ExecutionMgr
Expand Down
88 changes: 37 additions & 51 deletions service/history/queues/queue_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,12 @@ func (s *queueBaseSuite) TestNewProcessBase_NoPreviousState() {

mockShard := shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: rangeID,
QueueAckLevels: map[int32]*persistencespb.QueueAckLevel{
tasks.CategoryIDTransfer: {
AckLevel: ackLevel,
},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: rangeID,
QueueAckLevels: map[int32]*persistencespb.QueueAckLevel{
tasks.CategoryIDTransfer: {
AckLevel: ackLevel,
},
},
},
Expand Down Expand Up @@ -207,13 +205,11 @@ func (s *queueBaseSuite) TestNewProcessBase_WithPreviousState() {

mockShard := shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTransfer: persistenceState,
},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTransfer: persistenceState,
},
},
s.config,
Expand Down Expand Up @@ -248,14 +244,12 @@ func (s *queueBaseSuite) TestNewProcessBase_WithPreviousState() {
func (s *queueBaseSuite) TestStartStop() {
mockShard := shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueAckLevels: map[int32]*persistencespb.QueueAckLevel{
tasks.CategoryIDTransfer: {
AckLevel: 1024,
},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueAckLevels: map[int32]*persistencespb.QueueAckLevel{
tasks.CategoryIDTransfer: {
AckLevel: 1024,
},
},
},
Expand Down Expand Up @@ -318,13 +312,11 @@ func (s *queueBaseSuite) TestProcessNewRange() {

mockShard := shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTimer: persistenceState,
},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTimer: persistenceState,
},
},
s.config,
Expand Down Expand Up @@ -375,13 +367,11 @@ func (s *queueBaseSuite) TestCheckPoint_WithPendingTasks() {

mockShard := shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTimer: persistenceState,
},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTimer: persistenceState,
},
},
s.config,
Expand Down Expand Up @@ -449,13 +439,11 @@ func (s *queueBaseSuite) TestCheckPoint_NoPendingTasks() {

mockShard := shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTimer: persistenceState,
},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTimer: persistenceState,
},
},
s.config,
Expand Down Expand Up @@ -538,13 +526,11 @@ func (s *queueBaseSuite) TestCheckPoint_MoveSlices() {

mockShard := shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTimer: initialPersistenceState,
},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 10,
QueueStates: map[int32]*persistencespb.QueueState{
tasks.CategoryIDTimer: initialPersistenceState,
},
},
s.config,
Expand Down
8 changes: 3 additions & 5 deletions service/history/queues/queue_scheduled_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ func (s *scheduledQueueSuite) SetupTest() {
s.controller = gomock.NewController(s.T())
s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 1,
},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 1,
},
tests.NewDynamicConfig(),
)
Expand Down
9 changes: 4 additions & 5 deletions service/history/replication/ack_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,10 @@ func (s *ackManagerSuite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 1,
}},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 1,
},
tests.NewDynamicConfig(),
)

Expand Down
11 changes: 5 additions & 6 deletions service/history/replication/dlq_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,11 @@ func (s *dlqHandlerSuite) SetupTest() {

s.mockShard = shard.NewTestContext(
s.controller,
&persistence.ShardInfoWithFailover{
ShardInfo: &persistencespb.ShardInfo{
ShardId: 0,
RangeId: 1,
ReplicationDlqAckLevel: map[string]int64{cluster.TestAlternativeClusterName: persistence.EmptyQueueMessageID},
}},
&persistencespb.ShardInfo{
ShardId: 0,
RangeId: 1,
ReplicationDlqAckLevel: map[string]int64{cluster.TestAlternativeClusterName: persistence.EmptyQueueMessageID},
},
tests.NewDynamicConfig(),
)
s.mockResource = s.mockShard.Resource
Expand Down
Loading