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

Display mDDLTableVersion in mysql.tidb table #39778

Closed
Defined2014 opened this issue Dec 9, 2022 · 6 comments · Fixed by #47900
Closed

Display mDDLTableVersion in mysql.tidb table #39778

Defined2014 opened this issue Dec 9, 2022 · 6 comments · Fixed by #47900
Assignees
Labels
affects-7.5 component/ddl This issue is related to DDL of TiDB. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/moderate type/bug The issue is confirmed as a bug. type/enhancement The issue or PR belongs to an enhancement.

Comments

@Defined2014
Copy link
Contributor

Enhancement

We add mDDLTableVersion to control ddl related version update, like concurrency ddl and MDL. But it's hard to get current value by SQL now. I think we could display mDDLTableVersion in mysql.tidb just like currentBootstrapVersion.

@Defined2014 Defined2014 added type/enhancement The issue or PR belongs to an enhancement. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. labels Dec 9, 2022
@xinxiao
Copy link

xinxiao commented Jan 3, 2023

/assign

@ivange94
Copy link

ivange94 commented Jul 8, 2023

@xinxiao are you still working on this? I wanted to have a look if you aren't.

@Defined2014 is this issue still relevant? I see that it's now 7 months old. And there's this function that checks the mDDLTableVersion which is also tested in bootstrap_test.go. So I'm exactly sure what is required here.

// CheckDDLTableVersion check if the tables related to concurrent DDL exists.
func (m *Meta) CheckDDLTableVersion() (DDLTableVersion, error) {
	v, err := m.txn.Get(mDDLTableVersion)
	if err != nil {
		return -1, errors.Trace(err)
	}
	if string(v) == "" {
		return InitDDLTableVersion, nil
	}
	ver, err := strconv.Atoi(string(v))
	if err != nil {
		return -1, errors.Trace(err)
	}
	return DDLTableVersion(ver), nil
}

@Defined2014
Copy link
Contributor Author

Defined2014 commented Jul 10, 2023

My idea is to display this variable in the mysql.tidb table, just like tidb_server_version shown below, @ivange94

mysql> select * from mysql.tidb;
+-----------------------+----------------+----------------------------------------------------+
| VARIABLE_NAME         | VARIABLE_VALUE | COMMENT                                            |
+-----------------------+----------------+----------------------------------------------------+
| bootstrapped          | True           | Bootstrap flag. Do not delete.                     |
| tidb_server_version   | 169            | Bootstrap version. Do not delete.                  |
| system_tz             | Asia/Shanghai  | TiDB Global System Timezone.                       |
| new_collation_enabled | True           | If the new collations are enabled. Do not edit it. |
+-----------------------+----------------+----------------------------------------------------+
4 rows in set (0.00 sec)

@lkshminarayanan
Copy link
Contributor

/assign

@lkshminarayanan
Copy link
Contributor

@Defined2014 I have raised a PR that implements what you have suggested. Can you review it?

@tangenta
Copy link
Contributor

Add bug label in order to cherry-pick to v7.5.

@jebter jebter added the component/ddl This issue is related to DDL of TiDB. label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.5 component/ddl This issue is related to DDL of TiDB. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. severity/moderate type/bug The issue is confirmed as a bug. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants