Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-4278

Select count(*) may leave table in a bad state

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 1.4, 1.5.3
    • 5.4.1
    • MDB Plugin
    • None

    Description

      If @@sql_select_limit is set, followed by a select count, then the following queries may report wrong results. count(<colname>) has the same behavior.

      This behavior is intermittent, meaning it may or may not happen on any given attempt.

      2147483647 is max int32_t.

      MariaDB [tpch1]> set @@sql_select_limit=4;
      Query OK, 0 rows affected (0.001 sec)
       
      MariaDB [tpch1]> create table if not exists bug5054(id int)engine=columnstore; 
      Query OK, 0 rows affected (0.519 sec)
       
      MariaDB [tpch1]> insert into bug5054 values (1),(2),(3),(4),(5),(6),(7),(8); 
      Query OK, 8 rows affected (0.591 sec)
      Records: 8  Duplicates: 0  Warnings: 0
       
      MariaDB [tpch1]> select * from bug5054; 
      +------+
      | id   |
      +------+
      |    1 |
      |    2 |
      |    3 |
      |    4 |
      +------+
      4 rows in set (0.112 sec)  // Only 4 are shown because of sql_select_limit
       
      MariaDB [tpch1]> select count(*) from bug5054; 
      +----------+
      | count(*) |
      +----------+
      |        8 |
      +----------+
      1 row in set (2.384 sec)
       
      MariaDB [tpch1]> select * from bug5054 limit 10; 
      +------+
      | id   |
      +------+
      |    1 |
      |    2 |
      |    3 |
      |    4 |
      |    5 |
      |    6 |
      |    7 |
      |    8 |
      +------+
      8 rows in set (1.774 sec)  // Didn't break this time
       
      MariaDB [tpch1]> select count(*) from bug5054; 
      +----------+
      | count(*) |
      +----------+
      |        8 |
      +----------+
      1 row in set (1.877 sec)
       
      MariaDB [tpch1]> select * from bug5054 limit 10; 
      +------------+
      | id         |
      +------------+
      | 2147483647 |
      | 2147483647 |
      | 2147483647 |
      | 2147483647 |
      | 2147483647 |
      | 2147483647 |
      | 2147483647 |
      | 2147483647 |
      +------------+
      8 rows in set (2.808 sec)
      
      

      ########################################
      At this point, in another console:

      systemctl stop mariadb
      systemctl start mariadb
      
      

      Do not restart mariadb-columnstore.
      Restarting the mysqld process clears up the problem with the table.

      MariaDB [tpch1]> select * from bug5054 limit 10; 
      ERROR 2006 (HY000): MySQL server has gone away
      No connection. Trying to reconnect...
      Connection id:    3
      Current database: tpch1
       
      +------+
      | id   |
      +------+
      |    1 |
      |    2 |
      |    3 |
      |    4 |
      |    5 |
      |    6 |
      |    7 |
      |    8 |
      +------+
      8 rows in set (0.233 sec)
      
      

      Attachments

        Issue Links

          Activity

            People

              dleeyh Daniel Lee (Inactive)
              David.Hall David Hall (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.