diff options
author | unknown <serg@sergbook.mysql.com> | 2005-08-12 21:15:01 +0200 |
---|---|---|
committer | unknown <serg@sergbook.mysql.com> | 2005-08-12 21:15:01 +0200 |
commit | 87ae5a15976ef3db7a85ac018d0aae17f16fd09d (patch) | |
tree | 7bf5242134e413730acf82415d7616fa6b277323 /sql/handler.h | |
parent | e10362b47275e971a73f6a66a76a4bc24f237f42 (diff) | |
download | mariadb-git-87ae5a15976ef3db7a85ac018d0aae17f16fd09d.tar.gz |
BUG#12162 - one can start two transactions with the same XID.
Now we keep all active XID's in a hash
Diffstat (limited to 'sql/handler.h')
-rw-r--r-- | sql/handler.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/handler.h b/sql/handler.h index 276f50bde63..ef45676207b 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -227,11 +227,11 @@ struct xid_t { char data[XIDDATASIZE]; // not \0-terminated ! bool eq(struct xid_t *xid) - { return !memcmp(this, xid, sizeof(long)*3+gtrid_length+bqual_length); } + { return !memcmp(this, xid, length()); } bool eq(long g, long b, const char *d) { return g == gtrid_length && b == bqual_length && !memcmp(d, data, g+b); } void set(struct xid_t *xid) - { memcpy(this, xid, sizeof(long)*3+xid->gtrid_length+xid->bqual_length); } + { memcpy(this, xid, xid->length()); } void set(long f, const char *g, long gl, const char *b, long bl) { formatID= f; @@ -270,6 +270,11 @@ struct xid_t { !memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ? quick_get_my_xid() : 0; } + uint length() + { + return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+ + gtrid_length+bqual_length; + } }; typedef struct xid_t XID; |