Commit 58443d61 authored by unknown's avatar unknown

Post-review fixes for bug#17899 Partitions: crash, NDB, Select .. ORDER BY

parent 69aa271d
...@@ -55,7 +55,7 @@ INSERT INTO t1 SET f_int1 = -1, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_c ...@@ -55,7 +55,7 @@ INSERT INTO t1 SET f_int1 = -1, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_c
INSERT INTO t1 SET f_int1 = 0, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20==='; INSERT INTO t1 SET f_int1 = 0, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1==='; INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1==='; INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
--error 1505 --error ER_NO_PARTITION_FOR_GIVEN_VALUE
INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1==='; INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
SELECT * FROM t1 ORDER BY f_int1; SELECT * FROM t1 ORDER BY f_int1;
......
...@@ -960,12 +960,8 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, ...@@ -960,12 +960,8 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
int ha_ndbcluster::get_ndb_partition_id(NdbOperation *ndb_op) int ha_ndbcluster::get_ndb_partition_id(NdbOperation *ndb_op)
{ {
DBUG_ENTER("get_ndb_partition_id"); DBUG_ENTER("get_ndb_partition_id");
uint partition_id_fieldnr= table_share->fields + 1; DBUG_RETURN(ndb_op->getValue(NdbDictionary::Column::FRAGMENT,
(char *)&m_part_id) == NULL);
m_value[partition_id_fieldnr].rec=
ndb_op->getValue(NdbDictionary::Column::FRAGMENT,
(char *)&m_part_id);
DBUG_RETURN(m_value[partition_id_fieldnr].rec == NULL);
} }
/* /*
...@@ -3271,7 +3267,7 @@ int ha_ndbcluster::rnd_pos(byte *buf, byte *pos) ...@@ -3271,7 +3267,7 @@ int ha_ndbcluster::rnd_pos(byte *buf, byte *pos)
else else
{ {
key_range key_spec; key_range key_spec;
KEY *key_info= table->key_info + active_index; KEY *key_info= table->key_info + table_share->primary_key;
key_spec.key= pos; key_spec.key= pos;
key_spec.length= key_length; key_spec.length= key_length;
key_spec.flag= HA_READ_KEY_EXACT; key_spec.flag= HA_READ_KEY_EXACT;
...@@ -3298,11 +3294,13 @@ void ha_ndbcluster::position(const byte *record) ...@@ -3298,11 +3294,13 @@ void ha_ndbcluster::position(const byte *record)
KEY_PART_INFO *key_part; KEY_PART_INFO *key_part;
KEY_PART_INFO *end; KEY_PART_INFO *end;
byte *buff; byte *buff;
uint key_length= ref_length; uint key_length;
DBUG_ENTER("position"); DBUG_ENTER("position");
if (table_share->primary_key != MAX_KEY) if (table_share->primary_key != MAX_KEY)
{ {
key_length= ref_length;
key_info= table->key_info + table_share->primary_key; key_info= table->key_info + table_share->primary_key;
key_part= key_info->key_part; key_part= key_info->key_part;
end= key_part + key_info->key_parts; end= key_part + key_info->key_parts;
...@@ -3352,6 +3350,8 @@ void ha_ndbcluster::position(const byte *record) ...@@ -3352,6 +3350,8 @@ void ha_ndbcluster::position(const byte *record)
key_length= ref_length - sizeof(m_part_id); key_length= ref_length - sizeof(m_part_id);
memcpy(ref+key_length, (void *)&m_part_id, sizeof(m_part_id)); memcpy(ref+key_length, (void *)&m_part_id, sizeof(m_part_id));
} }
else
key_length= ref_length;
#ifndef DBUG_OFF #ifndef DBUG_OFF
int hidden_no= table->s->fields; int hidden_no= table->s->fields;
const NDBTAB *tab= (const NDBTAB *) m_table; const NDBTAB *tab= (const NDBTAB *) m_table;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment