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

Clear only the current shard's schemacopy rows during schema reload #8519

Merged
merged 4 commits into from
Jul 26, 2021

Conversation

frouioui
Copy link
Member

Description

This pull request makes VTTablet clear only the rows that match the current database name and the updated tables in schemacopy ; instead of clearing all the rows that match the updated tables. This will be useful for @GuptaManan100 when testing the Rails guide against a sharded cluster.

VTTestServer uses a single MySQL instance where the different shards are suffixed in the table_schema column by their name (-80, 80-, etc). Removing all the rows from the schemacopy tables was making the shards not agreeing and made them repetitively send schema updates to VTGate.

After testing VTTestServer with schema tracking enabled: it is preferable to lower the schema update interval in the VTTablets or add multiple timeouts in the Rails test suite.

Related Issue(s)

Resolves #8510

Checklist

  • Tests were added or are not required
  • Documentation was added or is not required

Copy link
Member

@GuptaManan100 GuptaManan100 left a comment

Choose a reason for hiding this comment

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

LGTM!


exec(t, conn, "drop table test_table")

time.Sleep(2 * time.Second)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why this extra sleep?

Copy link
Member Author

Choose a reason for hiding this comment

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

Schema tracking needs enough time to propagate the schema changes implied by DROP TABLE

Copy link
Member Author

Choose a reason for hiding this comment

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

Reload interval is set to 0.1 second, 2 seconds is plenty and should not flake the test

Copy link
Member

Choose a reason for hiding this comment

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

we have assertmatcheswithtimeout for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

The function assertMatchesWithTimeout delays the call to exec while making sure the call does not exceed a certain timeout, the goal of the time.Sleep here is a little different as I am trying to wait after the completion of the exec

@systay systay merged commit 42ef065 into vitessio:main Jul 26, 2021
@systay systay deleted the rails-test-docker branch July 26, 2021 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

schema tracking not working in rails tests
4 participants