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

ttl: replace SPLIT AT with SplitTable in tests #86349

Merged
merged 1 commit into from
Aug 18, 2022
Merged

ttl: replace SPLIT AT with SplitTable in tests #86349

merged 1 commit into from
Aug 18, 2022

Conversation

ecwall
Copy link
Contributor

@ecwall ecwall commented Aug 17, 2022

refs #85800
fixes #86376

SPLIT AT was causing occasional test failures if it did not asynchronously
split the range before the TTL job started. SplitTable synchronously splits
the range before the test starts the TTL job.

Release justification: Fix test flake.

Release note: None

@ecwall ecwall requested a review from a team August 17, 2022 23:22
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@ecwall ecwall requested review from rafiss and otan August 18, 2022 00:31
Copy link
Contributor

@otan otan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a follow up should any tests using SPLIT AT use the synchronous version too?

if expectedNumSpanPartitions != 0 {
actualNumSpanPartitions := len(spanPartitions)
if expectedNumSpanPartitions != actualNumSpanPartitions {
return errors.Newf(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make this AssertionFailedf which fails a bit more loudly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good idea

@@ -46,6 +47,8 @@ import (
"github.com/stretchr/testify/require"
)

var zeroDuration time.Duration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if you can make this const - const zeroDuration = time.Duration(0)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like that doesn't help since we would need to assign the const to a var to get its address.

https://stackoverflow.com/questions/35146286/find-address-of-constant-in-go

))

// split table
splitAt := 10_000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make splitAt and rowsPerRange const?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -88,12 +92,18 @@ func newRowLevelTTLTestJobTestHelper(

// As `ALTER TABLE ... SPLIT AT ...` is not supported in multi-tenancy, we
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be a problem i introduced, but this comment seems dated. maybe "we only run tests against a tenant for tests not utilising SPLIT AT". which your change, do multi-tenant tests work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It gives this error

    ttljob_test.go:389: error executing 'SHOW RANGES FROM TABLE tbl': pq: RangeIterator failed to seek to /Meta2/"\x00": rpc error: code = Unauthenticated desc = requested key /Meta2/"\x00" not fully contained in tenant keyspace /Tenant/1{0-1}

RequireMultipleSpanPartitions bool
// ExpectedNumSpanParitions causes the TTL job to fail if it does not match
// the number of DistSQL processors.
ExpectedNumSpanParitions int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Paritions -> Partitions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Goot catch

refs #85800

SPLIT AT was causing occasional test failures if it did not asynchronously
split the range before the TTL job started. SplitTable synchronously splits
the range before the test starts the TTL job.

Release justification: Fix test flake.

Release note: None
@ecwall
Copy link
Contributor Author

ecwall commented Aug 18, 2022

bors r=otan

@ecwall
Copy link
Contributor Author

ecwall commented Aug 18, 2022

in a follow up should any tests using SPLIT AT use the synchronous version too?

Yeah it seems in general tests should be using the synchronous version to make the behavior deterministic.

@craig
Copy link
Contributor

craig bot commented Aug 18, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 18, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 18, 2022

Build succeeded:

@craig craig bot merged commit 6e7e8e9 into cockroachdb:master Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql/ttl/ttljob: TestRowLevelTTLJobRandomEntries failed
3 participants