task_queue_partition_manager.go ×11

Frontier kind: Code frontier

unlabeled · c_b3ea337c8d99

15 tests · 5214 LOC · 186 files · introduces 0 tests · 48 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges48 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1050 ranges5214 lines · 186 files · Browse complete extent
All tests (intent)
15 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.

1 file ranked by introduced lines: 48 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/task_queue_partition_manager.go 48 introduced LOC · 11 ranges

Open complete file

1397 unversionedRampingShareByPriority = map[int32]*taskqueuepb.TaskQueueStats{}
1398 if rampingExists {
1399 > unversionedCurrentShareByPriority, unversionedRampingShareByPriority = task_queue_partition_manager.go
1400 > splitStatsByPriorityByRampPercentage(unversionedStatsByPriority, rampPercentage)
1401 } else if currentExists {
1402 // If there exist no ramping version, we attribute the entire unversioned backlog to the current version.
1461 // unversioned, that share should remain part of the unversioned queue stats.
1462 if rampingExists && !isRampingToUnversioned {
1463 > subtractStatsByPriority(adjustedStatsByPriority, unversionedRampingShareByPriority) task_queue_partition_manager.go
1464 > }
1465 } else if isCurrentDescribe && currentExists {
1466 mergeStatsByPriority(adjustedStatsByPriority, unversionedCurrentShareByPriority)
1467 } else if isRampingDescribe && rampingExists {
1468 > mergeStatsByPriority(adjustedStatsByPriority, unversionedRampingShareByPriority) task_queue_partition_manager.go
1469 > }
1470
1471 vInfo.PhysicalTaskQueueInfo.TaskQueueStatsByPriorityKey = adjustedStatsByPriority
1753 in *taskqueuepb.TaskQueueStats,
1754 rampPct float32,
1755 > ) (currentShare *taskqueuepb.TaskQueueStats, rampShare *taskqueuepb.TaskQueueStats) { task_queue_partition_manager.go
1756 > if in == nil {
1757 in = &taskqueuepb.TaskQueueStats{ApproximateBacklogAge: durationpb.New(0)}
1758 }
1759
1760 > total := in.GetApproximateBacklogCount() task_queue_partition_manager.go
1761 > // We intentionally bias towards over-attribution ("safe side"):
1762 > // compute both shares with ceil. This can result in currentCount+rampCount > total.
1763 > rampCount := int64(math.Ceil(float64(total) * float64(rampPct) / 100.0))
1764 > currentCount := int64(math.Ceil(float64(total) * float64(100.0-rampPct) / 100.0))
1765 >
1766 > // Just being defensive here; should never happen.
1767 > if rampCount < 0 {
1768 rampCount = 0
1769 }
1770 > if currentCount < 0 { task_queue_partition_manager.go
1771 currentCount = 0
1772 }
1773
1774 > rampAddRate := in.GetTasksAddRate() * rampPct / 100 task_queue_partition_manager.go
1775 > rampDispatchRate := in.GetTasksDispatchRate() * rampPct / 100
1776 >
1777 > age := in.GetApproximateBacklogAge()
1778 > if age == nil {
1779 age = durationpb.New(0)
1780 }
1781
1782 // Rather than splitting the backlog age, we set it to the oldest backlog age for both the current and the ramping shares.
1783 > currentAge := durationpb.New(age.AsDuration()) task_queue_partition_manager.go
1784 > rampAge := durationpb.New(age.AsDuration())
1785 > if currentCount == 0 {
1786 currentAge = durationpb.New(0)
1787 }
1788 > if rampCount == 0 { task_queue_partition_manager.go
1789 rampAge = durationpb.New(0)
1790 }
1791
1792 > currentShare = &taskqueuepb.TaskQueueStats{ task_queue_partition_manager.go
1793 > ApproximateBacklogCount: currentCount,
1794 > ApproximateBacklogAge: currentAge,
1795 > TasksAddRate: in.GetTasksAddRate() - rampAddRate,
1796 > TasksDispatchRate: in.GetTasksDispatchRate() - rampDispatchRate,
1797 > }
1798 > rampShare = &taskqueuepb.TaskQueueStats{
1799 > ApproximateBacklogCount: rampCount,
1800 > ApproximateBacklogAge: rampAge,
1801 > TasksAddRate: rampAddRate,
1802 > TasksDispatchRate: rampDispatchRate,
1803 > }
1804 > return currentShare, rampShare
1805 }
1806
1810 statsByPriority map[int32]*taskqueuepb.TaskQueueStats,
1811 rampPct float32,
1812 > ) (currentShareByPriority, rampShareByPriority map[int32]*taskqueuepb.TaskQueueStats) { task_queue_partition_manager.go
1813 > currentShareByPriority = make(map[int32]*taskqueuepb.TaskQueueStats, len(statsByPriority))
1814 > rampShareByPriority = make(map[int32]*taskqueuepb.TaskQueueStats, len(statsByPriority))
1815 > for pri, s := range statsByPriority {
1816 > current, ramp := splitTaskQueueStatsByRampPercentage(s, rampPct)
1817 > currentShareByPriority[pri] = current
1818 > rampShareByPriority[pri] = ramp
1819 > }
1820 > return currentShareByPriority, rampShareByPriority
1821 }
1822