What's New in v21.1.2

June 07, 2021

Get future release notes emailed to you:


The CockroachDB executable for Windows is experimental and not suitable for production deployments. Windows 8 or higher is required.

Docker image

$ docker pull cockroachdb/cockroach:v21.1.2

General changes

  • Added multi-region workloads for cockroach demo movr --geo-partitioned-replicas. Setting --multi-region enables for multi-region workloads, and setting --survive allows for surviving AZ or REGION failures. Setting --infer-crdb-region-column also infers the crdb_region for REGIONAL BY ROW tables. #65642
  • Changefeeds now better handle slow or unavailable sinks by treating "memory exceeded" errors as retryable. #65387

SQL language changes

  • Added the crdb_internal.lost_descriptors_with_data function to show descriptors that have no entries but data left behind. #65462
  • Added the crdb_internal.force_delete_table_data function which allows table data to be cleaned up only using a descriptor ID for cases of table descriptor corruption. #65462
  • The statement type ("tag") is now also included alongside the full text of the SQL query in the various structured log entries produced when query execution is being logged. #65554
  • CockroachDB now returns a SQL Notice if a CREATE TABLE IF NOT EXISTS command is used to create a TABLE and the TABLE already exists. #65636
  • The SHOW FULL TABLE SCANS statement was added to CockroachDB. #65671
  • CockroachDB now returns a SQL Notice if a CREATE TYPE IF NOT EXISTS command is used to create a type and the type already exists. #65635
  • Added a chunk_size option to EXPORT INTO CSV to control the target CSV file size. #65388
  • SQL stats can now be cleared using the crdb_internal.reset_sql_stats() function. #65674
  • CockroachDB now supports ALTER DATABASE ... ADD REGION IF NOT EXISTS ... which does not cause an error when adding a region that is already in the database. #65752
  • CockroachDB now outputs a clearer error message when running ALTER DATABASE ... ADD REGION ... if the region is an undefined region. Previously, the error message for not having a region defined on a database resulted in an error about enums. #65752
  • Added the ALTER DATABASE ... DROP REGION IF EXISTS ... statement syntax, which does not error if dropping a region that is not defined on the database. #65752
  • Fixed a bug where transitioning from locality REGIONAL BY ROW to GLOBAL or REGIONAL BY TABLE could mistakenly remove a zone configuration on an index which has no multi-region fields set. #65833
  • CockroachDB now only blocks a zone configuration DISCARD on a multi-region table, index, or partition if the multi-region abstractions created the zone configuration. #65834

Operational changes

  • Range metrics are now gathered from the leaseholder (if live) rather than the first available range replica. This avoids scenarios where a stale replica may yield incorrect metrics, in particular over/underreplication markers. #64590

DB Console changes

Bug fixes

  • Fixed a bug where a certain percentage of cases in which a node could have served a follower read were not handled correctly, resulting in the node routing the request to another nearby node for no reason. #65471
  • The has_database_privilege function now correctly will check privileges on databases that are not the current database being used by the session. #65534
  • Fixed a bug where CockroachDB would previously crash when attempting to create a table using CREATE TABLE ... AS syntax where the AS clause selects from crdb_internal.node_statement_statistics, crdb_internal.node_transaction_statistics, or crdb_internal.node_txn_stats virtual tables. #65542
  • Fixed a bug which allowed index definitions with redundant columns, which led to unnecessary storage usage. This bug can notably manifest itself with ALTER TABLE statements which alter the primary index on a partitioned table. This bug has been present for a long time in theory, but in practice would only appear in CockroachDB since version 21.1.0. #65482
  • Fixed a bug where binary TIMETZ values were not being decoded correctly when being sent as a parameter in the wire protocol. #65341
  • Fixed a race condition during transaction cleanup that could leave old transaction records behind until MVCC garbage collection. #65383
  • Improved transaction cleanup for disconnected clients, to reduce intent buildup. #65383
  • Added the ability to change the COMMENT on a column after using ALTER TYPE on that column. #65698
  • Scheduled backup with interleaved tables can now be created with the include_deprecated_interleaves option. #65731
  • Fixed a bug where ST_Node on a LINESTRING with the same repeated points results in an error. #65700
  • Calling get_bit or set_bit on a byte array argument now goes to the correct index of the underlying bit string, in order to match the behavior of Postgres. #65786
  • Fixed a bug where ALTER DATABASE ... CONVERT TO SCHEMA could potentially leave the schema with invalid privileges thus causing the privilege descriptor to be invalid. #65810
  • CockroachDB now renders the CACHE clause for sequences which use a cache. #65805
  • Fixed a bug that could cause a node to crash in rare cases if a BACKUP writing to Google Cloud Storage failed. #65802
  • Fixed a bug introduced in 21.1 where cluster restores would report inaccurate progress, showing 100% progress erroneously. #65803
  • Fixed a crash when performing a cluster BACKUP with revision history of a cluster upgraded from 20.1 to 20.2 to 21.1 which contains tables that were truncated by 20.1. #65860
  • Fixed a bug that caused incorrect results for queries where CHAR and VARCHAR columns are filtered by constant string values. The bug was present since version v21.1.0. #66101

Performance improvements

  • The optimizer can now avoid full table scans for queries with a LIMIT and ORDER BY clause in some additional cases where the ORDER BY columns are not a prefix of an index. #65392
  • The optimizer now generates query plans that scan indexes on virtual collated string columns, regardless of the casing or formatting of the collated locale in the query. #65531
  • CockroachDB now reduces the number of round-trips required to call pg_table_is_visible in the context of pg_catalog queries. #65807


This release includes 58 merged PRs by 34 authors. We would like to thank the following contributors from the CockroachDB community:

  • Max Neverov
  • Rupesh Harode
YesYes NoNo