What's New in v21.1.1

May 24, 2021

Get future release notes emailed to you:

Downloads

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

Docker image

icon/buttons/copy
$ docker pull cockroachdb/cockroach:v21.1.1

General changes

  • Disabled read-triggered compactions to avoid instances where the storage engine would compact excessively. #65345

SQL language changes

  • Fixed Julian date parsing logic for wrong formats. #63540
  • The error payload returned to the client when a DATE/TIME conversion fails now contains more details about the difference between the values provided and the values that are expected. #63540
  • Introduced ALTER TABLE ... ALTER COLUMN SET [VISIBLE|NOT VISIBLE], which marks columns as visible/not visible. #63881
  • When using ALTER TABLE ... LOCALITY REGIONAL BY ROW, we would previously verify uniqueness of the new table, which was an unnecessary operation. This verification has been removed, improving the performance of updating localities to or from REGIONAL BY ROW. #63880
  • Improved cancellation behavior for DistSQL flows. #65047
  • ST_EstimatedExtent now always returns NULL. This allows GeoServer to make progress in certain cases, and is a valid default return value for the function. #65098
  • Implemented ST_Envelope for Box2D. #65098
  • Implemented a subset of variants for ST_AsTWKB, which encodes a geometry into a TWKB format. This allows the use of GeoServer with CRDB if the user selects "PreserveTopology" for their "Method used to simplify geometries" option on the "Store" page. #65098
  • Implemented ST_Simplify with preserveCollapsed support. This unblocks the use of GeoServer with the default settings. #65098
  • Lookup joins on indexes with computed columns which are also either constrained by CHECK constraints or use an ENUM data type may now choose a more optimal plan. #65361
  • Floating point infinity values are now formatted as Infinity (or -Infinity if negative). This is for compatibility with PostgresSQL. #65334
  • INSERT INTO ... ON CONFLICT ... DO UPDATE SET statements without predicates now acquire locks using the FOR UPDATE locking mode during their initial row scan, which improves performance for contended workloads. This behavior is configurable using the enable_implicit_select_for_update session variable and the sql.defaults.implicit_select_for_update.enabled cluster setting. #65363
  • ST_GeomFromGeoJSON(string) is now marked as the preferred overload, meaning it will resolve correctly in more contexts. #65442

Operational changes

  • Replica garbage collection now checks replicas against the range descriptor every 12 hours (down from 10 days) to see if they should be removed. Replicas that fail to notice they have been removed from a range will therefore linger for at most 12 hours rather than 10 days. #64589

Command-line changes

  • The --help text for --log now references the fact that the flag accepts YAML syntax and also points to the cockroach debug check-log-config command. #64948
  • The new parameter --log-config-file simplifies the process of loading the logging configuration from a YAML file. Instead of passing the content of the file via the --log flag (e.g., --log=$(cat file.yaml)), it is now possible to pass the path to the file using --log-config-file=file.yaml.
    Note: Each occurrence of --log and --log-config-file on the command line overrides the configuration set from previous occurrences. #64948
  • The prefixes displayed before connection URLs when cockroach demo starts up have been updated to better align with the output of cockroach start. #63535
  • The flag --empty for cockroach demo has been renamed to --no-example-database. --empty is still recognized but is marked as deprecated. Additionally, the user can now set the environment variable COCKROACH_NO_EXAMPLE_DATABASE to obtain this behavior automatically in every new demo session. #63535
  • CockroachDB no longer supports the \demo add and \demo shutdown commands for cockroach demo in --global configurations. #63535
  • Added a note when starting up a --global demo cluster that the --global configuration is experimental. #63535
  • The SQL shell (cockroach demo, cockroach sql) now attempts to better format values that are akin to time/date values, as well as floating-point numbers. #63541
  • cockroach debug zip now attempts to pull data from multiple nodes concurrently, up to 15 nodes at a time. This change is meant to accelerate the data collection when a cluster contains multiple nodes. This behavior can be changed with the new command-line flag --concurrency. #64705
  • The format of the informational messages printed by cockroach debug zip , when concurrent execution is enabled. #64705
  • The new command cockroach debug list-files show the list of files that can be retrieved via the cockroach debug zip command. It supports the --nodes and --exclude-nodes parameters in the same way as cockroach debug zip. #64705
  • It is now possible to fine-tune which files get retrieved from the server nodes by the cockroach debug zip command, using the new flag --include-files and --exclude-files. These flags take glob patterns that are applied to the file names server-side. For example, to include only log files, use --include-files='*.log'. The command cockroach debug list-files also accepts these flags and can thus be used to experiment with the new flags before running the cockroach debug zip command. #64705
  • The cockroach debug zip command now retrieves only the log files, goroutine dumps and heap profiles pertaining to the last 48 hours prior to the command invocation. This behavior is supported entirely client-side, which means that it is not necessary to upgrade the server nodes to put these newly-configurable limits in place. The other data items retrieved by cockroach debug zip are not affected by this time limit. This behavior can be customized by the two new flags --files-from and --files-until. Both are optional. See the command-line help text for details. The two new flags are also supported by cockroach debug list-files. It is advised to experiment with list-files prior to issuing a debug zip command that may retrieve a large amount of data. #64705

