What's New in v21.1.0-beta.1

March 22, 2021

Get future release notes emailed to you:

Downloads

Warning:

Beta releases are intended for testing and experimentation only. Beta releases are not recommended for production use, as they can lead to data corruption, cluster unavailability, performance issues, etc.

Docker image

icon/buttons/copy
$ docker pull cockroachdb/cockroach-unstable:v21.1.0-beta.1

Backward-incompatible changes

  • The cockroach debug ballast command now refuses to overwrite the target ballast file if it already exists. This change is intended to prevent mistaken uses of the ballast command by operators. Scripts that integrate cockroach debug ballast can consider adding a rm command. #59995
  • Removed the kv.atomic_replication_changes.enabled cluster setting. All replication changes on a range now use joint-consensus. #61170

Security updates

  • It is now possible to log SQL statements executed by admin users. This logging is enabled via the sql.log.admin_audit.enabled cluster setting. When set, events of type admin_query are logged to the SENSITIVE_ACCESS channel. #60708

General changes

  • Updated the AWS SDK used to interface with AWS services such as S3 (for backup, restore, and import) and KMS (for backup/restore). #59709
  • SHOW TRACE FOR SESSION previously included CockroachDB internal traces for async threads kicked off as part of user operations. This trace data is no longer captured. #59815
  • Crash reports that are sent to Cockroach Labs no longer redact the names of built-in virtual tables from the crdb_internal, information_schema, and pg_catalog schemas. #60799
  • Raised the default limit on the maximum number of spans that can be protected by the protectedts subsystem. This limit can be configured using the kv.protectedts.max_spans cluster setting. #61018

Enterprise edition changes

  • Added the bulkio.stream_ingestion.minimum_flush_interval cluster setting, which allows the user to control how often the stream ingestion job will flush. Note that the job may still flush more often if the in-memory buffers are filled. #60160
  • CockroachDB now supports primary key changes in CREATE CHANGEFEED. #58422
  • Multi-region database creations are now permitted as long as the cluster has a CockroachDB subscription. #61041
  • ALTER DATABASE ... ADD REGION now requires an enterprise license.#61169

SQL language changes

  • Added a virtual table, crdb_internal.node_inflight_trace_spans, which exposes span ID, parent span ID, trace ID, start time, duration, and operation of node-local inflight spans. #59492
  • Added WITH avro_schema_prefix option to Avro changefeeds to prevent collisions in a shared schema registry #59710
  • CockroachDB now allows implicitly partitioned indexes to be referenced by foreign keys using the non-implicit columns. #59692
  • The SHOW ZONE CONFIGURATION statement has been changed to use FROM instead of FOR. #59410
  • It is now possible to use the NOT VISIBLE qualifier for new column definitions in CREATE TABLE. This causes the column to become "hidden". Hidden columns are not considered when using * in SELECT clauses. Note that CockroachDB already supported hidden columns (e.g., rowid, which is added automatically when a table definition has no PRIMARY KEY constraint). This change adds the opportunity for end-users to define their own hidden columns. It is intended for use in combination with other features related to geo-partitioning introduced in v21.1, which offer more control about how geo-partitioning keys get exposed to client ORMs and other automated tools that inspect the SQL schema. #58923
  • Added the goroutine_id column to the crdb_internal.node_inflight_trace_spans virtual table that represents the goroutine ID associated with a particular span. #59717
  • Updated SHOW BACKUP ... WITH PRIVILEGES to display ownership information of objects in the backup. #59732
  • The ALTER TYPE ... DROP VALUE ... statement has been added to drop values from an ENUM type. The statement drops the provided value if it isn't used as a value in any table's row. The use of this syntax is gated behind the sql_safe_updates session variable, as it is susceptible to the value being used in a table expression (such as a computed column). #58688
  • Added support for COPY CSV. #59790
  • CockroachDB now supports specifying NULL and DELIMITER in COPY. #59790
  • ALTER TABLE ... SET LOCALITY adds the ability to change the locality of a GLOBAL or REGIONAL BY TABLE table to REGIONAL BY ROW, provided an existing column of the appropriate type already exists. #59624
  • Overload sequence operators now accept a regclass. #59396
  • crdb_internal.invalid_objects now includes invalid type descriptors. #59978
  • Added the finished column to the virtual table crdb_internal.node_inflight_trace_spans, which represents whether each span has finished or not. #59856
  • Partitioned inverted indexes are now supported. #59858
  • Hidden columns (created by using NOT VISIBLE or implicitly created via hash sharded indexes, a lack of a primary key definition, or by using REGIONAL BY ROW) will now display with NOT VISIBLE annotations on SHOW CREATE TABLE. #59828
  • REGIONAL BY ROW tables that have an implicitly created crdb_region table will now mark the given column as hidden so it does not display in SELECT * statements. #59831
  • CockroachDB now recognizes the options URL parameter. The options parameter specifies session variables to set at connection start. This is treated the same as defined in the PostgreSQL docs. #59621
  • Implemented the ability to ALTER TABLE SET LOCALITY to REGIONAL BY ROW without specifying AS for GLOBAL and REGIONAL BY TABLE tables. #59824
  • Added the sql.show_tables.estimated_row_count.enabled cluster setting, which defaults to true. If false, estimated_row_count will not display on SHOW TABLES which improves performance. #60282
  • ALTER DATABASE ... DROP REGION is now implemented. #59989
  • When a connection is established, CockroachDB will now return a placeholder BackendKeyData message in the response. This is for compatibility with some tools, but using BackendKeyData to cancel a query will still have no effect (which is the same as before). #60281
  • To match the behavior of PRIMARY KEY creations setting, all relevant fields to NOT NULL, all PARTITION BY / REGIONAL BY ROW columns will now have their fields set to NOT NULL at CREATE TABLE time. #60379
  • ALTER DATABASE ... DROP REGION now allows for dropping the primary region. #60437
  • Added support for restore of multi-region databases. #60257
  • Implemented functionality to ALTER TABLE SET LOCALITY from REGIONAL BY ROW to REGIONAL BY TABLE or GLOBAL. #60311
  • Materialized views now require ownership or admin privilege to refresh. #60448
  • CONNECT can be granted to / revoked from users at the database level (e.g., GRANT CONNECT ON DATABASE db TO user;). CONNECT allows users to view all objects in a database in information_schema and pg_catalog. Previously, only users could only see an object in information_schema / pg_catalog if they had any privilege (e.g., SELECT) on the object. Added a warning when using USE DATABASE that notifies the user that they do not have CONNECT privilege on the database and will need CONNECT privilege to use databases in a future release. #59676
  • Add the builtin crdb_internal.show_create_all_tables, which takes in a database name (STRING) and returns a flat log of all the CREATE TABLE statements in the database followed by ALTER statements to add constraints. The output can be used to recreate a database. This builtin was added to replace old dump logic. #60154
  • Implemented default_to_database_primary_region, which will return the region passed in if the region is defined on the database, falling back to the primary key if not. #59836
  • The default expression for REGIONAL BY ROW tables is now default_to_database_primary_region(gateway_region()), allowing users to add to REGIONAL BY ROW tables from any region. This would previously error if the gateway's region was not defined on the database. #59836
  • EXPLAIN now shows the estimated percentage of the table that is scanned. #60467
  • Multi-region tables will have their zone configs regenerated during database restore. #60519
  • CockroachDB now supports the DETACHED option when running IMPORT. The detached import will return jobID and the user can later use SHOW JOB to check the result of the detached import. This allows users to run IMPORT under explicit transactions with DETACHED option specified. #60442
  • Casting JSON numeric scalars to numeric types now works as expected. #41367
  • Most batches of data flowing through the vectorized execution engine will now be limited in size by sql.distsql.temp_storage.workmem (64MiB by default), which should improve the stability of CockroachDB clusters. #59851
  • Implemented the ability to ALTER TABLE LOCALITY REGIONAL BY ROW from other REGIONAL BY ROW variants. #60497
  • Setting of zone configs for non-physical tables is now forbidden. #60592
  • Added telemetry to track usage of pg_catalog and information_schema tables #60511
  • SHOW JOBS now displays a meaningful value in the running_status column for GC jobs which are actually performing garbage collection, as opposed to waiting on a timer. #59220
  • Added the SHOW CREATE ALL TABLES statement, which allows the user to get the statements (CREATE/ALTER) to recreate a the current database. The command returns a flat log of the create statements followed by the alter statements for adding the constraints. The commands are ordered topologically such that dependencies appear before it's references. ALTER statements follow create statements to guarantee that the objects are all added before adding constraints. This command is added to replace old dump logic. #60539
  • Added the schema_name and table_id columns to the crdb_internal.ranges and crdb_internal.ranges_no_leases virtual tables. #59865
  • Using the CACHE sequence option no longer results in an "unimplemented" error. The CACHE option is now fully implemented and will allow nodes to cache sequence numbers. A cache size of 1 means that there is no cache, and cache sizes of less than 1 are not valid. #56954
  • The serial_normalization session variable can now be set to the value sql_sequence_cached. If this value is set, the sql.defaults.serial_sequences_cache_size cluster setting can be used to control the number of values to cache in a user's session with a default of 256. When the cache is empty, the the underlying sequence will only be incremented once to populate it. Using sql_sequence_cached will result in better performance than sql_sequence because the former will perform fewer distributed calls to increment sequences. However, cached sequences may result in large gaps between serial sequence numbers if a session terminates before using all the values in its cache. #56954
  • CockroachDB can now encode and decode sequence regclasses. #59864
  • CockroachDB now allows renaming of sequences referenced by ID and conversion of sequences referenced by name to ID. #59864
  • EXPLAIN ANALYZE now shows more top-level query statistics. #60641
  • Added payloads_for_span builtin that takes in a span ID and returns its paylods in JSONB format. If the span is not found, or if the span does not have any payloads, the builtin returns an empty JSON object. #60616
  • Added a new IMPORT PGDUMP option, ignore_unsupported, to skip over all the unsupported PGDUMP stmts. The collection of these statements will be appropriately documented. #57827
  • Users will now need to specify ignore_unsupported to ignore all unsupported import stmts during an IMPORT PGDUMP. #57827
  • Added a new IMPORT PGDUMP option, ignored_stmt_log, which allows users to specify where they would like to log stmts that have been skipped during an import, by virtue of being unsupported. #57827
  • CockroachDB now supports VIRTUAL computed columns (as opposed to STORED). These are computed columns that are not stored in the primary index and are recomputed as necessary. #60748
  • EXPLAIN ANALYZE now includes the nodes which were involved in the execution of each operator in the tree. #60550
  • Added missing tables and columns at pg_catalog. #60758
  • Added a new session setting locality_optimized_partitioned_index_scan and corresponding cluster default setting sql.defaults.locality_optimized_partitioned_index_scan.enabled. Both are currently disabled by default, and are currently unused. In the future, these settings will be used to enable or disable locality optimized search. If enabled, the optimizer will try to search locally for rows in REGIONAL BY ROW tables before searching remote nodes. #60771
  • Added the new parse_timestamp function, which can be used to parse absolute timestamp strings in computed column expressions or partial index predicates. #60772
  • CockroachDB now supports storing spatial type objects with Z and M dimensions (e.g., POINTZ, LINESTRINGM). #60832
  • ALTER DATABASE ... ADD REGION now re-partitions REGIONAL BY ROW tables and updates the zone configs on the newly created partitions as well. #60596
  • Updated the crdb_internal.payloads_for_span builtin to return a table instead of a JSONB array. Each row of the table represents one payload for the given span. It has columns for payload_type and payload_jsonb. #60784
  • ALTER DATABASE ... DROP REGION ... now re-partitions REGIONAL BY ROW tables to remove the partition for the removed region and removes the zone configuration for the partition as well. #60938
  • Added the experimental experimental_enable_stream_replication session setting and sql.defaults.experimental_stream_replication.enabled cluster setting to enable cluster streaming. #60826
  • Introduced a new is_multi_region column to crdb_internal.create_statements, which informs whether the database of the object is a multi-region database. #60761
  • Introduced the new crdb_internal.filter_multiregion_fields_from_zone_config_sql builtin, which removes multi-region fields from a CONFIGURE ZONE statement. #60761
  • Added new virtual tables crdb_internal.cluster_contention_events and crdb_internal.node_contention_events, which expose cluster-wide and gateway-only, respectively, contention information. In order to access them, the user needs to be either an admin or have VIEWACTIVITY grant. #60713
  • The structured payloads used for SQL audit and execution logs now include a transaction counter since the beginning of the session. Statements issued inside the same SQL transaction will thus be logged with the same counter value, thus enabling per-transactions grouping during log analysis. Separate sessions use independent counters. #41929
  • The geometry builtins ST_MakePoint and ST_MakePointM have been implemented and provide a mechanism for easily creating new points. #61105
  • Added the payloads_for_trace() builtin so that all payloads attached to all spans for a given trace ID will be displayed, utilizing the crdb_internal.payloads_for_span() builtin under the hood. All payloads for long-running spans are also added to debug.zip in the crdb_internal.node_inflight_trace_spans table dump. #60922
  • IMPORT PGDUMP can now import dump files with non-public schemas. #57183
  • Added the sql.optimizer.uniqueness_checks_for_gen_random_uuid.enabled cluster setting, which controls creation of uniqueness checks for UUID columns set to gen_random_uuid(). When enabled, uniqueness checks will be added for the UUID column if it has a unique constraint that cannot be enforced by an index. When disabled, no uniqueness checks are planned for these columns, and uniqueness is assumed due to the near-zero collision probability of gen_random_uuid(). #61132
  • The pg_catalog.pg_class table now has a relpartbound column. This is only for compatibility, and the column value is always NULL. #61162
  • Cluster backup now restores the zone configurations first. This means that there should be less range-relocation during and after cluster restores. #60461
  • Fixed information_schema.columns.udt_schema for ENUM or user-defined types. #61139
  • The geography builtin ST_Affine now supports 3D transformations. #61286
  • The ST_Z, ST_M, and ST_Zmflag builtins are now available for use. #61032
  • Geometry builtins for forcing geometries into non-2D layouts are now available. #61297
  • ST_Buffer now requires at least 1 quadrant segment. #61315
  • ST_RotateX function is now available. #61326
  • EXPLAIN now shows estimated row counts for all operators even without VERBOSE (except when we do not have statistics for the tables). #61344
  • Updated the error message returned in case of a unique constraint violation to hide the names and values for implicit partitioning columns and hash sharded index columns. #61362
  • Fixed information_schema.columns.is_identity to display the correct value. #61348
  • ST_RotateY and ST_RotateZ are now available. #61387
  • CockroachDB now prevents densifyFracs < 1e-6 for ST_FrechetDistance and ST_HausdorffDistance to protect panics and out-of-memory errors. #61427
  • CockroachDB now disallows GRANT/REVOKE operations on system tables. #61410
  • ST_Snap is now available. #61523
  • Updates to certain fields in the zone configurations are blocked for multi-region enabled databases. This block can be overridden through the use of the FORCE keyword on the blocked statement. #61499
  • The ST_AddMeasure function is now available for use. #61514
  • Added a new builtin that sets the verbosity of all spans in a given trace. Syntax: crdb_internal.set_trace_verbose($traceID,$verbosityAsBool). #61353
  • Pg_index.indkey now includes attributes. #61494
  • SHOW CREATE ALL TABLES is updated to be more memory efficient, however this should still not be run on a database with an excessive number of tables. Users should not run this on a database with more than 10000 tables (arbitrary but tested number). #61127
  • Set the default cluster setting for sql.defaults.locality_optimized_partitioned_index_scan.enabled to true, which is the default for the session setting locality_optimized_partitioned_index_scan. When this session setting is enabled, the optimizer will plan queries to use "locality optimized search" when possible, which instructs the execution engine to search for keys in local nodes before searching remote nodes. If a key is found in a local node, the execution engine may be able to avoid visiting the remote nodes altogether. #61601
  • ALTER TYPE ... DROP VALUE is gated behind a feature flag. The session setting is called enable_drop_enum_value and the corresponding cluster setting is called sql.defaults.drop_enum_value.enabled. #61723
  • TYPE SCHEMA CHANGE jobs which include a DROP VALUE in them are now cancellable. All other jobs remain non-cancellable. #61733
  • A statement contention timeseries is now displayed in the SQL metrics overview dashboard. #61844
  • The ST_SnapToGrid function can now be used to snap Z and M dimensions. #61826
  • Added json_extract_path_text and jsonb_extract_path_text builtins. #61813
  • Removed pg_catalog tables that were mistakenly added, notably all tables that end in _index that are not pg_catalog.pg_classes and all statistics collector tables that are not pg_stat_activity. #61876
  • The replicas column of crdb_internal.ranges{_no_leases} now includes both voting and non-voting replicas and crdb_internal.ranges{_no_leases} include two new columns: voting_replicas and non_voting_replicas, which work as labeled. #61962

