diff --git a/pkg/spanconfig/spanconfigreconciler/reconciler.go b/pkg/spanconfig/spanconfigreconciler/reconciler.go index b04c3022da8b..052576843e19 100644 --- a/pkg/spanconfig/spanconfigreconciler/reconciler.go +++ b/pkg/spanconfig/spanconfigreconciler/reconciler.go @@ -300,6 +300,7 @@ func (f *fullReconciler) reconcile( } if !f.codec.ForSystemTenant() { + found := false tenantPrefixKey := f.codec.TenantPrefix() // We want to ensure tenant ranges do not straddle tenant boundaries. As // such, a full reconciliation should always include a SpanConfig where the @@ -309,17 +310,24 @@ func (f *fullReconciler) reconcile( // tenant. Also, sql.CreateTenantRecord relies on such a SpanConfigs // existence to ensure the same thing for newly created tenants. if err := storeWithLatestSpanConfigs.Iterate(func(record spanconfig.Record) error { + if record.GetTarget().IsSystemTarget() { + return nil // skip over system span configurations, + } spanConfigStartKey := record.GetTarget().GetSpan().Key - if tenantPrefixKey.Compare(spanConfigStartKey) != 0 { - return errors.AssertionFailedf( - "tenant prefix key %q does not match first span config start key %q", - tenantPrefixKey, spanConfigStartKey, - ) + if tenantPrefixKey.Compare(spanConfigStartKey) == 0 { + found = true + return iterutil.StopIteration() } - return iterutil.StopIteration() + return nil }); err != nil { return nil, hlc.Timestamp{}, err } + + if !found { + return nil, hlc.Timestamp{}, errors.AssertionFailedf( + "did not find split point at the start of the tenant's keyspace during full reconciliation", + ) + } } return storeWithLatestSpanConfigs, readTimestamp, nil