-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
87931: backupccl: tenants should be restored in their correct state r=dt a=adityamaru Previously, all backed up tenants were unconditionally moved through an `ADD` and then `ACTIVE` state during a cluster/tenant restore. This behaviour appears incorrect. If the tenant was backed up in and adding or dropped state then it should be restored in the same state as well. This change only moves `ACTIVE` backed up tenants through an `ADD` and then `ACTIVE` state thereby fixing this bug. Fixes: #87915 Release note (bug fix): Cluster and tenant restores of dropped or adding tenants would incorrectly activate those tenants during restore. 88132: scbuild: add missing name check for ALTER PRIMARY KEY r=postamar a=postamar Previously, this check was missing, leading the schema change to hang due to a validation failure in a non-revertible post-commit transaction. This patch maintains the existing behavior of the legacy schema changer which doesn't distinguish between unique and non-unique indexes: all name collisions will be reported as constraint name collisions despite non-unique indexes not being constraints. Fixes #88131. Release justification: low-risk high-value bug fix Release note: None 88139: sql: fix current_setting(..., true) for custom options r=ZhouXing19 a=rafiss Release note (bug fix): The `current_setting` builtin function now properly does not result in an error when checking a custom session setting that does not exist and the `missing_ok` argument is true. Co-authored-by: adityamaru <[email protected]> Co-authored-by: Marius Posta <[email protected]> Co-authored-by: Rafi Shamim <[email protected]>
- Loading branch information
Showing
7 changed files
with
188 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
new-server name=s1 | ||
---- | ||
|
||
# Create a few tenants. | ||
exec-sql | ||
SELECT crdb_internal.create_tenant(5); | ||
---- | ||
|
||
exec-sql | ||
SELECT crdb_internal.create_tenant(6); | ||
---- | ||
|
||
# Drop one of them. | ||
exec-sql | ||
SELECT crdb_internal.destroy_tenant(5); | ||
---- | ||
|
||
query-sql | ||
SELECT id,active,crdb_internal.pb_to_json('cockroach.sql.sqlbase.TenantInfo', info, true) FROM system.tenants; | ||
---- | ||
5 false {"id": "5", "state": "DROP"} | ||
6 true {"id": "6", "state": "ACTIVE"} | ||
|
||
exec-sql | ||
BACKUP INTO 'nodelocal://1/cluster' | ||
---- | ||
|
||
exec-sql expect-error-regex=(tenant 5 is not active) | ||
BACKUP TENANT 5 INTO 'nodelocal://1/tenant5' | ||
---- | ||
regex matches error | ||
|
||
exec-sql | ||
BACKUP TENANT 6 INTO 'nodelocal://1/tenant6' | ||
---- | ||
|
||
new-server name=s2 share-io-dir=s1 | ||
---- | ||
|
||
exec-sql | ||
RESTORE FROM LATEST IN 'nodelocal://1/cluster' | ||
---- | ||
|
||
# A dropped tenant should be restored as an inactive tenant. | ||
query-sql | ||
SELECT id,active,crdb_internal.pb_to_json('cockroach.sql.sqlbase.TenantInfo', info, true) FROM system.tenants; | ||
---- | ||
5 false {"id": "5", "state": "DROP"} | ||
6 true {"id": "6", "state": "ACTIVE"} | ||
|
||
exec-sql | ||
RESTORE TENANT 6 FROM LATEST IN 'nodelocal://1/tenant6' WITH tenant = '7'; | ||
---- | ||
|
||
query-sql | ||
SELECT id,active,crdb_internal.pb_to_json('cockroach.sql.sqlbase.TenantInfo', info, true) FROM system.tenants; | ||
---- | ||
5 false {"id": "5", "state": "DROP"} | ||
6 true {"id": "6", "state": "ACTIVE"} | ||
7 true {"id": "7", "state": "ACTIVE"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters