Commit 396438a8 authored by ram@mysql.r18.ru's avatar ram@mysql.r18.ru

R-tree bug fixes.

parent 0ccb7c37
...@@ -188,6 +188,12 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag) ...@@ -188,6 +188,12 @@ int rtree_find_next(MI_INFO *info, uint keynr, uint search_flag)
uint nod_cmp_flag; uint nod_cmp_flag;
MI_KEYDEF *keyinfo = info->s->keyinfo + keynr; MI_KEYDEF *keyinfo = info->s->keyinfo + keynr;
if (info->update & HA_STATE_DELETED)
{
return rtree_find_first(info, keynr, info->lastkey, info->lastkey_length,
search_flag);
}
if (!info->buff_used) if (!info->buff_used)
{ {
uchar *key = info->int_keypos; uchar *key = info->int_keypos;
...@@ -814,6 +820,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length) ...@@ -814,6 +820,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
goto err1; goto err1;
info->s->state.key_root[keynr] = new_root; info->s->state.key_root[keynr] = new_root;
} }
info->update= HA_STATE_DELETED;
return 0; return 0;
err1: err1:
...@@ -911,7 +918,7 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key, ...@@ -911,7 +918,7 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key,
if (nod_flag) if (nod_flag)
{ {
if (i) if (i)
res = (int)(area / i * info->state->records); res = (ha_rows) (area / i * info->state->records);
else else
res = HA_POS_ERROR; res = HA_POS_ERROR;
} }
......
...@@ -56,6 +56,31 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key, ...@@ -56,6 +56,31 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
pos = ((byte*)mbr) + keyseg->start; pos = ((byte*)mbr) + keyseg->start;
if (keyseg->flag & HA_SWAP_KEY) if (keyseg->flag & HA_SWAP_KEY)
{ {
#ifdef HAVE_ISNAN
if (keyseg->type == HA_KEYTYPE_FLOAT)
{
float nr;
float4get(nr, pos);
if (isnan(nr))
{
/* Replace NAN with zero */
bzero(key, length);
key+= length;
continue;
}
}
else if (keyseg->type == HA_KEYTYPE_DOUBLE)
{
double nr;
float8get(nr, pos);
if (isnan(nr))
{
bzero(key, length);
key+= length;
continue;
}
}
#endif
pos += length; pos += length;
while (length--) while (length--)
{ {
...@@ -99,19 +124,19 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims, ...@@ -99,19 +124,19 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
double *mbr) double *mbr)
{ {
double ord; double ord;
double *mbr_end = mbr + n_dims * 2; double *mbr_end= mbr + n_dims * 2;
while (mbr < mbr_end) while (mbr < mbr_end)
{ {
if ((*wkb) > end - 8) if ((*wkb) > end - 8)
return -1; return -1;
float8get(ord, (*wkb)); float8get(ord, (*wkb));
(*wkb) += 8; (*wkb)+= 8;
if (ord < *mbr) if (ord < *mbr)
*mbr = ord; float8store((char*) mbr, ord);
mbr++; mbr++;
if (ord > *mbr) if (ord > *mbr)
*mbr = ord; float8store((char*) mbr, ord);
mbr++; mbr++;
} }
return 0; return 0;
......
...@@ -4285,7 +4285,7 @@ Field_blob::Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, ...@@ -4285,7 +4285,7 @@ Field_blob::Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
:Field_str(ptr_arg, (1L << min(blob_pack_length,3)*8)-1L, :Field_str(ptr_arg, (1L << min(blob_pack_length,3)*8)-1L,
null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, field_name_arg,
table_arg, cs), table_arg, cs),
packlength(blob_pack_length), geom_flag(true) geom_flag(true), packlength(blob_pack_length)
{ {
flags|= BLOB_FLAG; flags|= BLOB_FLAG;
if (table) if (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