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
5b4022b5
Commit
5b4022b5
authored
Oct 29, 2008
by
Mats Kindahl
Browse files
Options
Browse Files
Download
Plain Diff
Merging with 5.1-5.1.29-rc
parents
33abad89
abe09fb5
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
218 additions
and
24 deletions
+218
-24
configure.in
configure.in
+1
-1
mysql-test/r/alter_table.result
mysql-test/r/alter_table.result
+12
-0
mysql-test/r/binlog_format_basic.result
mysql-test/r/binlog_format_basic.result
+3
-0
mysql-test/r/xa.result
mysql-test/r/xa.result
+20
-0
mysql-test/t/alter_table.test
mysql-test/t/alter_table.test
+12
-0
mysql-test/t/binlog_format_basic.test
mysql-test/t/binlog_format_basic.test
+7
-0
mysql-test/t/xa.test
mysql-test/t/xa.test
+45
-0
sql/field.cc
sql/field.cc
+25
-10
sql/field.h
sql/field.h
+2
-0
sql/handler.cc
sql/handler.cc
+6
-1
sql/log.cc
sql/log.cc
+1
-1
sql/share/errmsg.txt
sql/share/errmsg.txt
+6
-0
sql/sql_class.cc
sql/sql_class.cc
+1
-1
sql/sql_class.h
sql/sql_class.h
+3
-1
sql/sql_parse.cc
sql/sql_parse.cc
+69
-9
zlib/gzio.c
zlib/gzio.c
+5
-0
No files found.
configure.in
View file @
5b4022b5
...
...
@@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM
#
# When changing major version number please also check switch statement
# in mysqlbinlog::check_master_version().
AM_INIT_AUTOMAKE
(
mysql, 5.1.
29
)
AM_INIT_AUTOMAKE
(
mysql, 5.1.
30
)
AM_CONFIG_HEADER
([
include/config.h:config.h.in]
)
PROTOCOL_VERSION
=
10
...
...
mysql-test/r/alter_table.result
View file @
5b4022b5
...
...
@@ -1222,4 +1222,16 @@ ALTER TABLE t1 CHANGE d c varchar(10);
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
CREATE TABLE t1(a INT AUTO_INCREMENT PRIMARY KEY,
b ENUM('a', 'b', 'c') NOT NULL);
INSERT INTO t1 (b) VALUES ('a'), ('c'), ('b'), ('b'), ('a');
ALTER TABLE t1 MODIFY b ENUM('a', 'z', 'b', 'c') NOT NULL;
SELECT * FROM t1;
a b
1 a
2 c
3 b
4 b
5 a
DROP TABLE t1;
End of 5.1 tests
mysql-test/r/binlog_format_basic.result
View file @
5b4022b5
SELECT @@GLOBAL.binlog_format;
@@GLOBAL.binlog_format
STATEMENT
'#---------------------BS_STVARS_002_01----------------------#'
SELECT COUNT(@@GLOBAL.binlog_format);
COUNT(@@GLOBAL.binlog_format)
...
...
mysql-test/r/xa.result
View file @
5b4022b5
...
...
@@ -55,3 +55,23 @@ select * from t1;
a
20
drop table t1;
drop table if exists t1;
create table t1(a int, b int, c varchar(20), primary key(a)) engine = innodb;
insert into t1 values(1, 1, 'a');
insert into t1 values(2, 2, 'b');
xa start 'a','b';
update t1 set c = 'aa' where a = 1;
xa start 'a','c';
update t1 set c = 'bb' where a = 2;
update t1 set c = 'bb' where a = 2;
update t1 set c = 'aa' where a = 1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
select count(*) from t1;
count(*)
2
xa end 'a','c';
ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
xa rollback 'a','c';
xa start 'a','c';
drop table t1;
End of 5.0 tests
mysql-test/t/alter_table.test
View file @
5b4022b5
...
...
@@ -947,4 +947,16 @@ ALTER TABLE t1 CHANGE d c varchar(10);
--
disable_info
DROP
TABLE
t1
;
#
# Bug #23113: Different behavior on altering ENUM fields between 5.0 and 5.1
#
CREATE
TABLE
t1
(
a
INT
AUTO_INCREMENT
PRIMARY
KEY
,
b
ENUM
(
'a'
,
'b'
,
'c'
)
NOT
NULL
);
INSERT
INTO
t1
(
b
)
VALUES
(
'a'
),
(
'c'
),
(
'b'
),
(
'b'
),
(
'a'
);
ALTER
TABLE
t1
MODIFY
b
ENUM
(
'a'
,
'z'
,
'b'
,
'c'
)
NOT
NULL
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
mysql-test/t/binlog_format_basic.test
View file @
5b4022b5
...
...
@@ -22,6 +22,13 @@
# #
###############################################################################
###################################################################
# BUG#39812: Make statement replication default for 5.1 (to match 5.0)
# We just verify that the default binlog_format is STATEMENT in 5.1.
# In 6.0, it should be MIXED.
###################################################################
SELECT
@@
GLOBAL
.
binlog_format
;
--
echo
'#---------------------BS_STVARS_002_01----------------------#'
####################################################################
# Displaying default value #
...
...
mysql-test/t/xa.test
View file @
5b4022b5
...
...
@@ -74,3 +74,48 @@ xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
select
*
from
t1
;
drop
table
t1
;
disconnect
con1
;
#
# Bug#28323: Server crashed in xid cache operations
#
--
disable_warnings
drop
table
if
exists
t1
;
--
enable_warnings
create
table
t1
(
a
int
,
b
int
,
c
varchar
(
20
),
primary
key
(
a
))
engine
=
innodb
;
insert
into
t1
values
(
1
,
1
,
'a'
);
insert
into
t1
values
(
2
,
2
,
'b'
);
connect
(
con1
,
localhost
,
root
,,);
connect
(
con2
,
localhost
,
root
,,);
--
connection
con1
xa
start
'a'
,
'b'
;
update
t1
set
c
=
'aa'
where
a
=
1
;
--
connection
con2
xa
start
'a'
,
'c'
;
update
t1
set
c
=
'bb'
where
a
=
2
;
--
connection
con1
--
send
update
t1
set
c
=
'bb'
where
a
=
2
--
connection
con2
--
sleep
1
--
error
ER_LOCK_DEADLOCK
update
t1
set
c
=
'aa'
where
a
=
1
;
select
count
(
*
)
from
t1
;
--
error
ER_XA_RBDEADLOCK
xa
end
'a'
,
'c'
;
xa
rollback
'a'
,
'c'
;
--
disconnect
con2
connect
(
con3
,
localhost
,
root
,,);
--
connection
con3
xa
start
'a'
,
'c'
;
--
disconnect
con1
--
disconnect
con3
--
connection
default
drop
table
t1
;
--
echo
End
of
5.0
tests
sql/field.cc
View file @
5b4022b5
...
...
@@ -8783,28 +8783,43 @@ bool Field::eq_def(Field *field)
return
1
;
}
/**
@return
returns 1 if the fields are equally defined
*/
bool
Field_enum
::
eq_def
(
Field
*
field
)
{
if
(
!
Field
::
eq_def
(
field
))
return
0
;
TYPELIB
*
from_lib
=
((
Field_enum
*
)
field
)
->
typelib
;
return
compare_enum_values
(((
Field_enum
*
)
field
)
->
typelib
);
}
if
(
typelib
->
count
<
from_lib
->
count
)
return
0
;
for
(
uint
i
=
0
;
i
<
from_lib
->
count
;
i
++
)
bool
Field_enum
::
compare_enum_values
(
TYPELIB
*
values
)
{
if
(
typelib
->
count
!=
values
->
count
)
return
FALSE
;
for
(
uint
i
=
0
;
i
<
typelib
->
count
;
i
++
)
if
(
my_strnncoll
(
field_charset
,
(
const
uchar
*
)
typelib
->
type_names
[
i
],
strlen
(
typelib
->
type_names
[
i
]),
(
const
uchar
*
)
from_lib
->
type_names
[
i
],
strlen
(
from_lib
->
type_names
[
i
])))
(
const
uchar
*
)
typelib
->
type_names
[
i
],
typelib
->
type_lengths
[
i
],
(
const
uchar
*
)
values
->
type_names
[
i
],
values
->
type_lengths
[
i
]))
return
FALSE
;
return
TRUE
;
}
uint
Field_enum
::
is_equal
(
Create_field
*
new_field
)
{
if
(
!
Field_str
::
is_equal
(
new_field
))
return
0
;
return
1
;
return
compare_enum_values
(
new_field
->
interval
)
;
}
/**
@return
returns 1 if the fields are equally defined
...
...
sql/field.h
View file @
5b4022b5
...
...
@@ -1853,6 +1853,8 @@ class Field_enum :public Field_str {
CHARSET_INFO
*
sort_charset
(
void
)
const
{
return
&
my_charset_bin
;
}
private:
int
do_save_field_metadata
(
uchar
*
first_byte
);
bool
compare_enum_values
(
TYPELIB
*
values
);
uint
is_equal
(
Create_field
*
new_field
);
};
...
...
sql/handler.cc
View file @
5b4022b5
...
...
@@ -1278,7 +1278,12 @@ int ha_rollback_trans(THD *thd, bool all)
trans
->
ha_list
=
0
;
trans
->
no_2pc
=
0
;
if
(
is_real_trans
)
{
if
(
thd
->
transaction_rollback_request
)
thd
->
transaction
.
xid_state
.
rm_error
=
thd
->
main_da
.
sql_errno
();
else
thd
->
transaction
.
xid_state
.
xid
.
null
();
}
if
(
all
)
{
thd
->
variables
.
tx_isolation
=
thd
->
session_tx_isolation
;
...
...
sql/log.cc
View file @
5b4022b5
...
...
@@ -3779,7 +3779,7 @@ THD::binlog_set_pending_rows_event(Rows_log_event* ev)
int
MYSQL_BIN_LOG
::
remove_pending_rows_event
(
THD
*
thd
)
{
DBUG_ENTER
(
__FUNCTION__
);
DBUG_ENTER
(
"MYSQL_BIN_LOG::remove_pending_rows_event"
);
binlog_trx_data
*
const
trx_data
=
(
binlog_trx_data
*
)
thd_get_ha_data
(
thd
,
binlog_hton
);
...
...
sql/share/errmsg.txt
View file @
5b4022b5
...
...
@@ -6128,6 +6128,12 @@ ER_LOAD_DATA_INVALID_COLUMN
ER_LOG_PURGE_NO_FILE
eng "Being purged log %s was not found"
ER_XA_RBTIMEOUT XA106
eng "XA_RBTIMEOUT: Transaction branch was rolled back: took too long"
ER_XA_RBDEADLOCK XA102
eng "XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected"
ER_NEED_REPREPARE
eng "Prepared statement needs to be re-prepared"
...
...
sql/sql_class.cc
View file @
5b4022b5
...
...
@@ -3513,7 +3513,7 @@ int THD::binlog_delete_row(TABLE* table, bool is_trans,
int
THD
::
binlog_remove_pending_rows_event
(
bool
clear_maps
)
{
DBUG_ENTER
(
__FUNCTION__
);
DBUG_ENTER
(
"THD::binlog_remove_pending_rows_event"
);
if
(
!
mysql_bin_log
.
is_open
())
DBUG_RETURN
(
0
);
...
...
sql/sql_class.h
View file @
5b4022b5
...
...
@@ -739,7 +739,7 @@ struct st_savepoint {
Ha_trx_info
*
ha_list
;
};
enum
xa_states
{
XA_NOTR
=
0
,
XA_ACTIVE
,
XA_IDLE
,
XA_PREPARED
};
enum
xa_states
{
XA_NOTR
=
0
,
XA_ACTIVE
,
XA_IDLE
,
XA_PREPARED
,
XA_ROLLBACK_ONLY
};
extern
const
char
*
xa_state_names
[];
typedef
struct
st_xid_state
{
...
...
@@ -747,6 +747,8 @@ typedef struct st_xid_state {
XID
xid
;
// transaction identifier
enum
xa_states
xa_state
;
// used by external XA only
bool
in_thd
;
/* Error reported by the Resource Manager (RM) to the Transaction Manager. */
uint
rm_error
;
}
XID_STATE
;
extern
pthread_mutex_t
LOCK_xid_cache
;
...
...
sql/sql_parse.cc
View file @
5b4022b5
...
...
@@ -83,9 +83,57 @@ const LEX_STRING command_name[]={
};
const
char
*
xa_state_names
[]
=
{
"NON-EXISTING"
,
"ACTIVE"
,
"IDLE"
,
"PREPARED"
"NON-EXISTING"
,
"ACTIVE"
,
"IDLE"
,
"PREPARED"
,
"ROLLBACK ONLY"
};
/**
Mark a XA transaction as rollback-only if the RM unilaterally
rolled back the transaction branch.
@note If a rollback was requested by the RM, this function sets
the appropriate rollback error code and transits the state
to XA_ROLLBACK_ONLY.
@return TRUE if transaction was rolled back or if the transaction
state is XA_ROLLBACK_ONLY. FALSE otherwise.
*/
static
bool
xa_trans_rolled_back
(
XID_STATE
*
xid_state
)
{
if
(
xid_state
->
rm_error
)
{
switch
(
xid_state
->
rm_error
)
{
case
ER_LOCK_WAIT_TIMEOUT
:
my_error
(
ER_XA_RBTIMEOUT
,
MYF
(
0
));
break
;
case
ER_LOCK_DEADLOCK
:
my_error
(
ER_XA_RBDEADLOCK
,
MYF
(
0
));
break
;
default:
my_error
(
ER_XA_RBROLLBACK
,
MYF
(
0
));
}
xid_state
->
xa_state
=
XA_ROLLBACK_ONLY
;
}
return
(
xid_state
->
xa_state
==
XA_ROLLBACK_ONLY
);
}
/**
Rollback work done on behalf of at ransaction branch.
*/
static
bool
xa_trans_rollback
(
THD
*
thd
)
{
bool
status
=
test
(
ha_rollback
(
thd
));
thd
->
options
&=
~
(
ulong
)
OPTION_BEGIN
;
thd
->
transaction
.
all
.
modified_non_trans_table
=
FALSE
;
thd
->
server_status
&=
~
SERVER_STATUS_IN_TRANS
;
xid_cache_delete
(
&
thd
->
transaction
.
xid_state
);
thd
->
transaction
.
xid_state
.
xa_state
=
XA_NOTR
;
thd
->
transaction
.
xid_state
.
rm_error
=
0
;
return
status
;
}
static
void
unlock_locked_tables
(
THD
*
thd
)
{
if
(
thd
->
locked_tables
)
...
...
@@ -4505,6 +4553,7 @@ mysql_execute_command(THD *thd)
}
DBUG_ASSERT
(
thd
->
transaction
.
xid_state
.
xid
.
is_null
());
thd
->
transaction
.
xid_state
.
xa_state
=
XA_ACTIVE
;
thd
->
transaction
.
xid_state
.
rm_error
=
0
;
thd
->
transaction
.
xid_state
.
xid
.
set
(
thd
->
lex
->
xid
);
xid_cache_insert
(
&
thd
->
transaction
.
xid_state
);
thd
->
transaction
.
all
.
modified_non_trans_table
=
FALSE
;
...
...
@@ -4530,6 +4579,8 @@ mysql_execute_command(THD *thd)
my_error
(
ER_XAER_NOTA
,
MYF
(
0
));
break
;
}
if
(
xa_trans_rolled_back
(
&
thd
->
transaction
.
xid_state
))
break
;
thd
->
transaction
.
xid_state
.
xa_state
=
XA_IDLE
;
my_ok
(
thd
);
break
;
...
...
@@ -4561,6 +4612,12 @@ mysql_execute_command(THD *thd)
XID_STATE
*
xs
=
xid_cache_search
(
thd
->
lex
->
xid
);
if
(
!
xs
||
xs
->
in_thd
)
my_error
(
ER_XAER_NOTA
,
MYF
(
0
));
else
if
(
xa_trans_rolled_back
(
xs
))
{
ha_commit_or_rollback_by_xid
(
thd
->
lex
->
xid
,
0
);
xid_cache_delete
(
xs
);
break
;
}
else
{
ha_commit_or_rollback_by_xid
(
thd
->
lex
->
xid
,
1
);
...
...
@@ -4569,6 +4626,11 @@ mysql_execute_command(THD *thd)
}
break
;
}
if
(
xa_trans_rolled_back
(
&
thd
->
transaction
.
xid_state
))
{
xa_trans_rollback
(
thd
);
break
;
}
if
(
thd
->
transaction
.
xid_state
.
xa_state
==
XA_IDLE
&&
thd
->
lex
->
xa_opt
==
XA_ONE_PHASE
)
{
...
...
@@ -4615,28 +4677,26 @@ mysql_execute_command(THD *thd)
my_error
(
ER_XAER_NOTA
,
MYF
(
0
));
else
{
bool
ok
=
!
xa_trans_rolled_back
(
xs
);
ha_commit_or_rollback_by_xid
(
thd
->
lex
->
xid
,
0
);
xid_cache_delete
(
xs
);
if
(
ok
)
my_ok
(
thd
);
}
break
;
}
if
(
thd
->
transaction
.
xid_state
.
xa_state
!=
XA_IDLE
&&
thd
->
transaction
.
xid_state
.
xa_state
!=
XA_PREPARED
)
thd
->
transaction
.
xid_state
.
xa_state
!=
XA_PREPARED
&&
thd
->
transaction
.
xid_state
.
xa_state
!=
XA_ROLLBACK_ONLY
)
{
my_error
(
ER_XAER_RMFAIL
,
MYF
(
0
),
xa_state_names
[
thd
->
transaction
.
xid_state
.
xa_state
]);
break
;
}
if
(
ha
_rollback
(
thd
))
if
(
xa_trans
_rollback
(
thd
))
my_error
(
ER_XAER_RMERR
,
MYF
(
0
));
else
my_ok
(
thd
);
thd
->
options
&=
~
(
OPTION_BEGIN
|
OPTION_KEEP_LOG
);
thd
->
transaction
.
all
.
modified_non_trans_table
=
FALSE
;
thd
->
server_status
&=
~
SERVER_STATUS_IN_TRANS
;
xid_cache_delete
(
&
thd
->
transaction
.
xid_state
);
thd
->
transaction
.
xid_state
.
xa_state
=
XA_NOTR
;
break
;
case
SQLCOM_XA_RECOVER
:
res
=
mysql_xa_recover
(
thd
);
...
...
zlib/gzio.c
View file @
5b4022b5
...
...
@@ -7,6 +7,11 @@
/* @(#) $Id$ */
/* Need to be included "early" to control other headers */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include "zutil.h"
...
...
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