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
07172cab
Commit
07172cab
authored
Oct 05, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#13143 - formatID should not affect XID's uniqueness
parent
ef16a041
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
7 deletions
+19
-7
mysql-test/r/xa.result
mysql-test/r/xa.result
+2
-0
mysql-test/t/xa.test
mysql-test/t/xa.test
+2
-0
sql/handler.h
sql/handler.h
+9
-1
sql/sql_class.cc
sql/sql_class.cc
+6
-6
No files found.
mysql-test/r/xa.result
View file @
07172cab
...
@@ -24,6 +24,8 @@ insert t1 values (30);
...
@@ -24,6 +24,8 @@ insert t1 values (30);
xa end 'testa','testb';
xa end 'testa','testb';
xa start 'testa','testb';
xa start 'testa','testb';
ERROR XAE08: XAER_DUPID: The XID already exists
ERROR XAE08: XAER_DUPID: The XID already exists
xa start 'testa','testb', 123;
ERROR XAE08: XAER_DUPID: The XID already exists
xa start 0x7465737462, 0x2030405060, 0xb;
xa start 0x7465737462, 0x2030405060, 0xb;
insert t1 values (40);
insert t1 values (40);
xa end 'testb',' 0@P`',11;
xa end 'testb',' 0@P`',11;
...
...
mysql-test/t/xa.test
View file @
07172cab
...
@@ -33,6 +33,8 @@ connection con1;
...
@@ -33,6 +33,8 @@ connection con1;
--
error
1440
--
error
1440
xa
start
'testa'
,
'testb'
;
xa
start
'testa'
,
'testb'
;
--
error
1440
xa
start
'testa'
,
'testb'
,
123
;
# gtrid [ , bqual [ , formatID ] ]
# gtrid [ , bqual [ , formatID ] ]
xa
start
0x7465737462
,
0x2030405060
,
0xb
;
xa
start
0x7465737462
,
0x2030405060
,
0xb
;
...
...
sql/handler.h
View file @
07172cab
...
@@ -228,7 +228,7 @@ struct xid_t {
...
@@ -228,7 +228,7 @@ struct xid_t {
char
data
[
XIDDATASIZE
];
// not \0-terminated !
char
data
[
XIDDATASIZE
];
// not \0-terminated !
bool
eq
(
struct
xid_t
*
xid
)
bool
eq
(
struct
xid_t
*
xid
)
{
return
!
memcmp
(
this
,
xid
,
length
()
);
}
{
return
eq
(
xid
->
gtrid_length
,
xid
->
bqual_length
,
xid
->
data
);
}
bool
eq
(
long
g
,
long
b
,
const
char
*
d
)
bool
eq
(
long
g
,
long
b
,
const
char
*
d
)
{
return
g
==
gtrid_length
&&
b
==
bqual_length
&&
!
memcmp
(
d
,
data
,
g
+
b
);
}
{
return
g
==
gtrid_length
&&
b
==
bqual_length
&&
!
memcmp
(
d
,
data
,
g
+
b
);
}
void
set
(
struct
xid_t
*
xid
)
void
set
(
struct
xid_t
*
xid
)
...
@@ -276,6 +276,14 @@ struct xid_t {
...
@@ -276,6 +276,14 @@ struct xid_t {
return
sizeof
(
formatID
)
+
sizeof
(
gtrid_length
)
+
sizeof
(
bqual_length
)
+
return
sizeof
(
formatID
)
+
sizeof
(
gtrid_length
)
+
sizeof
(
bqual_length
)
+
gtrid_length
+
bqual_length
;
gtrid_length
+
bqual_length
;
}
}
byte
*
key
()
{
return
(
byte
*
)
&
gtrid_length
;
}
uint
key_length
()
{
return
sizeof
(
gtrid_length
)
+
sizeof
(
bqual_length
)
+
gtrid_length
+
bqual_length
;
}
};
};
typedef
struct
xid_t
XID
;
typedef
struct
xid_t
XID
;
...
...
sql/sql_class.cc
View file @
07172cab
...
@@ -1982,8 +1982,8 @@ HASH xid_cache;
...
@@ -1982,8 +1982,8 @@ HASH xid_cache;
static
byte
*
xid_get_hash_key
(
const
byte
*
ptr
,
uint
*
length
,
static
byte
*
xid_get_hash_key
(
const
byte
*
ptr
,
uint
*
length
,
my_bool
not_used
__attribute__
((
unused
)))
my_bool
not_used
__attribute__
((
unused
)))
{
{
*
length
=
((
XID_STATE
*
)
ptr
)
->
xid
.
length
();
*
length
=
((
XID_STATE
*
)
ptr
)
->
xid
.
key_
length
();
return
(
byte
*
)
&
((
XID_STATE
*
)
ptr
)
->
xid
;
return
(
(
XID_STATE
*
)
ptr
)
->
xid
.
key
()
;
}
}
static
void
xid_free_hash
(
void
*
ptr
)
static
void
xid_free_hash
(
void
*
ptr
)
...
@@ -2011,7 +2011,7 @@ void xid_cache_free()
...
@@ -2011,7 +2011,7 @@ void xid_cache_free()
XID_STATE
*
xid_cache_search
(
XID
*
xid
)
XID_STATE
*
xid_cache_search
(
XID
*
xid
)
{
{
pthread_mutex_lock
(
&
LOCK_xid_cache
);
pthread_mutex_lock
(
&
LOCK_xid_cache
);
XID_STATE
*
res
=
(
XID_STATE
*
)
hash_search
(
&
xid_cache
,
(
byte
*
)
xid
,
xid
->
length
());
XID_STATE
*
res
=
(
XID_STATE
*
)
hash_search
(
&
xid_cache
,
xid
->
key
(),
xid
->
key_
length
());
pthread_mutex_unlock
(
&
LOCK_xid_cache
);
pthread_mutex_unlock
(
&
LOCK_xid_cache
);
return
res
;
return
res
;
}
}
...
@@ -2022,7 +2022,7 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state)
...
@@ -2022,7 +2022,7 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state)
XID_STATE
*
xs
;
XID_STATE
*
xs
;
my_bool
res
;
my_bool
res
;
pthread_mutex_lock
(
&
LOCK_xid_cache
);
pthread_mutex_lock
(
&
LOCK_xid_cache
);
if
(
hash_search
(
&
xid_cache
,
(
byte
*
)
xid
,
xid
->
length
()))
if
(
hash_search
(
&
xid_cache
,
xid
->
key
(),
xid
->
key_
length
()))
res
=
0
;
res
=
0
;
else
if
(
!
(
xs
=
(
XID_STATE
*
)
my_malloc
(
sizeof
(
*
xs
),
MYF
(
MY_WME
))))
else
if
(
!
(
xs
=
(
XID_STATE
*
)
my_malloc
(
sizeof
(
*
xs
),
MYF
(
MY_WME
))))
res
=
1
;
res
=
1
;
...
@@ -2041,8 +2041,8 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state)
...
@@ -2041,8 +2041,8 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state)
bool
xid_cache_insert
(
XID_STATE
*
xid_state
)
bool
xid_cache_insert
(
XID_STATE
*
xid_state
)
{
{
pthread_mutex_lock
(
&
LOCK_xid_cache
);
pthread_mutex_lock
(
&
LOCK_xid_cache
);
DBUG_ASSERT
(
hash_search
(
&
xid_cache
,
(
byte
*
)
&
xid_state
->
xid
,
DBUG_ASSERT
(
hash_search
(
&
xid_cache
,
xid_state
->
xid
.
key
()
,
xid_state
->
xid
.
length
())
==
0
);
xid_state
->
xid
.
key_
length
())
==
0
);
my_bool
res
=
my_hash_insert
(
&
xid_cache
,
(
byte
*
)
xid_state
);
my_bool
res
=
my_hash_insert
(
&
xid_cache
,
(
byte
*
)
xid_state
);
pthread_mutex_unlock
(
&
LOCK_xid_cache
);
pthread_mutex_unlock
(
&
LOCK_xid_cache
);
return
res
;
return
res
;
...
...
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