Commit 6aa578ec authored by Vasil Dimov's avatar Vasil Dimov Committed by Jan Lindström

Generalize "bool shared/exclusive" argument to enum

wsrep_append_foreign_key() and wsrep_append_key() used to take a boolean
argument denoting whether the relevant certification key type is shared
(assuming it is exclusive if the argument is false). Change that
argument to the enum wsrep_key_type from wsrep_api.h, so that eventually
other types can also be passed (like WSREP_KEY_SEMI).

This is a non-functional change.

(cherry picked from commit 360bf36dbb9378b36ef57921c725a9505e19e0d9)
parent bfc9aca1
...@@ -110,6 +110,7 @@ enum_tx_isolation thd_get_trx_isolation(const THD* thd); ...@@ -110,6 +110,7 @@ enum_tx_isolation thd_get_trx_isolation(const THD* thd);
# endif /* MYSQL_PLUGIN_IMPORT */ # endif /* MYSQL_PLUGIN_IMPORT */
#ifdef WITH_WSREP #ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#include <wsrep_mysqld.h> #include <wsrep_mysqld.h>
#include <my_md5.h> #include <my_md5.h>
extern my_bool wsrep_certify_nonPK; extern my_bool wsrep_certify_nonPK;
...@@ -6019,7 +6020,8 @@ ha_innobase::write_row( ...@@ -6019,7 +6020,8 @@ ha_innobase::write_row(
BINLOG_FORMAT_ROW)) { BINLOG_FORMAT_ROW)) {
*/ */
if (wsrep_append_keys(user_thd, false, record, NULL)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
DBUG_PRINT("wsrep", ("row key failed")); DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR; error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
...@@ -6391,7 +6393,8 @@ ha_innobase::update_row( ...@@ -6391,7 +6393,8 @@ ha_innobase::update_row(
DBUG_PRINT("wsrep", ("update row key")); DBUG_PRINT("wsrep", ("update row key"));
if (wsrep_append_keys(user_thd, false, old_row, new_row)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, old_row,
new_row)) {
DBUG_PRINT("wsrep", ("row key failed")); DBUG_PRINT("wsrep", ("row key failed"));
error = HA_ERR_INTERNAL_ERROR; error = HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
...@@ -6446,7 +6449,8 @@ ha_innobase::delete_row( ...@@ -6446,7 +6449,8 @@ ha_innobase::delete_row(
if (!error && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && if (!error && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
wsrep_on(user_thd)) { wsrep_on(user_thd)) {
if (wsrep_append_keys(user_thd, false, record, NULL)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
DBUG_PRINT("wsrep", ("delete fail")); DBUG_PRINT("wsrep", ("delete fail"));
error = HA_ERR_INTERNAL_ERROR; error = HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
...@@ -7259,6 +7263,21 @@ wsrep_dict_foreign_find_index( ...@@ -7259,6 +7263,21 @@ wsrep_dict_foreign_find_index(
ibool check_charsets, ibool check_charsets,
ulint check_null); ulint check_null);
inline
const char*
wsrep_key_type_to_str(wsrep_key_type type)
{
switch (type) {
case WSREP_KEY_SHARED:
return "shared";
case WSREP_KEY_SEMI:
return "semi";
case WSREP_KEY_EXCLUSIVE:
return "exclusive";
};
return "unknown";
}
ulint ulint
wsrep_append_foreign_key( wsrep_append_foreign_key(
/*===========================*/ /*===========================*/
...@@ -7267,7 +7286,8 @@ wsrep_append_foreign_key( ...@@ -7267,7 +7286,8 @@ wsrep_append_foreign_key(
const rec_t* rec, /*!<in: clustered index record */ const rec_t* rec, /*!<in: clustered index record */
dict_index_t* index, /*!<in: clustered index */ dict_index_t* index, /*!<in: clustered index */
ibool referenced, /*!<in: is check for referenced table */ ibool referenced, /*!<in: is check for referenced table */
ibool shared) /*!<in: is shared access */ wsrep_key_type key_type) /*!< in: access type of this key
(shared, exclusive, semi...) */
{ {
ut_a(trx); ut_a(trx);
THD* thd = (THD*)trx->mysql_thd; THD* thd = (THD*)trx->mysql_thd;
...@@ -7363,19 +7383,21 @@ wsrep_append_foreign_key( ...@@ -7363,19 +7383,21 @@ wsrep_append_foreign_key(
key[0] = (char)i; key[0] = (char)i;
rcode = wsrep_rec_get_foreign_key( rcode = wsrep_rec_get_foreign_key(
&key[1], &len, rec, index, idx, &key[1], &len, rec, index, idx,
wsrep_protocol_version > 1); wsrep_protocol_version > 1);
if (rcode != DB_SUCCESS) { if (rcode != DB_SUCCESS) {
WSREP_ERROR( WSREP_ERROR(
"FK key set failed: %lu (%lu %lu), index: %s %s, %s", "FK key set failed: %lu (%lu %s), index: %s %s, %s",
rcode, referenced, shared, rcode, referenced, wsrep_key_type_to_str(key_type),
(index && index->name) ? index->name : (index && index->name) ? index->name :
"void index", "void index",
(index && index->table_name) ? index->table_name : (index && index->table_name) ? index->table_name :
"void table", "void table",
wsrep_thd_query(thd)); wsrep_thd_query(thd));
return rcode; return rcode;
} }
strncpy(cache_key, strncpy(cache_key,
(wsrep_protocol_version > 1) ? (wsrep_protocol_version > 1) ?
((referenced) ? ((referenced) ?
...@@ -7419,7 +7441,7 @@ wsrep_append_foreign_key( ...@@ -7419,7 +7441,7 @@ wsrep_append_foreign_key(
wsrep_ws_handle(thd, trx), wsrep_ws_handle(thd, trx),
&wkey, &wkey,
1, 1,
shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, key_type,
copy); copy);
if (rcode) { if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %lu", rcode)); DBUG_PRINT("wsrep", ("row key failed: %lu", rcode));
...@@ -7442,15 +7464,16 @@ wsrep_append_key( ...@@ -7442,15 +7464,16 @@ wsrep_append_key(
TABLE *table, TABLE *table,
const char* key, const char* key,
uint16_t key_len, uint16_t key_len,
bool shared wsrep_key_type key_type /*!< in: access type of this key
(shared, exclusive, semi...) */
) )
{ {
DBUG_ENTER("wsrep_append_key"); DBUG_ENTER("wsrep_append_key");
bool const copy = true; bool const copy = true;
#ifdef WSREP_DEBUG_PRINT #ifdef WSREP_DEBUG_PRINT
fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ", fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ",
(shared) ? "Shared" : "Exclusive", wsrep_key_type_to_str(key_type),
wsrep_thd_thread_id(thd), trx->id, key_len, wsrep_thd_thread_id(thd), trx->id, key_len,
table_share->table_name.str, wsrep_thd_query(thd)); table_share->table_name.str, wsrep_thd_query(thd));
for (int i=0; i<key_len; i++) { for (int i=0; i<key_len; i++) {
fprintf(stderr, "%hhX, ", key[i]); fprintf(stderr, "%hhX, ", key[i]);
...@@ -7476,7 +7499,7 @@ wsrep_append_key( ...@@ -7476,7 +7499,7 @@ wsrep_append_key(
wsrep_ws_handle(thd, trx), wsrep_ws_handle(thd, trx),
&wkey, &wkey,
1, 1,
shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, key_type,
copy); copy);
if (rcode) { if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %d", rcode)); DBUG_PRINT("wsrep", ("row key failed: %d", rcode));
...@@ -7492,7 +7515,8 @@ int ...@@ -7492,7 +7515,8 @@ int
ha_innobase::wsrep_append_keys( ha_innobase::wsrep_append_keys(
/*==================*/ /*==================*/
THD *thd, THD *thd,
bool shared, wsrep_key_type key_type, /*!< in: access type of this key
(shared, exclusive, semi...) */
const uchar* record0, /* in: row in MySQL format */ const uchar* record0, /* in: row in MySQL format */
const uchar* record1) /* in: row in MySQL format */ const uchar* record1) /* in: row in MySQL format */
{ {
...@@ -7523,7 +7547,7 @@ ha_innobase::wsrep_append_keys( ...@@ -7523,7 +7547,7 @@ ha_innobase::wsrep_append_keys(
if (!is_null) { if (!is_null) {
int rcode = wsrep_append_key( int rcode = wsrep_append_key(
thd, trx, table_share, table, keyval, thd, trx, table_share, table, keyval,
len, shared); len, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
} }
else else
...@@ -7579,10 +7603,11 @@ ha_innobase::wsrep_append_keys( ...@@ -7579,10 +7603,11 @@ ha_innobase::wsrep_append_keys(
if (!is_null) { if (!is_null) {
int rcode = wsrep_append_key( int rcode = wsrep_append_key(
thd, trx, table_share, table, thd, trx, table_share, table,
keyval0, len+1, shared); keyval0, len+1, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
if (key_info->flags & HA_NOSAME || shared) if (key_info->flags & HA_NOSAME ||
key_type == WSREP_KEY_SHARED)
key_appended = true; key_appended = true;
} }
else else
...@@ -7599,7 +7624,7 @@ ha_innobase::wsrep_append_keys( ...@@ -7599,7 +7624,7 @@ ha_innobase::wsrep_append_keys(
int rcode = wsrep_append_key( int rcode = wsrep_append_key(
thd, trx, table_share, thd, trx, table_share,
table, table,
keyval1, len+1, shared); keyval1, len+1, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
} }
} }
...@@ -7615,7 +7640,7 @@ ha_innobase::wsrep_append_keys( ...@@ -7615,7 +7640,7 @@ ha_innobase::wsrep_append_keys(
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd); wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table, if ((rcode = wsrep_append_key(thd, trx, table_share, table,
(const char*) digest, 16, (const char*) digest, 16,
shared))) { key_type))) {
DBUG_RETURN(rcode); DBUG_RETURN(rcode);
} }
...@@ -7625,7 +7650,7 @@ ha_innobase::wsrep_append_keys( ...@@ -7625,7 +7650,7 @@ ha_innobase::wsrep_append_keys(
if ((rcode = wsrep_append_key(thd, trx, table_share, if ((rcode = wsrep_append_key(thd, trx, table_share,
table, table,
(const char*) digest, (const char*) digest,
16, shared))) { 16, key_type))) {
DBUG_RETURN(rcode); DBUG_RETURN(rcode);
} }
} }
......
...@@ -28,6 +28,10 @@ this program; if not, write to the Free Software Foundation, Inc., ...@@ -28,6 +28,10 @@ this program; if not, write to the Free Software Foundation, Inc.,
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
#ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#endif /* WITH_WSREP */
/* Structure defines translation table between mysql index and innodb /* Structure defines translation table between mysql index and innodb
index structures */ index structures */
typedef struct innodb_idx_translate_struct { typedef struct innodb_idx_translate_struct {
...@@ -115,7 +119,7 @@ class ha_innobase: public handler ...@@ -115,7 +119,7 @@ class ha_innobase: public handler
int info_low(uint flag, bool called_from_analyze); int info_low(uint flag, bool called_from_analyze);
#ifdef WITH_WSREP #ifdef WITH_WSREP
int wsrep_append_keys(THD *thd, bool shared, int wsrep_append_keys(THD *thd, wsrep_key_type key_type,
const uchar* record0, const uchar* record1); const uchar* record0, const uchar* record1);
#endif #endif
/* Init values for the class: */ /* Init values for the class: */
......
...@@ -56,6 +56,10 @@ Created 4/20/1996 Heikki Tuuri ...@@ -56,6 +56,10 @@ Created 4/20/1996 Heikki Tuuri
#define ROW_INS_PREV 1 #define ROW_INS_PREV 1
#define ROW_INS_NEXT 2 #define ROW_INS_NEXT 2
#ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#endif /* WITH_WSREP */
/************************************************************************* /*************************************************************************
IMPORTANT NOTE: Any operation that generates redo MUST check that there IMPORTANT NOTE: Any operation that generates redo MUST check that there
is enough space in the redo log before for that operation. This is is enough space in the redo log before for that operation. This is
...@@ -767,7 +771,7 @@ ulint wsrep_append_foreign_key(trx_t *trx, ...@@ -767,7 +771,7 @@ ulint wsrep_append_foreign_key(trx_t *trx,
const rec_t* clust_rec, const rec_t* clust_rec,
dict_index_t* clust_index, dict_index_t* clust_index,
ibool referenced, ibool referenced,
ibool shared); enum wsrep_key_type key_type);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/*********************************************************************//** /*********************************************************************//**
...@@ -1088,7 +1092,7 @@ row_ins_foreign_check_on_constraint( ...@@ -1088,7 +1092,7 @@ row_ins_foreign_check_on_constraint(
foreign, foreign,
clust_rec, clust_rec,
clust_index, clust_index,
FALSE, FALSE); FALSE, WSREP_KEY_EXCLUSIVE);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
fprintf(stderr, fprintf(stderr,
"WSREP: foreign key append failed: %lu\n", err); "WSREP: foreign key append failed: %lu\n", err);
...@@ -1437,7 +1441,9 @@ row_ins_check_foreign_constraint( ...@@ -1437,7 +1441,9 @@ row_ins_check_foreign_constraint(
rec, rec,
check_index, check_index,
check_ref, check_ref,
(upd_node) ? TRUE : FALSE); upd_node != NULL
? WSREP_KEY_SHARED
: WSREP_KEY_EXCLUSIVE);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
goto end_scan; goto end_scan;
} else if (foreign->type != 0) { } else if (foreign->type != 0) {
......
...@@ -127,6 +127,7 @@ extern ib_int64_t trx_sys_mysql_relay_log_pos; ...@@ -127,6 +127,7 @@ extern ib_int64_t trx_sys_mysql_relay_log_pos;
# endif /* MYSQL_PLUGIN_IMPORT */ # endif /* MYSQL_PLUGIN_IMPORT */
#ifdef WITH_WSREP #ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#include <wsrep_mysqld.h> #include <wsrep_mysqld.h>
#include <my_md5.h> #include <my_md5.h>
extern my_bool wsrep_certify_nonPK; extern my_bool wsrep_certify_nonPK;
...@@ -7043,7 +7044,7 @@ ha_innobase::write_row( ...@@ -7043,7 +7044,7 @@ ha_innobase::write_row(
thd_binlog_format(user_thd) == thd_binlog_format(user_thd) ==
BINLOG_FORMAT_ROW)) { BINLOG_FORMAT_ROW)) {
*/ */
if (wsrep_append_keys(user_thd, false, record, NULL)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record, NULL)) {
DBUG_PRINT("wsrep", ("row key failed")); DBUG_PRINT("wsrep", ("row key failed"));
error_result = HA_ERR_INTERNAL_ERROR; error_result = HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
...@@ -7437,7 +7438,8 @@ ha_innobase::update_row( ...@@ -7437,7 +7438,8 @@ ha_innobase::update_row(
DBUG_PRINT("wsrep", ("update row key")); DBUG_PRINT("wsrep", ("update row key"));
if (wsrep_append_keys(user_thd, false, old_row, new_row)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, old_row,
new_row)) {
DBUG_PRINT("wsrep", ("row key failed")); DBUG_PRINT("wsrep", ("row key failed"));
error = HA_ERR_INTERNAL_ERROR; error = HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
...@@ -7506,7 +7508,8 @@ ha_innobase::delete_row( ...@@ -7506,7 +7508,8 @@ ha_innobase::delete_row(
if (!error && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE && if (!error && wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
wsrep_on(user_thd)) { wsrep_on(user_thd)) {
if (wsrep_append_keys(user_thd, false, record, NULL)) { if (wsrep_append_keys(user_thd, WSREP_KEY_EXCLUSIVE, record,
NULL)) {
DBUG_PRINT("wsrep", ("delete fail")); DBUG_PRINT("wsrep", ("delete fail"));
error = HA_ERR_INTERNAL_ERROR; error = HA_ERR_INTERNAL_ERROR;
goto wsrep_error; goto wsrep_error;
...@@ -8366,6 +8369,21 @@ wsrep_dict_foreign_find_index( ...@@ -8366,6 +8369,21 @@ wsrep_dict_foreign_find_index(
ibool check_charsets, ibool check_charsets,
ulint check_null); ulint check_null);
inline
const char*
wsrep_key_type_to_str(wsrep_key_type type)
{
switch (type) {
case WSREP_KEY_SHARED:
return "shared";
case WSREP_KEY_SEMI:
return "semi";
case WSREP_KEY_EXCLUSIVE:
return "exclusive";
};
return "unknown";
}
ulint ulint
wsrep_append_foreign_key( wsrep_append_foreign_key(
/*===========================*/ /*===========================*/
...@@ -8374,7 +8392,8 @@ wsrep_append_foreign_key( ...@@ -8374,7 +8392,8 @@ wsrep_append_foreign_key(
const rec_t* rec, /*!<in: clustered index record */ const rec_t* rec, /*!<in: clustered index record */
dict_index_t* index, /*!<in: clustered index */ dict_index_t* index, /*!<in: clustered index */
ibool referenced, /*!<in: is check for referenced table */ ibool referenced, /*!<in: is check for referenced table */
ibool shared) /*!<in: is shared access */ wsrep_key_type key_type) /*!< in: access type of this key
(shared, exclusive, semi...) */
{ {
ut_a(trx); ut_a(trx);
THD* thd = (THD*)trx->mysql_thd; THD* thd = (THD*)trx->mysql_thd;
...@@ -8470,19 +8489,21 @@ wsrep_append_foreign_key( ...@@ -8470,19 +8489,21 @@ wsrep_append_foreign_key(
key[0] = (char)i; key[0] = (char)i;
rcode = wsrep_rec_get_foreign_key( rcode = wsrep_rec_get_foreign_key(
&key[1], &len, rec, index, idx, &key[1], &len, rec, index, idx,
wsrep_protocol_version > 1); wsrep_protocol_version > 1);
if (rcode != DB_SUCCESS) { if (rcode != DB_SUCCESS) {
WSREP_ERROR( WSREP_ERROR(
"FK key set failed: %lu (%lu %lu), index: %s %s, %s", "FK key set failed: %lu (%lu %s), index: %s %s, %s",
rcode, referenced, shared, rcode, referenced, wsrep_key_type_to_str(key_type),
(index && index->name) ? index->name : (index && index->name) ? index->name :
"void index", "void index",
(index && index->table_name) ? index->table_name : (index && index->table_name) ? index->table_name :
"void table", "void table",
wsrep_thd_query(thd)); wsrep_thd_query(thd));
return rcode; return rcode;
} }
strncpy(cache_key, strncpy(cache_key,
(wsrep_protocol_version > 1) ? (wsrep_protocol_version > 1) ?
((referenced) ? ((referenced) ?
...@@ -8526,7 +8547,7 @@ wsrep_append_foreign_key( ...@@ -8526,7 +8547,7 @@ wsrep_append_foreign_key(
wsrep_ws_handle(thd, trx), wsrep_ws_handle(thd, trx),
&wkey, &wkey,
1, 1,
shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, key_type,
copy); copy);
if (rcode) { if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %lu", rcode)); DBUG_PRINT("wsrep", ("row key failed: %lu", rcode));
...@@ -8549,15 +8570,16 @@ wsrep_append_key( ...@@ -8549,15 +8570,16 @@ wsrep_append_key(
TABLE *table, TABLE *table,
const char* key, const char* key,
uint16_t key_len, uint16_t key_len,
bool shared wsrep_key_type key_type /*!< in: access type of this key
(shared, exclusive, semi...) */
) )
{ {
DBUG_ENTER("wsrep_append_key"); DBUG_ENTER("wsrep_append_key");
bool const copy = true; bool const copy = true;
#ifdef WSREP_DEBUG_PRINT #ifdef WSREP_DEBUG_PRINT
fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ", fprintf(stderr, "%s conn %ld, trx %llu, keylen %d, table %s\n Query: %s ",
(shared) ? "Shared" : "Exclusive", wsrep_key_type_to_str(key_type),
wsrep_thd_thread_id(thd), trx->id, key_len, wsrep_thd_thread_id(thd), trx->id, key_len,
table_share->table_name.str, wsrep_thd_query(thd)); table_share->table_name.str, wsrep_thd_query(thd));
for (int i=0; i<key_len; i++) { for (int i=0; i<key_len; i++) {
fprintf(stderr, "%hhX, ", key[i]); fprintf(stderr, "%hhX, ", key[i]);
...@@ -8583,7 +8605,7 @@ wsrep_append_key( ...@@ -8583,7 +8605,7 @@ wsrep_append_key(
wsrep_ws_handle(thd, trx), wsrep_ws_handle(thd, trx),
&wkey, &wkey,
1, 1,
shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE, key_type,
copy); copy);
if (rcode) { if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %d", rcode)); DBUG_PRINT("wsrep", ("row key failed: %d", rcode));
...@@ -8599,7 +8621,8 @@ int ...@@ -8599,7 +8621,8 @@ int
ha_innobase::wsrep_append_keys( ha_innobase::wsrep_append_keys(
/*==================*/ /*==================*/
THD *thd, THD *thd,
bool shared, wsrep_key_type key_type, /*!< in: access type of this key
(shared, exclusive, semi...) */
const uchar* record0, /* in: row in MySQL format */ const uchar* record0, /* in: row in MySQL format */
const uchar* record1) /* in: row in MySQL format */ const uchar* record1) /* in: row in MySQL format */
{ {
...@@ -8630,7 +8653,7 @@ ha_innobase::wsrep_append_keys( ...@@ -8630,7 +8653,7 @@ ha_innobase::wsrep_append_keys(
if (!is_null) { if (!is_null) {
int rcode = wsrep_append_key( int rcode = wsrep_append_key(
thd, trx, table_share, table, keyval, thd, trx, table_share, table, keyval,
len, shared); len, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
} }
else else
...@@ -8686,10 +8709,11 @@ ha_innobase::wsrep_append_keys( ...@@ -8686,10 +8709,11 @@ ha_innobase::wsrep_append_keys(
if (!is_null) { if (!is_null) {
int rcode = wsrep_append_key( int rcode = wsrep_append_key(
thd, trx, table_share, table, thd, trx, table_share, table,
keyval0, len+1, shared); keyval0, len+1, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
if (key_info->flags & HA_NOSAME || shared) if (key_info->flags & HA_NOSAME ||
key_type == WSREP_KEY_SHARED)
key_appended = true; key_appended = true;
} }
else else
...@@ -8706,7 +8730,7 @@ ha_innobase::wsrep_append_keys( ...@@ -8706,7 +8730,7 @@ ha_innobase::wsrep_append_keys(
int rcode = wsrep_append_key( int rcode = wsrep_append_key(
thd, trx, table_share, thd, trx, table_share,
table, table,
keyval1, len+1, shared); keyval1, len+1, key_type);
if (rcode) DBUG_RETURN(rcode); if (rcode) DBUG_RETURN(rcode);
} }
} }
...@@ -8722,7 +8746,7 @@ ha_innobase::wsrep_append_keys( ...@@ -8722,7 +8746,7 @@ ha_innobase::wsrep_append_keys(
wsrep_calc_row_hash(digest, record0, table, prebuilt, thd); wsrep_calc_row_hash(digest, record0, table, prebuilt, thd);
if ((rcode = wsrep_append_key(thd, trx, table_share, table, if ((rcode = wsrep_append_key(thd, trx, table_share, table,
(const char*) digest, 16, (const char*) digest, 16,
shared))) { key_type))) {
DBUG_RETURN(rcode); DBUG_RETURN(rcode);
} }
...@@ -8732,7 +8756,7 @@ ha_innobase::wsrep_append_keys( ...@@ -8732,7 +8756,7 @@ ha_innobase::wsrep_append_keys(
if ((rcode = wsrep_append_key(thd, trx, table_share, if ((rcode = wsrep_append_key(thd, trx, table_share,
table, table,
(const char*) digest, (const char*) digest,
16, shared))) { 16, key_type))) {
DBUG_RETURN(rcode); DBUG_RETURN(rcode);
} }
} }
......
...@@ -28,6 +28,10 @@ this program; if not, write to the Free Software Foundation, Inc., ...@@ -28,6 +28,10 @@ this program; if not, write to the Free Software Foundation, Inc.,
#pragma interface /* gcc class implementation */ #pragma interface /* gcc class implementation */
#endif #endif
#ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#endif /* WITH_WSREP */
/* Structure defines translation table between mysql index and innodb /* Structure defines translation table between mysql index and innodb
index structures */ index structures */
typedef struct innodb_idx_translate_struct { typedef struct innodb_idx_translate_struct {
...@@ -116,7 +120,7 @@ class ha_innobase: public handler ...@@ -116,7 +120,7 @@ class ha_innobase: public handler
int info_low(uint flag, bool called_from_analyze); int info_low(uint flag, bool called_from_analyze);
#ifdef WITH_WSREP #ifdef WITH_WSREP
int wsrep_append_keys(THD *thd, bool shared, int wsrep_append_keys(THD *thd, wsrep_key_type key_type,
const uchar* record0, const uchar* record1); const uchar* record0, const uchar* record1);
#endif #endif
/* Init values for the class: */ /* Init values for the class: */
......
...@@ -56,6 +56,10 @@ Created 4/20/1996 Heikki Tuuri ...@@ -56,6 +56,10 @@ Created 4/20/1996 Heikki Tuuri
#define ROW_INS_PREV 1 #define ROW_INS_PREV 1
#define ROW_INS_NEXT 2 #define ROW_INS_NEXT 2
#ifdef WITH_WSREP
#include "../../../wsrep/wsrep_api.h"
#endif /* WITH_WSREP */
/************************************************************************* /*************************************************************************
IMPORTANT NOTE: Any operation that generates redo MUST check that there IMPORTANT NOTE: Any operation that generates redo MUST check that there
is enough space in the redo log before for that operation. This is is enough space in the redo log before for that operation. This is
...@@ -768,7 +772,7 @@ ulint wsrep_append_foreign_key(trx_t *trx, ...@@ -768,7 +772,7 @@ ulint wsrep_append_foreign_key(trx_t *trx,
const rec_t* clust_rec, const rec_t* clust_rec,
dict_index_t* clust_index, dict_index_t* clust_index,
ibool referenced, ibool referenced,
ibool shared); enum wsrep_key_type key_type);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/*********************************************************************//** /*********************************************************************//**
...@@ -1090,7 +1094,9 @@ row_ins_foreign_check_on_constraint( ...@@ -1090,7 +1094,9 @@ row_ins_foreign_check_on_constraint(
clust_rec, clust_rec,
clust_index, clust_index,
FALSE, FALSE,
(node) ? TRUE : FALSE); node != NULL
? WSREP_KEY_SHARED
: WSREP_KEY_EXCLUSIVE);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
fprintf(stderr, fprintf(stderr,
"WSREP: foreign key append failed: %lu\n", err); "WSREP: foreign key append failed: %lu\n", err);
...@@ -1445,7 +1451,9 @@ row_ins_check_foreign_constraint( ...@@ -1445,7 +1451,9 @@ row_ins_check_foreign_constraint(
rec, rec,
check_index, check_index,
check_ref, check_ref,
(upd_node) ? TRUE : FALSE); upd_node != NULL
? WSREP_KEY_SHARED
: WSREP_KEY_EXCLUSIVE);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
goto end_scan; goto end_scan;
} else if (foreign->type != 0) { } else if (foreign->type != 0) {
......
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