Loading mysql-test/r/partition.result +22 −0 Original line number Diff line number Diff line Loading @@ -278,3 +278,25 @@ partition p1 values in (14) insert into t1 values (10,1); ERROR HY000: Table has no partition for value 11 drop table t1; create table t1 (f1 integer,f2 integer, f3 varchar(10), primary key(f1,f2)) partition by range(f1) subpartition by hash(f2) subpartitions 2 (partition p1 values less than (0), partition p2 values less than (2), partition p3 values less than (2147483647)); insert into t1 values(10,10,'10'); insert into t1 values(2,2,'2'); select * from t1 where f1 = 2; f1 f2 f3 2 2 2 drop table t1; create table t1 (f1 integer,f2 integer, unique index(f1)) partition by range(f1 div 2) subpartition by hash(f1) subpartitions 2 (partition partb values less than (2), partition parte values less than (4), partition partf values less than (10000)); insert into t1 values(10,1); select * from t1 where f1 = 10; f1 f2 10 1 drop table t1; mysql-test/r/sp-code.result +2 −2 Original line number Diff line number Diff line Loading @@ -155,11 +155,11 @@ Pos Instruction 0 stmt 9 "drop temporary table if exists sudoku..." 1 stmt 1 "create temporary table sudoku_work ( ..." 2 stmt 1 "create temporary table sudoku_schedul..." 3 stmt 94 "call sudoku_init(" 3 stmt 95 "call sudoku_init(" 4 jump_if_not 7(8) p_naive@0 5 stmt 4 "update sudoku_work set cnt = 0 where ..." 6 jump 8 7 stmt 94 "call sudoku_count(" 7 stmt 95 "call sudoku_count(" 8 stmt 6 "insert into sudoku_schedule (row,col)..." 9 set v_scounter@2 0 10 set v_i@3 1 Loading mysql-test/t/disabled.def +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ rpl_until : Unstable test case, bug#15886 sp-goto : GOTO is currently is disabled - will be fixed in the future subselect : Bug#15706 (ps mode) [PATCH PENDING] rpl_ndb_log : result not deterministic sp-code : Bug #17360 binlog_row_mix_innodb_myisam : Bug #17386 binlog_row_insert_select : Bug #17385 rpl_row_basic_2myisam : Bug #17385 Loading mysql-test/t/partition.test +27 −0 Original line number Diff line number Diff line Loading @@ -353,3 +353,30 @@ insert into t1 values (10,1); drop table t1; # # Bug#16901 Partitions: crash, SELECT, column of part. # function=first column of primary key # create table t1 (f1 integer,f2 integer, f3 varchar(10), primary key(f1,f2)) partition by range(f1) subpartition by hash(f2) subpartitions 2 (partition p1 values less than (0), partition p2 values less than (2), partition p3 values less than (2147483647)); insert into t1 values(10,10,'10'); insert into t1 values(2,2,'2'); select * from t1 where f1 = 2; drop table t1; # # Bug #16907 Partitions: crash, SELECT goes into last partition, UNIQUE INDEX # create table t1 (f1 integer,f2 integer, unique index(f1)) partition by range(f1 div 2) subpartition by hash(f1) subpartitions 2 (partition partb values less than (2), partition parte values less than (4), partition partf values less than (10000)); insert into t1 values(10,1); select * from t1 where f1 = 10; drop table t1; sql/ha_ndbcluster.cc +45 −0 Original line number Diff line number Diff line Loading @@ -2198,6 +2198,7 @@ int ha_ndbcluster::full_table_scan(byte *buf) int res; NdbScanOperation *op; NdbTransaction *trans= m_active_trans; part_id_range part_spec; DBUG_ENTER("full_table_scan"); DBUG_PRINT("enter", ("Starting new scan on %s", m_tabname)); Loading @@ -2209,6 +2210,35 @@ int ha_ndbcluster::full_table_scan(byte *buf) op->readTuples(lm, 0, parallelism)) ERR_RETURN(trans->getNdbError()); m_active_cursor= op; if (m_use_partition_function) { part_spec.start_part= 0; part_spec.end_part= get_tot_partitions(m_part_info) - 1; prune_partition_set(table, &part_spec); DBUG_PRINT("info", ("part_spec.start_part = %u, part_spec.end_part = %u", part_spec.start_part, part_spec.end_part)); /* If partition pruning has found no partition in set we can return HA_ERR_END_OF_FILE If partition pruning has found exactly one partition in set we can optimize scan to run towards that partition only. */ if (part_spec.start_part > part_spec.end_part) { DBUG_RETURN(HA_ERR_END_OF_FILE); } else if (part_spec.start_part == part_spec.end_part) { /* Only one partition is required to scan, if sorted is required we don't need it any more since output from one ordered partitioned index is always sorted. */ m_active_cursor->setPartitionId(part_spec.start_part); } } if (generate_scan_filter(m_cond_stack, op)) DBUG_RETURN(ndb_err(trans)); if ((res= define_read_attrs(buf, op))) Loading Loading @@ -3012,6 +3042,14 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, if (m_use_partition_function) { get_partition_set(table, buf, active_index, start_key, &part_spec); DBUG_PRINT("info", ("part_spec.start_part = %u, part_spec.end_part = %u", part_spec.start_part, part_spec.end_part)); /* If partition pruning has found no partition in set we can return HA_ERR_END_OF_FILE If partition pruning has found exactly one partition in set we can optimize scan to run towards that partition only. */ if (part_spec.start_part > part_spec.end_part) { DBUG_RETURN(HA_ERR_END_OF_FILE); Loading @@ -3026,6 +3064,7 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, sorted= FALSE; } } m_write_op= FALSE; switch (type){ case PRIMARY_KEY_ORDERED_INDEX: Loading Loading @@ -7003,6 +7042,12 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, get_partition_set(table, curr, active_index, &multi_range_curr->start_key, &part_spec); DBUG_PRINT("info", ("part_spec.start_part = %u, part_spec.end_part = %u", part_spec.start_part, part_spec.end_part)); /* If partition pruning has found no partition in set we can skip this scan */ if (part_spec.start_part > part_spec.end_part) { /* Loading Loading
mysql-test/r/partition.result +22 −0 Original line number Diff line number Diff line Loading @@ -278,3 +278,25 @@ partition p1 values in (14) insert into t1 values (10,1); ERROR HY000: Table has no partition for value 11 drop table t1; create table t1 (f1 integer,f2 integer, f3 varchar(10), primary key(f1,f2)) partition by range(f1) subpartition by hash(f2) subpartitions 2 (partition p1 values less than (0), partition p2 values less than (2), partition p3 values less than (2147483647)); insert into t1 values(10,10,'10'); insert into t1 values(2,2,'2'); select * from t1 where f1 = 2; f1 f2 f3 2 2 2 drop table t1; create table t1 (f1 integer,f2 integer, unique index(f1)) partition by range(f1 div 2) subpartition by hash(f1) subpartitions 2 (partition partb values less than (2), partition parte values less than (4), partition partf values less than (10000)); insert into t1 values(10,1); select * from t1 where f1 = 10; f1 f2 10 1 drop table t1;
mysql-test/r/sp-code.result +2 −2 Original line number Diff line number Diff line Loading @@ -155,11 +155,11 @@ Pos Instruction 0 stmt 9 "drop temporary table if exists sudoku..." 1 stmt 1 "create temporary table sudoku_work ( ..." 2 stmt 1 "create temporary table sudoku_schedul..." 3 stmt 94 "call sudoku_init(" 3 stmt 95 "call sudoku_init(" 4 jump_if_not 7(8) p_naive@0 5 stmt 4 "update sudoku_work set cnt = 0 where ..." 6 jump 8 7 stmt 94 "call sudoku_count(" 7 stmt 95 "call sudoku_count(" 8 stmt 6 "insert into sudoku_schedule (row,col)..." 9 set v_scounter@2 0 10 set v_i@3 1 Loading
mysql-test/t/disabled.def +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ rpl_until : Unstable test case, bug#15886 sp-goto : GOTO is currently is disabled - will be fixed in the future subselect : Bug#15706 (ps mode) [PATCH PENDING] rpl_ndb_log : result not deterministic sp-code : Bug #17360 binlog_row_mix_innodb_myisam : Bug #17386 binlog_row_insert_select : Bug #17385 rpl_row_basic_2myisam : Bug #17385 Loading
mysql-test/t/partition.test +27 −0 Original line number Diff line number Diff line Loading @@ -353,3 +353,30 @@ insert into t1 values (10,1); drop table t1; # # Bug#16901 Partitions: crash, SELECT, column of part. # function=first column of primary key # create table t1 (f1 integer,f2 integer, f3 varchar(10), primary key(f1,f2)) partition by range(f1) subpartition by hash(f2) subpartitions 2 (partition p1 values less than (0), partition p2 values less than (2), partition p3 values less than (2147483647)); insert into t1 values(10,10,'10'); insert into t1 values(2,2,'2'); select * from t1 where f1 = 2; drop table t1; # # Bug #16907 Partitions: crash, SELECT goes into last partition, UNIQUE INDEX # create table t1 (f1 integer,f2 integer, unique index(f1)) partition by range(f1 div 2) subpartition by hash(f1) subpartitions 2 (partition partb values less than (2), partition parte values less than (4), partition partf values less than (10000)); insert into t1 values(10,1); select * from t1 where f1 = 10; drop table t1;
sql/ha_ndbcluster.cc +45 −0 Original line number Diff line number Diff line Loading @@ -2198,6 +2198,7 @@ int ha_ndbcluster::full_table_scan(byte *buf) int res; NdbScanOperation *op; NdbTransaction *trans= m_active_trans; part_id_range part_spec; DBUG_ENTER("full_table_scan"); DBUG_PRINT("enter", ("Starting new scan on %s", m_tabname)); Loading @@ -2209,6 +2210,35 @@ int ha_ndbcluster::full_table_scan(byte *buf) op->readTuples(lm, 0, parallelism)) ERR_RETURN(trans->getNdbError()); m_active_cursor= op; if (m_use_partition_function) { part_spec.start_part= 0; part_spec.end_part= get_tot_partitions(m_part_info) - 1; prune_partition_set(table, &part_spec); DBUG_PRINT("info", ("part_spec.start_part = %u, part_spec.end_part = %u", part_spec.start_part, part_spec.end_part)); /* If partition pruning has found no partition in set we can return HA_ERR_END_OF_FILE If partition pruning has found exactly one partition in set we can optimize scan to run towards that partition only. */ if (part_spec.start_part > part_spec.end_part) { DBUG_RETURN(HA_ERR_END_OF_FILE); } else if (part_spec.start_part == part_spec.end_part) { /* Only one partition is required to scan, if sorted is required we don't need it any more since output from one ordered partitioned index is always sorted. */ m_active_cursor->setPartitionId(part_spec.start_part); } } if (generate_scan_filter(m_cond_stack, op)) DBUG_RETURN(ndb_err(trans)); if ((res= define_read_attrs(buf, op))) Loading Loading @@ -3012,6 +3042,14 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, if (m_use_partition_function) { get_partition_set(table, buf, active_index, start_key, &part_spec); DBUG_PRINT("info", ("part_spec.start_part = %u, part_spec.end_part = %u", part_spec.start_part, part_spec.end_part)); /* If partition pruning has found no partition in set we can return HA_ERR_END_OF_FILE If partition pruning has found exactly one partition in set we can optimize scan to run towards that partition only. */ if (part_spec.start_part > part_spec.end_part) { DBUG_RETURN(HA_ERR_END_OF_FILE); Loading @@ -3026,6 +3064,7 @@ int ha_ndbcluster::read_range_first_to_buf(const key_range *start_key, sorted= FALSE; } } m_write_op= FALSE; switch (type){ case PRIMARY_KEY_ORDERED_INDEX: Loading Loading @@ -7003,6 +7042,12 @@ ha_ndbcluster::read_multi_range_first(KEY_MULTI_RANGE **found_range_p, get_partition_set(table, curr, active_index, &multi_range_curr->start_key, &part_spec); DBUG_PRINT("info", ("part_spec.start_part = %u, part_spec.end_part = %u", part_spec.start_part, part_spec.end_part)); /* If partition pruning has found no partition in set we can skip this scan */ if (part_spec.start_part > part_spec.end_part) { /* Loading