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

ddl: fix alter table share rowid bit problem #9868

Merged
merged 19 commits into from Apr 9, 2019

Conversation

Projects
None yet
5 participants
@crazycs520
Copy link
Contributor

crazycs520 commented Mar 22, 2019

What problem does this PR solve?

There is some problem in share rowid bits. Think about follow situation.
The current SHARD_ROW_ID_BITS = 6, then, after alter SHARD_ROW_ID_BITS = 4,

100011 1001100110011001100110011001100110011001100110011001100111

is duplicated with:

1000 111001100110011001100110011001100110011001100110011001100111

What is changed and how it works?

Add a MaxShardRowIDBits to tableInfo to record the max ShardRowIDBits has been used.
Then use MaxShardRowIDBits to check autoID overflow.

Then in upper situation, after SHARD_ROW_ID_BITS = 4, TiDB will also use 6 to check allocateAutoID overflow. then the duplicate ID cannot be insert , because the duplicated ID is overflow with MaxShardRowIDBits=6.

Related Parser PR: pingcap/parser#252, Pleaser merge parser first.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change

Side effects

Related changes

  • Need to cherry-pick to the release branch

crazycs520 added some commits Mar 22, 2019

Show resolved Hide resolved ddl/table.go Outdated
@crazycs520

This comment has been minimized.

Copy link
Contributor Author

crazycs520 commented Mar 26, 2019

Please merge pingcap/parser#252 first.

Show resolved Hide resolved ddl/table.go Outdated
Show resolved Hide resolved ddl/table.go

crazycs520 added some commits Apr 1, 2019

@winkyao
Copy link
Member

winkyao left a comment

LGTM

crazycs520 added some commits Apr 4, 2019

@codecov

This comment has been minimized.

Copy link

codecov bot commented Apr 4, 2019

Codecov Report

Merging #9868 into master will decrease coverage by 0.0181%.
The diff coverage is 58.8235%.

@@               Coverage Diff               @@
##             master     #9868        +/-   ##
===============================================
- Coverage   78.1391%   78.121%   -0.0182%     
===============================================
  Files           405       405                
  Lines         82005     82033        +28     
===============================================
+ Hits          64078     64085         +7     
- Misses        13231     13248        +17     
- Partials       4696      4700         +4
Show resolved Hide resolved table/tables/tables.go Outdated
Show resolved Hide resolved table/tables/tables.go Outdated
Show resolved Hide resolved table/tables/tables.go

@zimulala zimulala added the status/LGT1 label Apr 8, 2019

zimulala and others added some commits Apr 8, 2019

Update table/tables/tables.go
Co-Authored-By: crazycs520 <crazycs520@gmail.com>
@crazycs520

This comment has been minimized.

Copy link
Contributor Author

crazycs520 commented Apr 8, 2019

/run-all-tests

1 similar comment
@crazycs520

This comment has been minimized.

Copy link
Contributor Author

crazycs520 commented Apr 8, 2019

/run-all-tests

Show resolved Hide resolved ddl/table.go Outdated
Show resolved Hide resolved ddl/db_test.go Outdated
Show resolved Hide resolved ddl/db_test.go Outdated
Show resolved Hide resolved ddl/db_test.go Outdated
@tiancaiamao

This comment has been minimized.

Copy link
Contributor

tiancaiamao commented Apr 8, 2019

LGTM
Please add notes about the compatibility, and maybe you need update the document too.

@tiancaiamao tiancaiamao added status/LGT2 and removed status/LGT1 labels Apr 8, 2019

@zimulala
Copy link
Member

zimulala left a comment

LGTM

@zimulala zimulala added status/LGT3 and removed status/LGT2 labels Apr 9, 2019

@zimulala

This comment has been minimized.

Copy link
Member

zimulala commented Apr 9, 2019

/run-all-tests
Please fix the confliction.

@crazycs520

This comment has been minimized.

Copy link
Contributor Author

crazycs520 commented Apr 9, 2019

/run-all-tests

@crazycs520

This comment has been minimized.

Copy link
Contributor Author

crazycs520 commented Apr 9, 2019

/rebuild

@crazycs520 crazycs520 merged commit ed3e265 into pingcap:master Apr 9, 2019

8 checks passed

ci/circleci Your tests passed on CircleCI!
Details
codecov/patch 58.8235% of diff hit (target 0%)
Details
codecov/project 78.121% (-0.0182%) compared to 826c299
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/code_coverage Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.