Commit 505cfdb5 authored by craig[bot]'s avatar craig[bot]

Merge #49690

49690: lease: un-track deprecated use of Gossip r=nvanbenschoten a=tbg

The work to remove the dependency has been done, so we're just waiting
until we can remove the code. Until then, make sure this use of Gossip
does not show up as a prominent caller to DeprecatedGossip any more,
for easier bookkeeping.

Release note: None
Co-authored-by: default avatarTobias Schottdorf <[email protected]>
parents d8d001b2 a53153c1
......@@ -1931,14 +1931,20 @@ func (m *Manager) watchForGossipUpdates(
g gossip.DeprecatedGossip,
tableUpdateCh chan<- *sqlbase.TableDescriptor,
) {
if _, err := g.OptionalErr(47150); err != nil {
log.Fatalf(ctx, "required gossip until %v is active: %v", clusterversion.VersionRangefeedLeases, err)
rawG, err := g.OptionalErr(47150)
if err != nil {
if v := clusterversion.VersionRangefeedLeases; !m.settings.Version.IsActive(ctx, v) {
log.Fatalf(ctx, "required gossip until %v is active: %v", clusterversion.VersionRangefeedLeases, err)
}
return
}
s.RunWorker(ctx, func(ctx context.Context) {
descKeyPrefix := m.codec.TablePrefix(uint32(sqlbase.DescriptorTable.ID))
// TODO(ajwerner): Add a mechanism to unregister this channel upon return.
gossipUpdateC := g.DeprecatedRegisterSystemConfigChannel(47150)
// NB: this call is allowed to bypass DeprecatedGossip because we'll never
// get here after VersionRangefeedLeases.
gossipUpdateC := rawG.RegisterSystemConfigChannel()
filter := gossip.MakeSystemConfigDeltaFilter(descKeyPrefix)
ctx, cancel := s.WithCancelOnQuiesce(ctx)
......@@ -1946,7 +1952,7 @@ func (m *Manager) watchForGossipUpdates(
for {
select {
case <-gossipUpdateC:
m.handleUpdatedSystemCfg(ctx, g, &filter, tableUpdateCh)
m.handleUpdatedSystemCfg(ctx, rawG, &filter, tableUpdateCh)
case <-s.ShouldQuiesce():
return
}
......@@ -2051,11 +2057,11 @@ func (m *Manager) watchForRangefeedUpdates(
func (m *Manager) handleUpdatedSystemCfg(
ctx context.Context,
g gossip.DeprecatedGossip,
rawG *gossip.Gossip,
cfgFilter *gossip.SystemConfigDeltaFilter,
tableUpdateChan chan<- *sqlbase.TableDescriptor,
) {
cfg := g.DeprecatedSystemConfig(47150)
cfg := rawG.GetSystemConfig()
// Read all tables and their versions
if log.V(2) {
log.Info(ctx, "received a new config; will refresh leases")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment