stream_receiver.go ×8

Frontier kind: Code frontier

unlabeled · c_a6b79d8cec83

3 tests · 3289 LOC · 145 files · introduces 0 tests · 33 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges33 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
446 ranges3289 lines · 145 files · Browse complete extent
All tests (intent)
3 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: 33 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/replication/stream_receiver.go 29 introduced LOC · 8 ranges

Open complete file

351 }
352
353 > if err = ValidateTasksHaveSamePriority(priority, messages.ReplicationTasks...); err != nil { stream_receiver.go
354 // This should not happen because source side is sending task 1 by 1. Validate here just in case.
355 return NewStreamError("ReplicationTask priority check failed", err)
356 }
357
358 > convertedTasks := r.taskConverter.Convert( stream_receiver.go
359 > clusterName,
360 > r.clientShardKey,
361 > r.serverShardKey,
362 > messages.ReplicationTasks...,
363 > )
364 > exclusiveHighWatermark := messages.ExclusiveHighWatermark
365 > exclusiveHighWatermarkTime := timestamp.TimeValue(messages.ExclusiveHighWatermarkTime)
366 > taskTracker, err := r.getTaskTracker(priority)
367 > if err != nil {
368 // Todo: Change to write Tasks to DLQ. As resend task will not help here
369 return NewStreamError("ReplicationTask wrong priority", err)
370 }
371
372 > submissionThreshold := r.Config.ReplicationReceiverSlowSubmissionLatencyThreshold() stream_receiver.go
373 >
374 > for _, task := range taskTracker.TrackTasks(WatermarkInfo{
375 > Watermark: exclusiveHighWatermark,
376 > Timestamp: exclusiveHighWatermarkTime,
377 > }, convertedTasks...) {
378 schedulerPriority, err := r.getTaskSchedulerPriority(priority, task)
379 if err != nil {
422 }
423
424 > func (r *StreamReceiverImpl) getTaskTracker(priority enumsspb.TaskPriority) (ExecutableTaskTracker, error) { stream_receiver.go
425 > switch priority {
426 > case enumsspb.TASK_PRIORITY_UNSPECIFIED, enumsspb.TASK_PRIORITY_HIGH:
427 > return r.highPriorityTaskTracker, nil
428 case enumsspb.TASK_PRIORITY_LOW:
429 return r.lowPriorityTaskTracker, nil
468 receiverMode := ReceiverMode(atomic.LoadInt32((*int32)(&r.receiverMode)))
469 switch receiverMode {
470 > case ReceiverModeUnset: stream_receiver.go
471 > r.setReceiverMode(priority)
472 > return nil
473 case ReceiverModeSingleStack:
474 if priority != enumsspb.TASK_PRIORITY_UNSPECIFIED {
483 }
484
485 > func (r *StreamReceiverImpl) setReceiverMode(priority enumsspb.TaskPriority) { stream_receiver.go
486 > if r.receiverMode != ReceiverModeUnset {
487 return
488 }
489 > switch priority { stream_receiver.go
490 case enumsspb.TASK_PRIORITY_UNSPECIFIED:
491 atomic.StoreInt32((*int32)(&r.receiverMode), int32(ReceiverModeSingleStack))
495 }
496
497 > func ValidateTasksHaveSamePriority(messageBatchPriority enumsspb.TaskPriority, tasks ...*replicationspb.ReplicationTask) error { stream_receiver.go
498 > if len(tasks) == 0 || messageBatchPriority == enumsspb.TASK_PRIORITY_UNSPECIFIED {
499 return nil
500 }
go.temporal.io/server/service/history/replication/executable_task_converter.go 4 introduced LOC · 2 ranges

Open complete file

38 serverShardKey ClusterShardKey,
39 replicationTasks ...*replicationspb.ReplicationTask,
40 > ) []TrackableExecutableTask { executable_task_converter.go
41 > tasks := make([]TrackableExecutableTask, len(replicationTasks))
42 > for index, replicationTask := range replicationTasks {
43 metrics.ReplicationTasksRecv.With(e.processToolBox.MetricsHandler).Record(
44 int64(1),
49 tasks[index] = e.convertOne(sourceClusterName, serverShardKey, replicationTask)
50 }
51 > return tasks executable_task_converter.go
52 }
53