Skip to content

Commit

Permalink
sqlinstance: use the correct timestamp when populating the cache
Browse files Browse the repository at this point in the history
Previously, the sql instance cache would be populated using the
timestamp of the initial rangefeed scan. This was a bug since the
timestamp is used to determine which sql instance ID to use when there
are two IDs for the same address (i.e., it should use the most recent
one).

This caused problems if a tenant node was shutdown, then started with
the same address. Other layers like DistSQL would try to route requests
to an old sql instance, which would actually be the same as the
requesting node.

No release note since this bug didn't affect anything prior to v22.2.

Release justification: high priority bug fix.
  • Loading branch information
rafiss committed Sep 1, 2022
1 parent 11a6c9c commit aebc71d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/sql/sqlinstance/instancestorage/instancereader.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func (r *Reader) maybeStartRangeFeed(ctx context.Context) *rangefeed.RangeFeed {
updateCacheFn,
rangefeed.WithInitialScan(initialScanDoneFn),
rangefeed.WithOnInitialScanError(initialScanErrFn),
rangefeed.WithRowTimestampInInitialScan(true),
)
r.setStarted()
if err != nil {
Expand Down

0 comments on commit aebc71d

Please sign in to comment.