-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
*: support the TiFlash replica of table #12453
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12453 +/- ##
===========================================
Coverage 80.2271% 80.2271%
===========================================
Files 468 468
Lines 110303 110303
===========================================
Hits 88493 88493
Misses 15085 15085
Partials 6725 6725 |
/run-all-tests |
/rebuild |
if err != nil { | ||
return errors.Trace(infoschema.ErrTableNotExists.GenWithStackByArgs(ident.Schema, ident.Name)) | ||
} | ||
|
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.
How about alter table t_flash set tiflash replica 2 location labels 'a','a';
?
If labels are the same, is it OK?
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.
It's OK. PD will get the same labels and deduplicate.
/run-all-tests |
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.
Rest LGTM
tables := schema.SchemaTables(db.Name) | ||
for _, tbl := range tables { | ||
tblInfo := tbl.Meta() | ||
if tblInfo.TiFlashReplica == nil { |
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.
So TiFlashReplica is in tableInfo, what will happen if tableInfo loses this meta, for example, admin repair table
will reconstruct tableInfo from create table stmt without TiFlashReplica info.
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.
em..., Great question, I have not consider this before...
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-unit-test |
LGTM |
test: 1. create table t(id int); 2. ALTER TABLE t SET TIFLASH REPLICA 3 LOCATION LABELS "rack", "host", "abc"; // model.ActionSetTiFlashReplica 3. curl -X POST -d '{"id":45,"region_count":3,"flash_region_count":3}' https://127.0.0.1:10080/tiflash/replica // model.ActionUpdateTiFlashReplicaStatus 4. performance write on table t and check can still replicate. ref: pingcap/tidb#12453
* Skip the tiflash job. test: 1. create table t(id int); 2. ALTER TABLE t SET TIFLASH REPLICA 3 LOCATION LABELS "rack", "host", "abc"; // model.ActionSetTiFlashReplica 3. curl -X POST -d '{"id":45,"region_count":3,"flash_region_count":3}' https://127.0.0.1:10080/tiflash/replica // model.ActionUpdateTiFlashReplicaStatus 4. performance write on table t and check can still replicate. ref: pingcap/tidb#12453 * Specify status port for tidb * Try repl SetReplicate * check len
test: 1. create table t(id int); 2. ALTER TABLE t SET TIFLASH REPLICA 3 LOCATION LABELS "rack", "host", "abc"; // model.ActionSetTiFlashReplica 3. curl -X POST -d '{"id":45,"region_count":3,"flash_region_count":3}' https://127.0.0.1:10080/tiflash/replica // model.ActionUpdateTiFlashReplicaStatus 4. performance write on table t and check can still replicate. ref: pingcap/tidb#12453
What problem does this PR solve?
Related parser PR: pingcap/parser#564
/flash/replica
http api to query the all table flash replica infos./flash/replica
HTTP API also use to let TiFlash to report the table replica status.What is changed and how it works?
The flash replica information is store in the
tableInfo
, So when set/update the table flash replica information, I use DDL to change thetableInfo
.Check List
Tests
Unit test
Integration test
Manual test (add detailed scripts or steps below)
Code changes
Has exported function/method change
Side effects
Related changes
Release note