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
7bb535bb
Commit
7bb535bb
authored
Sep 15, 2006
by
osku
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make dict_index_find_cols() always succeed.
parent
16951e43
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
54 deletions
+38
-54
dict/dict0boot.c
dict/dict0boot.c
+19
-22
dict/dict0crea.c
dict/dict0crea.c
+2
-5
dict/dict0dict.c
dict/dict0dict.c
+15
-24
include/dict0dict.h
include/dict0dict.h
+2
-3
No files found.
dict/dict0boot.c
View file @
7bb535bb
...
@@ -214,7 +214,6 @@ dict_boot(void)
...
@@ -214,7 +214,6 @@ dict_boot(void)
dict_index_t
*
index
;
dict_index_t
*
index
;
dict_hdr_t
*
dict_hdr
;
dict_hdr_t
*
dict_hdr
;
mtr_t
mtr
;
mtr_t
mtr
;
ibool
success
;
mtr_start
(
&
mtr
);
mtr_start
(
&
mtr
);
...
@@ -269,21 +268,20 @@ dict_boot(void)
...
@@ -269,21 +268,20 @@ dict_boot(void)
index
->
id
=
DICT_TABLES_ID
;
index
->
id
=
DICT_TABLES_ID
;
success
=
dict_index_add_to_cache
(
table
,
index
,
mtr_read_ulint
dict_index_add_to_cache
(
table
,
index
,
(
dict_hdr
+
DICT_HDR_TABLES
,
mtr_read_ulint
(
dict_hdr
+
DICT_HDR_TABLES
,
MLOG_4BYTES
,
&
mtr
));
MLOG_4BYTES
,
&
mtr
));
ut_a
(
success
);
/*-------------------------*/
/*-------------------------*/
index
=
dict_mem_index_create
(
"SYS_TABLES"
,
"ID_IND"
,
index
=
dict_mem_index_create
(
"SYS_TABLES"
,
"ID_IND"
,
DICT_HDR_SPACE
,
DICT_UNIQUE
,
1
);
DICT_HDR_SPACE
,
DICT_UNIQUE
,
1
);
dict_mem_index_add_field
(
index
,
"ID"
,
0
);
dict_mem_index_add_field
(
index
,
"ID"
,
0
);
index
->
id
=
DICT_TABLE_IDS_ID
;
index
->
id
=
DICT_TABLE_IDS_ID
;
success
=
dict_index_add_to_cache
(
table
,
index
,
dict_index_add_to_cache
(
table
,
index
,
mtr_read_ulint
mtr_read_ulint
(
dict_hdr
+
DICT_HDR_TABLE_IDS
,
(
dict_hdr
+
DICT_HDR_TABLE_IDS
,
MLOG_4BYTES
,
&
mtr
));
MLOG_4BYTES
,
&
mtr
));
ut_a
(
success
);
/*-------------------------*/
/*-------------------------*/
table
=
dict_mem_table_create
(
"SYS_COLUMNS"
,
DICT_HDR_SPACE
,
7
,
0
);
table
=
dict_mem_table_create
(
"SYS_COLUMNS"
,
DICT_HDR_SPACE
,
7
,
0
);
...
@@ -308,10 +306,10 @@ dict_boot(void)
...
@@ -308,10 +306,10 @@ dict_boot(void)
dict_mem_index_add_field
(
index
,
"POS"
,
0
);
dict_mem_index_add_field
(
index
,
"POS"
,
0
);
index
->
id
=
DICT_COLUMNS_ID
;
index
->
id
=
DICT_COLUMNS_ID
;
success
=
dict_index_add_to_cache
(
table
,
index
,
mtr_read_ulint
dict_index_add_to_cache
(
table
,
index
,
(
dict_hdr
+
DICT_HDR_COLUMNS
,
mtr_read_ulint
(
dict_hdr
+
DICT_HDR_COLUMNS
,
MLOG_4BYTES
,
&
mtr
));
MLOG_4BYTES
,
&
mtr
));
ut_a
(
success
);
/*-------------------------*/
/*-------------------------*/
table
=
dict_mem_table_create
(
"SYS_INDEXES"
,
DICT_HDR_SPACE
,
7
,
0
);
table
=
dict_mem_table_create
(
"SYS_INDEXES"
,
DICT_HDR_SPACE
,
7
,
0
);
...
@@ -346,10 +344,10 @@ dict_boot(void)
...
@@ -346,10 +344,10 @@ dict_boot(void)
dict_mem_index_add_field
(
index
,
"ID"
,
0
);
dict_mem_index_add_field
(
index
,
"ID"
,
0
);
index
->
id
=
DICT_INDEXES_ID
;
index
->
id
=
DICT_INDEXES_ID
;
success
=
dict_index_add_to_cache
(
table
,
index
,
mtr_read_ulint
dict_index_add_to_cache
(
table
,
index
,
(
dict_hdr
+
DICT_HDR_INDEXES
,
mtr_read_ulint
(
dict_hdr
+
DICT_HDR_INDEXES
,
MLOG_4BYTES
,
&
mtr
));
MLOG_4BYTES
,
&
mtr
));
ut_a
(
success
);
/*-------------------------*/
/*-------------------------*/
table
=
dict_mem_table_create
(
"SYS_FIELDS"
,
DICT_HDR_SPACE
,
3
,
0
);
table
=
dict_mem_table_create
(
"SYS_FIELDS"
,
DICT_HDR_SPACE
,
3
,
0
);
...
@@ -369,10 +367,9 @@ dict_boot(void)
...
@@ -369,10 +367,9 @@ dict_boot(void)
dict_mem_index_add_field
(
index
,
"POS"
,
0
);
dict_mem_index_add_field
(
index
,
"POS"
,
0
);
index
->
id
=
DICT_FIELDS_ID
;
index
->
id
=
DICT_FIELDS_ID
;
success
=
dict_index_add_to_cache
(
table
,
index
,
mtr_read_ulint
dict_index_add_to_cache
(
table
,
index
,
(
dict_hdr
+
DICT_HDR_FIELDS
,
mtr_read_ulint
(
dict_hdr
+
DICT_HDR_FIELDS
,
MLOG_4BYTES
,
&
mtr
));
MLOG_4BYTES
,
&
mtr
));
ut_a
(
success
);
mtr_commit
(
&
mtr
);
mtr_commit
(
&
mtr
);
/*-------------------------*/
/*-------------------------*/
...
...
dict/dict0crea.c
View file @
7bb535bb
...
@@ -1004,7 +1004,6 @@ dict_create_index_step(
...
@@ -1004,7 +1004,6 @@ dict_create_index_step(
que_thr_t
*
thr
)
/* in: query thread */
que_thr_t
*
thr
)
/* in: query thread */
{
{
ind_node_t
*
node
;
ind_node_t
*
node
;
ibool
success
;
ulint
err
=
DB_ERROR
;
ulint
err
=
DB_ERROR
;
trx_t
*
trx
;
trx_t
*
trx
;
...
@@ -1088,11 +1087,9 @@ dict_create_index_step(
...
@@ -1088,11 +1087,9 @@ dict_create_index_step(
if
(
node
->
state
==
INDEX_ADD_TO_CACHE
)
{
if
(
node
->
state
==
INDEX_ADD_TO_CACHE
)
{
success
=
dict_index_add_to_cache
(
node
->
table
,
node
->
index
,
dict_index_add_to_cache
(
node
->
table
,
node
->
index
,
node
->
page_no
);
node
->
page_no
);
ut_a
(
success
);
err
=
DB_SUCCESS
;
err
=
DB_SUCCESS
;
}
}
...
...
dict/dict0dict.c
View file @
7bb535bb
...
@@ -146,13 +146,12 @@ dict_index_copy(
...
@@ -146,13 +146,12 @@ dict_index_copy(
ulint
start
,
/* in: first position to copy */
ulint
start
,
/* in: first position to copy */
ulint
end
);
/* in: last position to copy */
ulint
end
);
/* in: last position to copy */
/***********************************************************************
/***********************************************************************
Tries to find column names for the index and
Tries to find column names for the index and
sets the col field of the
sets the col field of the
index. */
index. */
static
static
ibool
void
dict_index_find_cols
(
dict_index_find_cols
(
/*=================*/
/*=================*/
/* out: TRUE if success */
dict_table_t
*
table
,
/* in: table */
dict_table_t
*
table
,
/* in: table */
dict_index_t
*
index
);
/* in: index */
dict_index_t
*
index
);
/* in: index */
/***********************************************************************
/***********************************************************************
...
@@ -1308,10 +1307,9 @@ dict_col_name_is_reserved(
...
@@ -1308,10 +1307,9 @@ dict_col_name_is_reserved(
/**************************************************************************
/**************************************************************************
Adds an index to the dictionary cache. */
Adds an index to the dictionary cache. */
ibool
void
dict_index_add_to_cache
(
dict_index_add_to_cache
(
/*====================*/
/*====================*/
/* out: TRUE if success */
dict_table_t
*
table
,
/* in: table on which the index is */
dict_table_t
*
table
,
/* in: table on which the index is */
dict_index_t
*
index
,
/* in, own: index; NOTE! The index memory
dict_index_t
*
index
,
/* in, own: index; NOTE! The index memory
object is freed in this function! */
object is freed in this function! */
...
@@ -1321,7 +1319,6 @@ dict_index_add_to_cache(
...
@@ -1321,7 +1319,6 @@ dict_index_add_to_cache(
dict_tree_t
*
tree
;
dict_tree_t
*
tree
;
dict_field_t
*
field
;
dict_field_t
*
field
;
ulint
n_ord
;
ulint
n_ord
;
ibool
success
;
ulint
i
;
ulint
i
;
ut_ad
(
index
);
ut_ad
(
index
);
...
@@ -1349,13 +1346,7 @@ dict_index_add_to_cache(
...
@@ -1349,13 +1346,7 @@ dict_index_add_to_cache(
ut_a
(
!
(
index
->
type
&
DICT_CLUSTERED
)
ut_a
(
!
(
index
->
type
&
DICT_CLUSTERED
)
||
UT_LIST_GET_LEN
(
table
->
indexes
)
==
0
);
||
UT_LIST_GET_LEN
(
table
->
indexes
)
==
0
);
success
=
dict_index_find_cols
(
table
,
index
);
dict_index_find_cols
(
table
,
index
);
if
(
!
success
)
{
dict_mem_index_free
(
index
);
return
(
FALSE
);
}
/* Build the cache internal representation of the index,
/* Build the cache internal representation of the index,
containing also the added system fields */
containing also the added system fields */
...
@@ -1421,8 +1412,6 @@ dict_index_add_to_cache(
...
@@ -1421,8 +1412,6 @@ dict_index_add_to_cache(
dict_sys
->
size
+=
mem_heap_get_size
(
new_index
->
heap
);
dict_sys
->
size
+=
mem_heap_get_size
(
new_index
->
heap
);
dict_mem_index_free
(
index
);
dict_mem_index_free
(
index
);
return
(
TRUE
);
}
}
/**************************************************************************
/**************************************************************************
...
@@ -1459,13 +1448,12 @@ dict_index_remove_from_cache(
...
@@ -1459,13 +1448,12 @@ dict_index_remove_from_cache(
}
}
/***********************************************************************
/***********************************************************************
Tries to find column names for the index and
Tries to find column names for the index and
sets the col field of the
sets the col field of the
index. */
index. */
static
static
ibool
void
dict_index_find_cols
(
dict_index_find_cols
(
/*=================*/
/*=================*/
/* out: TRUE if success */
dict_table_t
*
table
,
/* in: table */
dict_table_t
*
table
,
/* in: table */
dict_index_t
*
index
)
/* in: index */
dict_index_t
*
index
)
/* in: index */
{
{
...
@@ -1483,17 +1471,20 @@ dict_index_find_cols(
...
@@ -1483,17 +1471,20 @@ dict_index_find_cols(
for
(
j
=
0
;
j
<
table
->
n_cols
;
j
++
)
{
for
(
j
=
0
;
j
<
table
->
n_cols
;
j
++
)
{
dict_col_t
*
col
=
dict_table_get_nth_col
(
table
,
j
);
dict_col_t
*
col
=
dict_table_get_nth_col
(
table
,
j
);
if
(
!
strcmp
(
col
->
name
,
field
->
name
))
{
if
(
!
strcmp
(
col
->
name
,
field
->
name
))
{
field
->
col
=
col
;
field
->
col
=
col
;
goto
found
;
goto
found
;
}
}
}
}
return
(
FALSE
);
/* It is an error not to find a matching column. */
found:
;
ut_error
;
}
return
(
TRUE
);
found:
;
}
}
}
/***********************************************************************
/***********************************************************************
...
...
include/dict0dict.h
View file @
7bb535bb
...
@@ -550,12 +550,11 @@ dict_index_find_on_id_low(
...
@@ -550,12 +550,11 @@ dict_index_find_on_id_low(
/* out: index or NULL if not found from cache */
/* out: index or NULL if not found from cache */
dulint
id
);
/* in: index id */
dulint
id
);
/* in: index id */
/**************************************************************************
/**************************************************************************
Adds an index to dictionary cache. */
Adds an index to
the
dictionary cache. */
ibool
void
dict_index_add_to_cache
(
dict_index_add_to_cache
(
/*====================*/
/*====================*/
/* out: TRUE if success */
dict_table_t
*
table
,
/* in: table on which the index is */
dict_table_t
*
table
,
/* in: table on which the index is */
dict_index_t
*
index
,
/* in, own: index; NOTE! The index memory
dict_index_t
*
index
,
/* in, own: index; NOTE! The index memory
object is freed in this function! */
object is freed in this function! */
...
...
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