user_data_manager.go ×7

Frontier kind: Code frontier

unlabeled · c_8fa357fa2a32

100 tests · 3041 LOC · 143 files · introduces 0 tests · 45 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges45 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
460 ranges3041 lines · 143 files · Browse complete extent
All tests (intent)
100 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: 45 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/matching/user_data_manager.go 41 introduced LOC · 7 ranges

Open complete file

308 // hasFetchedUserData is true if we have gotten a successful reply to GetTaskQueueUserData.
309 // It's used to control whether we do a long poll or a simple get.
310 > hasFetchedUserData := false user_data_manager.go
311 > userDataVersionChanged := false
312 >
313 > op := func(ctx context.Context) error {
314 > knownUserData, _, _ := m.GetUserData()
315 > userDataVersionChanged = false
316 >
317 > callCtx, cancel := context.WithTimeout(ctx, m.config.GetUserDataLongPollTimeout())
318 > defer cancel()
319 >
320 > res, err := m.matchingClient.GetTaskQueueUserData(callCtx, &matchingservice.GetTaskQueueUserDataRequest{
321 > NamespaceId: m.partition.NamespaceId(),
322 > TaskQueue: fetchSource.RpcName(),
323 > TaskQueueType: fetchSource.TaskType(),
324 > LastKnownUserDataVersion: knownUserData.GetVersion(),
325 > LastKnownEphemeralDataVersion: m.getIncomingEphemeralDataVersion(),
326 > WaitNewData: hasFetchedUserData,
327 > })
328 > if err != nil {
329 // don't log on context canceled, produces too much log spam at shutdown
330 if !common.IsContextCanceledErr(err) {
345 // It can't be nil due to removing versions, as that would result in a non-nil container with
346 // nil inner fields.
347 > if res.GetUserData() != nil { user_data_manager.go
348 m.setUserDataForNonOwningPartition(res.GetUserData())
349 userDataVersionChanged = res.GetUserData().GetVersion() != knownUserData.GetVersion()
350 m.logNewUserData("fetched user data from parent", res.GetUserData())
351 > } else { user_data_manager.go
352 m.logger.Debug("fetched user data from parent, no change")
353 }
354 > if res.GetEphemeralData() != nil { user_data_manager.go
355 m.gotIncomingEphemeralData(res.EphemeralData)
356 }
357 > hasFetchedUserData = true user_data_manager.go
358 > m.setUserDataState(userDataEnabled, nil)
359 > return nil
360 }
361
362 > fastResponseCounter := 0 user_data_manager.go
363 > minWaitTime := m.config.GetUserDataMinWaitTime
364 >
365 > for ctx.Err() == nil {
366 > start := time.Now()
367 > _ = backoff.ThrottleRetryContext(ctx, op, m.config.GetUserDataRetryPolicy, nil)
368 > elapsed := time.Since(start)
369 >
370 > // In general, we want to start a new call immediately on completion of the previous
371 > // one. But if the remote is broken and returns success immediately, we might end up
372 > // spinning. So enforce a minimum wait time that increases as long as we keep getting
373 > // very fast replies.
374 > // If the user data version changed it means new data was received so we skip this check.
375 > if !userDataVersionChanged && elapsed < m.config.GetUserDataMinWaitTime {
376 if fastResponseCounter >= maxFastUserDataFetches {
377 // maxFastUserDataFetches or more consecutive fast responses, let's throttle!
822 }
823
824 > func (m *userDataManagerImpl) getIncomingEphemeralDataVersion() int64 { user_data_manager.go
825 > if m.partition.IsRoot() {
826 // The root activity/nexus partition should not fetch ephemeral data from the root
827 // workflow partition.
go.temporal.io/server/api/matchingservice/v1/request_response.pb.go 4 introduced LOC · 1 range

Open complete file

2915 }
2916
2917 > func (x *GetTaskQueueUserDataResponse) GetEphemeralData() *v18.VersionedEphemeralData { request_response.pb.go
2918 > if x != nil {
2919 > return x.EphemeralData
2920 > }
2921 return nil
2922 }