Skip to content

Commit

Permalink
Merge #69829 #71006
Browse files Browse the repository at this point in the history
69829: roachtest: make roachtest recognize 21.2 r=celiala a=celiala

Shortly after [Creating a release branch](https://cockroachlabs.atlassian.net/wiki/spaces/ENG/pages/187859111/Creating+a+release+branch) for release-21.2, we'll want to merge PRs as instructed by the [New major version checklist](https://cockroachlabs.atlassian.net/wiki/spaces/ENG/pages/1522270228/New+major+version+checklist).

This PR is for Step 2c of the [New major version checklist](https://cockroachlabs.atlassian.net/wiki/spaces/ENG/pages/1522270228/New+major+version+checklist), where we update the ORM tests. Specifically, adding block/ignore lists for the `vNEXT` major version for these files:
```
ls pkg/cmd/roachtest/tests/*_blocklist.go
```

This PR is one of the tasks detailed in #70751, which tracks all the steps relevant to creating a release branch for `${vBRANCH_CUT}` and preparing master for the `${vNEXT}` major version.

Release justification: Non-production code change.
Release note: None

71006: sqlliveness/slstorage: fix bug due to not using a transaction r=ajwerner a=ajwerner

We had a bug where updating a session was not using the transaction. This
exposed it to a problem whereby a concurrent removal of the session would
not be detected and the session could be resurrected.

Fortunately this code moved to using KV from SQL in the 21.2 cycle and
thus no released major release should experience this issue.

Fixes #71008.

Release note: None

Co-authored-by: Celia La <[email protected]>
Co-authored-by: Andrew Werner <[email protected]>
  • Loading branch information
3 people committed Oct 1, 2021
3 parents 3bf6227 + d6ba75a + 4ee0f2b commit fb0940f
Show file tree
Hide file tree
Showing 14 changed files with 154 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/activerecord_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var activeRecordBlocklists = blocklistsForVersion{
{"v20.2", "activeRecordBlockList20_2", activeRecordBlockList20_2, "activeRecordIgnoreList20_2", activeRecordIgnoreList20_2},
{"v21.1", "activeRecordBlockList21_1", activeRecordBlockList21_1, "activeRecordIgnoreList21_1", activeRecordIgnoreList21_1},
{"v21.2", "activeRecordBlockList21_2", activeRecordBlockList21_2, "activeRecordIgnoreList21_2", activeRecordIgnoreList21_2},
{"v22.1", "activeRecordBlockList22_1", activeRecordBlockList22_1, "activeRecordIgnoreList22_1", activeRecordIgnoreList22_1},
}

// These are lists of known activerecord test errors and failures.
Expand All @@ -27,12 +28,16 @@ var activeRecordBlocklists = blocklistsForVersion{
// Please keep these lists alphabetized for easy diffing.
// After a failed run, an updated version of this blocklist should be available
// in the test log.
var activeRecordBlockList22_1 = blocklist{}

var activeRecordBlockList21_2 = blocklist{}

var activeRecordBlockList21_1 = blocklist{}

var activeRecordBlockList20_2 = blocklist{}

var activeRecordIgnoreList22_1 = activeRecordIgnoreList21_2

var activeRecordIgnoreList21_2 = blocklist{
"ActiveRecord::CockroachDB::UnloggedTablesTest#test_gracefully_handles_temporary_tables": "modified to pass on 20.2",
"FixturesTest#test_create_fixtures": "flaky - FK constraint violated sometimes when loading all fixture data",
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/django_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,20 @@ var djangoBlocklists = blocklistsForVersion{
{"v20.2", "djangoBlocklist20_2", djangoBlocklist20_2, "djangoIgnoreList20_2", djangoIgnoreList20_2},
{"v21.1", "djangoBlocklist21_1", djangoBlocklist21_1, "djangoIgnoreList21_1", djangoIgnoreList21_1},
{"v21.2", "djangoBlocklist21_2", djangoBlocklist21_2, "djangoIgnoreList21_2", djangoIgnoreList21_2},
{"v22.1", "djangoBlocklist22_1", djangoBlocklist22_1, "djangoIgnoreList22_1", djangoIgnoreList22_1},
}

// Maintain that this list is alphabetized.
var djangoBlocklist22_1 = djangoBlocklist21_2

var djangoBlocklist21_2 = djangoBlocklist21_1

var djangoBlocklist21_1 = djangoBlocklist20_2

var djangoBlocklist20_2 = blocklist{}

var djangoIgnoreList22_1 = djangoIgnoreList21_2

var djangoIgnoreList21_2 = blocklist{
"migrations.test_operations.OperationTests.test_alter_fk_non_fk": "will be fixed in django-cockroachdb v3.2.2",
"schema.tests.SchemaTests.test_alter_field_db_collation": "will be fixed in django-cockroachdb v3.2.2",
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/gopg_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var gopgBlocklists = blocklistsForVersion{
{"v20.2", "gopgBlockList20_2", gopgBlockList20_2, "gopgIgnoreList20_2", gopgIgnoreList20_2},
{"v21.1", "gopgBlockList21_1", gopgBlockList21_1, "gopgIgnoreList21_1", gopgIgnoreList21_1},
{"v21.2", "gopgBlockList21_2", gopgBlockList21_2, "gopgIgnoreList21_2", gopgIgnoreList21_2},
{"v22.1", "gopgBlockList22_1", gopgBlockList22_1, "gopgIgnoreList22_1", gopgIgnoreList22_1},
}

// These are lists of known gopg test errors and failures.
Expand All @@ -25,6 +26,8 @@ var gopgBlocklists = blocklistsForVersion{
// After a failed run, an updated version of this blocklist should be available
// in the test log.

var gopgBlockList22_1 = gopgBlockList21_2

var gopgBlockList21_2 = gopgBlockList21_1

var gopgBlockList21_1 = blocklist{
Expand Down Expand Up @@ -75,6 +78,8 @@ var gopgBlockList20_2 = blocklist{
"v10.TestUnixSocket": "31113",
}

var gopgIgnoreList22_1 = gopgIgnoreList21_2

var gopgIgnoreList21_2 = gopgIgnoreList21_1

var gopgIgnoreList21_1 = gopgIgnoreList20_2
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/gorm_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ var gormBlocklists = blocklistsForVersion{
{"v20.2", "gormBlocklist20_2", gormBlocklist20_2, "gormIgnorelist20_2", gormIgnorelist20_2},
{"v21.1", "gormBlocklist21_1", gormBlocklist21_1, "gormIgnorelist21_1", gormIgnorelist21_1},
{"v21.2", "gormBlocklist21_2", gormBlocklist21_2, "gormIgnorelist21_2", gormIgnorelist21_2},
{"v22.1", "gormBlocklist22_1", gormBlocklist22_1, "gormIgnorelist22_1", gormIgnorelist22_1},
}

var gormBlocklist22_1 = gormBlocklist21_2

var gormBlocklist21_2 = gormBlocklist21_1

var gormBlocklist21_1 = gormBlocklist20_2

var gormBlocklist20_2 = blocklist{}

var gormIgnorelist22_1 = gormIgnorelist21_2

var gormIgnorelist21_2 = gormIgnorelist21_1

var gormIgnorelist21_1 = gormIgnorelist20_2
Expand Down
8 changes: 8 additions & 0 deletions pkg/cmd/roachtest/tests/hibernate_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@ var hibernateBlocklists = blocklistsForVersion{
{"v20.2", "hibernateBlockList20_2", hibernateBlockList20_2, "", nil},
{"v21.1", "hibernateBlockList21_1", hibernateBlockList21_1, "hibernateIgnoreList21_1", hibernateIgnoreList21_1},
{"v21.2", "hibernateBlockList21_2", hibernateBlockList21_2, "hibernateIgnoreList21_2", hibernateIgnoreList21_2},
{"v22.1", "hibernateBlockList22_1", hibernateBlockList22_1, "hibernateIgnoreList22_1", hibernateIgnoreList22_1},
}

var hibernateSpatialBlocklists = blocklistsForVersion{
{"v21.1", "hibernateSpatialBlockList21_1", hibernateSpatialBlockList21_1, "", nil},
{"v21.2", "hibernateSpatialBlockList21_2", hibernateSpatialBlockList21_2, "", nil},
{"v22.1", "hibernateSpatialBlockList22_1", hibernateSpatialBlockList22_1, "", nil},
}

// Please keep these lists alphabetized for easy diffing.
// After a failed run, an updated version of this blocklist should be available
// in the test log.
var hibernateSpatialBlockList22_1 = blocklist{}

var hibernateSpatialBlockList21_2 = blocklist{}

var hibernateSpatialBlockList21_1 = blocklist{}

var hibernateBlockList22_1 = hibernateBlockList21_2

var hibernateBlockList21_2 = blocklist{
"org.hibernate.jpa.test.graphs.FetchGraphTest.testCollectionEntityGraph": "unknown",
"org.hibernate.jpa.test.packaging.PackagedEntityManagerTest.testConfiguration": "unknown",
Expand Down Expand Up @@ -209,6 +215,8 @@ var hibernateBlockList20_2 = blocklist{
"org.hibernate.test.where.annotations.EagerManyToOneFetchModeSelectWhereTest.testAssociatedWhereClause": "unknown",
}

var hibernateIgnoreList22_1 = hibernateIgnoreList21_2

var hibernateIgnoreList21_2 = hibernateIgnoreList21_1

var hibernateIgnoreList21_1 = blocklist{}
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/libpq_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ var libPQBlocklists = blocklistsForVersion{
{"v20.2", "libPQBlocklist20_2", libPQBlocklist20_2, "libPQIgnorelist20_2", libPQIgnorelist20_2},
{"v21.1", "libPQBlocklist21_1", libPQBlocklist21_1, "libPQIgnorelist21_1", libPQIgnorelist21_1},
{"v21.2", "libPQBlocklist21_2", libPQBlocklist21_2, "libPQIgnorelist21_2", libPQIgnorelist21_2},
{"v22.1", "libPQBlocklist22_1", libPQBlocklist22_1, "libPQIgnorelist22_1", libPQIgnorelist22_1},
}

var libPQBlocklist22_1 = libPQBlocklist21_2

var libPQBlocklist21_2 = blocklist{
"pq.ExampleConnectorWithNoticeHandler": "unknown",
"pq.TestBinaryByteSliceToInt": "41547",
Expand Down Expand Up @@ -90,6 +93,8 @@ var libPQBlocklist20_2 = blocklist{
"pq.TestStringWithNul": "26366",
}

var libPQIgnorelist22_1 = libPQIgnorelist21_2

var libPQIgnorelist21_2 = libPQIgnorelist21_1

var libPQIgnorelist21_1 = libPQIgnorelist20_2
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/liquibase_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ var liquibaseBlocklists = blocklistsForVersion{
{"v20.2", "liquibaseBlocklist20_2", liquibaseBlocklist20_2, "liquibaseIgnorelist20_2", liquibaseIgnorelist20_2},
{"v21.1", "liquibaseBlocklist21_1", liquibaseBlocklist21_1, "liquibaseIgnorelist21_1", liquibaseIgnorelist21_1},
{"v21.2", "liquibaseBlocklist21_2", liquibaseBlocklist21_2, "liquibaseIgnorelist21_2", liquibaseIgnorelist21_2},
{"v22.1", "liquibaseBlocklist22_1", liquibaseBlocklist22_1, "liquibaseIgnorelist21_2", liquibaseIgnorelist22_1},
}

var liquibaseBlocklist22_1 = liquibaseBlocklist21_2

var liquibaseBlocklist21_2 = blocklist{
"liquibase.harness.change.ChangeObjectTests.apply addDefaultValueSequenceNext against cockroachdb 20.2; verify generated SQL and DB snapshot": "",
}
Expand All @@ -24,6 +27,8 @@ var liquibaseBlocklist21_1 = liquibaseBlocklist20_2

var liquibaseBlocklist20_2 = blocklist{}

var liquibaseIgnorelist22_1 = liquibaseIgnorelist21_2

var liquibaseIgnorelist21_2 = liquibaseIgnorelist21_1

var liquibaseIgnorelist21_1 = liquibaseIgnorelist20_2
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/pgjdbc_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ var pgjdbcBlocklists = blocklistsForVersion{
{"v20.2", "pgjdbcBlockList20_2", pgjdbcBlockList20_2, "pgjdbcIgnoreList20_2", pgjdbcIgnoreList20_2},
{"v21.1", "pgjdbcBlockList21_1", pgjdbcBlockList21_1, "pgjdbcIgnoreList21_1", pgjdbcIgnoreList21_1},
{"v21.2", "pgjdbcBlockList21_2", pgjdbcBlockList21_2, "pgjdbcIgnoreList21_2", pgjdbcIgnoreList21_2},
{"v22.1", "pgjdbcBlockList22_1", pgjdbcBlockList22_1, "pgjdbcIgnoreList22_1", pgjdbcIgnoreList22_1},
}

// Please keep these lists alphabetized for easy diffing.
// After a failed run, an updated version of this blocklist should be available
// in the test log.
var pgjdbcBlockList22_1 = pgjdbcBlockList21_2

var pgjdbcBlockList21_2 = blocklist{
"org.postgresql.jdbc.DeepBatchedInsertStatementTest.testDeepInternalsBatchedQueryDecorator": "26508",
"org.postgresql.jdbc.DeepBatchedInsertStatementTest.testUnspecifiedParameterType": "26508",
Expand Down Expand Up @@ -2527,6 +2530,8 @@ var pgjdbcBlockList20_2 = blocklist{
"org.postgresql.test.xa.XADataSourceTest.testWrapperEquals": "22329",
}

var pgjdbcIgnoreList22_1 = pgjdbcIgnoreList21_2

var pgjdbcIgnoreList21_2 = pgjdbcIgnoreList21_1

var pgjdbcIgnoreList21_1 = pgjdbcIgnoreList20_2
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/pgx_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ var pgxBlocklists = blocklistsForVersion{
{"v20.2", "pgxBlocklist20_2", pgxBlocklist20_2, "pgxIgnorelist20_2", pgxIgnorelist20_2},
{"v21.1", "pgxBlocklist21_1", pgxBlocklist21_1, "pgxIgnorelist21_1", pgxIgnorelist21_1},
{"v21.2", "pgxBlocklist21_2", pgxBlocklist21_2, "pgxIgnorelist21_2", pgxIgnorelist21_2},
{"v22.1", "pgxBlocklist22_1", pgxBlocklist22_1, "pgxIgnorelist22_1", pgxIgnorelist22_1},
}

// Please keep these lists alphabetized for easy diffing.
// After a failed run, an updated version of this blocklist should be available
// in the test log.
var pgxBlocklist22_1 = blocklist{}

var pgxBlocklist21_2 = blocklist{}

var pgxBlocklist21_1 = blocklist{}

var pgxBlocklist20_2 = blocklist{}

var pgxIgnorelist22_1 = pgxIgnorelist21_2

var pgxIgnorelist21_2 = pgxIgnorelist21_1

var pgxIgnorelist21_1 = pgxIgnorelist20_2
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/psycopg_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var psycopgBlocklists = blocklistsForVersion{
{"v20.2", "psycopgBlockList20_2", psycopgBlockList20_2, "psycopgIgnoreList20_2", psycopgIgnoreList20_2},
{"v21.1", "psycopgBlockList21_1", psycopgBlockList21_1, "psycopgIgnoreList21_1", psycopgIgnoreList21_1},
{"v21.2", "psycopgBlockList21_2", psycopgBlockList21_2, "psycopgIgnoreList21_2", psycopgIgnoreList21_2},
{"v22.1", "psycopgBlockList22_1", psycopgBlockList22_1, "psycopgIgnoreList22_1", psycopgIgnoreList22_1},
}

// These are lists of known psycopg test errors and failures.
Expand All @@ -27,6 +28,8 @@ var psycopgBlocklists = blocklistsForVersion{
// Please keep these lists alphabetized for easy diffing.
// After a failed run, an updated version of this blocklist should be available
// in the test log.
var psycopgBlockList22_1 = psycopgBlockList21_2

var psycopgBlockList21_2 = blocklist{
"tests.test_async_keyword.CancelTests.test_async_cancel": "41335",
// The following two items can be removed once there is a new psycopg2 release.
Expand All @@ -44,6 +47,8 @@ var psycopgBlockList20_2 = blocklist{
"tests.test_async_keyword.CancelTests.test_async_cancel": "41335",
}

var psycopgIgnoreList22_1 = psycopgIgnoreList21_2

var psycopgIgnoreList21_2 = psycopgIgnoreList21_1

var psycopgIgnoreList21_1 = psycopgIgnoreList20_2
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/ruby_pg_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ var rubyPGBlocklist = blocklistsForVersion{
{"v20.2", "rubyPGBlockList20_2", rubyPGBlockList20_2, "rubyPGIgnoreList20_2", rubyPGIgnoreList20_2},
{"v21.1", "rubyPGBlockList21_1", rubyPGBlockList21_1, "rubyPGIgnoreList21_1", rubyPGIgnoreList21_1},
{"v21.2", "rubyPGBlockList21_2", rubyPGBlockList21_2, "rubyPGIgnoreList21_2", rubyPGIgnoreList21_2},
{"v22.1", "rubyPGBlockList22_1", rubyPGBlockList22_1, "rubyPGIgnoreList21_2", rubyPGIgnoreList22_1},
}

var rubyPGBlockList22_1 = rubyPGBlockList21_2

var rubyPGBlockList21_2 = blocklist{
"Basic type mapping PG::BasicTypeMapBasedOnResult with usage of result oids for bind params encoder selection can do JSON conversions": "unknown",
"Basic type mapping PG::BasicTypeMapBasedOnResult with usage of result oids for copy encoder selection can type cast #copy_data input with explicit encoder": "unknown",
Expand Down Expand Up @@ -363,6 +366,8 @@ var rubyPGBlockList20_2 = blocklist{
"PG::Connection deprecated forms of methods should forward exec to exec_params": "unknown",
}

var rubyPGIgnoreList22_1 = rubyPGIgnoreList21_2

var rubyPGIgnoreList21_2 = rubyPGIgnoreList21_1

var rubyPGIgnoreList21_1 = rubyPGIgnoreList20_2
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/roachtest/tests/sqlalchemy_blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ var sqlAlchemyBlocklists = blocklistsForVersion{
{"v20.2", "sqlAlchemyBlocklist20_2", sqlAlchemyBlocklist20_2, "sqlAlchemyIgnoreList20_2", sqlAlchemyIgnoreList20_2},
{"v21.1", "sqlAlchemyBlocklist21_1", sqlAlchemyBlocklist21_1, "sqlAlchemyIgnoreList21_1", sqlAlchemyIgnoreList21_1},
{"v21.2", "sqlAlchemyBlocklist21_2", sqlAlchemyBlocklist21_2, "sqlAlchemyIgnoreList21_2", sqlAlchemyIgnoreList21_2},
{"v22.1", "sqlAlchemyBlocklist22_1", sqlAlchemyBlocklist22_1, "sqlAlchemyIgnoreList22_1", sqlAlchemyIgnoreList22_1},
}

var sqlAlchemyBlocklist22_1 = blocklist{}

var sqlAlchemyBlocklist21_2 = blocklist{}

var sqlAlchemyBlocklist21_1 = blocklist{}

var sqlAlchemyBlocklist20_2 = blocklist{}

var sqlAlchemyIgnoreList22_1 = sqlAlchemyIgnoreList21_2

var sqlAlchemyIgnoreList21_2 = sqlAlchemyIgnoreList21_1

var sqlAlchemyIgnoreList21_1 = sqlAlchemyIgnoreList20_2
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/sqlliveness/slstorage/slstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,15 @@ func (s *Storage) Update(
) (sessionExists bool, err error) {
err = s.db.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error {
k := s.makeSessionKey(sid)
kv, err := s.db.Get(ctx, k)
kv, err := txn.Get(ctx, k)
if err != nil {
return err
}
if sessionExists = kv.Value != nil; !sessionExists {
return nil
}
v := encodeValue(expiration)
return s.db.Put(ctx, k, &v)
return txn.Put(ctx, k, &v)
})
if err != nil || !sessionExists {
s.metrics.WriteFailures.Inc(1)
Expand Down
89 changes: 89 additions & 0 deletions pkg/sql/sqlliveness/slstorage/slstorage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,95 @@ func TestConcurrentAccessSynchronization(t *testing.T) {
})
}

// TestDeleteMidUpdateFails ensures that a session removed while it attempts to
// update itself fails.
func TestDeleteMidUpdateFails(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)

ctx := context.Background()
type filterFunc = func(context.Context, roachpb.BatchRequest, *roachpb.BatchResponse) *roachpb.Error
var respFilter atomic.Value
respFilter.Store(filterFunc(nil))
s, sqlDB, kvDB := serverutils.StartServer(t, base.TestServerArgs{
Knobs: base.TestingKnobs{
Store: &kvserver.StoreTestingKnobs{
TestingResponseFilter: func(
ctx context.Context, request roachpb.BatchRequest, resp *roachpb.BatchResponse,
) *roachpb.Error {
if f := respFilter.Load().(filterFunc); f != nil {
return f(ctx, request, resp)
}
return nil
},
},
},
})
defer s.Stopper().Stop(ctx)
tdb := sqlutils.MakeSQLRunner(sqlDB)

// Set up a fake storage implementation using a separate table.
dbName := t.Name()
tdb.Exec(t, `CREATE DATABASE "`+dbName+`"`)
schema := strings.Replace(systemschema.SqllivenessTableSchema,
`CREATE TABLE system.sqlliveness`,
`CREATE TABLE "`+dbName+`".sqlliveness`, 1)
tdb.Exec(t, schema)
tableID := getTableID(t, tdb, dbName, "sqlliveness")

storage := slstorage.NewTestingStorage(
s.Stopper(), s.Clock(), kvDB, keys.SystemSQLCodec, s.ClusterSettings(),
tableID, timeutil.DefaultTimeSource{}.NewTimer,
)

// Insert a session.
ID := sqlliveness.SessionID("foo")
require.NoError(t, storage.Insert(ctx, ID, s.Clock().Now()))

// Install a filter which will send on this channel when we attempt
// to perform an update after the get has evaluated.
getChan := make(chan chan struct{})
respFilter.Store(func(
ctx context.Context, request roachpb.BatchRequest, _ *roachpb.BatchResponse,
) *roachpb.Error {
if get, ok := request.GetArg(roachpb.Get); !ok || !bytes.HasPrefix(
get.(*roachpb.GetRequest).Key,
keys.SystemSQLCodec.TablePrefix(uint32(tableID)),
) {
return nil
}
respFilter.Store(filterFunc(nil))
unblock := make(chan struct{})
getChan <- unblock
<-unblock
return nil
})

// Launch the update.
type result struct {
exists bool
err error
}
resCh := make(chan result)
go func() {
var res result
res.exists, res.err = storage.Update(ctx, ID, s.Clock().Now())
resCh <- res
}()

// Wait for the update to block.
unblock := <-getChan

// Delete the session being updated.
tdb.Exec(t, `DELETE FROM "`+dbName+`".sqlliveness WHERE true`)

// Unblock the update and ensure that it saw that its session was deleted.
close(unblock)
res := <-resCh
require.False(t, res.exists)
require.NoError(t, res.err)
}

func getTableID(
t *testing.T, db *sqlutils.SQLRunner, dbName, tableName string,
) (tableID descpb.ID) {
Expand Down

0 comments on commit fb0940f

Please sign in to comment.