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

bugfix: After 1.6.0, auto-increment of oracle pk columns are no longer supported #5288

Merged

Conversation

isharpever
Copy link
Contributor

@isharpever isharpever commented Feb 2, 2023

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

fix:1.6.0~1.6.1,AT模式,当insert语句不包含主键列时,无法获取到oracle的自增主键值。

Ⅱ. Does this pull request fix one issue?

fixes #5264

Ⅲ. Why don't you add test cases (unit test/integration test)?

添加下面几个单测
io.seata.rm.datasource.exec.OracleInsertExecutorTest#testGetPkValues_SinglePk
io.seata.rm.datasource.exec.OracleInsertExecutorTest#testGetPkValues_MultiPk
io.seata.rm.datasource.exec.OracleInsertExecutorTest#testContainsAnyPK

Ⅳ. Describe how to verify it

集成测试验证了下面几种情况

    /*
     * 单主键场景
     * 表: single
     * 列: id, name
     * 主键: id
     */
    // insert columns为空:从插入行获取主键值
    jdbcTemplate.update("insert into single values(1, ?)", name);

    // insert columns包含主键:从插入行获取主键值
    jdbcTemplate.update("insert into single(id, name) values(2, ?)", name);

    // insert columns不是空, 且不包含主键:获取自增值
    jdbcTemplate.update("insert into single(name) values(?)", name);

    /*
     * 多主键场景
     * 表: multi
     * 列: id1, id2, name
     * 联合主键: (id1, id2)
     */
    // insert columns为空:从插入行获取全部主键值
    jdbcTemplate.update("insert into multi values(1, 1, ?)", name);

    // insert columns包含全部主键:从插入行获取全部主键值
    jdbcTemplate.update("insert into multi(id1, id2, name) values(2, 2, ?)", name);

    // insert columns包含部分主键:从插入行获取存在的主键值,其他获取自增值
    jdbcTemplate.update("insert into multi(id1, name) values(3, ?)", name);
    jdbcTemplate.update("insert into multi(id2, name) values(4, ?)", name);

    // insert columns不是空, 且不包含主键:全部主键都获取自增值
    jdbcTemplate.update("insert into multi(name) values(?)", name);

Ⅴ. Special notes for reviews

@funky-eyes funky-eyes added type: bug Category issues or prs related to bug. module/rm-datasource rm-datasource module labels Feb 2, 2023
@funky-eyes funky-eyes added this to the 1.7.0 milestone Feb 2, 2023
@isharpever isharpever force-pushed the fix_1.6.1_oracle_pk_auto_increment branch from d46a927 to 2e49978 Compare February 2, 2023 08:20
@codecov-commenter
Copy link

codecov-commenter commented Feb 2, 2023

Codecov Report

Merging #5288 (aca1764) into develop (cee99cd) will increase coverage by 0.08%.
The diff coverage is 94.73%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #5288      +/-   ##
=============================================
+ Coverage      48.73%   48.81%   +0.08%     
- Complexity      4159     4174      +15     
=============================================
  Files            743      743              
  Lines          26590    26608      +18     
  Branches        3321     3327       +6     
=============================================
+ Hits           12958    12989      +31     
+ Misses         12232    12219      -13     
  Partials        1400     1400              
Impacted Files Coverage Δ
...m/datasource/exec/oracle/OracleInsertExecutor.java 83.78% <94.73%> (+10.09%) ⬆️
...er/src/main/java/io/seata/server/ServerRunner.java 50.00% <0.00%> (-15.39%) ⬇️
...in/java/io/seata/server/session/GlobalSession.java 79.38% <0.00%> (+0.38%) ⬆️
...o/seata/rm/datasource/exec/BaseInsertExecutor.java 62.38% <0.00%> (+0.45%) ⬆️
...erver/storage/file/session/FileSessionManager.java 48.40% <0.00%> (+0.63%) ⬆️
...torage/file/store/FileTransactionStoreManager.java 60.45% <0.00%> (+0.64%) ⬆️
...in/java/io/seata/server/session/BranchSession.java 79.28% <0.00%> (+0.71%) ⬆️
...o/seata/server/session/AbstractSessionManager.java 64.17% <0.00%> (+2.98%) ⬆️
.../java/io/seata/server/coordinator/DefaultCore.java 54.11% <0.00%> (+5.88%) ⬆️

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@l81893521 l81893521 left a comment

Choose a reason for hiding this comment

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

LGTM

isharpever added a commit to isharpever/seata that referenced this pull request Feb 3, 2023
@funky-eyes funky-eyes merged commit 01a1ff9 into apache:develop Feb 3, 2023
l81893521 pushed a commit to l81893521/seata that referenced this pull request Mar 28, 2023
l81893521 pushed a commit to l81893521/seata that referenced this pull request Mar 28, 2023
l81893521 pushed a commit to l81893521/seata that referenced this pull request Mar 28, 2023
l81893521 pushed a commit to l81893521/seata that referenced this pull request Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/rm-datasource rm-datasource module type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants