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

infoschema: add TIDB_ROW_ID_SHARDING_INFO for table table. #13342

Closed
wants to merge 1 commit into from

Conversation

bb7133
Copy link
Member

@bb7133 bb7133 commented Nov 11, 2019

What problem does this PR solve?

This PR adds an extra column TIDB_ROW_ID_SHARDING_INFO to information_schema.tables table, which gives a brief description of the sharding information of the table:

The description may be:

  • "NOT_SHARDED" for tables that SHARD_ROW_ID_BITS is not specified.
  • "NOT_SHARDED(PK_IS_HANDLE)" for tables that primary key is part of row id(aka PK_IS_HANDLE).
  • "SHARD_BITS={bit_number}": for tables that are defined with SHARD_ROW_ID_BITS.
  • nil: for tables that are not suitable(views, system tables).

What is changed and how it works?

A GetShardingInfo is added to retrieve such information.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change

Side effects

  • Breaking backward compatibility

Related changes

  • Need to update the documentation(4.0 new feature)

@bb7133 bb7133 added type/enhancement The issue or PR belongs to an enhancement. status/DNM labels Nov 11, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 11, 2019

Thanks for your PR.
This PR will be closed by bot because you already had 3 opened PRs, close or merge them before submitting a new one.
#9431 , #12056 , #13329

// - "SHARD_BITS={bit_number}": for tables that with SHARD_ROW_ID_BITS.
// The returned nil indicates that sharding information is not suitable for the table(for example, when the table is a View).
// This function is exported for unit test.
func GetShardingInfo(dbInfo *model.DBInfo, tableInfo *model.TableInfo) interface{} {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest changing the return type to string and returning "NIL" if it's not suitable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants