Skip to content

sql: back-to-back schema DROP DATABASE and CREATE DATABASE take up to 60s #46224

@otan

Description

@otan

Describe the problem

back-to-back drop database and create database queries can stall and take up to 60s.

To Reproduce

On one shell on the latest master: ./cockroach start-single-node --listen-addr=localhost:26257 --insecure

On the next shell: ./cockroach sql --watch '1ms' -e 'DROP DATABASE IF EXISTS db0;CREATE DATABASE db0;USE db0;CREATE TABLE t0(c0 INT);' --insecure

You can see 1 min query answers:


CREATE TABLE

Time: 46.067ms

CREATE TABLE

Time: 68.928ms

CREATE TABLE

Time: 43.123171s

CREATE TABLE

Time: 1m0.149811s

CREATE TABLE

Time: 1m0.026241s

CREATE TABLE

Time: 47.636ms

CREATE TABLE

Time: 47.969ms

CREATE TABLE

Time: 59.962868s

Expected behavior
Not taking a minute to resolve some queries

Additional data / screenshots

If additionally running with ./cockroach sql --watch '1ms' -e 'SHOW TABLES;' --insecure, this will also spin for a while:


  table_name
---------------
  a
  geo_example
  nyc_streets
(3 rows)

Time: 56.238637s

  table_name
---------------
  a
  geo_example
  nyc_streets
(3 rows)

Time: 2.781ms

Metadata

Metadata

Assignees

Labels

A-sql-name-resolutionSQL name resolution rules and CTEs.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions