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
9c6947fd
Commit
9c6947fd
authored
Sep 22, 2006
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: Merge revisions 838:861 from trunk.
parent
841f288a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
123 additions
and
98 deletions
+123
-98
dict/dict0dict.c
dict/dict0dict.c
+7
-7
export.sh
export.sh
+0
-1
fsp/fsp0fsp.c
fsp/fsp0fsp.c
+4
-5
handler/ha_innodb.cc
handler/ha_innodb.cc
+57
-67
mysql-test/innodb_mysql.result
mysql-test/innodb_mysql.result
+30
-8
mysql-test/innodb_mysql.test
mysql-test/innodb_mysql.test
+18
-3
row/row0row.c
row/row0row.c
+2
-1
row/row0sel.c
row/row0sel.c
+3
-4
row/row0upd.c
row/row0upd.c
+2
-2
No files found.
dict/dict0dict.c
View file @
9c6947fd
...
@@ -3881,8 +3881,8 @@ dict_update_statistics_low(
...
@@ -3881,8 +3881,8 @@ dict_update_statistics_low(
index
=
dict_table_get_first_index
(
table
);
index
=
dict_table_get_first_index
(
table
);
table
->
stat_n_rows
=
index
->
stat_n_diff_key_vals
table
->
stat_n_rows
=
index
->
stat_n_diff_key_vals
[
[
dict_index_get_n_unique
(
index
)];
dict_index_get_n_unique
(
index
)];
table
->
stat_clustered_index_size
=
index
->
stat_index_size
;
table
->
stat_clustered_index_size
=
index
->
stat_index_size
;
...
@@ -4080,8 +4080,8 @@ dict_index_print_low(
...
@@ -4080,8 +4080,8 @@ dict_index_print_low(
#endif
/* UNIV_SYNC_DEBUG */
#endif
/* UNIV_SYNC_DEBUG */
if
(
index
->
n_user_defined_cols
>
0
)
{
if
(
index
->
n_user_defined_cols
>
0
)
{
n_vals
=
index
->
stat_n_diff_key_vals
n_vals
=
index
->
stat_n_diff_key_vals
[
[
index
->
n_user_defined_cols
];
index
->
n_user_defined_cols
];
}
else
{
}
else
{
n_vals
=
index
->
stat_n_diff_key_vals
[
1
];
n_vals
=
index
->
stat_n_diff_key_vals
[
1
];
}
}
...
@@ -4295,9 +4295,9 @@ dict_print_info_on_foreign_keys(
...
@@ -4295,9 +4295,9 @@ dict_print_info_on_foreign_keys(
if
(
i
)
{
if
(
i
)
{
putc
(
' '
,
file
);
putc
(
' '
,
file
);
}
}
ut_print_name
(
file
,
trx
,
FALSE
,
ut_print_name
(
foreign
->
referenced_col_names
file
,
trx
,
FALSE
,
[
i
]);
foreign
->
referenced_col_names
[
i
]);
}
}
putc
(
')'
,
file
);
putc
(
')'
,
file
);
...
...
export.sh
View file @
9c6947fd
...
@@ -38,7 +38,6 @@ do
...
@@ -38,7 +38,6 @@ do
done
done
cd
to-mysql/storage/innobase
cd
to-mysql/storage/innobase
mv
handler ../../sql
mv
mysql-test/
*
.test mysql-test/
*
.opt ../../mysql-test/t
mv
mysql-test/
*
.test mysql-test/
*
.opt ../../mysql-test/t
mv
mysql-test/
*
.result ../../mysql-test/r
mv
mysql-test/
*
.result ../../mysql-test/r
...
...
fsp/fsp0fsp.c
View file @
9c6947fd
...
@@ -1183,11 +1183,10 @@ fsp_try_extend_data_file(
...
@@ -1183,11 +1183,10 @@ fsp_try_extend_data_file(
<
srv_data_file_sizes
[
srv_n_data_files
-
1
])
{
<
srv_data_file_sizes
[
srv_n_data_files
-
1
])
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"InnoDB: Error: Last data file"
"InnoDB: Error: Last data file size"
" size is %lu,"
" is %lu, max size allowed %lu
\n
"
,
" max size allowed %lu
\n
"
,
(
ulong
)
srv_data_file_sizes
[
(
ulong
)
srv_data_file_sizes
srv_n_data_files
-
1
],
[
srv_n_data_files
-
1
],
(
ulong
)
srv_last_file_size_max
);
(
ulong
)
srv_last_file_size_max
);
}
}
...
...
handler/ha_innodb.cc
View file @
9c6947fd
...
@@ -33,6 +33,8 @@ have disables the InnoDB inlining in this file. */
...
@@ -33,6 +33,8 @@ have disables the InnoDB inlining in this file. */
#include <mysql_priv.h>
#include <mysql_priv.h>
#ifdef WITH_INNOBASE_STORAGE_ENGINE
#include <m_ctype.h>
#include <m_ctype.h>
#include <hash.h>
#include <hash.h>
#include <myisampack.h>
#include <myisampack.h>
...
@@ -206,7 +208,7 @@ static handler *innobase_create_handler(TABLE_SHARE *table,
...
@@ -206,7 +208,7 @@ static handler *innobase_create_handler(TABLE_SHARE *table,
static
const
char
innobase_hton_name
[]
=
"InnoDB"
;
static
const
char
innobase_hton_name
[]
=
"InnoDB"
;
handlerton
innobase_hton
;
handlerton
*
innobase_hton
;
static
handler
*
innobase_create_handler
(
TABLE_SHARE
*
table
,
MEM_ROOT
*
mem_root
)
static
handler
*
innobase_create_handler
(
TABLE_SHARE
*
table
,
MEM_ROOT
*
mem_root
)
{
{
...
@@ -387,7 +389,7 @@ innobase_release_temporary_latches(
...
@@ -387,7 +389,7 @@ innobase_release_temporary_latches(
return
0
;
return
0
;
}
}
trx
=
(
trx_t
*
)
thd
->
ha_data
[
innobase_hton
.
slot
];
trx
=
(
trx_t
*
)
thd
->
ha_data
[
innobase_hton
->
slot
];
if
(
trx
)
{
if
(
trx
)
{
innobase_release_stat_resources
(
trx
);
innobase_release_stat_resources
(
trx
);
...
@@ -845,7 +847,7 @@ check_trx_exists(
...
@@ -845,7 +847,7 @@ check_trx_exists(
ut_ad
(
thd
==
current_thd
);
ut_ad
(
thd
==
current_thd
);
trx
=
(
trx_t
*
)
thd
->
ha_data
[
innobase_hton
.
slot
];
trx
=
(
trx_t
*
)
thd
->
ha_data
[
innobase_hton
->
slot
];
if
(
trx
==
NULL
)
{
if
(
trx
==
NULL
)
{
DBUG_ASSERT
(
thd
!=
NULL
);
DBUG_ASSERT
(
thd
!=
NULL
);
...
@@ -859,7 +861,7 @@ check_trx_exists(
...
@@ -859,7 +861,7 @@ check_trx_exists(
CPU time */
CPU time */
trx
->
support_xa
=
(
ibool
)(
thd
->
variables
.
innodb_support_xa
);
trx
->
support_xa
=
(
ibool
)(
thd
->
variables
.
innodb_support_xa
);
thd
->
ha_data
[
innobase_hton
.
slot
]
=
trx
;
thd
->
ha_data
[
innobase_hton
->
slot
]
=
trx
;
}
else
{
}
else
{
if
(
trx
->
magic_n
!=
TRX_MAGIC_N
)
{
if
(
trx
->
magic_n
!=
TRX_MAGIC_N
)
{
mem_analyze_corruption
(
trx
);
mem_analyze_corruption
(
trx
);
...
@@ -888,7 +890,7 @@ check_trx_exists(
...
@@ -888,7 +890,7 @@ check_trx_exists(
Construct ha_innobase handler. */
Construct ha_innobase handler. */
ha_innobase
::
ha_innobase
(
TABLE_SHARE
*
table_arg
)
ha_innobase
::
ha_innobase
(
TABLE_SHARE
*
table_arg
)
:
handler
(
&
innobase_hton
,
table_arg
),
:
handler
(
innobase_hton
,
table_arg
),
int_table_flags
(
HA_REC_NOT_IN_SEQ
|
int_table_flags
(
HA_REC_NOT_IN_SEQ
|
HA_NULL_IN_KEY
|
HA_NULL_IN_KEY
|
HA_CAN_INDEX_BLOBS
|
HA_CAN_INDEX_BLOBS
|
...
@@ -939,7 +941,7 @@ innobase_register_stmt(
...
@@ -939,7 +941,7 @@ innobase_register_stmt(
THD
*
thd
)
/* in: MySQL thd (connection) object */
THD
*
thd
)
/* in: MySQL thd (connection) object */
{
{
/* Register the statement */
/* Register the statement */
trans_register_ha
(
thd
,
FALSE
,
&
innobase_hton
);
trans_register_ha
(
thd
,
FALSE
,
innobase_hton
);
}
}
/*************************************************************************
/*************************************************************************
...
@@ -963,7 +965,7 @@ innobase_register_trx_and_stmt(
...
@@ -963,7 +965,7 @@ innobase_register_trx_and_stmt(
if
(
thd
->
options
&
(
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
{
if
(
thd
->
options
&
(
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
{
/* No autocommit mode, register for a transaction */
/* No autocommit mode, register for a transaction */
trans_register_ha
(
thd
,
TRUE
,
&
innobase_hton
);
trans_register_ha
(
thd
,
TRUE
,
innobase_hton
);
}
}
}
}
...
@@ -1327,7 +1329,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
...
@@ -1327,7 +1329,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
Opens an InnoDB database. */
Opens an InnoDB database. */
int
int
innobase_init
(
void
)
innobase_init
(
void
*
p
)
/*===============*/
/*===============*/
{
{
static
char
current_dir
[
3
];
/* Set if using current lib */
static
char
current_dir
[
3
];
/* Set if using current lib */
...
@@ -1336,31 +1338,32 @@ innobase_init(void)
...
@@ -1336,31 +1338,32 @@ innobase_init(void)
char
*
default_path
;
char
*
default_path
;
DBUG_ENTER
(
"innobase_init"
);
DBUG_ENTER
(
"innobase_init"
);
innobase_hton
=
(
handlerton
*
)
p
;
innobase_hton
.
state
=
have_innodb
;
innobase_hton
.
db_type
=
DB_TYPE_INNODB
;
innobase_hton
->
state
=
have_innodb
;
innobase_hton
.
savepoint_offset
=
sizeof
(
trx_named_savept_t
);
innobase_hton
->
db_type
=
DB_TYPE_INNODB
;
innobase_hton
.
close_connection
=
innobase_close_connection
;
innobase_hton
->
savepoint_offset
=
sizeof
(
trx_named_savept_t
);
innobase_hton
.
savepoint_set
=
innobase_savepoint
;
innobase_hton
->
close_connection
=
innobase_close_connection
;
innobase_hton
.
savepoint_rollback
=
innobase_rollback_to_savepoint
;
innobase_hton
->
savepoint_set
=
innobase_savepoint
;
innobase_hton
.
savepoint_release
=
innobase_release_savepoint
;
innobase_hton
->
savepoint_rollback
=
innobase_rollback_to_savepoint
;
innobase_hton
.
commit
=
innobase_commit
;
innobase_hton
->
savepoint_release
=
innobase_release_savepoint
;
innobase_hton
.
rollback
=
innobase_rollback
;
innobase_hton
->
commit
=
innobase_commit
;
innobase_hton
.
prepare
=
innobase_xa_prepare
;
innobase_hton
->
rollback
=
innobase_rollback
;
innobase_hton
.
recover
=
innobase_xa_recover
;
innobase_hton
->
prepare
=
innobase_xa_prepare
;
innobase_hton
.
commit_by_xid
=
innobase_commit_by_xid
;
innobase_hton
->
recover
=
innobase_xa_recover
;
innobase_hton
.
rollback_by_xid
=
innobase_rollback_by_xid
;
innobase_hton
->
commit_by_xid
=
innobase_commit_by_xid
;
innobase_hton
.
create_cursor_read_view
=
innobase_create_cursor_view
;
innobase_hton
->
rollback_by_xid
=
innobase_rollback_by_xid
;
innobase_hton
.
set_cursor_read_view
=
innobase_set_cursor_view
;
innobase_hton
->
create_cursor_read_view
=
innobase_create_cursor_view
;
innobase_hton
.
close_cursor_read_view
=
innobase_close_cursor_view
;
innobase_hton
->
set_cursor_read_view
=
innobase_set_cursor_view
;
innobase_hton
.
create
=
innobase_create_handler
;
innobase_hton
->
close_cursor_read_view
=
innobase_close_cursor_view
;
innobase_hton
.
drop_database
=
innobase_drop_database
;
innobase_hton
->
create
=
innobase_create_handler
;
innobase_hton
.
panic
=
innobase_end
;
innobase_hton
->
drop_database
=
innobase_drop_database
;
innobase_hton
.
start_consistent_snapshot
=
innobase_start_trx_and_assign_read_view
;
innobase_hton
->
panic
=
innobase_end
;
innobase_hton
.
flush_logs
=
innobase_flush_logs
;
innobase_hton
->
start_consistent_snapshot
=
innobase_start_trx_and_assign_read_view
;
innobase_hton
.
show_status
=
innobase_show_status
;
innobase_hton
->
flush_logs
=
innobase_flush_logs
;
innobase_hton
.
flags
=
HTON_NO_FLAGS
;
innobase_hton
->
show_status
=
innobase_show_status
;
innobase_hton
.
release_temporary_latches
=
innobase_release_temporary_latches
;
innobase_hton
->
flags
=
HTON_NO_FLAGS
;
innobase_hton
->
release_temporary_latches
=
innobase_release_temporary_latches
;
if
(
have_innodb
!=
SHOW_OPTION_YES
)
if
(
have_innodb
!=
SHOW_OPTION_YES
)
DBUG_RETURN
(
0
);
// nothing else to do
DBUG_RETURN
(
0
);
// nothing else to do
...
@@ -1937,7 +1940,7 @@ innobase_commit_complete(
...
@@ -1937,7 +1940,7 @@ innobase_commit_complete(
{
{
trx_t
*
trx
;
trx_t
*
trx
;
trx
=
(
trx_t
*
)
thd
->
ha_data
[
innobase_hton
.
slot
];
trx
=
(
trx_t
*
)
thd
->
ha_data
[
innobase_hton
->
slot
];
if
(
trx
&&
trx
->
active_trans
)
{
if
(
trx
&&
trx
->
active_trans
)
{
...
@@ -2156,7 +2159,7 @@ innobase_close_connection(
...
@@ -2156,7 +2159,7 @@ innobase_close_connection(
{
{
trx_t
*
trx
;
trx_t
*
trx
;
trx
=
(
trx_t
*
)
thd
->
ha_data
[
innobase_hton
.
slot
];
trx
=
(
trx_t
*
)
thd
->
ha_data
[
innobase_hton
->
slot
];
ut_a
(
trx
);
ut_a
(
trx
);
...
@@ -3251,11 +3254,11 @@ ha_innobase::write_row(
...
@@ -3251,11 +3254,11 @@ ha_innobase::write_row(
DBUG_ENTER
(
"ha_innobase::write_row"
);
DBUG_ENTER
(
"ha_innobase::write_row"
);
if
(
prebuilt
->
trx
!=
if
(
prebuilt
->
trx
!=
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
])
{
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
])
{
sql_print_error
(
"The transaction object for the table handle is at "
sql_print_error
(
"The transaction object for the table handle is at "
"%p, but for the current thread it is at %p"
,
"%p, but for the current thread it is at %p"
,
prebuilt
->
trx
,
prebuilt
->
trx
,
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
fputs
(
"InnoDB: Dump of 200 bytes around prebuilt: "
,
stderr
);
fputs
(
"InnoDB: Dump of 200 bytes around prebuilt: "
,
stderr
);
ut_print_buf
(
stderr
,
((
const
byte
*
)
prebuilt
)
-
100
,
200
);
ut_print_buf
(
stderr
,
((
const
byte
*
)
prebuilt
)
-
100
,
200
);
...
@@ -3263,7 +3266,7 @@ ha_innobase::write_row(
...
@@ -3263,7 +3266,7 @@ ha_innobase::write_row(
"InnoDB: Dump of 200 bytes around transaction.all: "
,
"InnoDB: Dump of 200 bytes around transaction.all: "
,
stderr
);
stderr
);
ut_print_buf
(
stderr
,
ut_print_buf
(
stderr
,
((
byte
*
)(
&
(
current_thd
->
ha_data
[
innobase_hton
.
slot
])))
-
100
,
((
byte
*
)(
&
(
current_thd
->
ha_data
[
innobase_hton
->
slot
])))
-
100
,
200
);
200
);
putc
(
'\n'
,
stderr
);
putc
(
'\n'
,
stderr
);
ut_error
;
ut_error
;
...
@@ -3639,7 +3642,7 @@ ha_innobase::update_row(
...
@@ -3639,7 +3642,7 @@ ha_innobase::update_row(
DBUG_ENTER
(
"ha_innobase::update_row"
);
DBUG_ENTER
(
"ha_innobase::update_row"
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
if
(
table
->
timestamp_field_type
&
TIMESTAMP_AUTO_SET_ON_UPDATE
)
if
(
table
->
timestamp_field_type
&
TIMESTAMP_AUTO_SET_ON_UPDATE
)
table
->
timestamp_field
->
set_time
();
table
->
timestamp_field
->
set_time
();
...
@@ -3700,7 +3703,7 @@ ha_innobase::delete_row(
...
@@ -3700,7 +3703,7 @@ ha_innobase::delete_row(
DBUG_ENTER
(
"ha_innobase::delete_row"
);
DBUG_ENTER
(
"ha_innobase::delete_row"
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
if
(
last_query_id
!=
user_thd
->
query_id
)
{
if
(
last_query_id
!=
user_thd
->
query_id
)
{
prebuilt
->
sql_stat_start
=
TRUE
;
prebuilt
->
sql_stat_start
=
TRUE
;
...
@@ -3798,7 +3801,7 @@ ha_innobase::try_semi_consistent_read(bool yes)
...
@@ -3798,7 +3801,7 @@ ha_innobase::try_semi_consistent_read(bool yes)
row_prebuilt_t
*
prebuilt
=
(
row_prebuilt_t
*
)
innobase_prebuilt
;
row_prebuilt_t
*
prebuilt
=
(
row_prebuilt_t
*
)
innobase_prebuilt
;
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
/* Row read type is set to semi consistent read if this was
/* Row read type is set to semi consistent read if this was
requested by the MySQL and either innodb_locks_unsafe_for_binlog
requested by the MySQL and either innodb_locks_unsafe_for_binlog
...
@@ -3965,7 +3968,7 @@ ha_innobase::index_read(
...
@@ -3965,7 +3968,7 @@ ha_innobase::index_read(
DBUG_ENTER
(
"index_read"
);
DBUG_ENTER
(
"index_read"
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
statistic_increment
(
current_thd
->
status_var
.
ha_read_key_count
,
statistic_increment
(
current_thd
->
status_var
.
ha_read_key_count
,
&
LOCK_status
);
&
LOCK_status
);
...
@@ -4080,7 +4083,7 @@ ha_innobase::change_active_index(
...
@@ -4080,7 +4083,7 @@ ha_innobase::change_active_index(
ut_ad
(
user_thd
==
current_thd
);
ut_ad
(
user_thd
==
current_thd
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
active_index
=
keynr
;
active_index
=
keynr
;
...
@@ -4170,7 +4173,7 @@ ha_innobase::general_fetch(
...
@@ -4170,7 +4173,7 @@ ha_innobase::general_fetch(
DBUG_ENTER
(
"general_fetch"
);
DBUG_ENTER
(
"general_fetch"
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
innodb_srv_conc_enter_innodb
(
prebuilt
->
trx
);
innodb_srv_conc_enter_innodb
(
prebuilt
->
trx
);
...
@@ -4406,7 +4409,7 @@ ha_innobase::rnd_pos(
...
@@ -4406,7 +4409,7 @@ ha_innobase::rnd_pos(
&
LOCK_status
);
&
LOCK_status
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
if
(
prebuilt
->
clust_index_was_generated
)
{
if
(
prebuilt
->
clust_index_was_generated
)
{
/* No primary key was defined for the table and we
/* No primary key was defined for the table and we
...
@@ -4456,7 +4459,7 @@ ha_innobase::position(
...
@@ -4456,7 +4459,7 @@ ha_innobase::position(
uint
len
;
uint
len
;
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
if
(
prebuilt
->
clust_index_was_generated
)
{
if
(
prebuilt
->
clust_index_was_generated
)
{
/* No primary key was defined for the table and we
/* No primary key was defined for the table and we
...
@@ -4965,7 +4968,7 @@ ha_innobase::discard_or_import_tablespace(
...
@@ -4965,7 +4968,7 @@ ha_innobase::discard_or_import_tablespace(
ut_a
(
prebuilt
->
trx
&&
prebuilt
->
trx
->
magic_n
==
TRX_MAGIC_N
);
ut_a
(
prebuilt
->
trx
&&
prebuilt
->
trx
->
magic_n
==
TRX_MAGIC_N
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
dict_table
=
prebuilt
->
table
;
dict_table
=
prebuilt
->
table
;
trx
=
prebuilt
->
trx
;
trx
=
prebuilt
->
trx
;
...
@@ -5293,7 +5296,7 @@ ha_innobase::records_in_range(
...
@@ -5293,7 +5296,7 @@ ha_innobase::records_in_range(
DBUG_ENTER
(
"records_in_range"
);
DBUG_ENTER
(
"records_in_range"
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
prebuilt
->
trx
->
op_info
=
(
char
*
)
"estimating records in index range"
;
prebuilt
->
trx
->
op_info
=
(
char
*
)
"estimating records in index range"
;
...
@@ -5735,7 +5738,7 @@ ha_innobase::check(
...
@@ -5735,7 +5738,7 @@ ha_innobase::check(
ut_a
(
prebuilt
->
trx
&&
prebuilt
->
trx
->
magic_n
==
TRX_MAGIC_N
);
ut_a
(
prebuilt
->
trx
&&
prebuilt
->
trx
->
magic_n
==
TRX_MAGIC_N
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
if
(
prebuilt
->
mysql_template
==
NULL
)
{
if
(
prebuilt
->
mysql_template
==
NULL
)
{
/* Build the template; we will use a dummy template
/* Build the template; we will use a dummy template
...
@@ -6019,7 +6022,7 @@ ha_innobase::can_switch_engines(void)
...
@@ -6019,7 +6022,7 @@ ha_innobase::can_switch_engines(void)
DBUG_ENTER
(
"ha_innobase::can_switch_engines"
);
DBUG_ENTER
(
"ha_innobase::can_switch_engines"
);
ut_a
(
prebuilt
->
trx
==
ut_a
(
prebuilt
->
trx
==
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
.
slot
]);
(
trx_t
*
)
current_thd
->
ha_data
[
innobase_hton
->
slot
]);
prebuilt
->
trx
->
op_info
=
prebuilt
->
trx
->
op_info
=
"determining if there are foreign key constraints"
;
"determining if there are foreign key constraints"
;
...
@@ -6186,25 +6189,11 @@ ha_innobase::start_stmt(
...
@@ -6186,25 +6189,11 @@ ha_innobase::start_stmt(
1) ::store_lock(),
1) ::store_lock(),
2) ::external_lock(),
2) ::external_lock(),
3) ::init_table_handle_for_HANDLER(), and
3) ::init_table_handle_for_HANDLER(), and
4) :
.
transactional_table_lock(). */
4) :
:
transactional_table_lock(). */
prebuilt
->
select_lock_type
=
prebuilt
->
select_lock_type
=
prebuilt
->
stored_select_lock_type
;
prebuilt
->
stored_select_lock_type
;
}
}
if
(
prebuilt
->
stored_select_lock_type
!=
LOCK_S
&&
prebuilt
->
stored_select_lock_type
!=
LOCK_X
)
{
sql_print_error
(
"stored_select_lock_type is %lu inside "
"::start_stmt()!"
,
prebuilt
->
stored_select_lock_type
);
/* Set the value to LOCK_X: this is just fault
tolerance, we do not know what the correct value
should be! */
prebuilt
->
select_lock_type
=
LOCK_X
;
}
}
}
trx
->
detailed_error
[
0
]
=
'\0'
;
trx
->
detailed_error
[
0
]
=
'\0'
;
...
@@ -7617,7 +7606,7 @@ SHOW_VAR innodb_status_variables_export[]= {
...
@@ -7617,7 +7606,7 @@ SHOW_VAR innodb_status_variables_export[]= {
};
};
struct
st_mysql_storage_engine
innobase_storage_engine
=
struct
st_mysql_storage_engine
innobase_storage_engine
=
{
MYSQL_HANDLERTON_INTERFACE_VERSION
,
&
innobase_hton
};
{
MYSQL_HANDLERTON_INTERFACE_VERSION
,
innobase_hton
};
mysql_declare_plugin
(
innobase
)
mysql_declare_plugin
(
innobase
)
{
{
...
@@ -7629,9 +7618,10 @@ mysql_declare_plugin(innobase)
...
@@ -7629,9 +7618,10 @@ mysql_declare_plugin(innobase)
innobase_init
,
/* Plugin Init */
innobase_init
,
/* Plugin Init */
NULL
,
/* Plugin Deinit */
NULL
,
/* Plugin Deinit */
0x0100
/* 1.0 */
,
0x0100
/* 1.0 */
,
innodb_status_variables_export
,
innodb_status_variables_export
,
/* status variables */
NULL
,
/* system variables */
NULL
,
/* system variables */
NULL
/* config options */
NULL
/* config options */
}
}
mysql_declare_plugin_end
;
mysql_declare_plugin_end
;
#endif
mysql-test/innodb_mysql.result
View file @
9c6947fd
...
@@ -124,7 +124,7 @@ min(7)
...
@@ -124,7 +124,7 @@ min(7)
NULL
NULL
select min(7) from DUAL;
select min(7) from DUAL;
min(7)
min(7)
NULL
7
explain select min(7) from t2m join t1m;
explain select min(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
...
@@ -139,7 +139,7 @@ max(7)
...
@@ -139,7 +139,7 @@ max(7)
NULL
NULL
select max(7) from DUAL;
select max(7) from DUAL;
max(7)
max(7)
NULL
7
explain select max(7) from t2m join t1m;
explain select max(7) from t2m join t1m;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
...
@@ -178,7 +178,7 @@ min(7)
...
@@ -178,7 +178,7 @@ min(7)
NULL
NULL
select min(7) from DUAL;
select min(7) from DUAL;
min(7)
min(7)
NULL
7
explain select min(7) from t2i join t1i;
explain select min(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
...
@@ -194,7 +194,7 @@ max(7)
...
@@ -194,7 +194,7 @@ max(7)
NULL
NULL
select max(7) from DUAL;
select max(7) from DUAL;
max(7)
max(7)
NULL
7
explain select max(7) from t2i join t1i;
explain select max(7) from t2i join t1i;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
...
@@ -432,22 +432,44 @@ ifnull( c,
...
@@ -432,22 +432,44 @@ ifnull( c,
0 ) + 1;
0 ) + 1;
select last_insert_id();
select last_insert_id();
last_insert_id()
last_insert_id()
1
2
select last_insert_id(0);
last_insert_id(0)
0
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1;
select last_insert_id();
last_insert_id()
0
select * from t2;
select * from t2;
k a c
k a c
1 6
1
1 6
2
2 7 NULL
2 7 NULL
insert ignore into t2 values (null,6,1),(10,8,1);
insert ignore into t2 values (null,6,1),(10,8,1);
select last_insert_id();
select last_insert_id();
last_insert_id()
last_insert_id()
1
0
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select last_insert_id();
select last_insert_id();
last_insert_id()
last_insert_id()
11
11
select * from t2;
select * from t2;
k a c
k a c
1 6 1
1 6 2
2 7 NULL
10 8 1
11 15 1
12 20 1
insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull( c,
0 ) + 1, k=last_insert_id(k);
select last_insert_id();
last_insert_id()
1
select * from t2;
k a c
1 6 3
2 7 NULL
2 7 NULL
10 8 1
10 8 1
11 15 1
11 15 1
...
...
mysql-test/innodb_mysql.test
View file @
9c6947fd
...
@@ -369,8 +369,8 @@ insert into t1 values('aaa');
...
@@ -369,8 +369,8 @@ insert into t1 values('aaa');
drop
table
t1
;
drop
table
t1
;
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
# Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY
# UPDATE":
now LAST_INSERT_ID() will return the id of the updated
# UPDATE":
if the row is updated, it's like a regular UPDATE:
#
row
.
#
LAST_INSERT_ID() is not affected
.
CREATE
TABLE
`t2`
(
CREATE
TABLE
`t2`
(
`k`
int
(
11
)
NOT
NULL
auto_increment
,
`k`
int
(
11
)
NOT
NULL
auto_increment
,
`a`
int
(
11
)
default
NULL
,
`a`
int
(
11
)
default
NULL
,
...
@@ -390,6 +390,12 @@ insert into t2 ( a ) values ( 6 ) on duplicate key update c =
...
@@ -390,6 +390,12 @@ insert into t2 ( a ) values ( 6 ) on duplicate key update c =
ifnull
(
c
,
ifnull
(
c
,
0
)
+
1
;
0
)
+
1
;
select
last_insert_id
();
select
last_insert_id
();
# test again when last_insert_id() is 0 initially
select
last_insert_id
(
0
);
insert
into
t2
(
a
)
values
(
6
)
on
duplicate
key
update
c
=
ifnull
(
c
,
0
)
+
1
;
select
last_insert_id
();
select
*
from
t2
;
select
*
from
t2
;
# Test of LAST_INSERT_ID() when autogenerated will fail:
# Test of LAST_INSERT_ID() when autogenerated will fail:
...
@@ -402,5 +408,14 @@ insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
...
@@ -402,5 +408,14 @@ insert ignore into t2 values (null,6,1),(null,8,1),(null,15,1),(null,20,1);
select
last_insert_id
();
select
last_insert_id
();
select
*
from
t2
;
select
*
from
t2
;
drop
table
t2
;
# Test of the workaround which enables people to know the id of the
# updated row in INSERT ON DUPLICATE KEY UPDATE, by using
# LAST_INSERT_ID(autoinc_col) in the UPDATE clause.
insert
into
t2
(
a
)
values
(
6
)
on
duplicate
key
update
c
=
ifnull
(
c
,
0
)
+
1
,
k
=
last_insert_id
(
k
);
select
last_insert_id
();
select
*
from
t2
;
drop
table
t2
;
row/row0row.c
View file @
9c6947fd
...
@@ -91,8 +91,9 @@ row_build_index_entry(
...
@@ -91,8 +91,9 @@ row_build_index_entry(
}
}
for
(
i
=
0
;
i
<
entry_len
;
i
++
)
{
for
(
i
=
0
;
i
<
entry_len
;
i
++
)
{
const
dict_col_t
*
col
;
ind_field
=
dict_index_get_nth_field
(
index
,
i
);
ind_field
=
dict_index_get_nth_field
(
index
,
i
);
co
nst
dict_col_t
*
co
l
=
ind_field
->
col
;
col
=
ind_field
->
col
;
dfield
=
dtuple_get_nth_field
(
entry
,
i
);
dfield
=
dtuple_get_nth_field
(
entry
,
i
);
...
...
row/row0sel.c
View file @
9c6947fd
...
@@ -3005,8 +3005,8 @@ row_sel_pop_cached_row_for_mysql(
...
@@ -3005,8 +3005,8 @@ row_sel_pop_cached_row_for_mysql(
if
(
UNIV_UNLIKELY
(
prebuilt
->
keep_other_fields_on_keyread
))
{
if
(
UNIV_UNLIKELY
(
prebuilt
->
keep_other_fields_on_keyread
))
{
/* Copy cache record field by field, don't touch fields that
/* Copy cache record field by field, don't touch fields that
are not covered by current key */
are not covered by current key */
cached_rec
=
prebuilt
->
fetch_cache
cached_rec
=
prebuilt
->
fetch_cache
[
[
prebuilt
->
fetch_cache_first
];
prebuilt
->
fetch_cache_first
];
for
(
i
=
0
;
i
<
prebuilt
->
n_template
;
i
++
)
{
for
(
i
=
0
;
i
<
prebuilt
->
n_template
;
i
++
)
{
templ
=
prebuilt
->
mysql_template
+
i
;
templ
=
prebuilt
->
mysql_template
+
i
;
...
@@ -3018,8 +3018,7 @@ row_sel_pop_cached_row_for_mysql(
...
@@ -3018,8 +3018,7 @@ row_sel_pop_cached_row_for_mysql(
if
(
templ
->
mysql_null_bit_mask
)
{
if
(
templ
->
mysql_null_bit_mask
)
{
buf
[
templ
->
mysql_null_byte_offset
]
buf
[
templ
->
mysql_null_byte_offset
]
^=
(
buf
[
templ
->
mysql_null_byte_offset
]
^=
(
buf
[
templ
->
mysql_null_byte_offset
]
^
cached_rec
^
cached_rec
[
templ
->
mysql_null_byte_offset
])
[
templ
->
mysql_null_byte_offset
])
&
(
byte
)
templ
->
mysql_null_bit_mask
;
&
(
byte
)
templ
->
mysql_null_bit_mask
;
}
}
}
}
...
...
row/row0upd.c
View file @
9c6947fd
...
@@ -1387,8 +1387,8 @@ func_exit:
...
@@ -1387,8 +1387,8 @@ func_exit:
}
}
/***************************************************************
/***************************************************************
Updates
secondary index record if it is changed in the row update. This
Updates
the secondary index record if it is changed in the row update or
should be quite rare in database applications
. */
deletes it if this is a delete
. */
UNIV_INLINE
UNIV_INLINE
ulint
ulint
row_upd_sec_step
(
row_upd_sec_step
(
...
...
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