-
Notifications
You must be signed in to change notification settings - Fork 4.1k
backupccl: crash on SHOW BACKUP for database with table referencing type in other database #55772
Copy link
Copy link
Closed
Labels
A-disaster-recoveryC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.release-blockerIndicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked.Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked.
Description
We have a bug that makes cross-database type references possible (#55709 (comment)). This makes backups not work with RESTORE or SHOW BACKUP. SHOW BACKUP will crash the node:
root@:26257/defaultdb> create type t as enum('foo');
CREATE TYPE
Time: 93ms total (execution 93ms / network 0ms)
root@:26257/defaultdb> create table tbl (a t);
CREATE TABLE
Time: 198ms total (execution 78ms / network 120ms)
root@:26257/defaultdb> create database otherdb;
CREATE DATABASE
Time: 56ms total (execution 56ms / network 0ms)
root@:26257/defaultdb> alter table tbl rename to otherdb.tbl;
NOTICE: renaming tables with a qualification is deprecated
HINT: use ALTER TABLE tbl RENAME TO tbl instead
RENAME TABLE
Time: 185ms total (execution 57ms / network 128ms)
root@:26257/defaultdb> backup otherdb to 'nodelocal://backup';
ERROR: failed to resolve targets specified in the BACKUP stmt: table "otherdb" does not exist
root@:26257/defaultdb> backup database otherdb to 'nodelocal://backup';
ERROR: host component of nodelocal URI must be a node ID: nodelocal://backup
root@:26257/defaultdb> backup database otherdb to 'nodelocal://1/backup';
job_id | status | fraction_completed | rows | index_entries | bytes
---------------------+-----------+--------------------+------+---------------+--------
600147520773095425 | succeeded | 1 | 0 | 0 | 0
(1 row)
Time: 366ms total (execution 366ms / network 0ms)
root@:26257/defaultdb> restore otherdb from 'nodelocal://1/backup' with into_db=newdb;
ERROR: failed to resolve targets in the BACKUP location specified by the RESTORE stmt, use SHOW BACKUP to find correct targets: type "t" has unknown ParentID 50
root@:26257/defaultdb> show backup 'nodelocal://1/backup';
ERROR: driver: bad connection
warning: connection lost!
opening new connection: all session settings will be lost
warning: error retrieving the transaction status: dial tcp [::1]:26257: connect: connection refused
warning: connection lost!
opening new connection: all session settings will be lost
warning: error retrieving the database name: dial tcp [::1]:26257: connect: connection refused
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-disaster-recoveryC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.release-blockerIndicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked.Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked.