Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-22.1: sql/catalog/tabledesc: permit zero-valued column IDs in DependedOnBy #82859

Merged
merged 1 commit into from
Jun 21, 2022

Commits on Jun 13, 2022

  1. sql/catalog/tabledesc: permit zero-valued column IDs in DependedOnBy

    In 21.1 there was a bug whereby we would store a 0-value column ID in the
    sequence's DependedOnBy because we'd add the depedency before allocating
    an ID to the column. This bug was fixed in 21.2. Below is a reproduction
    I've used to play with this bug:
    
    ```bash
    roachprod wipe local
    roachprod stage local release v21.1.3
    roachprod run local -- mv cockroach cockroach-v21.1.3
    roachprod stage local release v21.2.10
    roachprod run local -- mv cockroach cockroach-v21.2.10
    roachprod stage local release v22.1.1
    roachprod run local -- mv cockroach cockroach-v22.1.1
    roachprod start local --binary cockroach-v21.1.3
    roachprod sql local -- -e "create table t1( i int primary key);
                               create table t2(i int primary key);
                               create sequence s1;
                               create sequence s2;
                               ALTER TABLE t1 ADD c1 BIGINT DEFAULT nextval('s1') NOT NULL;
                               ALTER TABLE t1 ADD c2 BIGINT DEFAULT nextval('s2') NOT NULL;
                               ALTER TABLE t2 ADD c1 BIGINT DEFAULT nextval('s1') NOT NULL;"
    roachprod stop local
    roachprod start local --binary cockroach-v21.2.10
    while ! { roachprod sql local -- -e 'show cluster setting version' | grep 21.2 ; }; do sleep 1; done
    
    roachprod sql local -- -e "alter table t1 add column c3 int default nextval('s1');
                               create table t3 (i int primary key);
                               alter table t3 add column c1 int default nextval('s1');"
    
    roachprod stop local
    roachprod start local --binary cockroach-v22.1.1
    while ! { roachprod sql local -- -e 'show cluster setting version' | grep 22.1 ; }; do sleep 1; done
    ```
    
    For now, for the rest of 22.1 we'll let this slide. As follow-up work, we'll
    perform a migration to repair this situation and add back this validation once
    the migration has been performed.
    
    Release note (bug fix): In earlier 22.1 releases of cockroach, added validation
    could cause problems for descriptors which carried invalid backreferences due
    to an earlier bug in 21.1. This stricter validation could result in a variety
    of query failures. This patch weakens the validation to permit the corruption
    as we know it. A subsequent patch in 22.2 will be created to repair the invalid
    reference.
    ajwerner committed Jun 13, 2022
    Configuration menu
    Copy the full SHA
    5f38e71 View commit details
    Browse the repository at this point in the history