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

fix(tianmu): AUTO_INCREMENT of the Primary Key with tianmu occurs the problem of max value about data type(#1046) #1144

Merged
merged 3 commits into from
Dec 20, 2022

Conversation

isredstar
Copy link
Collaborator

@isredstar isredstar commented Dec 18, 2022

Summary about this PR

Issue Number: close #1046

Analysis: When the auto-increment obtained is greater than the maximum value of the data type, the inserted data will become negative. According to the debugging analysis of the code, it is found that the auto-increment maximum value obtained is not compared with the maximum value that the type can store, so the value overflow occurs.
Solution: Compare the type maximum value with auto-increment value. When the auto-increment value is less than the maximum value, it can be inserted normally. When the auto-increment value is is greater than the maximum value, it will report the error of primary key conflict.
main fix: if auto_inc_value < max_value, return auto_inc_value else return max_value,also consider the unsigned auto_increment column and primary key conflict.

Tests Check List

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Changelog

  • [] New Feature
  • Bug Fix
  • Performance Improvement
  • Build/Testing/CI/CD
  • Documentation
  • Not for changelog (changelog entry is not required)

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features

@isredstar isredstar added A-bug Something isn't working C-stonedb-5.7 associated with stonedb 5.7 labels Dec 18, 2022
@isredstar isredstar added this to the stonedb_5.7_v1.0.2 milestone Dec 18, 2022
@isredstar isredstar self-assigned this Dec 18, 2022
@isredstar isredstar requested review from RingsC, lujiashun, hustjieke and duanfuxiang0 and removed request for RingsC and lujiashun December 18, 2022 14:01
@mergify
Copy link
Contributor

mergify bot commented Dec 18, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the PR-bug bug for pull request label Dec 18, 2022
Copy link

@lujiashun lujiashun left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Dec 18, 2022

Codecov Report

Base: 42.73% // Head: 42.73% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (81c921c) compared to base (863cebc).
Patch coverage: 91.66% of modified lines in pull request are covered.

Additional details and impacted files
@@               Coverage Diff                @@
##           stonedb-5.7-dev    #1144   +/-   ##
================================================
  Coverage            42.73%   42.73%           
================================================
  Files                 1830     1830           
  Lines               395970   395989   +19     
================================================
+ Hits                169223   169233   +10     
- Misses              226747   226756    +9     
Impacted Files Coverage Δ
storage/tianmu/common/common_definitions.h 84.21% <ø> (ø)
storage/tianmu/core/column_type.h 64.70% <50.00%> (-0.61%) ⬇️
storage/tianmu/core/tianmu_table.cpp 47.90% <77.77%> (+<0.01%) ⬆️
storage/tianmu/core/column_share.h 100.00% <100.00%> (ø)
storage/tianmu/core/tianmu_attr.h 82.22% <100.00%> (+4.59%) ⬆️
storage/tianmu/loader/load_parser.cpp 63.39% <100.00%> (ø)
storage/innobase/include/ut0mutex.ic 52.38% <0.00%> (-19.05%) ⬇️
storage/innobase/row/row0umod.cc 62.50% <0.00%> (-4.17%) ⬇️
storage/innobase/btr/btr0bulk.cc 80.89% <0.00%> (-0.96%) ⬇️
sql/sql_profile.cc 10.30% <0.00%> (-0.43%) ⬇️
... and 19 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mergify mergify bot merged commit 263104e into stoneatom:stonedb-5.7-dev Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working C-stonedb-5.7 associated with stonedb 5.7 PR-bug bug for pull request
Projects
Development

Successfully merging this pull request may close these issues.

bug: AUTO_INCREMENT of the Primary Key with tianmu occurs the problem of max value about data type
3 participants