mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Merge gleb.loc:/home/uchum/work/bk/5.0
into gleb.loc:/home/uchum/work/bk/5.0-opt sql/sql_base.cc: Auto merged
This commit is contained in:
commit
a9322f2e57
15 changed files with 384 additions and 154 deletions
|
@ -2806,7 +2806,7 @@ will be able to insert new data to the database without running out the
|
|||
tablespace. Only free extents are taken into account and we also subtract
|
||||
the safety margin required by the above function fsp_reserve_free_extents. */
|
||||
|
||||
ulint
|
||||
ullint
|
||||
fsp_get_available_space_in_free_extents(
|
||||
/*====================================*/
|
||||
/* out: available space in kB */
|
||||
|
@ -2872,8 +2872,9 @@ fsp_get_available_space_in_free_extents(
|
|||
return(0);
|
||||
}
|
||||
|
||||
return(((n_free - reserve) * FSP_EXTENT_SIZE)
|
||||
* (UNIV_PAGE_SIZE / 1024));
|
||||
return((ullint)(n_free - reserve)
|
||||
* FSP_EXTENT_SIZE
|
||||
* (UNIV_PAGE_SIZE / 1024));
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
|
|
@ -245,7 +245,7 @@ will be able to insert new data to the database without running out the
|
|||
tablespace. Only free extents are taken into account and we also subtract
|
||||
the safety margin required by the above function fsp_reserve_free_extents. */
|
||||
|
||||
ulint
|
||||
ullint
|
||||
fsp_get_available_space_in_free_extents(
|
||||
/*====================================*/
|
||||
/* out: available space in kB */
|
||||
|
|
|
@ -195,6 +195,8 @@ typedef __int64 ib_longlong;
|
|||
typedef longlong ib_longlong;
|
||||
#endif
|
||||
|
||||
typedef unsigned long long int ullint;
|
||||
|
||||
#ifndef __WIN__
|
||||
#if SIZEOF_LONG != SIZEOF_VOIDP
|
||||
#error "Error: InnoDB's ulint must be of the same size as void*"
|
||||
|
|
|
@ -57,6 +57,16 @@ ibool recv_needed_recovery = FALSE;
|
|||
|
||||
ibool recv_lsn_checks_on = FALSE;
|
||||
|
||||
/* There are two conditions under which we scan the logs, the first
|
||||
is normal startup and the second is when we do a recovery from an
|
||||
archive.
|
||||
This flag is set if we are doing a scan from the last checkpoint during
|
||||
startup. If we find log entries that were written after the last checkpoint
|
||||
we know that the server was not cleanly shutdown. We must then initialize
|
||||
the crash recovery environment before attempting to store these entries in
|
||||
the log hash table. */
|
||||
ibool recv_log_scan_is_startup_type = FALSE;
|
||||
|
||||
/* If the following is TRUE, the buffer pool file pages must be invalidated
|
||||
after recovery and no ibuf operations are allowed; this becomes TRUE if
|
||||
the log record hash table becomes too full, and log records must be merged
|
||||
|
@ -99,6 +109,16 @@ the recovery failed and the database may be corrupt. */
|
|||
|
||||
dulint recv_max_page_lsn;
|
||||
|
||||
/* prototypes */
|
||||
|
||||
/***********************************************************
|
||||
Initialize crash recovery environment. Can be called iff
|
||||
recv_needed_recovery == FALSE. */
|
||||
static
|
||||
void
|
||||
recv_init_crash_recovery(void);
|
||||
/*===========================*/
|
||||
|
||||
/************************************************************
|
||||
Creates the recovery system. */
|
||||
|
||||
|
@ -2438,6 +2458,23 @@ recv_scan_log_recs(
|
|||
|
||||
if (ut_dulint_cmp(scanned_lsn, recv_sys->scanned_lsn) > 0) {
|
||||
|
||||
/* We have found more entries. If this scan is
|
||||
of startup type, we must initiate crash recovery
|
||||
environment before parsing these log records. */
|
||||
|
||||
if (recv_log_scan_is_startup_type
|
||||
&& !recv_needed_recovery) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Log scan progressed"
|
||||
" past the checkpoint lsn %lu %lu\n",
|
||||
(ulong) ut_dulint_get_high(
|
||||
recv_sys->scanned_lsn),
|
||||
(ulong) ut_dulint_get_low(
|
||||
recv_sys->scanned_lsn));
|
||||
recv_init_crash_recovery();
|
||||
}
|
||||
|
||||
/* We were able to find more log data: add it to the
|
||||
parsing buffer if parse_start_lsn is already
|
||||
non-zero */
|
||||
|
@ -2557,6 +2594,48 @@ recv_group_scan_log_recs(
|
|||
#endif /* UNIV_DEBUG */
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
Initialize crash recovery environment. Can be called iff
|
||||
recv_needed_recovery == FALSE. */
|
||||
static
|
||||
void
|
||||
recv_init_crash_recovery(void)
|
||||
/*==========================*/
|
||||
{
|
||||
ut_a(!recv_needed_recovery);
|
||||
|
||||
recv_needed_recovery = TRUE;
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
fprintf(stderr,
|
||||
" InnoDB: Database was not"
|
||||
" shut down normally!\n"
|
||||
"InnoDB: Starting crash recovery.\n");
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Reading tablespace information"
|
||||
" from the .ibd files...\n");
|
||||
|
||||
fil_load_single_table_tablespaces();
|
||||
|
||||
/* If we are using the doublewrite method, we will
|
||||
check if there are half-written pages in data files,
|
||||
and restore them from the doublewrite buffer if
|
||||
possible */
|
||||
|
||||
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Restoring possible"
|
||||
" half-written data pages from"
|
||||
" the doublewrite\n"
|
||||
"InnoDB: buffer...\n");
|
||||
trx_sys_doublewrite_init_or_restore_pages(TRUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
Recovers from a checkpoint. When this function returns, the database is able
|
||||
to start processing of new user transactions, but the function
|
||||
|
@ -2681,72 +2760,6 @@ recv_recovery_from_checkpoint_start(
|
|||
recv_sys->recovered_lsn = checkpoint_lsn;
|
||||
|
||||
srv_start_lsn = checkpoint_lsn;
|
||||
|
||||
/* NOTE: we always do a 'recovery' at startup, but only if
|
||||
there is something wrong we will print a message to the
|
||||
user about recovery: */
|
||||
|
||||
if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn) != 0
|
||||
|| ut_dulint_cmp(checkpoint_lsn, min_flushed_lsn) != 0) {
|
||||
|
||||
if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn)
|
||||
< 0) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: ##########################################################\n"
|
||||
"InnoDB: WARNING!\n"
|
||||
"InnoDB: The log sequence number in ibdata files is higher\n"
|
||||
"InnoDB: than the log sequence number in the ib_logfiles! Are you sure\n"
|
||||
"InnoDB: you are using the right ib_logfiles to start up the database?\n"
|
||||
"InnoDB: Log sequence number in ib_logfiles is %lu %lu, log\n"
|
||||
"InnoDB: sequence numbers stamped to ibdata file headers are between\n"
|
||||
"InnoDB: %lu %lu and %lu %lu.\n"
|
||||
"InnoDB: ##########################################################\n",
|
||||
(ulong) ut_dulint_get_high(checkpoint_lsn),
|
||||
(ulong) ut_dulint_get_low(checkpoint_lsn),
|
||||
(ulong) ut_dulint_get_high(min_flushed_lsn),
|
||||
(ulong) ut_dulint_get_low(min_flushed_lsn),
|
||||
(ulong) ut_dulint_get_high(max_flushed_lsn),
|
||||
(ulong) ut_dulint_get_low(max_flushed_lsn));
|
||||
}
|
||||
|
||||
recv_needed_recovery = TRUE;
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
fprintf(stderr,
|
||||
" InnoDB: Database was not shut down normally!\n"
|
||||
"InnoDB: Starting crash recovery.\n");
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Reading tablespace information from the .ibd files...\n");
|
||||
|
||||
fil_load_single_table_tablespaces();
|
||||
|
||||
/* If we are using the doublewrite method, we will
|
||||
check if there are half-written pages in data files,
|
||||
and restore them from the doublewrite buffer if
|
||||
possible */
|
||||
|
||||
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Restoring possible half-written data pages from the doublewrite\n"
|
||||
"InnoDB: buffer...\n");
|
||||
trx_sys_doublewrite_init_or_restore_pages(
|
||||
TRUE);
|
||||
}
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
|
||||
fprintf(stderr,
|
||||
" InnoDB: Starting log scan based on checkpoint at\n"
|
||||
"InnoDB: log sequence number %lu %lu.\n",
|
||||
(ulong) ut_dulint_get_high(checkpoint_lsn),
|
||||
(ulong) ut_dulint_get_low(checkpoint_lsn));
|
||||
} else {
|
||||
/* Init the doublewrite buffer memory structure */
|
||||
trx_sys_doublewrite_init_or_restore_pages(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
contiguous_lsn = ut_dulint_align_down(recv_sys->scanned_lsn,
|
||||
|
@ -2798,7 +2811,9 @@ recv_recovery_from_checkpoint_start(
|
|||
group = UT_LIST_GET_NEXT(log_groups, group);
|
||||
}
|
||||
|
||||
while (group) {
|
||||
/* Set the flag to publish that we are doing startup scan. */
|
||||
recv_log_scan_is_startup_type = (type == LOG_CHECKPOINT);
|
||||
while (group) {
|
||||
old_scanned_lsn = recv_sys->scanned_lsn;
|
||||
|
||||
recv_group_scan_log_recs(group, &contiguous_lsn,
|
||||
|
@ -2819,6 +2834,69 @@ recv_recovery_from_checkpoint_start(
|
|||
group = UT_LIST_GET_NEXT(log_groups, group);
|
||||
}
|
||||
|
||||
/* Done with startup scan. Clear the flag. */
|
||||
recv_log_scan_is_startup_type = FALSE;
|
||||
if (type == LOG_CHECKPOINT) {
|
||||
/* NOTE: we always do a 'recovery' at startup, but only if
|
||||
there is something wrong we will print a message to the
|
||||
user about recovery: */
|
||||
|
||||
if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn) != 0
|
||||
|| ut_dulint_cmp(checkpoint_lsn, min_flushed_lsn) != 0) {
|
||||
|
||||
if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn)
|
||||
< 0) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: #########################"
|
||||
"#################################\n"
|
||||
"InnoDB: "
|
||||
"WARNING!\n"
|
||||
"InnoDB: The log sequence number"
|
||||
" in ibdata files is higher\n"
|
||||
"InnoDB: than the log sequence number"
|
||||
" in the ib_logfiles! Are you sure\n"
|
||||
"InnoDB: you are using the right"
|
||||
" ib_logfiles to start up"
|
||||
" the database?\n"
|
||||
"InnoDB: Log sequence number in"
|
||||
" ib_logfiles is %lu %lu, log\n"
|
||||
"InnoDB: sequence numbers stamped"
|
||||
" to ibdata file headers are between\n"
|
||||
"InnoDB: %lu %lu and %lu %lu.\n"
|
||||
"InnoDB: #########################"
|
||||
"#################################\n",
|
||||
(ulong) ut_dulint_get_high(
|
||||
checkpoint_lsn),
|
||||
(ulong) ut_dulint_get_low(
|
||||
checkpoint_lsn),
|
||||
(ulong) ut_dulint_get_high(
|
||||
min_flushed_lsn),
|
||||
(ulong) ut_dulint_get_low(
|
||||
min_flushed_lsn),
|
||||
(ulong) ut_dulint_get_high(
|
||||
max_flushed_lsn),
|
||||
(ulong) ut_dulint_get_low(
|
||||
max_flushed_lsn));
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!recv_needed_recovery) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: The log sequence number"
|
||||
" in ibdata files does not match\n"
|
||||
"InnoDB: the log sequence number"
|
||||
" in the ib_logfiles!\n");
|
||||
recv_init_crash_recovery();
|
||||
}
|
||||
|
||||
}
|
||||
if (!recv_needed_recovery) {
|
||||
/* Init the doublewrite buffer memory structure */
|
||||
trx_sys_doublewrite_init_or_restore_pages(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* We currently have only one log group */
|
||||
if (ut_dulint_cmp(group_scanned_lsn, checkpoint_lsn) < 0) {
|
||||
ut_print_timestamp(stderr);
|
||||
|
@ -2871,16 +2949,9 @@ recv_recovery_from_checkpoint_start(
|
|||
recv_synchronize_groups(up_to_date_group);
|
||||
|
||||
if (!recv_needed_recovery) {
|
||||
if (ut_dulint_cmp(checkpoint_lsn, recv_sys->recovered_lsn)
|
||||
!= 0) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Warning: we did not need to do crash recovery, but log scan\n"
|
||||
"InnoDB: progressed past the checkpoint lsn %lu %lu up to lsn %lu %lu\n",
|
||||
(ulong) ut_dulint_get_high(checkpoint_lsn),
|
||||
(ulong) ut_dulint_get_low(checkpoint_lsn),
|
||||
(ulong) ut_dulint_get_high(recv_sys->recovered_lsn),
|
||||
(ulong) ut_dulint_get_low(recv_sys->recovered_lsn));
|
||||
}
|
||||
ut_a(ut_dulint_cmp(checkpoint_lsn,
|
||||
recv_sys->recovered_lsn) == 0);
|
||||
|
||||
} else {
|
||||
srv_start_lsn = recv_sys->recovered_lsn;
|
||||
}
|
||||
|
|
|
@ -436,10 +436,9 @@ os_file_handle_error_no_exit(
|
|||
|
||||
#undef USE_FILE_LOCK
|
||||
#define USE_FILE_LOCK
|
||||
#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__FreeBSD__) || defined(__NETWARE__)
|
||||
#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__)
|
||||
/* InnoDB Hot Backup does not lock the data files.
|
||||
* On Windows, mandatory locking is used.
|
||||
* On FreeBSD with LinuxThreads, advisory locking does not work properly.
|
||||
*/
|
||||
# undef USE_FILE_LOCK
|
||||
#endif
|
||||
|
|
|
@ -1151,7 +1151,7 @@ srv_conc_force_enter_innodb(
|
|||
|
||||
srv_conc_n_threads++;
|
||||
trx->declared_to_be_inside_innodb = TRUE;
|
||||
trx->n_tickets_to_enter_innodb = 0;
|
||||
trx->n_tickets_to_enter_innodb = 1;
|
||||
|
||||
os_fast_mutex_unlock(&srv_conc_mutex);
|
||||
}
|
||||
|
|
|
@ -1606,19 +1606,21 @@ trx_commit_for_mysql(
|
|||
the transaction object does not have an InnoDB session object, and we
|
||||
set the dummy session that we use for all MySQL transactions. */
|
||||
|
||||
mutex_enter(&kernel_mutex);
|
||||
|
||||
if (trx->sess == NULL) {
|
||||
/* Open a dummy session */
|
||||
|
||||
if (!trx_dummy_sess) {
|
||||
trx_dummy_sess = sess_open();
|
||||
mutex_enter(&kernel_mutex);
|
||||
|
||||
if (!trx_dummy_sess) {
|
||||
trx_dummy_sess = sess_open();
|
||||
}
|
||||
|
||||
mutex_exit(&kernel_mutex);
|
||||
}
|
||||
|
||||
trx->sess = trx_dummy_sess;
|
||||
}
|
||||
|
||||
mutex_exit(&kernel_mutex);
|
||||
|
||||
trx_start_if_not_started(trx);
|
||||
|
||||
|
|
177
mysql-test/r/ctype_ascii.result
Normal file
177
mysql-test/r/ctype_ascii.result
Normal file
|
@ -0,0 +1,177 @@
|
|||
set names ascii;
|
||||
select 'e'='`';
|
||||
'e'='`'
|
||||
0
|
||||
select 'y'='~';
|
||||
'y'='~'
|
||||
0
|
||||
create table t1 (a char(1) character set ascii);
|
||||
insert into t1 (a) values (' '), ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h'), ('i'), ('j'), ('k'), ('l'), ('m'), ('n'), ('o'), ('p'), ('q'), ('r'), ('s'), ('t'), ('u'), ('v'), ('w'), ('x'), ('y'), ('z'), ('A'), ('B'), ('C'), ('D'), ('E'), ('F'), ('G'), ('H'), ('I'), ('J'), ('K'), ('L'), ('M'), ('N'), ('O'), ('P'), ('Q'), ('R'), ('S'), ('T'), ('U'), ('V'), ('W'), ('X'), ('Y'), ('Z'), ('!'), ('@'), ('#'), ('$'), ('%'), ('^'), ('&'), ('*'), ('('), (')'), ('_'), ('+'), ('`'), ('~'), ('1'), ('2'), ('3'), ('4'), ('5'), ('6'), ('7'), ('8'), ('9'), ('0'), ('['), (']'), ('\\'), ('|'), ('}'), ('{'), ('"'), (':'), (''''), (';'), ('/'), ('.'), (','), ('?'), ('>'), ('<'), ('\n'), ('\t'), ('\a'), ('\f'), ('\v');
|
||||
select t1a.a, t1b.a from t1 as t1a, t1 as t1b where t1a.a=t1b.a order by binary t1a.a, binary t1b.a;
|
||||
a a
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
! !
|
||||
" "
|
||||
# #
|
||||
$ $
|
||||
% %
|
||||
& &
|
||||
' '
|
||||
( (
|
||||
) )
|
||||
* *
|
||||
+ +
|
||||
, ,
|
||||
. .
|
||||
/ /
|
||||
0 0
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
7 7
|
||||
8 8
|
||||
9 9
|
||||
: :
|
||||
; ;
|
||||
< <
|
||||
> >
|
||||
? ?
|
||||
@ @
|
||||
A A
|
||||
A a
|
||||
A a
|
||||
B B
|
||||
B b
|
||||
C C
|
||||
C c
|
||||
D D
|
||||
D d
|
||||
E E
|
||||
E e
|
||||
F F
|
||||
F f
|
||||
F f
|
||||
G G
|
||||
G g
|
||||
H H
|
||||
H h
|
||||
I I
|
||||
I i
|
||||
J J
|
||||
J j
|
||||
K K
|
||||
K k
|
||||
L L
|
||||
L l
|
||||
M M
|
||||
M m
|
||||
N N
|
||||
N n
|
||||
O O
|
||||
O o
|
||||
P P
|
||||
P p
|
||||
Q Q
|
||||
Q q
|
||||
R R
|
||||
R r
|
||||
S S
|
||||
S s
|
||||
T T
|
||||
T t
|
||||
U U
|
||||
U u
|
||||
V V
|
||||
V v
|
||||
V v
|
||||
W W
|
||||
W w
|
||||
X X
|
||||
X x
|
||||
Y Y
|
||||
Y y
|
||||
Z Z
|
||||
Z z
|
||||
[ [
|
||||
\ \
|
||||
] ]
|
||||
^ ^
|
||||
_ _
|
||||
` `
|
||||
a A
|
||||
a A
|
||||
a a
|
||||
a a
|
||||
a a
|
||||
a a
|
||||
b B
|
||||
b b
|
||||
c C
|
||||
c c
|
||||
d D
|
||||
d d
|
||||
e E
|
||||
e e
|
||||
f F
|
||||
f F
|
||||
f f
|
||||
f f
|
||||
f f
|
||||
f f
|
||||
g G
|
||||
g g
|
||||
h H
|
||||
h h
|
||||
i I
|
||||
i i
|
||||
j J
|
||||
j j
|
||||
k K
|
||||
k k
|
||||
l L
|
||||
l l
|
||||
m M
|
||||
m m
|
||||
n N
|
||||
n n
|
||||
o O
|
||||
o o
|
||||
p P
|
||||
p p
|
||||
q Q
|
||||
q q
|
||||
r R
|
||||
r r
|
||||
s S
|
||||
s s
|
||||
t T
|
||||
t t
|
||||
u U
|
||||
u u
|
||||
v V
|
||||
v V
|
||||
v v
|
||||
v v
|
||||
v v
|
||||
v v
|
||||
w W
|
||||
w w
|
||||
x X
|
||||
x x
|
||||
y Y
|
||||
y y
|
||||
z Z
|
||||
z z
|
||||
{ {
|
||||
| |
|
||||
} }
|
||||
~ ~
|
||||
drop table t1;
|
||||
End of 5.0 tests.
|
13
mysql-test/t/ctype_ascii.test
Normal file
13
mysql-test/t/ctype_ascii.test
Normal file
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# Bug #27562: ascii.xml invalid?
|
||||
#
|
||||
set names ascii;
|
||||
select 'e'='`';
|
||||
select 'y'='~';
|
||||
create table t1 (a char(1) character set ascii);
|
||||
insert into t1 (a) values (' '), ('a'), ('b'), ('c'), ('d'), ('e'), ('f'), ('g'), ('h'), ('i'), ('j'), ('k'), ('l'), ('m'), ('n'), ('o'), ('p'), ('q'), ('r'), ('s'), ('t'), ('u'), ('v'), ('w'), ('x'), ('y'), ('z'), ('A'), ('B'), ('C'), ('D'), ('E'), ('F'), ('G'), ('H'), ('I'), ('J'), ('K'), ('L'), ('M'), ('N'), ('O'), ('P'), ('Q'), ('R'), ('S'), ('T'), ('U'), ('V'), ('W'), ('X'), ('Y'), ('Z'), ('!'), ('@'), ('#'), ('$'), ('%'), ('^'), ('&'), ('*'), ('('), (')'), ('_'), ('+'), ('`'), ('~'), ('1'), ('2'), ('3'), ('4'), ('5'), ('6'), ('7'), ('8'), ('9'), ('0'), ('['), (']'), ('\\'), ('|'), ('}'), ('{'), ('"'), (':'), (''''), (';'), ('/'), ('.'), (','), ('?'), ('>'), ('<'), ('\n'), ('\t'), ('\a'), ('\f'), ('\v');
|
||||
select t1a.a, t1b.a from t1 as t1a, t1 as t1b where t1a.a=t1b.a order by binary t1a.a, binary t1b.a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
--echo End of 5.0 tests.
|
|
@ -3301,8 +3301,6 @@ no_commit:
|
|||
if (error == DB_DUPLICATE_KEY && auto_inc_used
|
||||
&& (user_thd->lex->sql_command == SQLCOM_REPLACE
|
||||
|| user_thd->lex->sql_command == SQLCOM_REPLACE_SELECT
|
||||
|| (user_thd->lex->sql_command == SQLCOM_INSERT
|
||||
&& user_thd->lex->duplicates == DUP_UPDATE)
|
||||
|| (user_thd->lex->sql_command == SQLCOM_LOAD
|
||||
&& user_thd->lex->duplicates == DUP_REPLACE))) {
|
||||
|
||||
|
@ -3533,6 +3531,27 @@ ha_innobase::update_row(
|
|||
|
||||
error = row_update_for_mysql((byte*) old_row, prebuilt);
|
||||
|
||||
/* We need to do some special AUTOINC handling for the following case:
|
||||
|
||||
INSERT INTO t (c1,c2) VALUES(x,y) ON DUPLICATE KEY UPDATE ...
|
||||
|
||||
We need to use the AUTOINC counter that was actually used by
|
||||
MySQL in the UPDATE statement, which can be different from the
|
||||
value used in the INSERT statement.*/
|
||||
if (error == DB_SUCCESS
|
||||
&& table->next_number_field && new_row == table->record[0]
|
||||
&& user_thd->lex->sql_command == SQLCOM_INSERT
|
||||
&& user_thd->lex->duplicates == DUP_UPDATE) {
|
||||
|
||||
longlong auto_inc;
|
||||
|
||||
auto_inc = table->next_number_field->val_int();
|
||||
|
||||
if (auto_inc != 0) {
|
||||
dict_table_autoinc_update(prebuilt->table, auto_inc);
|
||||
}
|
||||
}
|
||||
|
||||
innodb_srv_conc_exit_innodb(prebuilt->trx);
|
||||
|
||||
error = convert_error_code_to_mysql(error, user_thd);
|
||||
|
@ -5609,9 +5628,9 @@ ha_innobase::update_table_comment(
|
|||
mutex_enter_noninline(&srv_dict_tmpfile_mutex);
|
||||
rewind(srv_dict_tmpfile);
|
||||
|
||||
fprintf(srv_dict_tmpfile, "InnoDB free: %lu kB",
|
||||
(ulong) fsp_get_available_space_in_free_extents(
|
||||
prebuilt->table->space));
|
||||
fprintf(srv_dict_tmpfile, "InnoDB free: %llu kB",
|
||||
fsp_get_available_space_in_free_extents(
|
||||
prebuilt->table->space));
|
||||
|
||||
dict_print_info_on_foreign_keys(FALSE, srv_dict_tmpfile,
|
||||
prebuilt->trx, prebuilt->table);
|
||||
|
|
|
@ -995,7 +995,6 @@ bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
|
|||
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
|
||||
int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
|
||||
bool is_locked);
|
||||
void mysql_ha_mark_tables_for_reopen(THD *thd, TABLE *table);
|
||||
/* mysql_ha_flush mode_flags bits */
|
||||
#define MYSQL_HA_CLOSE_FINAL 0x00
|
||||
#define MYSQL_HA_REOPEN_ON_USAGE 0x01
|
||||
|
|
|
@ -117,9 +117,9 @@
|
|||
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
|
||||
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
|
||||
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
|
||||
50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F
|
||||
45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
|
||||
50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 59 7F
|
||||
50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
|
||||
60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
|
||||
50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
|
||||
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
|
||||
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
|
||||
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
|
||||
|
|
|
@ -585,14 +585,6 @@ void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
|
|||
|
||||
DBUG_PRINT("info", ("thd->open_tables: %p", thd->open_tables));
|
||||
|
||||
|
||||
/*
|
||||
End open index scans and table scans and remove references to the tables
|
||||
from the handler tables hash. After this preparation it is safe to close
|
||||
the tables.
|
||||
*/
|
||||
mysql_ha_mark_tables_for_reopen(thd, thd->open_tables);
|
||||
|
||||
found_old_table= 0;
|
||||
while (thd->open_tables)
|
||||
found_old_table|=close_thread_table(thd, &thd->open_tables);
|
||||
|
|
|
@ -746,48 +746,3 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
|
|||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Mark tables for reopen.
|
||||
|
||||
SYNOPSIS
|
||||
mysql_ha_mark_tables_for_reopen()
|
||||
thd Thread identifier.
|
||||
table Table list to mark for reopen.
|
||||
|
||||
DESCRIPTION
|
||||
For each table found in the handler hash mark it as closed
|
||||
(ready for reopen) and end all index/table scans.
|
||||
|
||||
NOTE
|
||||
The caller must lock LOCK_open.
|
||||
*/
|
||||
|
||||
void mysql_ha_mark_tables_for_reopen(THD *thd, TABLE *table)
|
||||
{
|
||||
DBUG_ENTER("mysql_ha_mark_tables_for_reopen");
|
||||
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
for (; table; table= table->next)
|
||||
{
|
||||
/*
|
||||
Some elements in open table list, for example placeholders used for
|
||||
name-locking, can have alias set to 0.
|
||||
*/
|
||||
if (table->alias)
|
||||
{
|
||||
TABLE_LIST *hash_tables;
|
||||
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
|
||||
(byte*) table->alias,
|
||||
strlen(table->alias) + 1)))
|
||||
{
|
||||
/* Mark table as ready for reopen. */
|
||||
hash_tables->table= NULL;
|
||||
/* End open index/table scans. */
|
||||
table->file->ha_index_or_rnd_end();
|
||||
}
|
||||
}
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
|
@ -894,9 +894,9 @@ uchar sort_order_ascii_general_ci[] = {
|
|||
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
|
||||
0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
|
||||
0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
|
||||
0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5C,0x5D,0x5B,0x5E,0x5F,
|
||||
0x45,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
|
||||
0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x59,0x7F,
|
||||
0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
|
||||
0x60,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
|
||||
0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x7B,0x7C,0x7D,0x7E,0x7F,
|
||||
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,
|
||||
0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,
|
||||
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
|
||||
|
|
Loading…
Reference in a new issue