Commit 11384fec authored by svoj@mysql.com/april.(none)'s avatar svoj@mysql.com/april.(none)

Merge mysql.com:/home/svoj/devel/bk/mysql-5.0

into  mysql.com:/home/svoj/devel/mysql/BUG26881/mysql-5.0-engines
parents f3e56b5a 8fb003f5
This diff is collapsed.
...@@ -34,6 +34,7 @@ int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, ...@@ -34,6 +34,7 @@ int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
{ {
uint page_size = mi_getint(page_buf); uint page_size = mi_getint(page_buf);
uint nod_flag = mi_test_if_nod(page_buf); uint nod_flag = mi_test_if_nod(page_buf);
DBUG_ENTER("rtree_add_key");
if (page_size + key_length + info->s->base.rec_reflength <= if (page_size + key_length + info->s->base.rec_reflength <=
keyinfo->block_length) keyinfo->block_length)
...@@ -42,22 +43,26 @@ int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, ...@@ -42,22 +43,26 @@ int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
if (nod_flag) if (nod_flag)
{ {
/* save key */ /* save key */
DBUG_ASSERT(_mi_kpos(nod_flag, key) < info->state->key_file_length);
memcpy(rt_PAGE_END(page_buf), key - nod_flag, key_length + nod_flag); memcpy(rt_PAGE_END(page_buf), key - nod_flag, key_length + nod_flag);
page_size += key_length + nod_flag; page_size += key_length + nod_flag;
} }
else else
{ {
/* save key */ /* save key */
DBUG_ASSERT(_mi_dpos(info, nod_flag, key + key_length +
info->s->base.rec_reflength) <
info->state->data_file_length + info->s->base.pack_reclength);
memcpy(rt_PAGE_END(page_buf), key, key_length + memcpy(rt_PAGE_END(page_buf), key, key_length +
info->s->base.rec_reflength); info->s->base.rec_reflength);
page_size += key_length + info->s->base.rec_reflength; page_size += key_length + info->s->base.rec_reflength;
} }
mi_putint(page_buf, page_size, nod_flag); mi_putint(page_buf, page_size, nod_flag);
return 0; DBUG_RETURN(0);
} }
return (rtree_split_page(info, keyinfo, page_buf, key, key_length, DBUG_RETURN((rtree_split_page(info, keyinfo, page_buf, key, key_length,
new_page) ? -1 : 1); new_page) ? -1 : 1));
} }
/* /*
...@@ -89,11 +94,13 @@ int rtree_delete_key(MI_INFO *info, uchar *page_buf, uchar *key, ...@@ -89,11 +94,13 @@ int rtree_delete_key(MI_INFO *info, uchar *page_buf, uchar *key,
int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, my_off_t child_page) uint key_length, my_off_t child_page)
{ {
DBUG_ENTER("rtree_set_key_mbr");
if (!_mi_fetch_keypage(info, keyinfo, child_page, if (!_mi_fetch_keypage(info, keyinfo, child_page,
DFLT_INIT_HITS, info->buff, 0)) DFLT_INIT_HITS, info->buff, 0))
return -1; DBUG_RETURN(-1); /* purecov: inspected */
return rtree_page_mbr(info, keyinfo->seg, info->buff, key, key_length); DBUG_RETURN(rtree_page_mbr(info, keyinfo->seg, info->buff, key, key_length));
} }
#endif /*HAVE_RTREE_KEYS*/ #endif /*HAVE_RTREE_KEYS*/
...@@ -264,13 +264,15 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key, ...@@ -264,13 +264,15 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
uint full_length= key_length + (nod_flag ? nod_flag : uint full_length= key_length + (nod_flag ? nod_flag :
info->s->base.rec_reflength); info->s->base.rec_reflength);
int max_keys= (mi_getint(page)-2) / (full_length); int max_keys= (mi_getint(page)-2) / (full_length);
DBUG_ENTER("rtree_split_page");
DBUG_PRINT("rtree", ("splitting block"));
n_dim = keyinfo->keysegs / 2; n_dim = keyinfo->keysegs / 2;
if (!(coord_buf= (double*) my_alloca(n_dim * 2 * sizeof(double) * if (!(coord_buf= (double*) my_alloca(n_dim * 2 * sizeof(double) *
(max_keys + 1 + 4) + (max_keys + 1 + 4) +
sizeof(SplitStruct) * (max_keys + 1)))) sizeof(SplitStruct) * (max_keys + 1))))
return -1; DBUG_RETURN(-1); /* purecov: inspected */
task= (SplitStruct *)(coord_buf + n_dim * 2 * (max_keys + 1 + 4)); task= (SplitStruct *)(coord_buf + n_dim * 2 * (max_keys + 1 + 4));
...@@ -341,12 +343,13 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key, ...@@ -341,12 +343,13 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
else else
err_code= _mi_write_keypage(info, keyinfo, *new_page_offs, err_code= _mi_write_keypage(info, keyinfo, *new_page_offs,
DFLT_INIT_HITS, new_page); DFLT_INIT_HITS, new_page);
DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs));
my_afree((byte*)new_page); my_afree((byte*)new_page);
split_err: split_err:
my_afree((byte*) coord_buf); my_afree((byte*) coord_buf);
return err_code; DBUG_RETURN(err_code);
} }
#endif /*HAVE_RTREE_KEYS*/ #endif /*HAVE_RTREE_KEYS*/
...@@ -243,3 +243,10 @@ SET @@session.auto_increment_offset= ...@@ -243,3 +243,10 @@ SET @@session.auto_increment_offset=
@bug20830_old_session_auto_increment_offset; @bug20830_old_session_auto_increment_offset;
SET @@session.auto_increment_increment= SET @@session.auto_increment_increment=
@bug20830_old_session_auto_increment_increment; @bug20830_old_session_auto_increment_increment;
CREATE TABLE t1(a BIT);
INSERT DELAYED INTO t1 VALUES(1);
FLUSH TABLE t1;
SELECT HEX(a) FROM t1;
HEX(a)
1
DROP TABLE t1;
This diff is collapsed.
...@@ -803,6 +803,11 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1); ...@@ -803,6 +803,11 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1; SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, tm1; DROP TABLE t1, tm1;
CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1);
INSERT DELAYED INTO t2 VALUES(1);
ERROR HY000: Table storage engine for 't2' doesn't have this option
DROP TABLE t1, t2;
create table t1 (b bit(1)); create table t1 (b bit(1));
create table t2 (b bit(1)); create table t2 (b bit(1));
create table tm (b bit(1)) engine = merge union = (t1,t2); create table tm (b bit(1)) engine = merge union = (t1,t2);
......
...@@ -234,3 +234,11 @@ SET @@session.auto_increment_offset= ...@@ -234,3 +234,11 @@ SET @@session.auto_increment_offset=
SET @@session.auto_increment_increment= SET @@session.auto_increment_increment=
@bug20830_old_session_auto_increment_increment; @bug20830_old_session_auto_increment_increment;
#
# BUG#26238 - inserted delayed always inserts 0 for BIT columns
#
CREATE TABLE t1(a BIT);
INSERT DELAYED INTO t1 VALUES(1);
FLUSH TABLE t1;
SELECT HEX(a) FROM t1;
DROP TABLE t1;
This diff is collapsed.
...@@ -430,6 +430,15 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1); ...@@ -430,6 +430,15 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1);
SELECT * FROM tm1; SELECT * FROM tm1;
DROP TABLE t1, tm1; DROP TABLE t1, tm1;
#
# Bug#26464 - insert delayed + update + merge = corruption
#
CREATE TABLE t1(c1 INT) ENGINE=MyISAM;
CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1);
--error 1031
INSERT DELAYED INTO t2 VALUES(1);
DROP TABLE t1, t2;
# End of 4.1 tests # End of 4.1 tests
# #
......
...@@ -225,7 +225,7 @@ class Field ...@@ -225,7 +225,7 @@ class Field
ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg; ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg;
} }
inline void move_field(char *ptr_arg) { ptr=ptr_arg; } inline void move_field(char *ptr_arg) { ptr=ptr_arg; }
inline void move_field(my_ptrdiff_t ptr_diff) virtual inline void move_field(my_ptrdiff_t ptr_diff)
{ {
ptr=ADD_TO_PTR(ptr,ptr_diff,char*); ptr=ADD_TO_PTR(ptr,ptr_diff,char*);
if (null_ptr) if (null_ptr)
...@@ -1407,6 +1407,11 @@ class Field_bit :public Field { ...@@ -1407,6 +1407,11 @@ class Field_bit :public Field {
Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, Field *new_key_field(MEM_ROOT *root, struct st_table *new_table,
char *new_ptr, uchar *new_null_ptr, char *new_ptr, uchar *new_null_ptr,
uint new_null_bit); uint new_null_bit);
inline void move_field(my_ptrdiff_t ptr_diff)
{
Field::move_field(ptr_diff);
bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*);
}
void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg) void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg)
{ {
bit_ptr= bit_ptr_arg; bit_ptr= bit_ptr_arg;
......
...@@ -36,8 +36,7 @@ class ha_myisammrg: public handler ...@@ -36,8 +36,7 @@ class ha_myisammrg: public handler
{ {
return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_READ_RND_SAME | return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_READ_RND_SAME |
HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED | HA_NULL_IN_KEY | HA_CAN_INDEX_BLOBS | HA_FILE_BASED |
HA_CAN_INSERT_DELAYED | HA_ANY_INDEX_MAY_BE_UNIQUE | HA_ANY_INDEX_MAY_BE_UNIQUE | HA_CAN_BIT_FIELD);
HA_CAN_BIT_FIELD);
} }
ulong index_flags(uint inx, uint part, bool all_parts) const ulong index_flags(uint inx, uint part, bool all_parts) const
{ {
......
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