-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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.
#13418
Conversation
// - "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{} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djshow832 I suggest changing the return type to string and returning "NIL" if it's not suitable.
Why this is better?
I still prefer to nil
because it will be converted as NULL
of MySQL, but string "nil"
will not.
PTAL @djshow832 @zimulala @lonng |
Codecov Report
@@ Coverage Diff @@
## master #13418 +/- ##
=========================================
Coverage 80.483% 80.483%
=========================================
Files 472 472
Lines 115920 115920
=========================================
Hits 93296 93296
Misses 15440 15440
Partials 7184 7184 |
92ed26d
to
853850b
Compare
@bb7133 please add some proper labels for this PR. |
Done, thanks for reminding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/run-all-tests |
@bb7133 merge failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/run-unit-test |
What problem does this PR solve?
This PR adds an extra column
TIDB_ROW_ID_SHARDING_INFO
toinformation_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(akaPK_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
Code changes
Side effects
Related changes