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

cdc: Test for falling behind schema TTL #31020

Merged
merged 1 commit into from
Oct 9, 2018

Conversation

mrtracy
Copy link
Contributor

@mrtracy mrtracy commented Oct 5, 2018

Add a test that ensures that changefeeds properly exit if they fall far
enough behind that schema information has been lost due to the GC TTL
(that is, a historical row version can no longer be read because the
schema at its timestamp has been garbage collected).

I have also discovered why the sister test (for the table TTL, not the
schema) required a 3 second sleep: the GC queue enforces that replicas
must have an appropriately high "score" before being GCed, even when the
"shouldQueue" process is skipped. To get around this, I have changed
"ManuallyEnqueueSpan" to a more explicit "ManuallyGCSpan", which
directly calls the processing implementation of the gcQueue on the
appropriate replicas. Both that sister test, and the new schema TTL
test, now only require a more predictable 1 second sleep.

Resolves #28644

Release note: None

@mrtracy mrtracy requested review from danhhz and a team October 5, 2018 18:19
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@mrtracy mrtracy force-pushed the mtracy/cdc_schema_ttl_test branch from 25dd012 to fe51cfc Compare October 6, 2018 07:06
Copy link
Contributor

@danhhz danhhz left a comment

Choose a reason for hiding this comment

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

:lgtm: very nice!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/ccl/changefeedccl/helpers_test.go, line 706 at r1 (raw file):

	sqlDB *sqlutils.SQLRunner,
	database, table string,
) {

probably want a t.Helper() at the beginning of this


pkg/ccl/changefeedccl/helpers_test.go, line 711 at r1 (raw file):

		stmt = `ALTER DATABASE system CONFIGURE ZONE USING gc.ttlseconds = $1`
	} else {
		fmt.Sprintf(`ALTER TABLE %s.%s CONFIGURE ZONE USING gc.ttlseconds = $1`, database, table)

the result of this Sprintf call seems unused

@mrtracy mrtracy force-pushed the mtracy/cdc_schema_ttl_test branch 2 times, most recently from be8f460 to a006390 Compare October 8, 2018 20:06
Copy link
Contributor Author

@mrtracy mrtracy left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/ccl/changefeedccl/helpers_test.go, line 706 at r1 (raw file):

Previously, danhhz (Daniel Harrison) wrote…

probably want a t.Helper() at the beginning of this

Done.


pkg/ccl/changefeedccl/helpers_test.go, line 711 at r1 (raw file):

Previously, danhhz (Daniel Harrison) wrote…

the result of this Sprintf call seems unused

You're correct, and so is the linter/failing tests.

Copy link
Contributor Author

@mrtracy mrtracy left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/ccl/changefeedccl/helpers_test.go, line 711 at r1 (raw file):

Previously, mrtracy (Matt Tracy) wrote…

You're correct, and so is the linter/failing tests.

Done.

@vivekmenezes
Copy link
Contributor

I believe the change to store.go to run a GC is unnecessary. See TestIndexBackfillAfterGC

@mrtracy
Copy link
Contributor Author

mrtracy commented Oct 9, 2018

Hah, thanks Vivek, wish I had found that earlier! I did not think to look for a request, I was only looking for test hooks.

This actually means the tests do not need the sleep at all, that's 4 total seconds of test time back. Nice! Finishing up the change now.

@mrtracy mrtracy force-pushed the mtracy/cdc_schema_ttl_test branch from a006390 to a504908 Compare October 9, 2018 07:12
Add a test that ensures that changefeeds properly exit if they fall far
enough behind that schema information has been lost due to the GC TTL
(that is, a historical row version can no longer be read because the
schema at its timestamp has been garbage collected).

I have also discovered why the sister test (for the table TTL, not the
schema) required a 3 second sleep: the GC queue enforces that replicas
must have an appropriately high "score" before being GCed, even when the
"shouldQueue" process is skipped. I have swapped to using the
"ManuallyEnqueue" method to force the GC, and instead use the already
existing GCRequest request type to force a GC of the table; as a result
the tests no longer require any sleep.

Resolves cockroachdb#28644

Release note: None
@mrtracy mrtracy force-pushed the mtracy/cdc_schema_ttl_test branch from a504908 to 4cab780 Compare October 9, 2018 18:40
@mrtracy
Copy link
Contributor Author

mrtracy commented Oct 9, 2018

bors r=danhhz

craig bot pushed a commit that referenced this pull request Oct 9, 2018
30566: sql: asynchronously drop non-interleaved indexes r=eriktrinh a=eriktrinh

This change drops non-interleaved indexes asynchronously by performing
the deletion of data using an asynchronous schema changer. This is in
preparation to eventually remove index data using `ClearRange` after the
GC TTL period has passed. The initial schema changer runs through the
state machine but does not perform the deletion of index data. Instead
the mutation is moved to a separate list and has a timestamp attached.
The created asynchronous schema changer uses the timestamp and index's
configured GC TTL value to determine when it should begin execution and
actually truncate the index.

When the async schema changer deletes the index data two things occur:
the job is marked as succeeded and the index zone config is removed.

The job can immediately be marked as succeeded because currently a
separate job is created for each index that is dropped.

Interleaved indexes are unaffected and have their data deleted
immediately.

Related to #20696

Fixes #28859.

31020: cdc: Test for falling behind schema TTL r=danhhz a=mrtracy

Add a test that ensures that changefeeds properly exit if they fall far
enough behind that schema information has been lost due to the GC TTL
(that is, a historical row version can no longer be read because the
schema at its timestamp has been garbage collected).

I have also discovered why the sister test (for the table TTL, not the
schema) required a 3 second sleep: the GC queue enforces that replicas
must have an appropriately high "score" before being GCed, even when the
"shouldQueue" process is skipped. To get around this, I have changed
"ManuallyEnqueueSpan" to a more explicit "ManuallyGCSpan", which
directly calls the processing implementation of the gcQueue on the
appropriate replicas. Both that sister test, and the new schema TTL
test, now only require a more predictable 1 second sleep.

Resolves #28644

Release note: None

31152: changefeedccl: fix TestAvroSchema/DECIMAL flake r=mrtracy a=danhhz

The precision is really meant to be in [1,10], but it sure looks like
there's an off by one error in the avro library that makes this test
flake if it picks precision of 1.

Release note: None

31154: kubernetes: Add multiregion channel, add channel to daemonset configs r=a-robinson a=a-robinson

Release note: None

Fixes #31144

Co-authored-by: Erik Trinh <[email protected]>
Co-authored-by: Matt Tracy <[email protected]>
Co-authored-by: Daniel Harrison <[email protected]>
Co-authored-by: Alex Robinson <[email protected]>
@craig
Copy link
Contributor

craig bot commented Oct 9, 2018

Build succeeded

@craig craig bot merged commit 4cab780 into cockroachdb:master Oct 9, 2018
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.

4 participants