cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.1k stars 3.81k forks source link

sql: Improve self-serviceability of paused IMPORT #114807

Open ajstorm opened 11 months ago

ajstorm commented 11 months ago

When upgrading a cluster with concurrently running IMPORTs, the IMPORT jobs may end up in a paused state due to the draining of one or more nodes. This can also leave tables in a strange state where they're neither visible, nor droppable:

root@localhost:26257/application/defaultdb> drop database cct_tpcc_drop cascade;                                                                                                           
ERROR: table "customer": object state is OFFLINE instead of PUBLIC, cannot be targeted by DROP
SQLSTATE: 55000
root@localhost:26257/application/defaultdb> use cct_tpcc_drop;                                                                                                                             
SET

Time: 0ms total (execution 0ms / network 0ms)

root@localhost:26257/application/cct_tpcc_drop> show tables;                                                                                                                               
SHOW TABLES 0

Time: 33ms total (execution 33ms / network 0ms)

root@localhost:26257/application/cct_tpcc_drop> drop table customer;                                                                                                                       
ERROR: relation "customer" is offline: importing
root@localhost:26257/application/cct_tpcc_drop> show tables;                                                                                                                               
SHOW TABLES 0

Time: 36ms total (execution 36ms / network 0ms)

For the last error shown, it would be nice if we could provide a hint as to how to get out of this situation. We have an allusion to this in the doc here, but it's not easy to find, especially if this is your first time using IMPORT.

Internal thread here.

Jira issue: CRDB-33689

michae2 commented 11 months ago

[triage] question for @ajstorm: would a notice as part of the returned error suffice?

ajstorm commented 11 months ago

Yes, I think that would be sufficient, especially if we can link it to the relevant docs pages.

mgartner commented 3 weeks ago

Drew thinks that the fix for this is to add a hint in the error message. It should be a fairly quick-win.