Operational changes

  • Added the storage.transaction.separated_intents.enabled cluster setting, which enables separated intents by default. #59829

Command-line changes

  • It is now possible to redirect logging to Fluentd-compatible network collectors. See the reference sink documentation for details.This is an alpha-quality feature. Note that Fluent-enabled configuration only provide minimal event buffering, and log entries are dropped if the logging server becomes unavailable or network errors are encountered. This is a known limitation and will be likely improved in a later version. #57170
  • The SQL shell (cockroach sql / cockroach demo) now supports a flag --embedded, for use with playground-style web applications. #59750
  • cockroach userfile get can now be used to fetch files from a cluster. #60490
  • Added the ignore-unsupported-statements, log-ignored-statements and row-limit flags to the cockroach import command. #60923
  • The doctor tool can now report multiple descriptor validation failures per descriptor. #60775
  • The new cockroach connect command now recognizes --single-node to prepare a TLS configuration suitable for a subsequent start-single-node command. Additionally, the command checks that either --single-node is specified, or both --init-token and --num-expected-peers. #60854
  • Optimized handling of multi-line SQL strings to avoid unwanted extra server roundtrips. #61207
  • Added back support for cockroach dump --dump-mode=schema. This command calls SHOW CREATE ALL TABLES and returns the output. This gives users a migration path to use in v21.1 while switching over to SHOW CREATE ALL TABLES for v21.2. When executing this, the user is warned that the command is being removed in v21.2 and they should use SHOW CREATE ALL TABLES instead. #61871

API endpoint changes

  • Added the following new HTTP API endpoints:

    • /api/v2/nodes/: Lists all nodes in the cluster
    • /api/v2/nodes/<node_id>/ranges: Lists all ranges on the specified node
    • /api/v2/ranges/hot/: Lists hot ranges in the cluster
    • /api/v2/ranges/<range_id>/: Describes range in more detail
    • /api/v2/health/: Returns an HTTP 200 response if node is healthy. #60952

DB Console changes

  • Manually enqueue range in a replica GC queue now properly respects the SkipShouldQueue option. This can be useful to force a GC of a specific Range. #60619
  • Added a filter for full scans to the Statements page. #60670
  • The Range Report page on the DB Console will now also show each of the replica's types. #61113
  • The Transaction Type column was removed from Statements page. The sort order in Statement / Transaction Table views is now by execution count. The sort order in Transaction Details view is by latency. Column titles in statements and transactions tables now say "{Statement,Transaction} Time" instead of "Latency". The Contention column added to the Statements / Transactions pages. Max Scratch Disk Usage added to Statements and Transaction Details pages. #61177
  • Added a full-table scan checkbox. #61676

Bug fixes

  • Fixed a bug in the DB Console affecting status badges in Nodes list on Cluster Overview page. #59636
  • Fixes a bug where backups would fail with an error when trying to read a backup that was written. #59730
  • Fixes a bug where some import failures would cause tables to stay OFFLINE, when they should have been brought back to PUBLIC. #59723
  • Fixed a bug that caused errors when joining two tables when one of the tables had a computed column. This bug was present since version v21.1.0-alpha.2 and not present in any production releases. #59741
  • Statistics are now correctly generated for columns in multi-column inverted indexes and columns referenced in partial inverted index predicates. #59687
  • Fixed a timestamp overflow bug that would overflow timestamps after the year 2038 by updating the Avro SDK used by changefeeds. #59745
  • Fixed a very rare chance of inconsistent follower reads. #59502
  • Previously if RELEASE SAVEPOINT cockroach_restart was followed by ROLLBACK, the sql.txn.rollback.count metric would be incremented. This was incorrect, since the transaction had already committed. Now that metric is not incremented in this case. #59781
  • CockroachDB now explicitly verify descriptors are sequences. #60159
  • The final result of the cockroach debug doctor invocation during cockroach debug zip is now properly included inside the generated zip file. #60529
  • Fixed a bug in the optimizer statistics code that could cause an unconstrained partial index scan to be preferred over a constrained scan of the same index. #60516
  • Fixed a deficiency in the replication layer that could result in ranges becoming unavailable for prolonged periods of time (hours) when a write burst occurred under system overload. While unavailable, the range status page for the affected range would show a last index much larger than the committed index and no movement in these indexes on a quorum of the replicas. Note that this should be distinguished from the case in which enough replicas are offline to constitute a loss of quorum, where the replication layer can not make progress due to the loss of quorum itself. #60581
  • Previously, retryable errors in the cleanup phase of the type schema changer wouldn't be retried automatically in the background. This is now fixed. #60495
  • v20.2 introduced an ability to rebalance replicas between multiple stores on the same node. This change fixed a problem with that feature, where occasionally an intra-node rebalance would fail and a range would get stuck permanently under replicated. #60546
  • Fixed a bug that would cause the value of the optional into_db parameter to RESTORE to be included in anonymized crash reports. #60624
  • Fixed a bug that caused errors for some queries on tables with GEOMETRY or GEOGRAPHY inverted indexes with filters containing shapes with zero area. #60598
  • CockroachDB previously didn't account for some RAM used when disk-spilling operations (like sorts and hash joins) were using the temporary storage in the vectorized execution engine. This could result in OOM crashes, especially when the rows are large in size. This has been fixed. #60593
  • Fixed a bug where ST_Node would panic if passed in MULTILINESTRING EMPTY. #60691
  • Fixed a bug that could result in crashes during tracing when using the trace.debug.enable cluster setting. #60725
  • Fixed execution errors for some queries that use set operations (UNION / EXCEPT / INTERSECT) where a column has types of different widths on the two sides (e.g., INT4 vs. INT8). #60560
  • CockroachDB now avoids creating batches that exceed the raft command limit (64MB) when reverting ranges that contain very large keys. #59716
  • Fixed a bug whereby high-latency global clusters could sometimes fall behind checkpointing resolved timestamps. #60807
  • Added check privileges before changing table/database owner. #60800
  • Fixed an internal error caused in some cases involving JSON objects and arrays in a VALUES clause. #60767
  • Previously DROP TYPE IF EXISTS with one existent, and another non-existent type would cause an unhandled error. This is now fixed. #60822
  • Fixed bug that could report that a protected timestamp limit was exceeded when the limit was disabled, if an error were to occur while protecting a record. #60913
  • CockroachDB previously could encounter an internal error when performing UNION operation when the first input resulted only in NULL values and consequent inputs produce tuples, and this is now fixed. Only v21.1 alpha versions are affected. #60827
  • Fixed a bug in crdb_internal.unsafe_upsert_namespace_entry related to tables and types in user-defined schemas. #60510
  • Integers inside of tuples were not being encoded properly when using the binary format for retrieving data. This is now fixed, and the proper integer width is reported. #61013
  • Blank-padded chars (e.g., CHAR(3)) were not being encoded correctly when returning results to the client. Now they correctly include blank-padding when appropriate. #61013
  • Collated strings were not encoded with the proper type OID when sending results to the client if the OID was for the char type. This is now fixed. #61013
  • Fixed a very rare, possible impossible in practice, bug where a range merge that applied through a Raft snapshot on the left-hand side range's leaseholder could allow that leaseholder to serve writes that invalidated reads from before the merge on the right-hand side. Release justification: bug fix #60521
  • The SHOW CREATE output of a partitioned partial index now lists the PARTITION BY and WHERE clauses in the order accepted by the parser. #60590
  • The SHOW CREATE output of a partial interleaved index now lists the INTERLEAVED and WHERE clauses in the order accepted by the parser. #60590
  • Fix a bug where cluster restore would sometimes (very rarely) fail after retrying. #60458
  • Previously, comparing a negative integer to an OID would fail to compare correctly because the integer was not converted to an unsigned representation first. this is now fixed for both comparisons and casts.#61148
  • Previously, CockroachDB could not decode arrays of user-defined types when sent to the server in the binary format. Now it can. #61165
  • crdb_internal.jobs virtual table is now populated in a paginated fashion, thus, alleviating memory related concerns when previously we could encounter OOM crash. #60693
  • The SHOW TABLES FROM database command would always show a NULL estimated_row_count if inspecting a database that was not the current database. This is now fixed. #61191
  • Fixed a bug where schema changes on databases and schemas could return a relation [<id>] does not exist if they failed or were canceled and entered the reverting state. These jobs are not actually possible to revert. With this change, the correct error causing the job to fail will be returned, and the job will enter the failed state with an error indicating that the job could not be reverted. #61159
  • CockroachDB now drops the default value when its dependent sequence is dropped. #60744
  • Dropping and recreating a view/table/sequence in a transaction will now correctly error out if a conflicting object exists or if the drop is incomplete. #61135
  • The non-server cockroach commands now recognize the new --log flag properly. This had been broken in one of the earlier v21.1 alpha releases. #61232
  • Prepared statements would sometimes get the wrong type OID for placeholder arguments used in function parameters. This is now fixed. #60949
  • Fixed a case where empty zone configurations get created for certain indexes during ALTER PRIMARY KEY. #61235
  • Schema change jobs associated with databases and schemas can no longer be canceled. Such jobs cannot actually be reverted successfully, so cancelation had no benefit and could have caused namespace corruption. #61210
  • Fixed cockroach demo commands nodeName error argument index handling. #61246
  • CockroachDB no longer displays incorrect node statuses on Metrics page, when page just loaded. #61000
  • Fixed an NPE observed with a SpanFromContext call in the stack trace. #61124
  • Limit scans are no longer counted as full scans. #61178
  • Selecting from crdb_internal.create_statements will now correctly populate the database_name when the virtual index is not used. #61201
  • Fixed an internal error when EXPLAINing an INSERT with an input that was determined by the optimizer to produce no rows. #61278
  • Fixed a rare deadlock where a series of lease transfers concurrent with a Range merge could block each other from ever completing. #60905
  • ALTER TYPE ... ADD VALUE changes are picked up by the array type alias correctly. #61288
  • Previously, the traces of cascades and checks could be incomplete. This is now fixed. #61321
  • Creating interleaved partitioned indexes is now disallowed. Previously, the database would crash when trying to create one. #61106
  • Dropping and re-creating a database in a transaction will now correctly error out if an object in a dropped state is detected. #61361 #61358
  • CockroachDB now uses the correct FuncExpr when encoding sequences. #61428
  • Alter primary key was not idempotent, so logical equivalent changes to primary keys would unnecessarily create new indexes. This is now fixed. #61345
  • Fixed a bug where GRANT/REVOKE on the system.lease table would result in a deadlock. #61410
  • Fixed operation hangs when a node loses access to cluster RPC (e.g., after it has been decommissioned), and immediately return an error instead. #61356
  • Fixed a bug from v21.1-alpha where a node decommissioning process could sometimes hang or fail when the decommission request was submitted via the node being decommissioned. #61356
  • Fixed bug where zone configurations on indexes were not copied before the backfill of an ALTER PRIMARY KEY. They used to be copied afterwards instead. #61300
  • Fixed a bug where random numbers generated as default expressions during IMPORT would collide a few hundred rows apart from each-other. #61214
  • Fixed a bug that caused UPSERT and INSERT..ON CONFLICT..DO UPDATEstatements to fail on tables with both partial indexes and foreign key references. This bug has been present since v20.2.0. #61416
  • An UPDATE..FROM statement where the FROM clause contained column names that match table column names erred if the table had a partial index predicate referencing those columns. This bug, present since partial indexes were released in v20.2.0, has been fixed. #61522
  • The names of custom types are no longer sent to Cockroach Labs in telemetry and crash reports. #60806
  • Fixed a case where an invalid tuple comparison using ANY was causing an internal error; we now return "unsupported comparison operator". #61647
  • Added better privilege checks when creating a changefeed. #61709
  • Fixed privileges for system.protected_ts_meta. #61842
  • The indexdef column in the pg_indexes table would always report that the index belonged to the public schema. Now it correctly reports user-defined schemas if necessary. #61754
  • Fixed "command is too large" errors in some cases when using EXPLAIN ANALYZE (DEBUG) or statement diagnostics on complex queries. #61909
  • Using EXPLAIN (OPT, ENV) on a query that references a table in a user-defined schema would fail previously. This is now fixed. #61888
  • Fixed a bug that caused "column does not exist errors" in specific cases of UPDATE..FROM statements. The error only occurred when updating a DECIMAL column to a column in the FROM clause, and the column had a CHECK constraint or was referenced by a partial index predicate. #61949
  • Previously the idle_in_session_timeout and idle_in_transaction_session_timeout settings would show the wrong value when using SHOW. They would instead show the value of the statement_timeout setting. This is now fixed. The functionality was already working correctly; this just fixes a display bug. #61959

