task_queue_partition_manager.go ×10

Frontier kind: Code frontier

unlabeled · c_a3232d2fcd5d

6 tests · 5022 LOC · 191 files · introduces 0 tests · 38 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges38 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
996 ranges5022 lines · 191 files · Browse complete extent
All tests (intent)
6 testsBrowse complete intent

Neighbourhood graph

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.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 38 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/task_queue_partition_manager.go 35 introduced LOC · 10 ranges

Open complete file

1081 taskId string,
1082 request *matchingservice.DispatchNexusTaskRequest,
1083 > ) (*matchingservice.DispatchNexusTaskResponse, error) { task_queue_partition_manager.go
1084 > // TODO(dp): if this partition becomes invalid while the query is blocked, we should cancel the match
1085 > defer pm.sendPartitionCountTrailer(ctx)
1086 > // nexus counts as "write" for partition load balancing
1087 > if err := pm.checkPartitionCounts(ctx, true); err != nil {
1088 return nil, err
1089 }
1090 > if request.ForwardInfo == nil { task_queue_partition_manager.go
1091 pm.signalPartitionScaler()
1092 }
1093
1094 > deadline, _ := ctx.Deadline() // If not set by user, our client will set a default. task_queue_partition_manager.go
1095 > var opDeadline time.Time
1096 > if header := nexus.Header(request.GetRequest().GetHeader()); header != nil {
1097 if opTimeoutHeader := header.Get(nexus.HeaderOperationTimeout); opTimeoutHeader != "" {
1098 opTimeout, err := time.ParseDuration(opTimeoutHeader)
1106 }
1107
1108 > task := newInternalNexusTask(taskId, deadline, opDeadline, request) task_queue_partition_manager.go
1109 > pm.config.setDefaultPriority(task)
1110 >
1111 > reredirectTask:
1112 > firedNoPollerHook := false
1113 > _, syncMatchQueue, _, _, _, err := pm.getPhysicalQueuesForAdd(ctx,
1114 > worker_versioning.MakeUseAssignmentRulesDirective(),
1115 > // We do not pass forwardInfo because we want the parent partition to make fresh versioning decision. Note that
1116 > // forwarded Query/Nexus task requests do not expire rapidly in contrast to forwarded activity/workflow tasks
1117 > // that only try up to 200ms sync-match. Therefore, to prevent blocking the request on the wrong build ID, its
1118 > // more important to allow the parent partition to make a fresh versioning decision in case the child partition
1119 > // did not have up-to-date User Data when selected a dispatch build ID.
1120 > nil,
1121 > "",
1122 > "",
1123 > false)
1124 > if err != nil {
1125 return nil, err
1126 }
1129 // Only fire for non-forwarded tasks: forwarded tasks already had the hook fired
1130 // on the originating partition.
1131 > if request.ForwardInfo == nil && task_queue_partition_manager.go
1132 > !syncMatchQueue.HasPollerAfter(time.Now().Add(-pm.config.WorkerControllerNoPollerHookWindow())) {
1133 queueVersion := syncMatchQueue.QueueKey().Version().WorkerDeploymentVersionS()
1134 pm.processTaskAddHooks(ctx, queueVersion, syncMatchNoPoller)
1136 }
1137
1138 > dbq := pm.defaultQueue() task_queue_partition_manager.go
1139 > if dbq == nil {
1140 return nil, errDefaultQueueNotInit
1141 }
1142 > if dbq != syncMatchQueue { task_queue_partition_manager.go
1143 // default queue should stay alive even if requests go to other queues
1144 dbq.MarkAlive()
1145 }
1146
1147 > res, err := syncMatchQueue.DispatchNexusTask(ctx, task) task_queue_partition_manager.go
1148 > if errors.Is(err, errReprocessTask) {
1149 // We get this if userdata changed while the task was blocked in DispatchNexusTask
1150 goto reredirectTask
1153 // fired a no-poller hook for this task — the two signals are contradictory for
1154 // the same task dispatch.
1155 > if err == nil && res == nil && request.ForwardInfo == nil && !firedNoPollerHook { task_queue_partition_manager.go
1156 queueVersion := syncMatchQueue.QueueKey().Version().WorkerDeploymentVersionS()
1157 pm.processTaskAddHooks(ctx, queueVersion, syncMatchSuccess)
1158 }
1159 > return res, err task_queue_partition_manager.go
1160 }
1161
go.temporal.io/server/service/matching/physical_task_queue_manager.go 3 introduced LOC · 2 ranges

Open complete file

622 ctx context.Context,
623 task *internalTask,
624 > ) (*matchingservice.DispatchNexusTaskResponse, error) { physical_task_queue_manager.go
625 > if !task.isForwarded() {
626 c.incTaskTracker(c.tasksAdded, priorityKey(0), 1) // Nexus has no priorities
627 }
628 > return c.matcher.OfferNexusTask(ctx, task) physical_task_queue_manager.go
629 }
630