Skip to content

Instance Crashed when SELECT with group by after the number of rows reaches a certain value. #469

Closed

Description

@MOOS2021

Can be reproduced ?

Yes

Steps:

BlockMaxRows: 1000000,
SegmentMaxBlocks: 8000,

test1000.txt

create table test(a int, b varchar(3),c int);
source test1000.txt
source test1000.txt
...
source test1000.txt

More than 1000 rows, the result it normal.
mysql> select b,sum(c) from test where a>2 and c<1000 group by b order by b;
+------+--------+
| b | sum(c) |
+------+--------+
| a | 8128 |
| b | 70485 |
| c | 42418 |
+------+--------+

More than 10000 rows, lost connection.
mysql> select count() from test;
+----------+
| count(
) |
+----------+
| 12104 |
+----------+
1 row in set (0.12 sec)

mysql> select b,sum(c) from test where a>2 and c<1000 group by b order by b;
ERROR 2013 (HY000): Lost connection to MySQL server during query

The

Expected behavior:

Actual behavior:

Environment:

  • Version or commit-id (e.g. v0.1.0 or 8b23a93):df9b134970edc6e4abcfed5281b8a1b8500a879b
  • Hardware parameters:
  • OS type:
  • Others:

Configuration file:

Additional context:

  • Error message from client:
  • Server log:
  • Other information:

Activity

  1. added
    kind/bug
    on Aug 23, 2021
  2. added this to the v0.1.0 milestone on Aug 23, 2021
  3. yingfeng commented on Aug 23, 2021

    @yingfeng
    Contributor

    Corruption for the system.

    select b,sum(c) from test where a>2 and c<1000 group by b order by b
    

    Log output:

    2021-08-23 20:48:26.037551 I | [Debug0820]query 100113 at epoch 30 start to run
    +++++++++
                            :0 π(a,c,b) -> σ(a > 2 and c < 1000) -> γ([b], [sum(c) -> sum(c)] -> transfer
                    :2 γ([b], [sum(sum(c)) -> sum(c)] -> transfer
            :1 γ([b], [sum(sum(c)) -> sum(c)] -> π(b,sum(c)) -> π(b,sum(c)) -> transfer
    :1 τ([b ASC]) -> sql output
    +++++++++
    panic: runtime error: slice bounds out of range [:2047] with capacity 1024
    
    goroutine 1279 [running]:
    matrixone/pkg/sql/colexec/group.(*Container).fillHashSels(0x0, 0x100006000, {0xc001e0a808, 0x42, 0x7611800}, {0xc000304d68, 0xaf87140, 0x3000007611800})
            /Users/yingfeng/codebase/matrixorigin/yingfeng/matrixone/pkg/sql/colexec/group/group.go:558 +0x46d
    matrixone/pkg/sql/colexec/group.(*Container).unitGroup(0xc0005a1218, 0x8, 0x400, {0xc001e0a808, 0x800000001, 0x8e3}, {0xc000304d68, 0x1, 0x68f8d98}, {0xc00177f040, ...}, ...)
            /Users/yingfeng/codebase/matrixorigin/yingfeng/matrixone/pkg/sql/colexec/group/group.go:484 +0x151
    matrixone/pkg/sql/colexec/group.(*Container).batchGroupSels(0x1, {0xc001e0a808, 0x5e8, 0x8e3}, {0xc000304d68, 0x2, 0x3}, {0xc00177f040, 0x1, 0x1}, ...)
            /Users/yingfeng/codebase/matrixorigin/yingfeng/matrixone/pkg/sql/colexec/group/group.go:469 +0x174
    matrixone/pkg/sql/colexec/group.Call(0xc00017b200, {0x535e6c0, 0xc0005a1200})
            /Users/yingfeng/codebase/matrixorigin/yingfeng/matrixone/pkg/sql/colexec/group/group.go:153 +0x749
    matrixone/pkg/vm.Run({0xc001fabc80, 0x4, 0x3}, 0x3)
            /Users/yingfeng/codebase/matrixorigin/yingfeng/matrixone/pkg/vm/vm.go:35 +0x94
    matrixone/pkg/vm/pipeline.(*Pipeline).Run(0xc001c79e78, {0xc0024b5b00, 0x1, 0x1}, 0xc00017b200)
            /Users/yingfeng/codebase/matrixorigin/yingfeng/matrixone/pkg/vm/pipeline/pipeline.go:62 +0x33b
    matrixone/pkg/sql/compile.(*Scope).Run(0xc000664e80, {0x591b398, 0xc0000aa450})
            /Users/yingfeng/codebase/matrixorigin/yingfeng/matrixone/pkg/sql/compile/scope.go:62 +0x6b9
    matrixone/pkg/sql/compile.(*Scope).MergeRun.func1(0x0)
            /Users/yingfeng/codebase/matrixorigin/yingfeng/matrixone/pkg/sql/compile/scope.go:77 +0x33
    
  4. added
    severity/s0
    and removed on Aug 23, 2021
  5. linked a pull request that will close this issueAdd batch shuffle #476on Aug 24, 2021
  6. MOOS2021 commented on Aug 24, 2021

    @MOOS2021
    ContributorAuthor

    fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions