Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: Fix "dangling rows" left over by schema change + rollback to sav…
…epoint Prior to this patch, the following sequence would write a row that's then unaccessible: begin; savepoint cockroach_restart; create table t(x int primary key); rollback to savepoint cockroach_restart; insert into t(x) values(1); release savepoint cockroach_restart; commit; The insert manages to resolve the table because we weren't clearing the "uncommitted descriptors" set that the session maintains. Since the table descriptor doesn't end up being committed, the row will be essentially unreachable. This patch is original work on the 1.1 branch. This bug is not present in the 2.0 release, where we're better about reseting state on transaction retries. I believe on 1.1 there's still a similar issue present when doing automatic retries (as opposed to user-directed ones through rollback to savepoint). I think fixing those would be more involved because it's less clear where to stick the cleanup done in this patch; I'd rather not do anything this point. Also note that, with the fix, the sequence above doesn't actually work. Instead, it deadlocks, just like it does on 2.0, because of cockroachdb#24885. However, the following works: begin; savepoint cockroach_restart; create table t(x int primary key); rollback to savepoint cockroach_restart; create table t(x int primary key); insert into t(x) values(1); release savepoint cockroach_restart; commit; Fixes cockroachdb#24785
- Loading branch information