Skip to content

Commit

Permalink
spanconfig/sqlwatcher: use the right mvcc timestamp
Browse files Browse the repository at this point in the history
When unmarshaling descriptor protos into their specific types, we want
to pass in the MVCC timestamp at which that descriptor was read. Given
we receive these protos through the surrounding rangefeed, we want to
use the rangefeed event timestamp. We we erroneously using the timestamp
found on the rangefeed event's "previous value", which the API
guarantees will be the zero timestamp.

(This tripped us up before; we added some commentary + tests in cockroachdb#71225
for the rangefeed library to make this clearer.)

Release note: None
  • Loading branch information
irfansharif committed Dec 3, 2021
1 parent eea11ee commit 1f7f905
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/spanconfig/spanconfigsqlwatcher/sqlwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (s *SQLWatcher) watchForDescriptorUpdates(
return
}

table, database, typ, schema := descpb.FromDescriptorWithMVCCTimestamp(&descriptor, value.Timestamp)
table, database, typ, schema := descpb.FromDescriptorWithMVCCTimestamp(&descriptor, ev.Value.Timestamp)

var id descpb.ID
var descType catalog.DescriptorType
Expand Down

0 comments on commit 1f7f905

Please sign in to comment.