Skip to content

[Fix] : replace point locks with table lock in some cases - #15578

Merged
mergify[bot] merged 13 commits into
matrixorigin:mainfrom
jensenojs:fix_moc3006
Apr 18, 2024
Merged

mergify[bot] merged 13 commits into
matrixorigin:mainfrom
jensenojs:fix_moc3006

Conversation

@jensenojs

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #https://github.com/matrixorigin/MO-Cloud/issues/3039 https://github.com/matrixorigin/MO-Cloud/issues/3006

What this PR does / why we need it:

sql like insert into A select * from B, will try to lock the value in B. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Apr 17, 2024
@mergify mergify Bot added the kind/bug Something isn't working label Apr 17, 2024
@jensenojs

jensenojs commented Apr 17, 2024 •

Copy link
Copy Markdown
Contributor Author

本地ci已经过了

alter table add column相关的测试还没有跑完.

目前还有一个场景会遇到这个pr所希望fix的bug

begin;
insert into values xxx
...
...
commit;

当这个insert into values所插入的数据过多的时候, 也会遇到panic too large fixed slice 的问题, 需要讨论一下怎么解决

Comment thread pkg/cnservice/types.go Resolved
Comment thread pkg/sql/plan/build_dml_util.go Resolved
@jensenojs
jensenojs marked this pull request as draft April 18, 2024 03:05
@jensenojs
jensenojs marked this pull request as ready for review April 18, 2024 04:03
@jensenojs
jensenojs requested a review from iamlinjunhong April 18, 2024 06:35
@ouyuanning

Copy link
Copy Markdown
Contributor

本地ci已经过了

alter table add column相关的测试还没有跑完.

目前还有一个场景会遇到这个pr所希望fix的bug

begin;
insert into values xxx
...
...
commit;

当这个insert into values所插入的数据过多的时候, 也会遇到panic too large fixed slice 的问题, 需要讨论一下怎么解决

理论上,最后一次要超过配置锁的数量的那个insert,如果统计信息是准确的,应该也是会转成表锁的。所以感觉当前逻辑应该已经覆盖了。

@jensenojs

Copy link
Copy Markdown
Contributor Author

本地ci已经过了

alter table add column相关的测试还没有跑完.
目前还有一个场景会遇到这个pr所希望fix的bug

begin;
insert into values xxx
...
...
commit;

当这个insert into values所插入的数据过多的时候, 也会遇到panic too large fixed slice 的问题, 需要讨论一下怎么解决

理论上,最后一次要超过配置锁的数量的那个insert,如果统计信息是准确的,应该也是会转成表锁的。所以感觉当前逻辑应该已经覆盖了。

调试了一下, 发现目前这种情况下, insert values xxx走到ifNeedLockWholeTable的时候, lastNode.Stats.OutCnt的结果是0, 这个现象在执行了相当个数的insert values之后仍然存在

@ouyuanning

Copy link
Copy Markdown
Contributor

本地ci已经过了

alter table add column相关的测试还没有跑完.
目前还有一个场景会遇到这个pr所希望fix的bug

begin;
insert into values xxx
...
...
commit;

当这个insert into values所插入的数据过多的时候, 也会遇到panic too large fixed slice 的问题, 需要讨论一下怎么解决

理论上,最后一次要超过配置锁的数量的那个insert,如果统计信息是准确的,应该也是会转成表锁的。所以感觉当前逻辑应该已经覆盖了。

调试了一下, 发现目前这种情况下, insert values xxx走到ifNeedLockWholeTable的时候, lastNode.Stats.OutCnt的结果是0, 这个现象在执行了相当个数的insert values之后仍然存在

提个issue给倪涛帮忙看看吧

@mergify
mergify Bot merged commit 57def8e into matrixorigin:main Apr 18, 2024
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 18, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Approved by: @ouyuanning, @daviszhen, @zhangxu19830126
@jensenojs
jensenojs deleted the fix_moc3006 branch April 19, 2024 06:13
guguducken added a commit that referenced this pull request Apr 19, 2024
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 20, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Approved by: @ouyuanning, @daviszhen, @zhangxu19830126
mergify Bot pushed a commit that referenced this pull request Apr 20, 2024
sukki37 added a commit that referenced this pull request Apr 21, 2024
sukki37 added a commit that referenced this pull request Apr 22, 2024
sukki37 added a commit that referenced this pull request Apr 22, 2024
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 22, 2024
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 25, 2024
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 25, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Previous pr's used the wrong stats, now it's standardized to do the judgement in the last step of building the logic plan.
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 25, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Previous pr's used the wrong stats, now it's standardized to do the judgement in the last step of building the logic plan.
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 25, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Previous pr's used the wrong stats, now it's standardized to do the judgement in the last step of building the logic plan.
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 26, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Previous pr's used the wrong stats, now it's standardized to do the judgement in the last step of building the logic plan.
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 26, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Previous pr's used the wrong stats, now it's standardized to do the judgement in the last step of building the logic plan.
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 26, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Previous pr's used the wrong stats, now it's standardized to do the judgement in the last step of building the logic plan.
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 28, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Previous pr's used the wrong stats, now it's standardized to do the judgement in the last step of building the logic plan.
jensenojs added a commit to jensenojs/matrixone that referenced this pull request Apr 29, 2024
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Previous pr's used the wrong stats, now it's standardized to do the judgement in the last step of building the logic plan.
mergify Bot pushed a commit that referenced this pull request Apr 30, 2024
…15763)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Approved by: @zhangxu19830126, @reusee, @ouyuanning, @daviszhen
fengttt pushed a commit to fengttt/matrixone that referenced this pull request May 7, 2026
…in#15578)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Approved by: @ouyuanning, @daviszhen, @zhangxu19830126
fengttt pushed a commit to fengttt/matrixone that referenced this pull request May 7, 2026
…in#15578) (matrixorigin#15763)

sql like `insert into A select * from B`, will try to lock the value in `B`. When the number of these locks is too much, it will lead to bugs reflected in the issue. In the context of range locks being temporarily unavailable, use table lock to replace point lock

Approved by: @zhangxu19830126, @reusee, @ouyuanning, @daviszhen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants