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

vttablet: create database if not present #6490

Merged
merged 2 commits into from
Aug 1, 2020

Conversation

sougou
Copy link
Contributor

@sougou sougou commented Jul 29, 2020

This change addresses the use where we are initializing an externally managed mysql server, but which is empty. In this case, we should create the database.

I've implemented the db creation in the tabletserver. This means that ISM also does not need to create the database. However, this change causes ISM to hang (waiting for semi-sync) because the db creation happens before the replicas are pointed at the master. To work around this, I've moved the enforcement of semi-sync until after the db is created.

This change opens up two corner cases, both of which are unlikely in a production environment:

  • Between the time that a tablet became master and semi-sync is enforced, an app can rush in and write data that does not meet the durability criteria. This is an unlikely scenario and low risk scenario because we are just initializing the cluster, and everything will converge to the right state after the replicas are wired up.
  • A failure in the operation could result in a tablet being master, but semi-sync not being set. In this case, the ISM command will receive an error. This gives the operator the opportunity for an operator to go remedy the system, ideally by doing another reparent.

Finally, this is temporary. Within the next few PRs, ISM will be replaced by a version that happens automatically within vttablet itself.

This functionality facilitates the use case where we connect to
an externally managed mysql, but whose database has not been
created yet.

If the DB we look for is not found, we can just create it.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
The feature to auo-create the database causes ISM to hang because
it enforces semi-synch before it sets the tablet type.

Enforcing semi-sync after tablet has become master allows the
tabletserver to create the database without getting stuck waiting
for yet-to-be-initialized replicas to ack.

Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
@sougou sougou requested review from enisoc and deepthi July 29, 2020 02:26
@sougou sougou merged commit 108eda8 into vitessio:master Aug 1, 2020
@sougou sougou deleted the ss-ts3-auto-create branch August 1, 2020 22:16
@deepthi deepthi added this to the v8.0 milestone Sep 22, 2020
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.

3 participants