Commit a87b79cc authored by unknown's avatar unknown

Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.1

into  mysql.com:/home/kent/bk/tmp/mysql-5.1-build
parents 3d09e8a1 a07b5ca9
...@@ -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.
...@@ -731,3 +731,10 @@ SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256); ...@@ -731,3 +731,10 @@ SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
COUNT(*) COUNT(*)
2 2
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
INSERT INTO t1 VALUES('', 0);
ALTER TABLE t1 MODIFY c1 VARCHAR(101);
SELECT c2 FROM t1;
c2
0
DROP TABLE t1;
...@@ -806,6 +806,24 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1); ...@@ -806,6 +806,24 @@ 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(c1 VARCHAR(1));
CREATE TABLE m1 LIKE t1;
ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
SELECT * FROM m1;
c1
DROP TABLE t1, m1;
CREATE TABLE t1(c1 VARCHAR(4), c2 TINYINT, c3 TINYINT, c4 TINYINT,
c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT, c9 TINYINT);
CREATE TABLE m1 LIKE t1;
ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
SELECT * FROM m1;
c1 c2 c3 c4 c5 c6 c7 c8 c9
DROP TABLE t1, m1;
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.
...@@ -471,3 +471,12 @@ SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256); ...@@ -471,3 +471,12 @@ SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
DROP TABLE t1; DROP TABLE t1;
# End of 5.0 tests # End of 5.0 tests
#
# BUG#26080 - Memory Storage engine not working properly
#
CREATE TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
INSERT INTO t1 VALUES('', 0);
ALTER TABLE t1 MODIFY c1 VARCHAR(101);
SELECT c2 FROM t1;
DROP TABLE t1;
...@@ -434,6 +434,32 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1); ...@@ -434,6 +434,32 @@ 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;
#
# BUG#26881 - Large MERGE tables report incorrect specification when no
# differences in tables
#
CREATE TABLE t1(c1 VARCHAR(1));
CREATE TABLE m1 LIKE t1;
ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
SELECT * FROM m1;
DROP TABLE t1, m1;
CREATE TABLE t1(c1 VARCHAR(4), c2 TINYINT, c3 TINYINT, c4 TINYINT,
c5 TINYINT, c6 TINYINT, c7 TINYINT, c8 TINYINT, c9 TINYINT);
CREATE TABLE m1 LIKE t1;
ALTER TABLE m1 ENGINE=MERGE UNION=(t1);
SELECT * FROM m1;
DROP TABLE t1, m1;
# End of 4.1 tests # End of 4.1 tests
# #
......
...@@ -703,9 +703,10 @@ bool ha_heap::check_if_incompatible_data(HA_CREATE_INFO *info, ...@@ -703,9 +703,10 @@ bool ha_heap::check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes) uint table_changes)
{ {
/* Check that auto_increment value was not changed */ /* Check that auto_increment value was not changed */
if ((table_changes != IS_EQUAL_YES && if ((info->used_fields & HA_CREATE_USED_AUTO &&
info->used_fields & HA_CREATE_USED_AUTO) && info->auto_increment_value != 0) ||
info->auto_increment_value != 0) table_changes == IS_EQUAL_NO ||
table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet
return COMPATIBLE_DATA_NO; return COMPATIBLE_DATA_NO;
return COMPATIBLE_DATA_YES; return COMPATIBLE_DATA_YES;
} }
......
...@@ -320,6 +320,12 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, ...@@ -320,6 +320,12 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
RETURN VALUE RETURN VALUE
0 - Equal definitions. 0 - Equal definitions.
1 - Different definitions. 1 - Different definitions.
TODO
- compare FULLTEXT keys;
- compare SPATIAL keys;
- compare FIELD_SKIP_ZERO which is converted to FIELD_NORMAL correctly
(should be corretly detected in table2myisam).
*/ */
int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
...@@ -345,6 +351,28 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, ...@@ -345,6 +351,28 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
{ {
HA_KEYSEG *t1_keysegs= t1_keyinfo[i].seg; HA_KEYSEG *t1_keysegs= t1_keyinfo[i].seg;
HA_KEYSEG *t2_keysegs= t2_keyinfo[i].seg; HA_KEYSEG *t2_keysegs= t2_keyinfo[i].seg;
if (t1_keyinfo[i].flag & HA_FULLTEXT && t2_keyinfo[i].flag & HA_FULLTEXT)
continue;
else if (t1_keyinfo[i].flag & HA_FULLTEXT ||
t2_keyinfo[i].flag & HA_FULLTEXT)
{
DBUG_PRINT("error", ("Key %d has different definition", i));
DBUG_PRINT("error", ("t1_fulltext= %d, t2_fulltext=%d",
test(t1_keyinfo[i].flag & HA_FULLTEXT),
test(t2_keyinfo[i].flag & HA_FULLTEXT)));
DBUG_RETURN(1);
}
if (t1_keyinfo[i].flag & HA_SPATIAL && t2_keyinfo[i].flag & HA_SPATIAL)
continue;
else if (t1_keyinfo[i].flag & HA_SPATIAL ||
t2_keyinfo[i].flag & HA_SPATIAL)
{
DBUG_PRINT("error", ("Key %d has different definition", i));
DBUG_PRINT("error", ("t1_spatial= %d, t2_spatial=%d",
test(t1_keyinfo[i].flag & HA_SPATIAL),
test(t2_keyinfo[i].flag & HA_SPATIAL)));
DBUG_RETURN(1);
}
if (t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs || if (t1_keyinfo[i].keysegs != t2_keyinfo[i].keysegs ||
t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg) t1_keyinfo[i].key_alg != t2_keyinfo[i].key_alg)
{ {
...@@ -381,7 +409,14 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo, ...@@ -381,7 +409,14 @@ int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
{ {
MI_COLUMNDEF *t1_rec= &t1_recinfo[i]; MI_COLUMNDEF *t1_rec= &t1_recinfo[i];
MI_COLUMNDEF *t2_rec= &t2_recinfo[i]; MI_COLUMNDEF *t2_rec= &t2_recinfo[i];
if (t1_rec->type != t2_rec->type || /*
FIELD_SKIP_ZERO can be changed to FIELD_NORMAL in mi_create,
see NOTE1 in mi_create.c
*/
if ((t1_rec->type != t2_rec->type &&
!(t1_rec->type == (int) FIELD_SKIP_ZERO &&
t1_rec->length == 1 &&
t2_rec->type == (int) FIELD_NORMAL)) ||
t1_rec->length != t2_rec->length || t1_rec->length != t2_rec->length ||
t1_rec->null_bit != t2_rec->null_bit) t1_rec->null_bit != t2_rec->null_bit)
{ {
......
...@@ -158,6 +158,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, ...@@ -158,6 +158,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
rec--; rec--;
if (rec->type == (int) FIELD_SKIP_ZERO && rec->length == 1) if (rec->type == (int) FIELD_SKIP_ZERO && rec->length == 1)
{ {
/*
NOTE1: here we change a field type FIELD_SKIP_ZERO ->
FIELD_NORMAL
*/
rec->type=(int) FIELD_NORMAL; rec->type=(int) FIELD_NORMAL;
packed--; packed--;
min_pack_length++; min_pack_length++;
......
...@@ -506,24 +506,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) ...@@ -506,24 +506,6 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share->data_file_type = DYNAMIC_RECORD; share->data_file_type = DYNAMIC_RECORD;
my_afree((gptr) disk_cache); my_afree((gptr) disk_cache);
mi_setup_functions(share); mi_setup_functions(share);
#ifdef HAVE_MMAP
if (open_flags & HA_OPEN_MMAP)
{
info.s= share;
if (mi_dynmap_file(&info, share->state.state.data_file_length))
{
/* purecov: begin inspected */
/* Ignore if mmap fails. Use file I/O instead. */
DBUG_PRINT("warning", ("mmap failed: errno: %d", errno));
/* purecov: end */
}
else
{
share->file_read= mi_mmap_pread;
share->file_write= mi_mmap_pwrite;
}
}
#endif /* HAVE_MMAP */
share->is_log_table= FALSE; share->is_log_table= FALSE;
#ifdef THREAD #ifdef THREAD
thr_lock_init(&share->lock); thr_lock_init(&share->lock);
...@@ -554,6 +536,14 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) ...@@ -554,6 +536,14 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
} }
} }
#endif #endif
/*
Memory mapping can only be requested after initializing intern_lock.
*/
if (open_flags & HA_OPEN_MMAP)
{
info.s= share;
mi_extra(&info, HA_EXTRA_MMAP, 0);
}
} }
else else
{ {
......
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*/
...@@ -36,8 +36,8 @@ class ha_myisammrg: public handler ...@@ -36,8 +36,8 @@ class ha_myisammrg: public handler
{ {
return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_NO_TRANSACTIONS | return (HA_REC_NOT_IN_SEQ | HA_AUTO_PART_KEY | HA_NO_TRANSACTIONS |
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 | HA_NO_COPY_ON_ALTER); HA_NO_COPY_ON_ALTER);
} }
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