Skip to content

Commit

Permalink
sql: fix secondary region notice
Browse files Browse the repository at this point in the history
Fix notice message to be make it clearer.

Release justification: low risk changes to existing functionality
Release note: None
  • Loading branch information
e-mbrown committed Aug 29, 2022
1 parent f4c3de1 commit 963de8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/ccl/logictestccl/testdata/logic_test/secondary_region
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ ALTER DATABASE db DROP SECONDARY REGION
query T noticetrace
ALTER DATABASE db DROP SECONDARY REGION IF EXISTS
----
NOTICE: No secondary region is not defined on the database; skipping
NOTICE: No secondary region is defined on the database; skipping


query TT
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/alter_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -1898,7 +1898,7 @@ func (n *alterDatabaseDropSecondaryRegion) startExec(params runParams) error {
if n.n.IfExists {
params.p.BufferClientNotice(
params.ctx,
pgnotice.Newf("No secondary region is not defined on the database; skipping"),
pgnotice.Newf("No secondary region is defined on the database; skipping"),
)
return nil
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/catalog/dbdesc/database_desc.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ func (desc *immutable) validateMultiRegion(vea catalog.ValidationErrorAccumulato
vea.Report(errors.AssertionFailedf(
"primary region unset on a multi-region db %d", desc.GetID()))
}
if desc.RegionConfig.PrimaryRegion == desc.RegionConfig.SecondaryRegion {
vea.Report(errors.AssertionFailedf(
"primary region is same as secondary region on multi-region db %d", desc.GetID()))
}
}

// GetReferencedDescIDs returns the IDs of all descriptors referenced by
Expand Down

0 comments on commit 963de8f

Please sign in to comment.