Performance improvements

  • Improved the performance of the pg_table_is_visible builtin function. #59880
  • Added support for left and anti lookup joins in cases where the equi-join condition is not on the first column in the index, but the first column(s) are constrained to a small number of constant values using a CHECK constraint or an ENUM type. Planning a lookup join for these cases can significantly improve performance if the left input to the join is much smaller than the right-hand side. #60302
  • The optimizer now knows that the unique columns in an implicitly partitioned unique index form a key. This can be used to enable certain optimizations and may result in better plans. #60591
  • Improved the optimizer's ability to identify constant columns in scans. This can enable different types of optimizations and result in improved plans. #60927
  • Follower reads no longer wait before redirecting to the leaseholder if they could not be served by a local follower due to an insufficient closed timestamp. #60839
  • Updated the query used to build the virtual table crdb_internal.table_row_statistics so that it is always run at AS OF SYSTEM TIME '-10s'. This should reduce contention on the table and improve performance for transactions that rely on crdb_internal.table_row_statistics, such as SHOW TABLES. #60953
  • Improved the optimizer's cost estimation of index scans that must visit multiple partitions. When an index has multiple partitions, the optimizer is now more likely to choose a constrained scan rather than a full index scan. This can lead to better plans and improved performance. It also improves the ability of the database to serve queries if one of the partitions is unavailable. #61063
  • Optimized external sort to merge partition data faster in colexec. #61056
  • If the session setting locality_optimized_partitioned_index_scan is enabled, the optimizer will try to plan scans known to produce at most one row using "locality optimized search". This optimization applies for REGIONAL BY ROW tables, and if enabled, it means that the execution engine will first search locally for the row before searching remote nodes. If the row is found in a local node, remote nodes will not be searched. #60831
  • The optimizer now infers additional functional dependencies based on computed columns in tables. This may enable additional optimizations and lead to better query plans. #61097
  • Removed uniqueness checks on the primary key for REGIONAL BY ROW tables with a computed region column that is a function of the primary key columns. Uniqueness checks are not necessary in this case since uniqueness can be suitably guaranteed by the primary index. Removing these checks improves performance of INSERT, UPDATE, and UPSERT statements. #61097
  • The optimizer no longer plans uniqueness checks for columns in implicitly partitioned unique indexes when those columns are used as the arbiters to detect conflicts in INSERT ... ON CONFLICT statements. Unique checks are not needed in this case to enforce uniqueness. Removing these checks results in improved performance for INSERT ... ON CONFLICT statements. #61184
  • The columns fetched for uniqueness checks of implicitly partitioned unique indexes are now pruned to only include columns necessary for determining uniqueness. #61376
  • Introspection queries that use casts into the REGPROC pseudo-type are made much more efficient: they're now implemented as a constant-time lookup instead of an internal query. #61211
  • Fixed cases where the optimizer was doing unnecessary full table scans when the table was very small (according to the last collected statistics). #61805
  • The optimizer now estimates the cost of evaluating query filters more accurately for queries with a LIMIT. Previously, it was assumed that the filter would be evaluated on each input row. Now, the optimizer assumes that the filter will only be evaluated on the number of rows required to produce the LIMIT's number of rows after filtering. This may lead to more efficient query plans in some cases. #61947

Contributors

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

  • Abdullah Islam (first-time contributor)
  • Alan Acosta (first-time contributor)
  • Kumar Akshay
  • Max Neverov
  • Miguel Novelo (first-time contributor)
  • Ratnesh Mishra (first-time contributor)
  • Tharun (first-time contributor)
  • Ulf Adams (first-time contributor)
  • alex-berger@gmx.ch (first-time contributor)
  • leoric (first-time contributor)
  • shikamaru (first-time contributor)
YesYes NoNo