[MCOL-3716] Wrong min/max after cpimport which causes wrong select results Created: 2020-01-09  Updated: 2020-11-12  Resolved: 2020-02-10

Status: Closed
Project: MariaDB ColumnStore
Component/s: cpimport
Affects Version/s: 1.2.5
Fix Version/s: 1.2.6, 1.4.3, 1.5.1

Type: Bug Priority: Major
Reporter: Richard Stracke Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 2
Labels: bulk

Sprint: 2020-1, 2020-2

 Description   

If min/max is set cpimport not delete min/max like another write statement and
not updates min/max.

This cause wrong select results , because extent elimination wrongly exclude extents.

Create 2 Files

1 File c1.txt with content

"2019-12"

1 File c2.txt with content

"2020-01"

Execute:

use test;
create table c1 (pf char(7)) engine = columnstore;

Now load file c1.

/usr/local/mariadb/columnstore/bin/cpimport test c1 c1.txt -E \" -C "\\"
/usr/local/mariadb/columnstore/bin/cpimport test c1 c2.txt -E \" -C "\\"

MariaDB [test]> select * from pixid.c1 where pf = "2020-01";
Empty set (0.107 sec)
 
MariaDB [test]> select * from pixid.c1;
+---------+
| pf      |
+---------+
| 2019-12 |
| 2020-01 |
+---------+
2 rows in set (0.037 sec)

Delete and reimport via cpimport will fix it.

delete from pixid.c1 where pf = "2020-01";

/usr/local/mariadb/columnstore/bin/cpimport test c1 c2.txt -E \" -C "\\"

MariaDB [(none)]> use test;
Database changed
MariaDB [test]> select * from c1 where pf = "2020-01";
+---------+
| pf      |
+---------+
| 2020-01 |
+---------+
1 row in set (0.106 sec)

If you do the same with a select after the delete, the reimport will fail.

MariaDB [test]> select * from c1 where pf = "2020-01";
+---------+
| pf      |
+---------+
| 2020-01 |
+---------+
1 row in set (0.106 sec)
 
MariaDB [test]> delete from c1 where pf = "2020-01";
Query OK, 1 row affected (0.437 sec)

reimport with cpimport file c2.txt as above and:

MariaDB [(none)]> use test;
Database changed
MariaDB [test]>  select * from c1 where pf = "2020-01";
Empty set (0.079 sec)
 
MariaDB [test]> select calShowPartitions('c1','pf');
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| calShowPartitions('c1','pf')                                                                                                                                 |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Part#     Min                           Max                           Status
  0.0.2     2019-12                       2019-12                       Enabled |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.002 sec)



 Comments   
Comment by David Hall (Inactive) [ 2020-01-10 ]

Appears to break for char columns. Int Columns behave correctly.

Comment by David Hall (Inactive) [ 2020-01-20 ]

Tested in:
Server version: 10.3.16-MariaDB-debug-log Columnstore 1.2.6-1

Comment by Patrick LeBlanc (Inactive) [ 2020-01-24 ]

Created the PR against develop. Will down-merge into dev-1.2 and 1.4 before the next release.

Comment by Patrick LeBlanc (Inactive) [ 2020-01-24 ]

Oops. Moved the ticket to testing by mistake.

Comment by Patrick LeBlanc (Inactive) [ 2020-01-24 ]

Created a PR for the regression test. Used the sequence I specified above. Verified the test catches the problem.

Comment by Andrew Hutchings (Inactive) [ 2020-01-27 ]

pleblanc should this be marked as "In Review"?

Comment by Daniel Lee (Inactive) [ 2020-02-10 ]

Build verified: 1.4.3-1 source

server
commit 9bd5e14f4de1402c6cd4a3f81564887c1213c9e1

engine
commit 5efa6a4dc52129be2de49fdfc23e44020401b86b

Reproduced the issue in 1.2.5-1 and verified fix in 1.4.3-1

Comment by Daniel Lee (Inactive) [ 2020-02-10 ]

Build verified: 1.2.6-1 source

server
commit d3294cf9c18663673c62532dddaa11369ba184d0

engine
commit 668b23a23c59f6ba4f3aa00b6aa768f5931d59fb

Comment by Daniel Lee (Inactive) [ 2020-02-10 ]

Build verified: 1.5.0-1 source

server
commit 57950ded281731263f6aa358d43c7b9d51f3dbfb

engine
commit 46f30be5561f65eec488d61e011b727ca358720b

Generated at Thu Feb 08 02:44:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.