Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

support restore view #417

Merged
merged 19 commits into from
Nov 26, 2020
Merged

support restore view #417

merged 19 commits into from
Nov 26, 2020

Conversation

glorv
Copy link
Contributor

@glorv glorv commented Oct 9, 2020

What problem does this PR solve?

support restore view. parcially resolve #297

What is changed and how it works?

  • file routing add a new file type view-schema for view, default routing pattern is {schema}.{table}-schema-view.sql
  • restore view in restoreSchema after all table schemas are restored

NOTE: Currently, we only support the view schema files exported by dumpling like tools. That is, for a table db.tbl, there must exist two schema files:

  • db.tbl-schema.sql. This is for the stub table schema file.
  • db.tbl-schema-view.sql. This is the actual view schema file.

If the stub table schema file does not exist, currently, lightning will report an error and exit directly.

WARN: This pr only handles the name mapping for the view name but not for the table name in the queries in the CREATE VIEW statement.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

Related changes

  • Need to update the documentation
  • Need to be included in the release note

@glorv
Copy link
Contributor Author

glorv commented Oct 10, 2020

/run-all-tests

@glorv glorv added the status/PTAL This PR is ready for review. Add this label back after committing new changes label Oct 12, 2020
Copy link
Collaborator

@kennytm kennytm left a comment

Choose a reason for hiding this comment

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

Rest LGTM

tests/view/run.sh Outdated Show resolved Hide resolved
lightning/restore/restore.go Outdated Show resolved Hide resolved
@kennytm kennytm added status/LGT1 One reviewer already commented LGTM (LGTM1) and removed status/PTAL This PR is ready for review. Add this label back after committing new changes labels Nov 2, 2020
@glorv glorv added this to the 4.0.9 milestone Nov 23, 2020
lightning/restore/tidb.go Show resolved Hide resolved
lightning/restore/tidb.go Outdated Show resolved Hide resolved
Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

rest LGTM

lichunzhu
lichunzhu previously approved these changes Nov 25, 2020
Copy link
Contributor

@lichunzhu lichunzhu left a comment

Choose a reason for hiding this comment

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

LGTM

@lichunzhu lichunzhu dismissed their stale review November 25, 2020 11:32

waiting comment to be addressed

@glorv glorv added status/LGT2 Two reviewers already commented LGTM, ready for merge (LGTM2) and removed status/LGT1 One reviewer already commented LGTM (LGTM1) labels Nov 26, 2020
@glorv glorv merged commit fbb62fa into master Nov 26, 2020
@glorv glorv deleted the support-view branch November 26, 2020 03:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/LGT2 Two reviewers already commented LGTM, ready for merge (LGTM2)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support restoring VIEWs and SEQUENCEs
5 participants