service_resolver.go ×7

Frontier kind: Joint frontier

unlabeled · c_62794c4f46fb

1 test · 2636 LOC · 91 files · introduces 1 test · 36 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges36 lines · 3 files
Tests
1 test

Contains — complete concept membership

All code (extent)
440 ranges2636 lines · 91 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

3 files ranked by introduced lines: 36 introduced LOC across 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/membership/ringpop/service_resolver.go 21 introduced LOC · 7 ranges

Open complete file

316 return
317 }
318 > if _, ok := r.scheduledRefreshMap[nextEvent]; ok { service_resolver.go
319 > return // already have a timer scheduled for this time
320 > }
321 > nextEventTime := time.Unix(nextEvent, 0)
322 > r.scheduledRefreshMap[nextEvent] = time.AfterFunc(time.Until(nextEventTime), func() {
323 > // force refresh asap
324 > if err := r.refresh(refreshModeAlways); err != nil {
325 r.logger.Error("error refreshing ring on scheduled event", tag.Error(err))
326 }
327 // clean up map
328 > r.refreshLock.Lock() service_resolver.go
329 > defer r.refreshLock.Unlock()
330 > delete(r.scheduledRefreshMap, nextEvent)
331 })
332 > r.logger.Debug("Membership will refresh at scheduled event", tag.Timestamp(nextEventTime)) service_resolver.go
333 }
334
351 return false // ignore label if missing or can't parse
352 } else if startAt <= nowUnix {
353 > return false // start time is in the past service_resolver.go
354 > }
355 // start time is in the future: schedule refresh at that time
356 > nextEvent = min(nextEvent, startAt) service_resolver.go
357 > return true
358 })
359
364 return false // ignore label if missing or can't parse
365 } else if stopAt > nowUnix {
366 > // stop time is in the future: schedule refresh at that time service_resolver.go
367 > nextEvent = min(nextEvent, stopAt)
368 > return false
369 > }
370 > return true // stop time is in the past
371 })
372
521 return 0, errMissingLabel
522 }
523 > return strconv.ParseInt(str, 10, 64) service_resolver.go
524 }
525
go.temporal.io/server/common/membership/ringpop/monitor.go 13 introduced LOC · 6 ranges

Open complete file

158
159 if until := time.Until(rpo.joinTime); until > 0 && until.Seconds() < maxScheduledEventTimeSeconds {
160 > if err = labels.Set(startAtKey, strconv.FormatInt(rpo.joinTime.Unix(), 10)); err != nil { monitor.go
161 rpo.logger.Fatal("unable to set ringpop label", tag.Error(err), tag.Key(startAtKey))
162 }
164 // The jitter doesn't really matter, but if two nodes join/leave at the same aligned
165 // time, it just spreads out the membership gossip traffic a little bit.
166 > clearAfter := until + backoff.Jitter(2*rpo.propagationTime, 0.2) monitor.go
167 > time.AfterFunc(clearAfter, rpo.clearStartAt)
168 }
169
401 }
402
403 > func (rpo *monitor) EvictSelfAt(asOf time.Time) (time.Duration, error) { monitor.go
404 > until := time.Until(asOf)
405 > if until <= 0 || until.Seconds() >= maxScheduledEventTimeSeconds {
406 return 0, rpo.rp.SelfEvict()
407 }
408 // set label for eviction time in the future
409 > labels, err := rpo.rp.Labels() monitor.go
410 > if err != nil {
411 rpo.logger.Error("unable to set ringpop label", tag.Error(err), tag.Key(stopAtKey))
412 return 0, err
413 }
414 > err = labels.Set(stopAtKey, strconv.FormatInt(asOf.Unix(), 10)) monitor.go
415 > if err != nil {
416 rpo.logger.Error("unable to set ringpop label", tag.Error(err), tag.Key(stopAtKey))
417 return 0, err
420 // The jitter doesn't really matter, but if two nodes join/leave at the same aligned time,
421 // it just spreads out the membership gossip traffic a little bit.
422 > leaveAfter := until + backoff.Jitter(rpo.propagationTime, 0.2) monitor.go
423 > time.AfterFunc(leaveAfter, func() { _ = rpo.rp.SelfEvict() })
424 > return leaveAfter + rpo.propagationTime, nil
425 }
426
go.temporal.io/server/common/membership/ringpop/test_cluster.go 2 introduced LOC · 1 range

Open complete file

141 var joinTime time.Time
142 if i < len(joinTimes) {
143 > joinTime = joinTimes[i] test_cluster.go
144 > }
145 cluster.rings[i] = newMonitor(
146 serviceName,