diff --git a/pkg/keys/sql.go b/pkg/keys/sql.go index 85bc0e92c15b..2fd0d87ddf0b 100644 --- a/pkg/keys/sql.go +++ b/pkg/keys/sql.go @@ -185,6 +185,12 @@ func (e sqlEncoder) TenantSpan() roachpb.Span { return roachpb.Span{Key: key, EndKey: endKey} } +// TableSpan returns a span representing the table's keyspace. +func (e sqlEncoder) TableSpan(tableID uint32) roachpb.Span { + key := e.TablePrefix(tableID) + return roachpb.Span{Key: key, EndKey: key.PrefixEnd()} +} + // TablePrefix returns the key prefix used for the table's data. func (e sqlEncoder) TablePrefix(tableID uint32) roachpb.Key { k := e.TenantPrefix() diff --git a/pkg/server/systemconfigwatcher/cache.go b/pkg/server/systemconfigwatcher/cache.go index ed0d1755fd14..ed8634ea6516 100644 --- a/pkg/server/systemconfigwatcher/cache.go +++ b/pkg/server/systemconfigwatcher/cache.go @@ -85,14 +85,8 @@ func NewWithAdditionalProvider( c.additionalKVsSource = additional spans := []roachpb.Span{ - { - Key: append(codec.TenantPrefix(), keys.SystemDescriptorTableSpan.Key...), - EndKey: append(codec.TenantPrefix(), keys.SystemDescriptorTableSpan.EndKey...), - }, - { - Key: append(codec.TenantPrefix(), keys.SystemZonesTableSpan.Key...), - EndKey: append(codec.TenantPrefix(), keys.SystemZonesTableSpan.EndKey...), - }, + codec.TableSpan(keys.DescriptorTableID), + codec.TableSpan(keys.ZonesTableID), } c.w = rangefeedcache.NewWatcher( "system-config-cache", clock, f,