mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
A fix and a test case for Bug#12713 "Error in a stored function called from
a SELECT doesn't cause ROLLBACK of statem". The idea of the fix is to ensure that we always commit the current statement at the end of dispatch_command(). In order to not issue redundant disc syncs, an optimization of the two-phase commit protocol is implemented to bypass the two phase commit if the transaction is read-only.
This commit is contained in:
@ -686,7 +686,8 @@ private:
|
||||
struct st_savepoint {
|
||||
struct st_savepoint *prev;
|
||||
char *name;
|
||||
uint length, nht;
|
||||
uint length;
|
||||
Ha_trx_info *ha_list;
|
||||
};
|
||||
|
||||
enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED};
|
||||
@ -1092,6 +1093,33 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Storage engine specific thread local data.
|
||||
*/
|
||||
|
||||
struct Ha_data
|
||||
{
|
||||
/**
|
||||
Storage engine specific thread local data.
|
||||
Lifetime: one user connection.
|
||||
*/
|
||||
void *ha_ptr;
|
||||
/**
|
||||
0: Life time: one statement within a transaction. If @@autocommit is
|
||||
on, also represents the entire transaction.
|
||||
@sa trans_register_ha()
|
||||
|
||||
1: Life time: one transaction within a connection.
|
||||
If the storage engine does not participate in a transaction,
|
||||
this should not be used.
|
||||
@sa trans_register_ha()
|
||||
*/
|
||||
Ha_trx_info ha_info[2];
|
||||
|
||||
Ha_data() :ha_ptr(NULL) {}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@class THD
|
||||
For each client connection we create a separate thread with THD serving as
|
||||
@ -1231,7 +1259,7 @@ public:
|
||||
uint in_sub_stmt;
|
||||
|
||||
/* container for handler's private per-connection data */
|
||||
void *ha_data[MAX_HA];
|
||||
Ha_data ha_data[MAX_HA];
|
||||
|
||||
#ifndef MYSQL_CLIENT
|
||||
int binlog_setup_trx_data();
|
||||
|
Reference in New Issue
Block a user