Commit 518ced3a authored by Seppo Jaakola's avatar Seppo Jaakola

References:

  https://bugs.launchpad.net/codership-mysql/+bug/1084702
  https://bugs.launchpad.net/percona-xtradb-cluster/+bug/1019473

Merged revisions 3851-3852 from lp:~codership/codership-mysql/5.5-23
parent 2b0f16c5
......@@ -3452,8 +3452,9 @@ case SQLCOM_PREPARE:
#ifdef WITH_WSREP
for (TABLE_LIST *table= all_tables; table; table= table->next_global)
{
if (!thd->is_current_stmt_binlog_format_row() ||
!find_temporary_table(thd, table))
if (!lex->drop_temporary &&
(!thd->is_current_stmt_binlog_format_row() ||
!find_temporary_table(thd, table)))
{
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, all_tables);
break;
......
......@@ -7358,6 +7358,8 @@ ha_innobase::wsrep_append_keys(
const uchar* record1) /* in: row in MySQL format */
{
DBUG_ENTER("wsrep_append_keys");
bool key_appended = false;
trx_t *trx = thd_to_trx(thd);
if (table_share && table_share->tmp_table != NO_TMP_TABLE) {
......@@ -7369,29 +7371,6 @@ ha_innobase::wsrep_append_keys(
DBUG_RETURN(0);
}
/* if no PK, calculate hash of full row, to be the key value */
if (prebuilt->clust_index_was_generated && wsrep_certify_nonPK) {
uchar digest[16];
int rcode;
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table,
(const char*) digest, 16,
shared))) {
DBUG_RETURN(rcode);
}
if (record1) {
wsrep_calc_row_hash(digest, record1, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share,
table,
(const char*) digest,
16, shared))) {
DBUG_RETURN(rcode);
}
}
DBUG_RETURN(0);
}
if (wsrep_protocol_version == 0) {
uint len;
char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
......@@ -7430,6 +7409,8 @@ ha_innobase::wsrep_append_keys(
if (key_info->flags & HA_NOSAME ||
referenced_by_foreign_key()) {
if (key_info->flags & HA_NOSAME || shared)
key_appended = true;
len = wsrep_store_key_val_for_row(
table, i, key0, key_info->key_length,
......@@ -7460,6 +7441,32 @@ ha_innobase::wsrep_append_keys(
}
}
}
/* if no PK, calculate hash of full row, to be the key value */
if (!key_appended && wsrep_certify_nonPK) {
uchar digest[16];
int rcode;
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table,
(const char*) digest, 16,
shared))) {
DBUG_RETURN(rcode);
}
if (record1) {
wsrep_calc_row_hash(
digest, record1, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share,
table,
(const char*) digest,
16, shared))) {
DBUG_RETURN(rcode);
}
}
DBUG_RETURN(0);
}
DBUG_RETURN(0);
}
#endif
......
......@@ -8274,6 +8274,8 @@ ha_innobase::wsrep_append_keys(
const uchar* record1) /* in: row in MySQL format */
{
DBUG_ENTER("wsrep_append_keys");
bool key_appended = false;
trx_t *trx = thd_to_trx(thd);
if (table_share && table_share->tmp_table != NO_TMP_TABLE) {
......@@ -8285,29 +8287,6 @@ ha_innobase::wsrep_append_keys(
DBUG_RETURN(0);
}
/* if no PK, calculate hash of full row, to be the key value */
if (prebuilt->clust_index_was_generated && wsrep_certify_nonPK) {
uchar digest[16];
int rcode;
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table,
(const char*) digest, 16,
shared))) {
DBUG_RETURN(rcode);
}
if (record1) {
wsrep_calc_row_hash(digest, record1, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share,
table,
(const char*) digest,
16, shared))) {
DBUG_RETURN(rcode);
}
}
DBUG_RETURN(0);
}
if (wsrep_protocol_version == 0) {
uint len;
char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
......@@ -8346,6 +8325,8 @@ ha_innobase::wsrep_append_keys(
if (key_info->flags & HA_NOSAME ||
referenced_by_foreign_key()) {
if (key_info->flags & HA_NOSAME || shared)
key_appended = true;
len = wsrep_store_key_val_for_row(
table, i, key0, key_info->key_length,
......@@ -8376,6 +8357,32 @@ ha_innobase::wsrep_append_keys(
}
}
}
/* if no PK, calculate hash of full row, to be the key value */
if (!key_appended && wsrep_certify_nonPK) {
uchar digest[16];
int rcode;
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table,
(const char*) digest, 16,
shared))) {
DBUG_RETURN(rcode);
}
if (record1) {
wsrep_calc_row_hash(
digest, record1, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share,
table,
(const char*) digest,
16, shared))) {
DBUG_RETURN(rcode);
}
}
DBUG_RETURN(0);
}
DBUG_RETURN(0);
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment