@@ -56,11 +56,11 @@ type bufferedRegistration struct {
5656 outputLoopCancelFn func ()
5757 disconnected bool
5858
59- // catchUpIter is created by replica under raftMu lock when registration is
59+ // catchUpSnap is created by replica under raftMu lock when registration is
6060 // created. It is detached by output loop for processing and closed. If
61- // output loop was not started and catchUpIter is non-nil at the time that
61+ // output loop was not started and catchUpSnap is non-nil at the time that
6262 // disconnect is called, it is closed by disconnect.
63- catchUpIter * CatchUpIterator
63+ catchUpSnap * CatchUpSnapshot
6464 }
6565
6666 // Number of events that have been written to the buffer but
@@ -74,7 +74,7 @@ func newBufferedRegistration(
7474 streamCtx context.Context ,
7575 span roachpb.Span ,
7676 startTS hlc.Timestamp ,
77- catchUpIter * CatchUpIterator ,
77+ catchUpSnap * CatchUpSnapshot ,
7878 withDiff bool ,
7979 withFiltering bool ,
8080 withOmitRemote bool ,
@@ -100,7 +100,7 @@ func newBufferedRegistration(
100100 buf : make (chan * sharedEvent , bufferSz ),
101101 blockWhenFull : blockWhenFull ,
102102 }
103- br .mu .catchUpIter = catchUpIter
103+ br .mu .catchUpSnap = catchUpSnap
104104 return br
105105}
106106
@@ -172,9 +172,9 @@ func (br *bufferedRegistration) Disconnect(pErr *kvpb.Error) {
172172 br .mu .Lock ()
173173 defer br .mu .Unlock ()
174174 if ! br .mu .disconnected {
175- if br .mu .catchUpIter != nil {
176- br .mu .catchUpIter .Close ()
177- br .mu .catchUpIter = nil
175+ if br .mu .catchUpSnap != nil {
176+ br .mu .catchUpSnap .Close ()
177+ br .mu .catchUpSnap = nil
178178 }
179179 if br .mu .outputLoopCancelFn != nil {
180180 br .mu .outputLoopCancelFn ()
@@ -303,20 +303,19 @@ func (br *bufferedRegistration) drainAllocations(ctx context.Context) {
303303// This uses the iterator provided when the registration was originally created;
304304// after the scan completes, the iterator will be closed.
305305//
306- // If the registration does not have a catchUpIteratorConstructor, this method
307- // is a no-op.
306+ // If the registration does not have a catchUpSnap, this method is a no-op.
308307func (br * bufferedRegistration ) maybeRunCatchUpScan (ctx context.Context ) error {
309- catchUpIter := br .detachCatchUpIter ()
310- if catchUpIter == nil {
308+ catchUpSnap := br .detachCatchUpSnap ()
309+ if catchUpSnap == nil {
311310 return nil
312311 }
313312 start := crtime .NowMono ()
314313 defer func () {
315- catchUpIter .Close ()
314+ catchUpSnap .Close ()
316315 br .metrics .RangeFeedCatchUpScanNanos .Inc (start .Elapsed ().Nanoseconds ())
317316 }()
318317
319- return catchUpIter .CatchUpScan (ctx , br .stream .SendUnbuffered , br .withDiff , br .withFiltering , br .withOmitRemote , br .bulkDelivery )
318+ return catchUpSnap .CatchUpScan (ctx , br .stream .SendUnbuffered , br .withDiff , br .withFiltering , br .withOmitRemote , br .bulkDelivery )
320319}
321320
322321// Wait for this registration to completely process its internal
@@ -341,13 +340,13 @@ func (br *bufferedRegistration) waitForCaughtUp(ctx context.Context) error {
341340 return errors .Errorf ("bufferedRegistration %v failed to empty in time" , br .Range ())
342341}
343342
344- // detachCatchUpIter detaches the catchUpIter that was previously attached.
345- func (br * bufferedRegistration ) detachCatchUpIter () * CatchUpIterator {
343+ // detachCatchUpSnap detaches the catchUpSnap that was previously attached.
344+ func (br * bufferedRegistration ) detachCatchUpSnap () * CatchUpSnapshot {
346345 br .mu .Lock ()
347346 defer br .mu .Unlock ()
348- catchUpIter := br .mu .catchUpIter
349- br .mu .catchUpIter = nil
350- return catchUpIter
347+ catchUpSnap := br .mu .catchUpSnap
348+ br .mu .catchUpSnap = nil
349+ return catchUpSnap
351350}
352351
353352var overflowLogEvery = log .Every (5 * time .Second )
0 commit comments