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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d6373a22
Commit
d6373a22
authored
Dec 13, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Null-merge from 4.1
parent
8e239a27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
86 deletions
+86
-86
innobase/dict/dict0load.c
innobase/dict/dict0load.c
+86
-86
No files found.
innobase/dict/dict0load.c
View file @
d6373a22
...
@@ -8,6 +8,9 @@ Created 4/24/1996 Heikki Tuuri
...
@@ -8,6 +8,9 @@ Created 4/24/1996 Heikki Tuuri
*******************************************************/
*******************************************************/
#include "dict0load.h"
#include "dict0load.h"
#ifndef UNIV_HOTBACKUP
#include "mysql_version.h"
#endif
/* !UNIV_HOTBACKUP */
#ifdef UNIV_NONINL
#ifdef UNIV_NONINL
#include "dict0load.ic"
#include "dict0load.ic"
...
@@ -55,6 +58,7 @@ dict_get_first_table_name_in_db(
...
@@ -55,6 +58,7 @@ dict_get_first_table_name_in_db(
sys_tables
=
dict_table_get_low
(
"SYS_TABLES"
);
sys_tables
=
dict_table_get_low
(
"SYS_TABLES"
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_tables
->
indexes
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_tables
->
indexes
);
ut_a
(
!
sys_tables
->
comp
);
tuple
=
dtuple_create
(
heap
,
1
);
tuple
=
dtuple_create
(
heap
,
1
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
...
@@ -77,7 +81,7 @@ dict_get_first_table_name_in_db(
...
@@ -77,7 +81,7 @@ dict_get_first_table_name_in_db(
return
(
NULL
);
return
(
NULL
);
}
}
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
if
(
len
<
strlen
(
name
)
if
(
len
<
strlen
(
name
)
||
ut_memcmp
(
name
,
field
,
strlen
(
name
))
!=
0
)
{
||
ut_memcmp
(
name
,
field
,
strlen
(
name
))
!=
0
)
{
...
@@ -90,7 +94,7 @@ dict_get_first_table_name_in_db(
...
@@ -90,7 +94,7 @@ dict_get_first_table_name_in_db(
return
(
NULL
);
return
(
NULL
);
}
}
if
(
!
rec_get_deleted_flag
(
rec
))
{
if
(
!
rec_get_deleted_flag
(
rec
,
sys_tables
->
comp
))
{
/* We found one */
/* We found one */
...
@@ -163,9 +167,9 @@ dict_print(void)
...
@@ -163,9 +167,9 @@ dict_print(void)
return
;
return
;
}
}
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
if
(
!
rec_get_deleted_flag
(
rec
))
{
if
(
!
rec_get_deleted_flag
(
rec
,
sys_tables
->
comp
))
{
/* We found one */
/* We found one */
...
@@ -180,7 +184,7 @@ dict_print(void)
...
@@ -180,7 +184,7 @@ dict_print(void)
if
(
table
==
NULL
)
{
if
(
table
==
NULL
)
{
fputs
(
"InnoDB: Failed to load table "
,
stderr
);
fputs
(
"InnoDB: Failed to load table "
,
stderr
);
ut_print_namel
(
stderr
,
NULL
,
field
,
len
);
ut_print_namel
(
stderr
,
NULL
,
(
char
*
)
field
,
len
);
putc
(
'\n'
,
stderr
);
putc
(
'\n'
,
stderr
);
}
else
{
}
else
{
/* The table definition was corrupt if there
/* The table definition was corrupt if there
...
@@ -231,6 +235,7 @@ dict_check_tablespaces_and_store_max_id(
...
@@ -231,6 +235,7 @@ dict_check_tablespaces_and_store_max_id(
sys_tables
=
dict_table_get_low
(
"SYS_TABLES"
);
sys_tables
=
dict_table_get_low
(
"SYS_TABLES"
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_tables
->
indexes
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_tables
->
indexes
);
ut_a
(
!
sys_tables
->
comp
);
btr_pcur_open_at_index_side
(
TRUE
,
sys_index
,
BTR_SEARCH_LEAF
,
&
pcur
,
btr_pcur_open_at_index_side
(
TRUE
,
sys_index
,
BTR_SEARCH_LEAF
,
&
pcur
,
TRUE
,
&
mtr
);
TRUE
,
&
mtr
);
...
@@ -257,15 +262,15 @@ dict_check_tablespaces_and_store_max_id(
...
@@ -257,15 +262,15 @@ dict_check_tablespaces_and_store_max_id(
return
;
return
;
}
}
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
if
(
!
rec_get_deleted_flag
(
rec
))
{
if
(
!
rec_get_deleted_flag
(
rec
,
sys_tables
->
comp
))
{
/* We found one */
/* We found one */
char
*
name
=
mem_strdupl
((
char
*
)
field
,
len
);
char
*
name
=
mem_strdupl
((
char
*
)
field
,
len
);
field
=
rec_get_nth_field
(
rec
,
9
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
9
,
&
len
);
ut_a
(
len
==
4
);
ut_a
(
len
==
4
);
space_id
=
mach_read_from_4
(
field
);
space_id
=
mach_read_from_4
(
field
);
...
@@ -338,6 +343,7 @@ dict_load_columns(
...
@@ -338,6 +343,7 @@ dict_load_columns(
sys_columns
=
dict_table_get_low
(
"SYS_COLUMNS"
);
sys_columns
=
dict_table_get_low
(
"SYS_COLUMNS"
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_columns
->
indexes
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_columns
->
indexes
);
ut_a
(
!
sys_columns
->
comp
);
tuple
=
dtuple_create
(
heap
,
1
);
tuple
=
dtuple_create
(
heap
,
1
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
...
@@ -356,28 +362,27 @@ dict_load_columns(
...
@@ -356,28 +362,27 @@ dict_load_columns(
ut_a
(
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
));
ut_a
(
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
));
ut_a
(
!
rec_get_deleted_flag
(
rec
));
ut_a
(
!
rec_get_deleted_flag
(
rec
,
sys_columns
->
comp
));
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
ut_ad
(
len
==
8
);
ut_ad
(
len
==
8
);
ut_a
(
ut_dulint_cmp
(
table
->
id
,
mach_read_from_8
(
field
))
==
0
);
ut_a
(
ut_dulint_cmp
(
table
->
id
,
mach_read_from_8
(
field
))
==
0
);
field
=
rec_get_nth_field
(
rec
,
1
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
1
,
&
len
);
ut_ad
(
len
==
4
);
ut_ad
(
len
==
4
);
ut_a
(
i
==
mach_read_from_4
(
field
));
ut_a
(
i
==
mach_read_from_4
(
field
));
ut_a
(
0
==
ut_strcmp
(
"NAME"
,
ut_a
(
0
==
ut_strcmp
(
"NAME"
,
dict_field_get_col
(
dict_field_get_col
(
dict_index_get_nth_field
(
dict_index_get_nth_field
(
sys_index
,
4
))
->
name
));
dict_table_get_first_index
(
sys_columns
),
4
))
->
name
));
field
=
rec_get_nth_field
(
rec
,
4
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
4
,
&
len
);
name
=
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
len
);
name
=
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
len
);
field
=
rec_get_nth_field
(
rec
,
5
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
5
,
&
len
);
mtype
=
mach_read_from_4
(
field
);
mtype
=
mach_read_from_4
(
field
);
field
=
rec_get_nth_field
(
rec
,
6
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
6
,
&
len
);
prtype
=
mach_read_from_4
(
field
);
prtype
=
mach_read_from_4
(
field
);
if
(
dtype_is_non_binary_string_type
(
mtype
,
prtype
)
if
(
dtype_is_non_binary_string_type
(
mtype
,
prtype
)
...
@@ -389,15 +394,14 @@ dict_load_columns(
...
@@ -389,15 +394,14 @@ dict_load_columns(
data_mysql_default_charset_coll
);
data_mysql_default_charset_coll
);
}
}
field
=
rec_get_nth_field
(
rec
,
7
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
7
,
&
len
);
col_len
=
mach_read_from_4
(
field
);
col_len
=
mach_read_from_4
(
field
);
ut_a
(
0
==
ut_strcmp
(
"PREC"
,
ut_a
(
0
==
ut_strcmp
(
"PREC"
,
dict_field_get_col
(
dict_field_get_col
(
dict_index_get_nth_field
(
dict_index_get_nth_field
(
sys_index
,
8
))
->
name
));
dict_table_get_first_index
(
sys_columns
),
8
))
->
name
));
field
=
rec_get_nth_field
(
rec
,
8
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
8
,
&
len
);
prec
=
mach_read_from_4
(
field
);
prec
=
mach_read_from_4
(
field
);
dict_mem_table_add_col
(
table
,
name
,
mtype
,
prtype
,
col_len
,
dict_mem_table_add_col
(
table
,
name
,
mtype
,
prtype
,
col_len
,
...
@@ -462,6 +466,7 @@ dict_load_fields(
...
@@ -462,6 +466,7 @@ dict_load_fields(
sys_fields
=
dict_table_get_low
(
"SYS_FIELDS"
);
sys_fields
=
dict_table_get_low
(
"SYS_FIELDS"
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_fields
->
indexes
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_fields
->
indexes
);
ut_a
(
!
sys_fields
->
comp
);
tuple
=
dtuple_create
(
heap
,
1
);
tuple
=
dtuple_create
(
heap
,
1
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
...
@@ -479,15 +484,15 @@ dict_load_fields(
...
@@ -479,15 +484,15 @@ dict_load_fields(
rec
=
btr_pcur_get_rec
(
&
pcur
);
rec
=
btr_pcur_get_rec
(
&
pcur
);
ut_a
(
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
));
ut_a
(
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
));
if
(
rec_get_deleted_flag
(
rec
))
{
if
(
rec_get_deleted_flag
(
rec
,
sys_fields
->
comp
))
{
dict_load_report_deleted_index
(
table
->
name
,
i
);
dict_load_report_deleted_index
(
table
->
name
,
i
);
}
}
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
ut_ad
(
len
==
8
);
ut_ad
(
len
==
8
);
ut_a
(
ut_memcmp
(
buf
,
field
,
len
)
==
0
);
ut_a
(
ut_memcmp
(
buf
,
field
,
len
)
==
0
);
field
=
rec_get_nth_field
(
rec
,
1
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
1
,
&
len
);
ut_a
(
len
==
4
);
ut_a
(
len
==
4
);
/* The next field stores the field position in the index
/* The next field stores the field position in the index
...
@@ -513,10 +518,9 @@ dict_load_fields(
...
@@ -513,10 +518,9 @@ dict_load_fields(
ut_a
(
0
==
ut_strcmp
(
"COL_NAME"
,
ut_a
(
0
==
ut_strcmp
(
"COL_NAME"
,
dict_field_get_col
(
dict_field_get_col
(
dict_index_get_nth_field
(
dict_index_get_nth_field
(
sys_index
,
4
))
->
name
));
dict_table_get_first_index
(
sys_fields
),
4
))
->
name
));
field
=
rec_get_nth_field
(
rec
,
4
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
4
,
&
len
);
dict_mem_index_add_field
(
index
,
dict_mem_index_add_field
(
index
,
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
len
),
0
,
prefix_len
);
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
len
),
0
,
prefix_len
);
...
@@ -575,6 +579,7 @@ dict_load_indexes(
...
@@ -575,6 +579,7 @@ dict_load_indexes(
sys_indexes
=
dict_table_get_low
(
"SYS_INDEXES"
);
sys_indexes
=
dict_table_get_low
(
"SYS_INDEXES"
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_indexes
->
indexes
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_indexes
->
indexes
);
ut_a
(
!
sys_indexes
->
comp
);
tuple
=
dtuple_create
(
heap
,
1
);
tuple
=
dtuple_create
(
heap
,
1
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
...
@@ -595,14 +600,14 @@ dict_load_indexes(
...
@@ -595,14 +600,14 @@ dict_load_indexes(
rec
=
btr_pcur_get_rec
(
&
pcur
);
rec
=
btr_pcur_get_rec
(
&
pcur
);
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
ut_ad
(
len
==
8
);
ut_ad
(
len
==
8
);
if
(
ut_memcmp
(
buf
,
field
,
len
)
!=
0
)
{
if
(
ut_memcmp
(
buf
,
field
,
len
)
!=
0
)
{
break
;
break
;
}
}
if
(
rec_get_deleted_flag
(
rec
))
{
if
(
rec_get_deleted_flag
(
rec
,
table
->
comp
))
{
dict_load_report_deleted_index
(
table
->
name
,
dict_load_report_deleted_index
(
table
->
name
,
ULINT_UNDEFINED
);
ULINT_UNDEFINED
);
...
@@ -612,33 +617,31 @@ dict_load_indexes(
...
@@ -612,33 +617,31 @@ dict_load_indexes(
return
(
FALSE
);
return
(
FALSE
);
}
}
field
=
rec_get_nth_field
(
rec
,
1
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
1
,
&
len
);
ut_ad
(
len
==
8
);
ut_ad
(
len
==
8
);
id
=
mach_read_from_8
(
field
);
id
=
mach_read_from_8
(
field
);
ut_a
(
0
==
ut_strcmp
(
"NAME"
,
ut_a
(
0
==
ut_strcmp
(
"NAME"
,
dict_field_get_col
(
dict_field_get_col
(
dict_index_get_nth_field
(
dict_index_get_nth_field
(
sys_index
,
4
))
->
name
));
dict_table_get_first_index
(
sys_indexes
),
4
))
->
name
));
field
=
rec_get_nth_field_old
(
rec
,
4
,
&
name_len
);
field
=
rec_get_nth_field
(
rec
,
4
,
&
name_len
);
name_buf
=
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
name_len
);
name_buf
=
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
name_len
);
field
=
rec_get_nth_field
(
rec
,
5
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
5
,
&
len
);
n_fields
=
mach_read_from_4
(
field
);
n_fields
=
mach_read_from_4
(
field
);
field
=
rec_get_nth_field
(
rec
,
6
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
6
,
&
len
);
type
=
mach_read_from_4
(
field
);
type
=
mach_read_from_4
(
field
);
field
=
rec_get_nth_field
(
rec
,
7
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
7
,
&
len
);
space
=
mach_read_from_4
(
field
);
space
=
mach_read_from_4
(
field
);
ut_a
(
0
==
ut_strcmp
(
"PAGE_NO"
,
ut_a
(
0
==
ut_strcmp
(
"PAGE_NO"
,
dict_field_get_col
(
dict_field_get_col
(
dict_index_get_nth_field
(
dict_index_get_nth_field
(
sys_index
,
8
))
->
name
));
dict_table_get_first_index
(
sys_indexes
),
8
))
->
name
));
field
=
rec_get_nth_field
(
rec
,
8
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
8
,
&
len
);
page_no
=
mach_read_from_4
(
field
);
page_no
=
mach_read_from_4
(
field
);
if
(
page_no
==
FIL_NULL
)
{
if
(
page_no
==
FIL_NULL
)
{
...
@@ -680,12 +683,10 @@ dict_load_indexes(
...
@@ -680,12 +683,10 @@ dict_load_indexes(
}
else
{
}
else
{
index
=
dict_mem_index_create
(
table
->
name
,
name_buf
,
index
=
dict_mem_index_create
(
table
->
name
,
name_buf
,
space
,
type
,
n_fields
);
space
,
type
,
n_fields
);
index
->
page_no
=
page_no
;
index
->
id
=
id
;
index
->
id
=
id
;
dict_load_fields
(
table
,
index
,
heap
);
dict_load_fields
(
table
,
index
,
heap
);
dict_index_add_to_cache
(
table
,
index
,
page_no
);
dict_index_add_to_cache
(
table
,
index
);
}
}
btr_pcur_move_to_next_user_rec
(
&
pcur
,
&
mtr
);
btr_pcur_move_to_next_user_rec
(
&
pcur
,
&
mtr
);
...
@@ -741,6 +742,7 @@ dict_load_table(
...
@@ -741,6 +742,7 @@ dict_load_table(
sys_tables
=
dict_table_get_low
(
"SYS_TABLES"
);
sys_tables
=
dict_table_get_low
(
"SYS_TABLES"
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_tables
->
indexes
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_tables
->
indexes
);
ut_a
(
!
sys_tables
->
comp
);
tuple
=
dtuple_create
(
heap
,
1
);
tuple
=
dtuple_create
(
heap
,
1
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
...
@@ -753,7 +755,7 @@ dict_load_table(
...
@@ -753,7 +755,7 @@ dict_load_table(
rec
=
btr_pcur_get_rec
(
&
pcur
);
rec
=
btr_pcur_get_rec
(
&
pcur
);
if
(
!
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
)
if
(
!
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
)
||
rec_get_deleted_flag
(
rec
))
{
||
rec_get_deleted_flag
(
rec
,
sys_tables
->
comp
))
{
/* Not found */
/* Not found */
btr_pcur_close
(
&
pcur
);
btr_pcur_close
(
&
pcur
);
...
@@ -763,11 +765,10 @@ dict_load_table(
...
@@ -763,11 +765,10 @@ dict_load_table(
return
(
NULL
);
return
(
NULL
);
}
}
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
/* Check if the table name in record is the searched one */
/* Check if the table name in record is the searched one */
if
(
len
!=
ut_strlen
(
name
)
||
ut_memcmp
(
name
,
field
,
len
)
!=
0
)
{
if
(
len
!=
ut_strlen
(
name
)
||
ut_memcmp
(
name
,
field
,
len
)
!=
0
)
{
err_exit:
btr_pcur_close
(
&
pcur
);
btr_pcur_close
(
&
pcur
);
mtr_commit
(
&
mtr
);
mtr_commit
(
&
mtr
);
mem_heap_free
(
heap
);
mem_heap_free
(
heap
);
...
@@ -777,10 +778,9 @@ dict_load_table(
...
@@ -777,10 +778,9 @@ dict_load_table(
ut_a
(
0
==
ut_strcmp
(
"SPACE"
,
ut_a
(
0
==
ut_strcmp
(
"SPACE"
,
dict_field_get_col
(
dict_field_get_col
(
dict_index_get_nth_field
(
dict_index_get_nth_field
(
sys_index
,
9
))
->
name
));
dict_table_get_first_index
(
sys_tables
),
9
))
->
name
));
field
=
rec_get_nth_field
(
rec
,
9
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
9
,
&
len
);
space
=
mach_read_from_4
(
field
);
space
=
mach_read_from_4
(
field
);
/* Check if the tablespace exists and has the right name */
/* Check if the tablespace exists and has the right name */
...
@@ -812,49 +812,44 @@ dict_load_table(
...
@@ -812,49 +812,44 @@ dict_load_table(
ut_a
(
0
==
ut_strcmp
(
"N_COLS"
,
ut_a
(
0
==
ut_strcmp
(
"N_COLS"
,
dict_field_get_col
(
dict_field_get_col
(
dict_index_get_nth_field
(
dict_index_get_nth_field
(
sys_index
,
4
))
->
name
));
dict_table_get_first_index
(
sys_tables
),
4
))
->
name
));
field
=
rec_get_nth_field
(
rec
,
4
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
4
,
&
len
);
n_cols
=
mach_read_from_4
(
field
);
n_cols
=
mach_read_from_4
(
field
);
if
(
n_cols
&
0x80000000UL
)
{
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: table %s is in the new compact format
\n
"
"InnoDB: of MySQL 5.0.3 or later
\n
"
,
name
);
goto
err_exit
;
}
table
=
dict_mem_table_create
(
name
,
space
,
n_cols
);
/* The high-order bit of N_COLS is the "compact format" flag. */
table
=
dict_mem_table_create
(
name
,
space
,
n_cols
&
~
0x80000000UL
,
!!
(
n_cols
&
0x80000000UL
));
table
->
ibd_file_missing
=
ibd_file_missing
;
table
->
ibd_file_missing
=
ibd_file_missing
;
ut_a
(
0
==
ut_strcmp
(
"ID"
,
ut_a
(
0
==
ut_strcmp
(
"ID"
,
dict_field_get_col
(
dict_field_get_col
(
dict_index_get_nth_field
(
dict_index_get_nth_field
(
sys_index
,
3
))
->
name
));
dict_table_get_first_index
(
sys_tables
),
3
))
->
name
));
field
=
rec_get_nth_field
(
rec
,
3
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
3
,
&
len
);
table
->
id
=
mach_read_from_8
(
field
);
table
->
id
=
mach_read_from_8
(
field
);
field
=
rec_get_nth_field
(
rec
,
5
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
5
,
&
len
);
table
->
type
=
mach_read_from_4
(
field
);
table
->
type
=
mach_read_from_4
(
field
);
if
(
table
->
type
==
DICT_TABLE_CLUSTER_MEMBER
)
{
if
(
table
->
type
==
DICT_TABLE_CLUSTER_MEMBER
)
{
ut_error
;
ut_error
;
#if 0 /* clustered tables have not been implemented yet */
#if 0 /* clustered tables have not been implemented yet */
field = rec_get_nth_field(rec, 6, &len);
field = rec_get_nth_field
_old
(rec, 6, &len);
table->mix_id = mach_read_from_8(field);
table->mix_id = mach_read_from_8(field);
field = rec_get_nth_field(rec, 8, &len);
field = rec_get_nth_field
_old
(rec, 8, &len);
table->cluster_name = mem_heap_strdupl(heap, (char*) field, len);
table->cluster_name = mem_heap_strdupl(heap, (char*) field, len);
#endif
#endif
}
}
if
((
table
->
type
==
DICT_TABLE_CLUSTER
)
if
((
table
->
type
==
DICT_TABLE_CLUSTER
)
||
(
table
->
type
==
DICT_TABLE_CLUSTER_MEMBER
))
{
||
(
table
->
type
==
DICT_TABLE_CLUSTER_MEMBER
))
{
field
=
rec_get_nth_field
(
rec
,
7
,
&
len
);
field
=
rec_get_nth_field_old
(
rec
,
7
,
&
len
);
ut_a
(
len
==
4
);
table
->
mix_len
=
mach_read_from_4
(
field
);
table
->
mix_len
=
mach_read_from_4
(
field
);
}
}
...
@@ -933,6 +928,7 @@ dict_load_table_on_id(
...
@@ -933,6 +928,7 @@ dict_load_table_on_id(
sys_tables
=
dict_sys
->
sys_tables
;
sys_tables
=
dict_sys
->
sys_tables
;
sys_table_ids
=
dict_table_get_next_index
(
sys_table_ids
=
dict_table_get_next_index
(
dict_table_get_first_index
(
sys_tables
));
dict_table_get_first_index
(
sys_tables
));
ut_a
(
!
sys_tables
->
comp
);
heap
=
mem_heap_create
(
256
);
heap
=
mem_heap_create
(
256
);
tuple
=
dtuple_create
(
heap
,
1
);
tuple
=
dtuple_create
(
heap
,
1
);
...
@@ -949,7 +945,7 @@ dict_load_table_on_id(
...
@@ -949,7 +945,7 @@ dict_load_table_on_id(
rec
=
btr_pcur_get_rec
(
&
pcur
);
rec
=
btr_pcur_get_rec
(
&
pcur
);
if
(
!
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
)
if
(
!
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
)
||
rec_get_deleted_flag
(
rec
))
{
||
rec_get_deleted_flag
(
rec
,
sys_tables
->
comp
))
{
/* Not found */
/* Not found */
btr_pcur_close
(
&
pcur
);
btr_pcur_close
(
&
pcur
);
...
@@ -964,7 +960,7 @@ dict_load_table_on_id(
...
@@ -964,7 +960,7 @@ dict_load_table_on_id(
table ID and NAME */
table ID and NAME */
rec
=
btr_pcur_get_rec
(
&
pcur
);
rec
=
btr_pcur_get_rec
(
&
pcur
);
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
ut_ad
(
len
==
8
);
ut_ad
(
len
==
8
);
/* Check if the table id in record is the one searched for */
/* Check if the table id in record is the one searched for */
...
@@ -978,7 +974,7 @@ dict_load_table_on_id(
...
@@ -978,7 +974,7 @@ dict_load_table_on_id(
}
}
/* Now we get the table name from the record */
/* Now we get the table name from the record */
field
=
rec_get_nth_field
(
rec
,
1
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
1
,
&
len
);
/* Load the table definition to memory */
/* Load the table definition to memory */
table
=
dict_load_table
(
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
len
));
table
=
dict_load_table
(
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
len
));
...
@@ -1046,6 +1042,7 @@ dict_load_foreign_cols(
...
@@ -1046,6 +1042,7 @@ dict_load_foreign_cols(
sys_foreign_cols
=
dict_table_get_low
(
"SYS_FOREIGN_COLS"
);
sys_foreign_cols
=
dict_table_get_low
(
"SYS_FOREIGN_COLS"
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_foreign_cols
->
indexes
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_foreign_cols
->
indexes
);
ut_a
(
!
sys_foreign_cols
->
comp
);
tuple
=
dtuple_create
(
foreign
->
heap
,
1
);
tuple
=
dtuple_create
(
foreign
->
heap
,
1
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
...
@@ -1060,21 +1057,21 @@ dict_load_foreign_cols(
...
@@ -1060,21 +1057,21 @@ dict_load_foreign_cols(
rec
=
btr_pcur_get_rec
(
&
pcur
);
rec
=
btr_pcur_get_rec
(
&
pcur
);
ut_a
(
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
));
ut_a
(
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
));
ut_a
(
!
rec_get_deleted_flag
(
rec
));
ut_a
(
!
rec_get_deleted_flag
(
rec
,
sys_foreign_cols
->
comp
));
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
ut_a
(
len
==
ut_strlen
(
id
));
ut_a
(
len
==
ut_strlen
(
id
));
ut_a
(
ut_memcmp
(
id
,
field
,
len
)
==
0
);
ut_a
(
ut_memcmp
(
id
,
field
,
len
)
==
0
);
field
=
rec_get_nth_field
(
rec
,
1
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
1
,
&
len
);
ut_a
(
len
==
4
);
ut_a
(
len
==
4
);
ut_a
(
i
==
mach_read_from_4
(
field
));
ut_a
(
i
==
mach_read_from_4
(
field
));
field
=
rec_get_nth_field
(
rec
,
4
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
4
,
&
len
);
foreign
->
foreign_col_names
[
i
]
=
foreign
->
foreign_col_names
[
i
]
=
mem_heap_strdupl
(
foreign
->
heap
,
(
char
*
)
field
,
len
);
mem_heap_strdupl
(
foreign
->
heap
,
(
char
*
)
field
,
len
);
field
=
rec_get_nth_field
(
rec
,
5
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
5
,
&
len
);
foreign
->
referenced_col_names
[
i
]
=
foreign
->
referenced_col_names
[
i
]
=
mem_heap_strdupl
(
foreign
->
heap
,
(
char
*
)
field
,
len
);
mem_heap_strdupl
(
foreign
->
heap
,
(
char
*
)
field
,
len
);
...
@@ -1118,6 +1115,7 @@ dict_load_foreign(
...
@@ -1118,6 +1115,7 @@ dict_load_foreign(
sys_foreign
=
dict_table_get_low
(
"SYS_FOREIGN"
);
sys_foreign
=
dict_table_get_low
(
"SYS_FOREIGN"
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_foreign
->
indexes
);
sys_index
=
UT_LIST_GET_FIRST
(
sys_foreign
->
indexes
);
ut_a
(
!
sys_foreign
->
comp
);
tuple
=
dtuple_create
(
heap2
,
1
);
tuple
=
dtuple_create
(
heap2
,
1
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
dfield
=
dtuple_get_nth_field
(
tuple
,
0
);
...
@@ -1130,7 +1128,7 @@ dict_load_foreign(
...
@@ -1130,7 +1128,7 @@ dict_load_foreign(
rec
=
btr_pcur_get_rec
(
&
pcur
);
rec
=
btr_pcur_get_rec
(
&
pcur
);
if
(
!
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
)
if
(
!
btr_pcur_is_on_user_rec
(
&
pcur
,
&
mtr
)
||
rec_get_deleted_flag
(
rec
))
{
||
rec_get_deleted_flag
(
rec
,
sys_foreign
->
comp
))
{
/* Not found */
/* Not found */
fprintf
(
stderr
,
fprintf
(
stderr
,
...
@@ -1144,7 +1142,7 @@ dict_load_foreign(
...
@@ -1144,7 +1142,7 @@ dict_load_foreign(
return
(
DB_ERROR
);
return
(
DB_ERROR
);
}
}
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
/* Check if the id in record is the searched one */
/* Check if the id in record is the searched one */
if
(
len
!=
ut_strlen
(
id
)
||
ut_memcmp
(
id
,
field
,
len
)
!=
0
)
{
if
(
len
!=
ut_strlen
(
id
)
||
ut_memcmp
(
id
,
field
,
len
)
!=
0
)
{
...
@@ -1167,7 +1165,8 @@ dict_load_foreign(
...
@@ -1167,7 +1165,8 @@ dict_load_foreign(
foreign
=
dict_mem_foreign_create
();
foreign
=
dict_mem_foreign_create
();
foreign
->
n_fields
=
mach_read_from_4
(
rec_get_nth_field
(
rec
,
5
,
&
len
));
foreign
->
n_fields
=
mach_read_from_4
(
rec_get_nth_field_old
(
rec
,
5
,
&
len
));
ut_a
(
len
==
4
);
ut_a
(
len
==
4
);
...
@@ -1178,11 +1177,11 @@ dict_load_foreign(
...
@@ -1178,11 +1177,11 @@ dict_load_foreign(
foreign
->
id
=
mem_heap_strdup
(
foreign
->
heap
,
id
);
foreign
->
id
=
mem_heap_strdup
(
foreign
->
heap
,
id
);
field
=
rec_get_nth_field
(
rec
,
3
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
3
,
&
len
);
foreign
->
foreign_table_name
=
foreign
->
foreign_table_name
=
mem_heap_strdupl
(
foreign
->
heap
,
(
char
*
)
field
,
len
);
mem_heap_strdupl
(
foreign
->
heap
,
(
char
*
)
field
,
len
);
field
=
rec_get_nth_field
(
rec
,
4
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
4
,
&
len
);
foreign
->
referenced_table_name
=
foreign
->
referenced_table_name
=
mem_heap_strdupl
(
foreign
->
heap
,
(
char
*
)
field
,
len
);
mem_heap_strdupl
(
foreign
->
heap
,
(
char
*
)
field
,
len
);
...
@@ -1251,6 +1250,7 @@ dict_load_foreigns(
...
@@ -1251,6 +1250,7 @@ dict_load_foreigns(
return
(
DB_ERROR
);
return
(
DB_ERROR
);
}
}
ut_a
(
!
sys_foreign
->
comp
);
mtr_start
(
&
mtr
);
mtr_start
(
&
mtr
);
/* Get the secondary index based on FOR_NAME from table
/* Get the secondary index based on FOR_NAME from table
...
@@ -1282,7 +1282,7 @@ dict_load_foreigns(
...
@@ -1282,7 +1282,7 @@ dict_load_foreigns(
name and a foreign constraint ID */
name and a foreign constraint ID */
rec
=
btr_pcur_get_rec
(
&
pcur
);
rec
=
btr_pcur_get_rec
(
&
pcur
);
field
=
rec_get_nth_field
(
rec
,
0
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
0
,
&
len
);
/* Check if the table name in the record is the one searched for; the
/* Check if the table name in the record is the one searched for; the
following call does the comparison in the latin1_swedish_ci
following call does the comparison in the latin1_swedish_ci
...
@@ -1305,13 +1305,13 @@ dict_load_foreigns(
...
@@ -1305,13 +1305,13 @@ dict_load_foreigns(
goto
next_rec
;
goto
next_rec
;
}
}
if
(
rec_get_deleted_flag
(
rec
))
{
if
(
rec_get_deleted_flag
(
rec
,
sys_foreign
->
comp
))
{
goto
next_rec
;
goto
next_rec
;
}
}
/* Now we get a foreign key constraint id */
/* Now we get a foreign key constraint id */
field
=
rec_get_nth_field
(
rec
,
1
,
&
len
);
field
=
rec_get_nth_field
_old
(
rec
,
1
,
&
len
);
id
=
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
len
);
id
=
mem_heap_strdupl
(
heap
,
(
char
*
)
field
,
len
);
btr_pcur_store_position
(
&
pcur
,
&
mtr
);
btr_pcur_store_position
(
&
pcur
,
&
mtr
);
...
...
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