DB Console changes

  • A new metric for the average number of runnable goroutines per CPU is now present in the runtime graphs. #64750
  • The Console now uses a new library for line graphs that renders metrics more efficiently. Customers with large clusters can now load and interact with metrics much faster than before. #64479
  • Placed a legend under charts on metrics page, if more than 10 series are being displayed #64479

Bug fixes

  • Fixed a bug in the artificial latencies introduced by the --global flag to cockroach demo. #63535
  • Fixed a bug where multiple concurrent invocations of cockroach debug zip could yield cluster instability. This bug had been present since CockroachDB v20.1. #64083
  • When a STRING value is converted to TIME/DATE/TIMESTAMP, and the STRING value contains invalid entries, the error messages reported now more clearly report which fields are missing or undesired. #63540
  • Fixed a bug where view expressions created using an ARRAY ENUM without a name for the column could cause failures when dropping unrelated ENUM values. #64272
  • Fixed a bug causing an internal error in rare circumstances when executing queries via the vectorized engine that operate on columns of BOOL, BYTES, INT, and FLOAT types that have a mix of NULL and non-NULL values. #62915
  • Fixed a bug causing CockroachDB to either return an error or crash when comparing an infinite DATE coming from a subquery against a TIMESTAMP. #64074
  • CockroachDB now should crash less often due to out-of-memory conditions caused by the subqueries returning multiple rows of large size. #64727
  • Previously, the session trace could contain entries that corresponded to the previous trace (i.e., SET TRACING=ON didn't properly reset the trace). Now this is fixed. #64945
  • Previously, CockroachDB could incorrectly cast integers of larger widths to integers of smaller widths (e.g., INT8 to INT2) when the former was out of range for the latter. Now this is fixed. #65035
  • Fixed a race condition where read-write requests during replica removal (e.g., during range merges or rebalancing) could be evaluated on the removed replica. #64598
  • BACKUP no longer resolves intents one-by-one. This eliminates the need to run a high-priority query to cleanup intents to unblock BACKUP in the case of intent buildup. #64881
  • Fixed an internal error that could occur during planning when a query used the output of an UPDATE's RETURNING clause, and one or more of the columns in the RETURNING clause were from a table specified in the FROM clause of the UPDATE (i.e., not from the table being updated). #62960
  • Fixed an index-out-of-range error that could occur when crdb_internal_mvcc_timestamp was selected as part of a view. It is now possible to select crdb_internal_mvcc_timestamp as part of a view as long as it is aliased with a different name. #63632
  • Fixed a bug in the application of environment variables to populate defaults for certain command-line flags, for example COCKROACH_URL for --url, has been fixed. #63539
  • Fixed a stack overflow that can happen in some corner cases involving partial indexes with predicates containing (x IS NOT NULL). #64738
  • Providing a constant value as an ORDER BY value in an ordered-set aggregate, such as percentile_dist or percentile_cont, no longer returns an error. This bug has been present since order-set aggregates were added in version 20.2. #64902
  • Queries that reference tables with GEOMETRY or GEOGRAPHY inverted indexes and that call geospatial functions with constant NULL values cast to a type, like NULL::GEOMETRY or NULL::FLOAT8, no longer error. This bug was present since 20.2. #63003
  • Fixed a bug causing CockroachDB to incorrectly calculate the latency from the remote nodes when the latency info was shown on the EXPLAIN ANALYZE (DISTSQL) diagrams. #63089
  • Fixed a bug causing the ZONECONFIG privilege on tables and databases to be incorrectly interpreted as USAGE, which could corrupt a table and/or database because USAGE is an invalid privilege for tables and databases. #65160
  • Fixed a bug which could cause a panic when running an EXECUTE of a previously-prepared statement with a REGCLASS or REGTYPE parameter or a user-defined type argument after running BEGIN AS OF SYSTEM TIME with an invalid timestamp. #65150
  • Fixed a bug which could cause a panic when issuing a query referencing a user-defined type as a placeholder. #65150
  • Fixed a bug introduced in 20.2 that caused rows to be incorrectly de-duplicated from a scan with a non-unique index. #65284
  • Fixed a bug where interval math on a TIMESTAMPTZ value on a DST boundary would incorrectly add or subtract an extra hour. #65095
  • Fixed a bug where date_trunc on a TIME value on a DST boundary could switch timezones and produce the incorrect result. #65095
  • Improved memory utilization under some write-heavy workloads, added better logging to storage engine to surface compaction type, and persisted previously-missing Pebble options in OPTIONS file. #65308
  • Fixed a bug causing revision_history cluster backups to not include dropped databases. This means that, previously, dropped databases could not be restored from backups that were taken after the database was dropped. #65314
  • Fixed a bug causing SHOW CREATE TABLE output to not display the zone configurations of a table or index if there were no partitions, even if there were zone configurations on the index or table. #65176
  • Previously, concatenating a non-STRING value with a STRING value would not use the normal STRING representation of the non-STRING value. Now it does, so true || 'string' returns truestring instead of tstring. #65331
  • Large SELECT FOR UPDATE scans will no longer prevent the memory associated with their entire result set from being reclaimed by the Go garbage collector for the lifetime of the locks that they acquire. #65359
  • Fixed a rare race that could lead to a 3-second stall before a Raft leader was elected on a Range immediately after it was split off from its left-hand neighbor. #65356
  • Fixed a bug where SHOW CREATE TABLE would show the zone configurations of a table of the same name from a different schema. #65368
  • BACKUP, RESTORE, and IMPORT are now more resilient to node failures and will retry automatically. #65391
  • Previously, replica rebalancing could sometimes rebalance to stores on dead nodes. This bug is now fixed. #65428

Performance improvements

  • The optimizer now always prefers to plan a locality-optimized scan over a regular scan when possible. This may enable the execution engine to avoid communicating with remote nodes, thus reducing query latency. #65088
  • The optimizer will now try to plan anti lookup joins using "locality-optimized search". This optimization applies for anti lookup joins into REGIONAL BY ROW tables (i.e., the right side of the join is a REGIONAL BY ROW table), and if enabled, it means that the execution engine will first search locally for matching rows before searching remote nodes. If a matching row is found in a local node, remote nodes will not be searched. This optimization may improve the performance of foreign key checks when rows are inserted or updated in a table that references a foreign key in a REGIONAL BY ROW table. #63118
  • Certain queries containing <tuple> IN (<subquery>) conditions now run faster. #63866
  • Improved intent cleanup performance for aborted transactions. #64588
  • Adjusted the estimated cost of locality-optimized anti joins in the optimizer so that they are always chosen over non-locality-optimized anti joins when possible. This makes it more likely that queries involving anti joins (such as inserts with foreign key checks) can avoid visiting remote regions. This results in lower latency. #65131
  • The optimizer can now avoid full table scans for queries with a LIMIT and ORDER BY clause, where the ORDER BY columns form a prefix on an index in a REGIONAL BY ROW table (excluding the hidden crdb_region column). Instead of a full table scan, at most LIMIT rows are scanned per region. #65287

Contributors

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

  • Kumar Akshay
  • Mohammad Aziz (first-time contributor)
  • kurokochin (first-time contributor)
YesYes NoNo