summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2014-02-03 22:55:46 -0500
committerNirbhay Choubey <nirbhay@mariadb.com>2014-02-03 22:55:46 -0500
commit7ca53d947959fe420c28400c621f427b3008fe19 (patch)
tree89015270bb4f7a4c1b833e69ed7d973a55d57060 /storage/innobase
parent30b6b39d0b388dc13cbb75aabc539409f19e2f0f (diff)
downloadmariadb-git-7ca53d947959fe420c28400c621f427b3008fe19.tar.gz
Merging revisions 3934..3944 from codership-mysql/5.5.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/handler/ha_innodb.cc14
-rw-r--r--storage/innobase/lock/lock0lock.c57
2 files changed, 67 insertions, 4 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 152883a3e4c..0cf6f10c143 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -3469,6 +3469,9 @@ ha_innobase::max_supported_key_length() const
is 16 kB; but currently MySQL does not work with keys whose
size is > MAX_KEY_LENGTH */
#ifdef WITH_WSREP
+ /* this may look like obsolete code, but this ifdef is here
+ just to make sure we will see bzr merge conflict, if Oracle
+ changes max key length */
return(3500);
#else
return(3500);
@@ -4617,7 +4620,7 @@ wsrep_innobase_mysql_sort(
tmp_length = charset->coll->strnxfrm(charset, str, str_length,
tmp_str, str_length);
- DBUG_ASSERT(tmp_length == str_length);
+ DBUG_ASSERT(tmp_length <= str_length);
break;
}
@@ -7443,6 +7446,13 @@ ha_innobase::wsrep_append_keys(
} else {
ut_a(table->s->keys <= 256);
uint i;
+ bool hasPK= false;
+
+ for (i=0; i<table->s->keys && !hasPK; ++i) {
+ KEY* key_info = table->key_info + i;
+ if (key_info->flags & HA_NOSAME) hasPK = true;
+ }
+
for (i=0; i<table->s->keys; ++i) {
uint len;
char keyval0[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'};
@@ -7463,7 +7473,7 @@ ha_innobase::wsrep_append_keys(
table->s->table_name.str,
key_info->name);
}
- if (key_info->flags & HA_NOSAME ||
+ if (!hasPK || key_info->flags & HA_NOSAME ||
((tab &&
dict_table_get_referenced_constraint(tab, idx)) ||
(!tab && referenced_by_foreign_key()))) {
diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
index c500bf44ffa..71b3097d012 100644
--- a/storage/innobase/lock/lock0lock.c
+++ b/storage/innobase/lock/lock0lock.c
@@ -909,6 +909,9 @@ UNIV_INLINE
ibool
lock_rec_has_to_wait(
/*=================*/
+#ifdef WITH_WSREP
+ ibool for_locking, /*!< is caller locking or releasing */
+#endif /* WITH_WSREP */
const trx_t* trx, /*!< in: trx of new lock */
ulint type_mode,/*!< in: precise mode of the new lock
to set: LOCK_S or LOCK_X, possibly
@@ -983,6 +986,44 @@ lock_rec_has_to_wait(
return(FALSE);
}
+#ifdef WITH_WSREP
+ /* if BF thread is locking and has conflict with another BF
+ thread, we need to look at trx ordering and lock types */
+ if (for_locking &&
+ wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
+ wsrep_thd_is_BF(lock2->trx->mysql_thd, TRUE)) {
+
+ if (wsrep_debug) {
+ fprintf(stderr, "\n BF-BF lock conflict \n");
+ lock_rec_print(stderr, lock2);
+ }
+
+ if (wsrep_trx_order_before(trx->mysql_thd,
+ lock2->trx->mysql_thd) &&
+ (type_mode & LOCK_MODE_MASK) == LOCK_X &&
+ (lock2->type_mode & LOCK_MODE_MASK) == LOCK_X)
+ {
+ /* exclusive lock conflicts are not accepted */
+ fprintf(stderr, "BF-BF X lock conflict\n");
+ lock_rec_print(stderr, lock2);
+ abort();
+ } else {
+ /* if lock2->index->n_uniq <=
+ lock2->index->n_user_defined_cols
+ operation is on uniq index
+ */
+ if (wsrep_debug) fprintf(stderr,
+ "BF conflict, modes: %lu %lu, "
+ "idx: %s-%s n_uniq %u n_user %u\n",
+ type_mode, lock2->type_mode,
+ lock2->index->name,
+ lock2->index->table_name,
+ lock2->index->n_uniq,
+ lock2->index->n_user_defined_cols);
+ return FALSE;
+ }
+ }
+#endif /* WITH_WSREP */
return(TRUE);
}
@@ -1013,7 +1054,11 @@ lock_has_to_wait(
/* If this lock request is for a supremum record
then the second bit on the lock bitmap is set */
+#ifdef WITH_WSREP
+ return(lock_rec_has_to_wait(FALSE, lock1->trx,
+#else
return(lock_rec_has_to_wait(lock1->trx,
+#endif /* WITH_WSREP */
lock1->type_mode, lock2,
lock_rec_get_nth_bit(
lock1, 1)));
@@ -1592,7 +1637,11 @@ lock_rec_other_has_conflicting(
if (UNIV_UNLIKELY(heap_no == PAGE_HEAP_NO_SUPREMUM)) {
do {
- if (lock_rec_has_to_wait(trx, mode, lock,
+#ifdef WITH_WSREP
+ if (lock_rec_has_to_wait(TRUE, trx, mode, lock,
+#else
+ if (lock_rec_has_to_wait(trx, mode, lock,
+#endif /* WITH_WSREP */
TRUE)) {
#ifdef WITH_WSREP
wsrep_kill_victim(trx, lock);
@@ -1605,7 +1654,11 @@ lock_rec_other_has_conflicting(
} else {
do {
- if (lock_rec_has_to_wait(trx, mode, lock,
+#ifdef WITH_WSREP
+ if (lock_rec_has_to_wait(TRUE, trx, mode, lock,
+#else
+ if (lock_rec_has_to_wait(trx, mode, lock,
+#endif /* WITH_WSREP */
FALSE)) {
#ifdef WITH_WSREP
wsrep_kill_victim(trx, lock);