diff --git a/pkg/server/server_sql.go b/pkg/server/server_sql.go index 98ef2f815b63..ea141d4f48f8 100644 --- a/pkg/server/server_sql.go +++ b/pkg/server/server_sql.go @@ -1459,6 +1459,18 @@ func (s *SQLServer) preStart( if err := s.settingsWatcher.Start(ctx); err != nil { return errors.Wrap(err, "initializing settings") } + + // Prevent a secondary tenant's server from starting if its binary version is too low + // for the current tenant cluster version. + if !s.execCfg.Codec.ForSystemTenant() { + tenantActiveVersion := s.settingsWatcher.GetTenantClusterVersion().ActiveVersion(ctx).Version + if s.execCfg.Settings.Version.BinaryVersion().Less(tenantActiveVersion) { + return errors.Newf("preventing SQL server from starting because its binary version "+ + "is too low for the tenant active version: server binary version = %v, tenant active version = %v", + s.execCfg.Settings.Version.BinaryVersion(), tenantActiveVersion) + } + } + if err := s.systemConfigWatcher.Start(ctx, s.stopper); err != nil { return errors.Wrap(err, "initializing settings") } diff --git a/pkg/server/settingswatcher/settings_watcher.go b/pkg/server/settingswatcher/settings_watcher.go index a5733e35ee59..ffb11b36aa50 100644 --- a/pkg/server/settingswatcher/settings_watcher.go +++ b/pkg/server/settingswatcher/settings_watcher.go @@ -440,3 +440,7 @@ func (s *SettingsWatcher) GetStorageClusterVersion() clusterversion.ClusterVersi } return s.mu.storageClusterVersion } + +func (s *SettingsWatcher) GetTenantClusterVersion() clusterversion.Handle { + return s.settings.Version +}