Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
22c1bb4e
Commit
22c1bb4e
authored
Sep 23, 2005
by
msvensson@neptunus.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
parents
d55eeed8
06077eb1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
138 additions
and
30 deletions
+138
-30
innobase/data/data0data.c
innobase/data/data0data.c
+5
-5
innobase/dict/dict0dict.c
innobase/dict/dict0dict.c
+1
-1
innobase/include/dict0mem.h
innobase/include/dict0mem.h
+7
-7
innobase/include/row0mysql.h
innobase/include/row0mysql.h
+8
-2
innobase/include/trx0trx.h
innobase/include/trx0trx.h
+1
-1
innobase/rem/rem0rec.c
innobase/rem/rem0rec.c
+1
-1
innobase/row/row0mysql.c
innobase/row/row0mysql.c
+17
-4
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+34
-0
mysql-test/t/innodb.test
mysql-test/t/innodb.test
+46
-0
sql/ha_innodb.cc
sql/ha_innodb.cc
+18
-9
No files found.
innobase/data/data0data.c
View file @
22c1bb4e
...
...
@@ -561,12 +561,12 @@ dtuple_convert_big_rec(
}
/* We do not store externally fields which are smaller than
DICT_MAX_
COL_PREFIX
_LEN */
DICT_MAX_
INDEX_COL
_LEN */
ut_a
(
DICT_MAX_
COL_PREFIX
_LEN
>
REC_1BYTE_OFFS_LIMIT
);
ut_a
(
DICT_MAX_
INDEX_COL
_LEN
>
REC_1BYTE_OFFS_LIMIT
);
if
(
longest
<
BTR_EXTERN_FIELD_REF_SIZE
+
10
+
DICT_MAX_
COL_PREFIX
_LEN
)
{
+
DICT_MAX_
INDEX_COL
_LEN
)
{
/* Cannot shorten more */
mem_heap_free
(
heap
);
...
...
@@ -588,10 +588,10 @@ dtuple_convert_big_rec(
dfield
=
dtuple_get_nth_field
(
entry
,
longest_i
);
vector
->
fields
[
n_fields
].
field_no
=
longest_i
;
ut_a
(
dfield
->
len
>
DICT_MAX_
COL_PREFIX
_LEN
);
ut_a
(
dfield
->
len
>
DICT_MAX_
INDEX_COL
_LEN
);
vector
->
fields
[
n_fields
].
len
=
dfield
->
len
-
DICT_MAX_
COL_PREFIX
_LEN
;
-
DICT_MAX_
INDEX_COL
_LEN
;
vector
->
fields
[
n_fields
].
data
=
mem_heap_alloc
(
heap
,
vector
->
fields
[
n_fields
].
len
);
...
...
innobase/dict/dict0dict.c
View file @
22c1bb4e
...
...
@@ -1625,7 +1625,7 @@ dict_index_add_col(
variable-length fields, so that the extern flag can be embedded in
the length word. */
if
(
field
->
fixed_len
>
DICT_MAX_
COL_PREFIX
_LEN
)
{
if
(
field
->
fixed_len
>
DICT_MAX_
INDEX_COL
_LEN
)
{
field
->
fixed_len
=
0
;
}
...
...
innobase/include/dict0mem.h
View file @
22c1bb4e
...
...
@@ -152,12 +152,12 @@ struct dict_col_struct{
in some of the functions below */
};
/* DICT_MAX_
COL_PREFIX_LEN is measured in bytes. Starting from 4.1.6, we
set max col prefix len to < 3 * 256, so that one can create a column prefix
index on 255 characters of a TEXT field also in the UTF-8 charset. In that
charset, a character may take at most 3 bytes. */
/* DICT_MAX_
INDEX_COL_LEN is measured in bytes and is the max index column
length + 1. Starting from 4.1.6, we set it to < 3 * 256, so that one can
create a column prefix index on 255 characters of a TEXT field also in the
UTF-8 charset. In that
charset, a character may take at most 3 bytes. */
#define DICT_MAX_
COL_PREFIX_LEN
768
#define DICT_MAX_
INDEX_COL_LEN
768
/* Data structure for a field in an index */
struct
dict_field_struct
{
...
...
@@ -169,12 +169,12 @@ struct dict_field_struct{
prefix in bytes in a MySQL index of
type, e.g., INDEX (textcol(25));
must be smaller than
DICT_MAX_
COL_PREFIX
_LEN; NOTE that
DICT_MAX_
INDEX_COL
_LEN; NOTE that
in the UTF-8 charset, MySQL sets this
to 3 * the prefix len in UTF-8 chars */
ulint
fixed_len
;
/* 0 or the fixed length of the
column if smaller than
DICT_MAX_
COL_PREFIX
_LEN */
DICT_MAX_
INDEX_COL
_LEN */
ulint
fixed_offs
;
/* offset to the field, or
ULINT_UNDEFINED if it is not fixed
within the record (due to preceding
...
...
innobase/include/row0mysql.h
View file @
22c1bb4e
...
...
@@ -335,8 +335,14 @@ int
row_create_index_for_mysql
(
/*=======================*/
/* out: error number or DB_SUCCESS */
dict_index_t
*
index
,
/* in: index defintion */
trx_t
*
trx
);
/* in: transaction handle */
dict_index_t
*
index
,
/* in: index definition */
trx_t
*
trx
,
/* in: transaction handle */
const
ulint
*
field_lengths
);
/* in: if not NULL, must contain
dict_index_get_n_fields(index)
actual field lengths for the
index columns, which are
then checked for not being too
large. */
/*************************************************************************
Scans a table create SQL string and adds to the data dictionary
the foreign key constraints declared in the string. This function
...
...
innobase/include/trx0trx.h
View file @
22c1bb4e
...
...
@@ -205,7 +205,7 @@ trx_recover_for_mysql(
XID
*
xid_list
,
/* in/out: prepared transactions */
ulint
len
);
/* in: number of slots in xid_list */
/***********************************************************************
This function is used to
commit
one X/Open XA distributed transaction
This function is used to
find
one X/Open XA distributed transaction
which is in the prepared state */
trx_t
*
trx_get_trx_by_xid
(
...
...
innobase/rem/rem0rec.c
View file @
22c1bb4e
...
...
@@ -621,7 +621,7 @@ rec_set_nth_field_extern_bit_new(
if
(
field
->
fixed_len
)
{
/* fixed-length fields cannot be external
(Fixed-length fields longer than
DICT_MAX_
COL_PREFIX
_LEN will be treated as
DICT_MAX_
INDEX_COL
_LEN will be treated as
variable-length ones in dict_index_add_col().) */
ut_ad
(
i
!=
ith
);
continue
;
...
...
innobase/row/row0mysql.c
View file @
22c1bb4e
...
...
@@ -1973,13 +1973,20 @@ row_create_index_for_mysql(
/*=======================*/
/* out: error number or DB_SUCCESS */
dict_index_t
*
index
,
/* in: index definition */
trx_t
*
trx
)
/* in: transaction handle */
trx_t
*
trx
,
/* in: transaction handle */
const
ulint
*
field_lengths
)
/* in: if not NULL, must contain
dict_index_get_n_fields(index)
actual field lengths for the
index columns, which are
then checked for not being too
large. */
{
ind_node_t
*
node
;
mem_heap_t
*
heap
;
que_thr_t
*
thr
;
ulint
err
;
ulint
i
,
j
;
ulint
len
;
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
rw_lock_own
(
&
dict_operation_lock
,
RW_LOCK_EX
));
...
...
@@ -2018,10 +2025,16 @@ row_create_index_for_mysql(
}
}
/* Check also that prefix_len < DICT_MAX_COL_PREFIX_LEN */
/* Check also that prefix_len and actual length
< DICT_MAX_INDEX_COL_LEN */
len
=
dict_index_get_nth_field
(
index
,
i
)
->
prefix_len
;
if
(
dict_index_get_nth_field
(
index
,
i
)
->
prefix_len
>=
DICT_MAX_COL_PREFIX_LEN
)
{
if
(
field_lengths
)
{
len
=
ut_max
(
len
,
field_lengths
[
i
]);
}
if
(
len
>=
DICT_MAX_INDEX_COL_LEN
)
{
err
=
DB_TOO_BIG_RECORD
;
goto
error_handling
;
...
...
mysql-test/r/innodb.result
View file @
22c1bb4e
...
...
@@ -2559,3 +2559,37 @@ FOREIGN KEY (b) REFERENCES test.t1(id)
)
ENGINE=InnoDB;
Got one of the listed errors
DROP TABLE t1;
create table t1 (col1 varchar(2000), index (col1(767)))
character set = latin1 engine = innodb;
create table t2 (col1 char(255), index (col1))
character set = latin1 engine = innodb;
create table t3 (col1 binary(255), index (col1))
character set = latin1 engine = innodb;
create table t4 (col1 varchar(767), index (col1))
character set = latin1 engine = innodb;
create table t5 (col1 varchar(767) primary key)
character set = latin1 engine = innodb;
create table t6 (col1 varbinary(767) primary key)
character set = latin1 engine = innodb;
create table t7 (col1 text, index(col1(767)))
character set = latin1 engine = innodb;
create table t8 (col1 blob, index(col1(767)))
character set = latin1 engine = innodb;
create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
character set = latin1 engine = innodb;
drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
create table t1 (col1 varchar(768), index (col1))
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t1.frm' (errno: 139)
create table t2 (col1 varchar(768) primary key)
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t2.frm' (errno: 139)
create table t3 (col1 varbinary(768) primary key)
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t3.frm' (errno: 139)
create table t4 (col1 text, index(col1(768)))
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t4.frm' (errno: 139)
create table t5 (col1 blob, index(col1(768)))
character set = latin1 engine = innodb;
ERROR HY000: Can't create table './test/t5.frm' (errno: 139)
mysql-test/t/innodb.test
View file @
22c1bb4e
...
...
@@ -1482,3 +1482,49 @@ CREATE TEMPORARY TABLE t2
FOREIGN
KEY
(
b
)
REFERENCES
test
.
t1
(
id
)
)
ENGINE
=
InnoDB
;
DROP
TABLE
t1
;
#
# Test that index column max sizes are checked (bug #13315)
#
# prefix index
create
table
t1
(
col1
varchar
(
2000
),
index
(
col1
(
767
)))
character
set
=
latin1
engine
=
innodb
;
# normal indexes
create
table
t2
(
col1
char
(
255
),
index
(
col1
))
character
set
=
latin1
engine
=
innodb
;
create
table
t3
(
col1
binary
(
255
),
index
(
col1
))
character
set
=
latin1
engine
=
innodb
;
create
table
t4
(
col1
varchar
(
767
),
index
(
col1
))
character
set
=
latin1
engine
=
innodb
;
create
table
t5
(
col1
varchar
(
767
)
primary
key
)
character
set
=
latin1
engine
=
innodb
;
create
table
t6
(
col1
varbinary
(
767
)
primary
key
)
character
set
=
latin1
engine
=
innodb
;
create
table
t7
(
col1
text
,
index
(
col1
(
767
)))
character
set
=
latin1
engine
=
innodb
;
create
table
t8
(
col1
blob
,
index
(
col1
(
767
)))
character
set
=
latin1
engine
=
innodb
;
# multi-column indexes are allowed to be longer
create
table
t9
(
col1
varchar
(
512
),
col2
varchar
(
512
),
index
(
col1
,
col2
))
character
set
=
latin1
engine
=
innodb
;
drop
table
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
;
--
error
1005
create
table
t1
(
col1
varchar
(
768
),
index
(
col1
))
character
set
=
latin1
engine
=
innodb
;
--
error
1005
create
table
t2
(
col1
varchar
(
768
)
primary
key
)
character
set
=
latin1
engine
=
innodb
;
--
error
1005
create
table
t3
(
col1
varbinary
(
768
)
primary
key
)
character
set
=
latin1
engine
=
innodb
;
--
error
1005
create
table
t4
(
col1
text
,
index
(
col1
(
768
)))
character
set
=
latin1
engine
=
innodb
;
--
error
1005
create
table
t5
(
col1
blob
,
index
(
col1
(
768
)))
character
set
=
latin1
engine
=
innodb
;
sql/ha_innodb.cc
View file @
22c1bb4e
...
...
@@ -1252,7 +1252,7 @@ innobase_init(void)
copy of it: */
internal_innobase_data_file_path
=
my_strdup
(
innobase_data_file_path
,
MYF
(
MY_
WM
E
));
MYF
(
MY_
FA
E
));
ret
=
(
bool
)
srv_parse_data_file_paths_and_sizes
(
internal_innobase_data_file_path
,
...
...
@@ -2386,7 +2386,7 @@ ha_innobase::open(
"how you can resolve the problem.
\n
"
,
norm_name
);
free_share
(
share
);
my_free
((
char
*
)
upd_buff
,
MYF
(
0
));
my_free
((
gptr
)
upd_buff
,
MYF
(
0
));
my_errno
=
ENOENT
;
DBUG_RETURN
(
HA_ERR_NO_SUCH_TABLE
);
...
...
@@ -2404,7 +2404,7 @@ ha_innobase::open(
"how you can resolve the problem.
\n
"
,
norm_name
);
free_share
(
share
);
my_free
((
char
*
)
upd_buff
,
MYF
(
0
));
my_free
((
gptr
)
upd_buff
,
MYF
(
0
));
my_errno
=
ENOENT
;
dict_table_decrement_handle_count
(
ib_table
);
...
...
@@ -2498,7 +2498,7 @@ ha_innobase::close(void)
row_prebuilt_free
((
row_prebuilt_t
*
)
innobase_prebuilt
);
my_free
((
char
*
)
upd_buff
,
MYF
(
0
));
my_free
((
gptr
)
upd_buff
,
MYF
(
0
));
free_share
(
share
);
/* Tell InnoDB server that there might be work for
...
...
@@ -4492,7 +4492,8 @@ create_index(
ulint
is_unsigned
;
ulint
i
;
ulint
j
;
ulint
*
field_lengths
;
DBUG_ENTER
(
"create_index"
);
key
=
form
->
key_info
+
key_num
;
...
...
@@ -4514,6 +4515,10 @@ create_index(
index
=
dict_mem_index_create
((
char
*
)
table_name
,
key
->
name
,
0
,
ind_type
,
n_fields
);
field_lengths
=
(
ulint
*
)
my_malloc
(
sizeof
(
ulint
)
*
n_fields
,
MYF
(
MY_FAE
));
for
(
i
=
0
;
i
<
n_fields
;
i
++
)
{
key_part
=
key
->
key_part
+
i
;
...
...
@@ -4568,6 +4573,8 @@ create_index(
prefix_len
=
0
;
}
field_lengths
[
i
]
=
key_part
->
length
;
/* We assume all fields should be sorted in ascending
order, hence the '0': */
...
...
@@ -4576,10 +4583,12 @@ create_index(
0
,
prefix_len
);
}
error
=
row_create_index_for_mysql
(
index
,
trx
);
error
=
row_create_index_for_mysql
(
index
,
trx
,
field_lengths
);
error
=
convert_error_code_to_mysql
(
error
,
NULL
);
my_free
((
gptr
)
field_lengths
,
MYF
(
0
));
DBUG_RETURN
(
error
);
}
...
...
@@ -4602,7 +4611,7 @@ create_clustered_index_when_no_primary(
index
=
dict_mem_index_create
((
char
*
)
table_name
,
(
char
*
)
"GEN_CLUST_INDEX"
,
0
,
DICT_CLUSTERED
,
0
);
error
=
row_create_index_for_mysql
(
index
,
trx
);
error
=
row_create_index_for_mysql
(
index
,
trx
,
NULL
);
error
=
convert_error_code_to_mysql
(
error
,
NULL
);
...
...
@@ -5138,7 +5147,7 @@ ha_innobase::records_in_range(
mysql_byte
*
key_val_buff2
=
(
mysql_byte
*
)
my_malloc
(
table
->
s
->
reclength
+
table
->
s
->
max_key_length
+
100
,
MYF
(
MY_
WM
E
));
MYF
(
MY_
FA
E
));
ulint
buff2_len
=
table
->
s
->
reclength
+
table
->
s
->
max_key_length
+
100
;
dtuple_t
*
range_start
;
...
...
@@ -5197,7 +5206,7 @@ ha_innobase::records_in_range(
dtuple_free_for_mysql
(
heap1
);
dtuple_free_for_mysql
(
heap2
);
my_free
((
char
*
)
key_val_buff2
,
MYF
(
0
));
my_free
((
gptr
)
key_val_buff2
,
MYF
(
0
));
prebuilt
->
trx
->
op_info
=
(
char
*
)
""
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment