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
bc9f6021
Commit
bc9f6021
authored
13 years ago
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MWL#116: After-review fixes.
parent
a2d921be
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
187 additions
and
124 deletions
+187
-124
include/my_sys.h
include/my_sys.h
+2
-0
mysql-test/r/xa_binlog.result
mysql-test/r/xa_binlog.result
+32
-0
mysql-test/suite/binlog/t/binlog_ioerr.test
mysql-test/suite/binlog/t/binlog_ioerr.test
+2
-1
mysql-test/suite/pbxt/r/pbxt_xa_binlog.result
mysql-test/suite/pbxt/r/pbxt_xa_binlog.result
+1
-0
mysql-test/suite/pbxt/t/pbxt_xa_binlog.test
mysql-test/suite/pbxt/t/pbxt_xa_binlog.test
+1
-0
mysql-test/t/group_commit_binlog_pos.test
mysql-test/t/group_commit_binlog_pos.test
+4
-0
mysql-test/t/xa_binlog.test
mysql-test/t/xa_binlog.test
+32
-0
sql/handler.cc
sql/handler.cc
+11
-10
sql/handler.h
sql/handler.h
+4
-5
sql/log.cc
sql/log.cc
+88
-105
sql/sql_class.cc
sql/sql_class.cc
+1
-1
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.cc
+7
-0
storage/xtradb/include/srv0srv.h
storage/xtradb/include/srv0srv.h
+1
-1
storage/xtradb/srv/srv0srv.c
storage/xtradb/srv/srv0srv.c
+1
-1
No files found.
include/my_sys.h
View file @
bc9f6021
...
@@ -554,6 +554,8 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
...
@@ -554,6 +554,8 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
#define my_b_tell(info) ((info)->pos_in_file + \
#define my_b_tell(info) ((info)->pos_in_file + \
(size_t) (*(info)->current_pos - (info)->request_pos))
(size_t) (*(info)->current_pos - (info)->request_pos))
#define my_b_write_tell(info) ((info)->pos_in_file + \
((info)->write_pos - (info)->write_buffer))
#define my_b_get_buffer_start(info) (info)->request_pos
#define my_b_get_buffer_start(info) (info)->request_pos
#define my_b_get_bytes_in_buffer(info) (char*) (info)->read_end - \
#define my_b_get_bytes_in_buffer(info) (char*) (info)->read_end - \
...
...
This diff is collapsed.
Click to expand it.
mysql-test/r/xa_binlog.result
0 → 100644
View file @
bc9f6021
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
SET binlog_format= mixed;
RESET MASTER;
XA START 'xatest';
INSERT INTO t1 VALUES (1);
XA END 'xatest';
XA PREPARE 'xatest';
XA COMMIT 'xatest';
XA START 'xatest';
INSERT INTO t1 VALUES (2);
XA END 'xatest';
XA COMMIT 'xatest' ONE PHASE;
BEGIN;
INSERT INTO t1 VALUES (3);
COMMIT;
SELECT * FROM t1 ORDER BY a;
a
1
2
3
SHOW BINLOG EVENTS LIMIT 1,9;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (2)
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (3)
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
DROP TABLE t1;
This diff is collapsed.
Click to expand it.
mysql-test/suite/binlog/t/binlog_ioerr.test
View file @
bc9f6021
...
@@ -21,7 +21,8 @@ SELECT * FROM t1;
...
@@ -21,7 +21,8 @@ SELECT * FROM t1;
# Actually the output from this currently shows a bug.
# Actually the output from this currently shows a bug.
# The injected IO error leaves partially written transactions in the binlog in
# The injected IO error leaves partially written transactions in the binlog in
# the form of stray "BEGIN" events.
# the form of stray "BEGIN" events.
# These should disappear from the output if binlog error handling is improved.
# These should disappear from the output if binlog error handling is improved
# (see MySQL Bug#37148 and WL#1790).
--
replace_regex
/
\
/
\
*
xid
=.*
\
*
\
//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
--
replace_regex
/
\
/
\
*
xid
=.*
\
*
\
//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
--
replace_column
1
BINLOG
2
POS
5
ENDPOS
--
replace_column
1
BINLOG
2
POS
5
ENDPOS
SHOW
BINLOG
EVENTS
;
SHOW
BINLOG
EVENTS
;
...
...
This diff is collapsed.
Click to expand it.
mysql-test/suite/pbxt/r/pbxt_xa_binlog.result
View file @
bc9f6021
...
@@ -16,6 +16,7 @@ select * from t2;
...
@@ -16,6 +16,7 @@ select * from t2;
b
b
2
2
SET sql_log_bin = 0;
SET sql_log_bin = 0;
BEGIN;
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (3);
INSERT INTO t2 VALUES (4);
INSERT INTO t2 VALUES (4);
COMMIT;
COMMIT;
...
...
This diff is collapsed.
Click to expand it.
mysql-test/suite/pbxt/t/pbxt_xa_binlog.test
View file @
bc9f6021
...
@@ -20,6 +20,7 @@ select * from t2;
...
@@ -20,6 +20,7 @@ select * from t2;
# Test 2-phase commit when we disable binlogging.
# Test 2-phase commit when we disable binlogging.
SET
sql_log_bin
=
0
;
SET
sql_log_bin
=
0
;
BEGIN
;
INSERT
INTO
t1
VALUES
(
3
);
INSERT
INTO
t1
VALUES
(
3
);
INSERT
INTO
t2
VALUES
(
4
);
INSERT
INTO
t2
VALUES
(
4
);
COMMIT
;
COMMIT
;
...
...
This diff is collapsed.
Click to expand it.
mysql-test/t/group_commit_binlog_pos.test
View file @
bc9f6021
...
@@ -8,6 +8,10 @@
...
@@ -8,6 +8,10 @@
# Don't test this under valgrind, memory leaks will occur as we crash
# Don't test this under valgrind, memory leaks will occur as we crash
--
source
include
/
not_valgrind
.
inc
--
source
include
/
not_valgrind
.
inc
# The test case currently uses grep and tail, which may be unavailable on
# some windows systems. But see MWL#191 for how to remove the need for grep.
--
source
include
/
not_windows
.
inc
# XtraDB stores the binlog position corresponding to the last commit, and
# XtraDB stores the binlog position corresponding to the last commit, and
# prints it during crash recovery.
# prints it during crash recovery.
# Test that we get the correct position when we group commit several
# Test that we get the correct position when we group commit several
...
...
This diff is collapsed.
Click to expand it.
mysql-test/t/xa_binlog.test
0 → 100644
View file @
bc9f6021
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_log_bin
.
inc
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
# Fix binlog format (otherwise SHOW BINLOG EVENTS will fluctuate).
SET
binlog_format
=
mixed
;
RESET
MASTER
;
XA
START
'xatest'
;
INSERT
INTO
t1
VALUES
(
1
);
XA
END
'xatest'
;
XA
PREPARE
'xatest'
;
XA
COMMIT
'xatest'
;
XA
START
'xatest'
;
INSERT
INTO
t1
VALUES
(
2
);
XA
END
'xatest'
;
XA
COMMIT
'xatest'
ONE
PHASE
;
BEGIN
;
INSERT
INTO
t1
VALUES
(
3
);
COMMIT
;
SELECT
*
FROM
t1
ORDER
BY
a
;
--
replace_column
2
# 5 #
--
replace_regex
/
xid
=
[
0
-
9
]
+/
xid
=
XX
/
SHOW
BINLOG
EVENTS
LIMIT
1
,
9
;
DROP
TABLE
t1
;
This diff is collapsed.
Click to expand it.
sql/handler.cc
View file @
bc9f6021
...
@@ -1186,17 +1186,16 @@ int ha_commit_trans(THD *thd, bool all)
...
@@ -1186,17 +1186,16 @@ int ha_commit_trans(THD *thd, bool all)
Sic: we know that prepare() is not NULL since otherwise
Sic: we know that prepare() is not NULL since otherwise
trans->no_2pc would have been set.
trans->no_2pc would have been set.
*/
*/
if
((
err
=
ht
->
prepare
(
ht
,
thd
,
all
)))
err
=
ht
->
prepare
(
ht
,
thd
,
all
);
my_error
(
ER_ERROR_DURING_COMMIT
,
MYF
(
0
),
err
);
status_var_increment
(
thd
->
status_var
.
ha_prepare_count
);
status_var_increment
(
thd
->
status_var
.
ha_prepare_count
);
if
(
err
)
my_error
(
ER_ERROR_DURING_COMMIT
,
MYF
(
0
),
err
);
if
(
err
)
if
(
err
)
goto
err
;
goto
err
;
if
(
ht
->
prepare_ordered
)
need_prepare_ordered
|=
(
ht
->
prepare_ordered
!=
NULL
);
need_prepare_ordered
=
TRUE
;
need_commit_ordered
|=
(
ht
->
commit_ordered
!=
NULL
);
if
(
ht
->
commit_ordered
)
need_commit_ordered
=
TRUE
;
}
}
DBUG_EXECUTE_IF
(
"crash_commit_after_prepare"
,
DBUG_ABORT
(););
DBUG_EXECUTE_IF
(
"crash_commit_after_prepare"
,
DBUG_ABORT
(););
...
@@ -1225,8 +1224,7 @@ int ha_commit_trans(THD *thd, bool all)
...
@@ -1225,8 +1224,7 @@ int ha_commit_trans(THD *thd, bool all)
/* Come here if error and we need to rollback. */
/* Come here if error and we need to rollback. */
err:
err:
if
(
!
error
)
error
=
1
;
/* Transaction was rolled back */
error
=
1
;
ha_rollback_trans
(
thd
,
all
);
ha_rollback_trans
(
thd
,
all
);
end:
end:
...
@@ -1877,8 +1875,11 @@ int ha_start_consistent_snapshot(THD *thd)
...
@@ -1877,8 +1875,11 @@ int ha_start_consistent_snapshot(THD *thd)
bool
warn
=
true
;
bool
warn
=
true
;
/*
/*
Holding the LOCK_commit_ordered mutex ensures that for any transaction
Holding the LOCK_commit_ordered mutex ensures that we get the same
we either see it committed in all engines, or in none.
snapshot for all engines (including the binary log). This allows us
among other things to do backups with
START TRANSACTION WITH CONSISTENT SNAPSHOT and
have a consistent binlog position.
*/
*/
pthread_mutex_lock
(
&
LOCK_commit_ordered
);
pthread_mutex_lock
(
&
LOCK_commit_ordered
);
plugin_foreach
(
thd
,
snapshot_handlerton
,
MYSQL_STORAGE_ENGINE_PLUGIN
,
&
warn
);
plugin_foreach
(
thd
,
snapshot_handlerton
,
MYSQL_STORAGE_ENGINE_PLUGIN
,
&
warn
);
...
...
This diff is collapsed.
Click to expand it.
sql/handler.h
View file @
bc9f6021
...
@@ -670,7 +670,7 @@ struct handlerton
...
@@ -670,7 +670,7 @@ struct handlerton
Not that like prepare(), commit_ordered() is only called when 2-phase
Not that like prepare(), commit_ordered() is only called when 2-phase
commit takes place. Ie. when no binary log and only a single engine
commit takes place. Ie. when no binary log and only a single engine
participates in a transaction, one commit() is called, no
participates in a transaction, one commit() is called, no
commit_orderd(). So engines must be prepared for this.
commit_order
e
d(). So engines must be prepared for this.
The calls to commit_ordered() in multiple parallel transactions is
The calls to commit_ordered() in multiple parallel transactions is
guaranteed to happen in the same order in every participating
guaranteed to happen in the same order in every participating
...
@@ -683,7 +683,7 @@ struct handlerton
...
@@ -683,7 +683,7 @@ struct handlerton
transaction visible to other transactions, thereby making the order of
transaction visible to other transactions, thereby making the order of
transaction commits be defined by the order of commit_ordered() calls.
transaction commits be defined by the order of commit_ordered() calls.
The inten
s
ion is that commit_ordered() should do the minimal amount of
The inten
t
ion is that commit_ordered() should do the minimal amount of
work that needs to happen in consistent commit order among handlers. To
work that needs to happen in consistent commit order among handlers. To
preserve ordering, calls need to be serialised on a global mutex, so
preserve ordering, calls need to be serialised on a global mutex, so
doing any time-consuming or blocking operations in commit_ordered() will
doing any time-consuming or blocking operations in commit_ordered() will
...
@@ -727,7 +727,7 @@ struct handlerton
...
@@ -727,7 +727,7 @@ struct handlerton
order transactions will be eventually committed.
order transactions will be eventually committed.
Like commit_ordered(), prepare_ordered() calls are serialised to maintain
Like commit_ordered(), prepare_ordered() calls are serialised to maintain
ordering, so the inten
s
ion is that they should execute fast, with only
ordering, so the inten
t
ion is that they should execute fast, with only
the minimal amount of work needed to define commit order. Handlers can
the minimal amount of work needed to define commit order. Handlers can
rely on this serialisation, and do not need to do any extra locking to
rely on this serialisation, and do not need to do any extra locking to
avoid two prepare_ordered() calls running in parallel.
avoid two prepare_ordered() calls running in parallel.
...
@@ -747,8 +747,7 @@ struct handlerton
...
@@ -747,8 +747,7 @@ struct handlerton
require blocking all other commits for an indefinite time).
require blocking all other commits for an indefinite time).
When 2-phase commit is not used (eg. only one engine (and no binlog) in
When 2-phase commit is not used (eg. only one engine (and no binlog) in
transaction), prepare() is not called and in such cases prepare_ordered()
transaction), neither prepare() nor prepare_ordered() is called.
also is not called.
*/
*/
void
(
*
prepare_ordered
)(
handlerton
*
hton
,
THD
*
thd
,
bool
all
);
void
(
*
prepare_ordered
)(
handlerton
*
hton
,
THD
*
thd
,
bool
all
);
int
(
*
recover
)(
handlerton
*
hton
,
XID
*
xid_list
,
uint
len
);
int
(
*
recover
)(
handlerton
*
hton
,
XID
*
xid_list
,
uint
len
);
...
...
This diff is collapsed.
Click to expand it.
sql/log.cc
View file @
bc9f6021
This diff is collapsed.
Click to expand it.
sql/sql_class.cc
View file @
bc9f6021
...
@@ -4023,8 +4023,8 @@ THD::signal_wakeup_ready()
...
@@ -4023,8 +4023,8 @@ THD::signal_wakeup_ready()
{
{
pthread_mutex_lock
(
&
LOCK_wakeup_ready
);
pthread_mutex_lock
(
&
LOCK_wakeup_ready
);
wakeup_ready
=
true
;
wakeup_ready
=
true
;
pthread_cond_signal
(
&
COND_wakeup_ready
);
pthread_mutex_unlock
(
&
LOCK_wakeup_ready
);
pthread_mutex_unlock
(
&
LOCK_wakeup_ready
);
pthread_cond_signal
(
&
COND_wakeup_ready
);
}
}
...
...
This diff is collapsed.
Click to expand it.
storage/xtradb/handler/ha_innodb.cc
View file @
bc9f6021
...
@@ -11643,6 +11643,12 @@ static MYSQL_SYSVAR_ENUM(adaptive_checkpoint, srv_adaptive_checkpoint,
...
@@ -11643,6 +11643,12 @@ static MYSQL_SYSVAR_ENUM(adaptive_checkpoint, srv_adaptive_checkpoint,
"Enable/Disable flushing along modified age. (none, reflex, [estimate])"
,
"Enable/Disable flushing along modified age. (none, reflex, [estimate])"
,
NULL
,
innodb_adaptive_checkpoint_update
,
2
,
&
adaptive_checkpoint_typelib
);
NULL
,
innodb_adaptive_checkpoint_update
,
2
,
&
adaptive_checkpoint_typelib
);
static
MYSQL_SYSVAR_ULONG
(
enable_unsafe_group_commit
,
srv_deprecated_enable_unsafe_group_commit
,
PLUGIN_VAR_RQCMDARG
,
"Enable/Disable unsafe group commit when support_xa=OFF and use with binlog or other XA storage engine. "
"(Deprecated, and does nothing, group commit is always enabled in a safe way)"
,
NULL
,
NULL
,
0
,
0
,
1
,
0
);
static
MYSQL_SYSVAR_ULONG
(
expand_import
,
srv_expand_import
,
static
MYSQL_SYSVAR_ULONG
(
expand_import
,
srv_expand_import
,
PLUGIN_VAR_RQCMDARG
,
PLUGIN_VAR_RQCMDARG
,
"Enable/Disable converting automatically *.ibd files when import tablespace."
,
"Enable/Disable converting automatically *.ibd files when import tablespace."
,
...
@@ -11748,6 +11754,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
...
@@ -11748,6 +11754,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR
(
read_ahead
),
MYSQL_SYSVAR
(
read_ahead
),
MYSQL_SYSVAR
(
adaptive_checkpoint
),
MYSQL_SYSVAR
(
adaptive_checkpoint
),
MYSQL_SYSVAR
(
flush_log_at_trx_commit_session
),
MYSQL_SYSVAR
(
flush_log_at_trx_commit_session
),
MYSQL_SYSVAR
(
enable_unsafe_group_commit
),
MYSQL_SYSVAR
(
expand_import
),
MYSQL_SYSVAR
(
expand_import
),
MYSQL_SYSVAR
(
extra_rsegments
),
MYSQL_SYSVAR
(
extra_rsegments
),
MYSQL_SYSVAR
(
dict_size_limit
),
MYSQL_SYSVAR
(
dict_size_limit
),
...
...
This diff is collapsed.
Click to expand it.
storage/xtradb/include/srv0srv.h
View file @
bc9f6021
...
@@ -230,7 +230,7 @@ extern ulong srv_ibuf_active_contract;
...
@@ -230,7 +230,7 @@ extern ulong srv_ibuf_active_contract;
extern
ulong
srv_ibuf_accel_rate
;
extern
ulong
srv_ibuf_accel_rate
;
extern
ulint
srv_checkpoint_age_target
;
extern
ulint
srv_checkpoint_age_target
;
extern
ulong
srv_flush_neighbor_pages
;
extern
ulong
srv_flush_neighbor_pages
;
extern
ulong
srv_enable_unsafe_group_commit
;
extern
ulong
srv_
deprecated_
enable_unsafe_group_commit
;
extern
ulong
srv_read_ahead
;
extern
ulong
srv_read_ahead
;
extern
ulong
srv_adaptive_checkpoint
;
extern
ulong
srv_adaptive_checkpoint
;
...
...
This diff is collapsed.
Click to expand it.
storage/xtradb/srv/srv0srv.c
View file @
bc9f6021
...
@@ -407,7 +407,7 @@ UNIV_INTERN ulong srv_ibuf_accel_rate = 100;
...
@@ -407,7 +407,7 @@ UNIV_INTERN ulong srv_ibuf_accel_rate = 100;
UNIV_INTERN
ulint
srv_checkpoint_age_target
=
0
;
UNIV_INTERN
ulint
srv_checkpoint_age_target
=
0
;
UNIV_INTERN
ulong
srv_flush_neighbor_pages
=
1
;
/* 0:disable 1:enable */
UNIV_INTERN
ulong
srv_flush_neighbor_pages
=
1
;
/* 0:disable 1:enable */
UNIV_INTERN
ulong
srv_
enable_unsafe_group_commit
=
0
;
/* 0:disable 1:enable */
UNIV_INTERN
ulong
srv_
deprecated_enable_unsafe_group_commit
=
0
;
UNIV_INTERN
ulong
srv_read_ahead
=
3
;
/* 1: random 2: linear 3: Both */
UNIV_INTERN
ulong
srv_read_ahead
=
3
;
/* 1: random 2: linear 3: Both */
UNIV_INTERN
ulong
srv_adaptive_checkpoint
=
0
;
/* 0: none 1: reflex 2: estimate */
UNIV_INTERN
ulong
srv_adaptive_checkpoint
=
0
;
/* 0: none 1: reflex 2: estimate */
...
...
This diff is collapsed.
Click to expand it.
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