func (db *taskQueueDB) RenewLease(
ctx context.Context,
db.Lock()
defer db.Unlock()
if db.rangeID == 0 {
if err := db.takeOverTaskQueueLocked(ctx); err != nil {
return taskQueueState{}, err
}
Frontier kind: Code frontier
unlabeled · c_d938b0fa20f8
464 tests · 3003 LOC · 141 files · introduces 0 tests · 93 LOC · 3 files
The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.
Introduced files, introduced tests, and structurally relevant concept specialization
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.
Every exact file and test below is linked only from the concept that introduces it.
go.temporal.io/server/common/persistence/client/TestQuotasSuite/TestAPITypeCallOriginPriorityOverrideMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestBackgroundTypeAPIPriorityOverrideMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestCallerTypeDefaultPriorityMappinggo.temporal.io/server/common/persistence/client/TestQuotasSuite/TestRequestPrioritiesOrderedgo.temporal.io/server/common/circuitbreaker/TestTSCBWithDynamicSettingsgo.temporal.io/server/common/dynamicconfig/TestDeepCopy_OtherReferenceTypes_Nilgo.temporal.io/server/service/matching/configs/TestQuotasSuite/TestAPIPrioritiesOrderedgo.temporal.io/server/service/matching/configs/TestQuotasSuite/TestAPIToPriorityMappingEvery collected test enters the hierarchy at exactly one concept.
No tests are introduced at this concept. Its intent tests are introduced by other concepts.
Every collected source range enters the hierarchy at exactly one concept.
3 files ranked by introduced lines: 93 introduced LOC across 17 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
func (db *taskQueueDB) RenewLease(
ctx context.Context,
db.Lock()
defer db.Unlock()
if db.rangeID == 0 {
if err := db.takeOverTaskQueueLocked(ctx); err != nil {
return taskQueueState{}, err
}
}
}
rangeID: db.rangeID,
ackLevel: db.subqueues[subqueueZero].AckLevel, // TODO(pri): cleanup, only used by old backlog manager
subqueues: db.cloneSubqueues(),
otherHasTasks: !db.isDraining && db.otherHasTasks,
scaleState: db.scaleState,
}, nil
}
func (db *taskQueueDB) takeOverTaskQueueLocked(
ctx context.Context,
response, err := db.store.GetTaskQueue(ctx, &persistence.GetTaskQueueRequest{
NamespaceID: db.queue.NamespaceId(),
TaskQueue: db.queue.PersistenceName(),
TaskType: db.queue.TaskType(),
})
switch err.(type) {
case nil:
db.rangeID = response.RangeID
}
if ttl := db.queue.Partition().PersistenceTTL(); ttl > 0 {
return timestamppb.New(time.Now().Add(ttl))
}
}
infos := make([]*persistencespb.SubqueueInfo, len(db.subqueues))
for i := range db.subqueues {
infos[i] = &db.subqueues[i].SubqueueInfo
}
return &persistencespb.TaskQueueInfo{
NamespaceId: db.queue.NamespaceId(),
Name: db.queue.PersistenceName(),
TaskType: db.queue.TaskType(),
Kind: db.queue.Partition().Kind(),
AckLevel: db.subqueues[subqueueZero].AckLevel, // backwards compatibility
ExpiryTime: db.expiryTime(),
LastUpdateTime: timestamp.TimeNowPtrUtc(),
ApproximateBacklogCount: db.subqueues[subqueueZero].ApproximateBacklogCount, // backwards compatibility
Subqueues: infos,
OtherHasTasks: db.otherHasTasks,
PartitionScaleState: db.scaleState,
}
}
initAckLevel int64,
initApproxCount int64,
// convert+copy protos to []*dbSubqueue
subqueues := make([]*dbSubqueue, len(infos))
for i, info := range infos {
subqueues[i] = &dbSubqueue{}
proto.Merge(&subqueues[i].SubqueueInfo, info)
// check for default priority and add if not present (this may be initializing subqueue 0)
Priority: int32(db.config.DefaultPriorityKey),
}
hasDefault := slices.ContainsFunc(subqueues, func(s *dbSubqueue) bool {
return proto.Equal(s.Key, defKey)
})
subqueues = append(subqueues, db.newSubqueueLocked(defKey))
// If we are transitioning from no-subqueues to subqueues, initialize subqueue 0 with
// the ack level and approx count from TaskQueueInfo.
if len(subqueues) == 1 {
subqueues[subqueueZero].AckLevel = initAckLevel
subqueues[subqueueZero].ApproximateBacklogCount = initApproxCount
}
}
}
// For fifo queues: start ack level + max read level just before the current block.
// For fair queues: ack level and max read level don't matter here.
initAckLevel := rangeIDToTaskIDBlock(db.rangeID, db.config.RangeSize).start - 1
softassert.That(db.logger, initAckLevel >= 0, "initAckLevel should not be negative")
s := &dbSubqueue{maxReadLevel: initAckLevel}
s.Key = key
s.AckLevel = initAckLevel
return s
}
// clone db.subqueues so we can return it outside our lock
infos := make([]persistencespb.SubqueueInfo, len(db.subqueues))
for i := range db.subqueues {
proto.Merge(&infos[i], &db.subqueues[i].SubqueueInfo)
}
return infos
}
mi := &file_temporal_server_api_persistence_v1_tasks_proto_msgTypes[3]
if x != nil {
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
func (*FairnessKeyCount) ProtoMessage() {}
mi := &file_temporal_server_api_persistence_v1_tasks_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
func (*SubqueueKey) ProtoMessage() {}
mi := &file_temporal_server_api_persistence_v1_tasks_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
}
return taskIDBlock{
start: (rangeID-1)*rangeSize + 1,
end: rangeID * rangeSize,
}
}
// Retry operation on transient error.