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
4f3b3047
Commit
4f3b3047
authored
Dec 01, 2004
by
jan@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This is a code cleanup patch for X/Open XA.
parent
fb50b9e6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
50 deletions
+50
-50
innobase/include/trx0trx.h
innobase/include/trx0trx.h
+1
-1
innobase/include/trx0undo.h
innobase/include/trx0undo.h
+5
-3
innobase/include/trx0xa.h
innobase/include/trx0xa.h
+0
-0
innobase/trx/trx0trx.c
innobase/trx/trx0trx.c
+12
-11
innobase/trx/trx0undo.c
innobase/trx/trx0undo.c
+30
-33
sql/ha_innodb.cc
sql/ha_innodb.cc
+2
-2
No files found.
innobase/include/trx0trx.h
View file @
4f3b3047
...
...
@@ -16,7 +16,7 @@ Created 3/26/1996 Heikki Tuuri
#include "que0types.h"
#include "mem0mem.h"
#include "read0types.h"
#include "xa.h"
#include "
trx0
xa.h"
extern
ulint
trx_n_mysql_transactions
;
...
...
innobase/include/trx0undo.h
View file @
4f3b3047
...
...
@@ -14,7 +14,7 @@ Created 3/26/1996 Heikki Tuuri
#include "mtr0mtr.h"
#include "trx0sys.h"
#include "page0types.h"
#include "xa.h"
#include "
trx0
xa.h"
/***************************************************************************
Builds a roll pointer dulint. */
...
...
@@ -469,7 +469,10 @@ page of an update undo log segment. */
log start, and therefore this is not
necessarily the same as this log
header end offset */
#define TRX_UNDO_DICT_OPERATION 20
/* TRUE if the transaction is a table
#define TRX_UNDO_XID_EXISTS 20
/* TRUE if undo log header includes
X/Open XA transaction identification
XID */
#define TRX_UNDO_DICT_TRANS 21
/* TRUE if the transaction is a table
create, index create, or drop
transaction: in recovery
the transaction cannot be rolled back
...
...
@@ -492,7 +495,6 @@ page of an update undo log segment. */
#define TRX_UNDO_XA_BQUAL_LEN (TRX_UNDO_XA_TRID_LEN + 4)
#define TRX_UNDO_XA_XID (TRX_UNDO_XA_BQUAL_LEN + 4)
#define TRX_UNDO_XA_LEN (TRX_UNDO_XA_XID + XIDDATASIZE)
#define TRX_UNDO_XA_EXISTS 256
/*-------------------------------------------------------------*/
#define TRX_UNDO_LOG_HDR_SIZE (TRX_UNDO_XA_LEN)
...
...
innobase/include/xa.h
→
innobase/include/
trx0
xa.h
View file @
4f3b3047
File moved
innobase/trx/trx0trx.c
View file @
4f3b3047
...
...
@@ -24,7 +24,7 @@ Created 3/26/1996 Heikki Tuuri
#include "thr0loc.h"
#include "btr0sea.h"
#include "os0proc.h"
#include "xa.h"
#include "
trx0
xa.h"
/* Copy of the prototype for innobase_mysql_print_thd: this
copy MUST be equal to the one in mysql/sql/ha_innodb.cc ! */
...
...
@@ -1740,10 +1740,6 @@ trx_prepare_off_kernel(
undo
=
trx
->
update_undo
;
if
(
undo
)
{
mutex_enter
(
&
kernel_mutex
);
trx
->
no
=
trx_sys_get_new_trx_no
();
mutex_exit
(
&
kernel_mutex
);
/* It is not necessary to obtain trx->undo_mutex here
because only a single OS thread is allowed to do the
...
...
@@ -1781,11 +1777,6 @@ trx_prepare_off_kernel(
mutex_exit
(
&
kernel_mutex
);
if
(
trx
->
insert_undo
!=
NULL
)
{
trx_undo_insert_cleanup
(
trx
);
}
/* Write the log to the log files AND flush them to disk */
/*-------------------------------------*/
...
...
@@ -1860,9 +1851,19 @@ trx_recover_for_mysql(
while
(
trx
)
{
if
(
trx
->
conc_state
==
TRX_PREPARED
)
{
xid_list
[
num_of_transactions
]
=
trx
->
xid
;
fprintf
(
stderr
,
"InnoDB: Transaction %lu %lu in prepared state after recovery
\n
"
,
(
ulong
)
ut_dulint_get_high
(
trx
->
id
),
(
ulong
)
ut_dulint_get_low
(
trx
->
id
));
fprintf
(
stderr
,
"InnoDB: Transaction contains changes to %lu rows
\n
"
,
(
ulong
)
ut_conv_dulint_to_longlong
(
trx
->
undo_no
));
num_of_transactions
++
;
if
(
(
uint
)
num_of_transactions
==
len
)
{
if
((
uint
)
num_of_transactions
==
len
)
{
break
;
}
}
...
...
innobase/trx/trx0undo.c
View file @
4f3b3047
...
...
@@ -19,7 +19,7 @@ Created 3/26/1996 Heikki Tuuri
#include "srv0srv.h"
#include "trx0rec.h"
#include "trx0purge.h"
#include "xa.h"
#include "
trx0
xa.h"
/* How should the old versions in the history list be managed?
----------------------------------------------------------
...
...
@@ -537,18 +537,19 @@ trx_undo_header_create(
/* If X/Open XID exits in the log header we store a
flag of it in upper byte of dict operation flag. */
if
(
xid
==
NULL
||
xid
->
formatID
=
=
-
1
)
{
mach_write_to_
2
(
log_hdr
+
TRX_UNDO_DICT_OPERATION
,
FALS
E
);
if
(
xid
!=
NULL
||
xid
->
formatID
!
=
-
1
)
{
mach_write_to_
1
(
log_hdr
+
TRX_UNDO_XID_EXISTS
,
TRU
E
);
}
else
{
mach_write_to_2
(
log_hdr
+
TRX_UNDO_DICT_OPERATION
,
TRX_UNDO_XA_EXISTS
|
FALSE
);
mach_write_to_1
(
log_hdr
+
TRX_UNDO_XID_EXISTS
,
FALSE
);
}
mach_write_to_1
(
log_hdr
+
TRX_UNDO_DICT_TRANS
,
FALSE
);
mach_write_to_2
(
log_hdr
+
TRX_UNDO_NEXT_LOG
,
0
);
mach_write_to_2
(
log_hdr
+
TRX_UNDO_PREV_LOG
,
prev_log
);
/* Write X/Open XA transaction identification if exists */
if
(
xid
&&
xid
->
formatID
!=
-
1
)
{
if
(
xid
&&
xid
->
formatID
!=
-
1
)
{
trx_undo_write_xid
(
log_hdr
,
xid
);
}
...
...
@@ -659,18 +660,18 @@ trx_undo_insert_header_reuse(
mach_write_to_8
(
log_hdr
+
TRX_UNDO_TRX_ID
,
trx_id
);
mach_write_to_2
(
log_hdr
+
TRX_UNDO_LOG_START
,
new_free
);
/* If X/Open XID exits in the log header we store a
flag of it in upper byte of dict operation flag and
then write the xid. */
/* If X/Open XID exits in the log header we store it
to log header. */
if
(
xid
&&
xid
->
formatID
!=
-
1
)
{
mach_write_to_1
(
log_hdr
+
TRX_UNDO_XID_EXISTS
,
TRUE
);
if
(
xid
&&
xid
->
formatID
!=
-
1
)
{
mach_write_to_2
(
log_hdr
+
TRX_UNDO_DICT_OPERATION
,
TRX_UNDO_XA_EXISTS
|
FALSE
);
trx_undo_write_xid
(
log_hdr
,
xid
);
}
else
{
mach_write_to_
2
(
log_hdr
+
TRX_UNDO_DICT_OPERATION
,
FALSE
);
mach_write_to_
1
(
log_hdr
+
TRX_UNDO_XID_EXISTS
,
FALSE
);
}
mach_write_to_1
(
log_hdr
+
TRX_UNDO_DICT_TRANS
,
FALSE
);
trx_undo_insert_header_reuse_log
(
undo_page
,
trx_id
,
mtr
);
return
(
free
);
...
...
@@ -1203,7 +1204,7 @@ trx_undo_mem_create_at_db_start(
page_t
*
last_page
;
trx_undo_rec_t
*
rec
;
XID
xid
;
ulint
dict_op
;
ibool
xid_exists
=
FALSE
;
if
(
id
>=
TRX_RSEG_N_SLOTS
)
{
fprintf
(
stderr
,
...
...
@@ -1227,9 +1228,8 @@ trx_undo_mem_create_at_db_start(
trx_id
=
mtr_read_dulint
(
undo_header
+
TRX_UNDO_TRX_ID
,
mtr
);
dict_op
=
mtr_read_ulint
(
undo_header
+
TRX_UNDO_DICT_OPERATION
,
MLOG_2BYTES
,
mtr
);
xid_exists
=
mtr_read_ulint
(
undo_header
+
TRX_UNDO_XID_EXISTS
,
MLOG_1BYTE
,
mtr
);
/* Read X/Open XA transaction identification if exists or
set it to NULL. */
...
...
@@ -1237,7 +1237,7 @@ trx_undo_mem_create_at_db_start(
memset
(
&
xid
,
0
,
sizeof
(
xid
));
xid
.
formatID
=
-
1
;
if
(
dict_op
&
TRX_UNDO_XA_EXISTS
)
{
if
(
xid_exists
==
TRUE
)
{
trx_undo_read_xid
(
undo_header
,
&
xid
);
}
...
...
@@ -1248,7 +1248,10 @@ trx_undo_mem_create_at_db_start(
mutex_exit
(
&
(
rseg
->
mutex
));
undo
->
dict_operation
=
(
dict_op
&
1
);
undo
->
dict_operation
=
mtr_read_ulint
(
undo_header
+
TRX_UNDO_DICT_TRANS
,
MLOG_1BYTE
,
mtr
);
undo
->
table_id
=
mtr_read_dulint
(
undo_header
+
TRX_UNDO_TABLE_ID
,
mtr
);
undo
->
state
=
state
;
undo
->
size
=
flst_get_len
(
seg_header
+
TRX_UNDO_PAGE_LIST
,
mtr
);
...
...
@@ -1609,18 +1612,9 @@ trx_undo_mark_as_dict_operation(
hdr_page
=
trx_undo_page_get
(
undo
->
space
,
undo
->
hdr_page_no
,
mtr
);
/* Mark X/Open XA XID if it is not NULL to dict operation bit */
if
(
trx
->
xid
.
formatID
==
-
1
)
{
mlog_write_ulint
(
hdr_page
+
undo
->
hdr_offset
+
TRX_UNDO_DICT_OPERATION
,
trx
->
dict_operation
,
MLOG_2BYTES
,
mtr
);
}
else
{
mlog_write_ulint
(
hdr_page
+
undo
->
hdr_offset
+
TRX_UNDO_DICT_OPERATION
,
trx
->
dict_operation
|
TRX_UNDO_XA_EXISTS
,
MLOG_2BYTES
,
mtr
);
}
TRX_UNDO_DICT_TRANS
,
trx
->
dict_operation
,
MLOG_1BYTE
,
mtr
);
mlog_write_dulint
(
hdr_page
+
undo
->
hdr_offset
+
TRX_UNDO_TABLE_ID
,
trx
->
table_id
,
mtr
);
...
...
@@ -1788,6 +1782,9 @@ trx_undo_set_state_at_prepare(
offset
=
mach_read_from_2
(
seg_hdr
+
TRX_UNDO_LAST_LOG
);
undo_header
=
undo_page
+
offset
;
mlog_write_ulint
(
undo_header
+
TRX_UNDO_XID_EXISTS
,
TRUE
,
MLOG_1BYTE
,
mtr
);
trx_undo_write_xid
(
undo_header
,
&
undo
->
xid
);
return
(
undo_page
);
}
...
...
sql/ha_innodb.cc
View file @
4f3b3047
...
...
@@ -80,7 +80,7 @@ extern "C" {
#include "../innobase/include/fsp0fsp.h"
#include "../innobase/include/sync0sync.h"
#include "../innobase/include/fil0fil.h"
#include "../innobase/include/xa.h"
#include "../innobase/include/
trx0
xa.h"
}
#define HA_INNOBASE_ROWS_IN_TABLE 10000
/* to get optimization right */
...
...
@@ -5935,7 +5935,7 @@ int innobase_xa_end(
int
i
;
XID
xid
;
while
(
trx_num
=
innobase_xa_recover
(
trx_list
,
trx_num_max
))
{
while
(
(
trx_num
=
innobase_xa_recover
(
trx_list
,
trx_num_max
)
))
{
for
(
i
=
0
;
i
<
trx_num
;
i
++
)
{
xid
=
trx_list
[
i
];
...
...
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