Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
305c1ae1
Commit
305c1ae1
authored
Aug 12, 2014
by
Nirbhay Choubey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge of innobase changes to xtradb. (r3871..3873).
parent
8ec02bb8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
57 deletions
+144
-57
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.cc
+87
-36
storage/xtradb/include/hash0hash.h
storage/xtradb/include/hash0hash.h
+27
-0
storage/xtradb/lock/lock0lock.cc
storage/xtradb/lock/lock0lock.cc
+24
-6
storage/xtradb/row/row0upd.cc
storage/xtradb/row/row0upd.cc
+6
-15
No files found.
storage/xtradb/handler/ha_innodb.cc
View file @
305c1ae1
...
...
@@ -6207,7 +6207,7 @@ wsrep_innobase_mysql_sort(
case
MYSQL_TYPE_LONG_BLOB
:
case
MYSQL_TYPE_VARCHAR
:
{
uchar
tmp_str
[
REC_VERSION_56_MAX_INDEX_COL_LEN
];
uchar
tmp_str
[
REC_VERSION_56_MAX_INDEX_COL_LEN
]
=
{
'\0'
}
;
uint
tmp_length
=
REC_VERSION_56_MAX_INDEX_COL_LEN
;
/* Use the charset number to pick the right charset struct for
...
...
@@ -6246,11 +6246,11 @@ wsrep_innobase_mysql_sort(
}
else
{
/* strnxfrm will expand the destination string,
protocols < 3 truncated the sorted sring
protocols > 3 gets full sorted sring
protocols >
=
3 gets full sorted sring
*/
tmp_length
=
charset
->
coll
->
strnxfrm
(
charset
,
str
,
buf_length
,
str_length
,
tmp_str
,
tmp
_length
,
0
);
str_length
,
tmp_str
,
str
_length
,
0
);
DBUG_ASSERT
(
tmp_length
<=
buf_length
);
ret_length
=
tmp_length
;
}
...
...
@@ -6793,6 +6793,7 @@ UNIV_INTERN
uint
wsrep_store_key_val_for_row
(
/*===============================*/
THD
*
thd
,
TABLE
*
table
,
uint
keynr
,
/*!< in: key number */
char
*
buff
,
/*!< in/out: buffer for the key value (in MySQL
...
...
@@ -6807,25 +6808,33 @@ wsrep_store_key_val_for_row(
char
*
buff_start
=
buff
;
enum_field_types
mysql_type
;
Field
*
field
;
uint
buff_space
=
buff_len
;
DBUG_ENTER
(
"wsrep_store_key_val_for_row"
);
memset
(
buff
,
0
,
buff_len
);
*
key_is_null
=
TRUE
;
for
(;
key_part
!=
end
;
key_part
++
)
{
uchar
sorted
[
REC_VERSION_56_MAX_INDEX_COL_LEN
]
=
{
'\0'
};
ibool
part_is_null
=
FALSE
;
if
(
key_part
->
null_bit
)
{
if
(
record
[
key_part
->
null_offset
]
&
key_part
->
null_bit
)
{
*
buff
=
1
;
part_is_null
=
TRUE
;
if
(
buff_space
>
0
)
{
if
(
record
[
key_part
->
null_offset
]
&
key_part
->
null_bit
)
{
*
buff
=
1
;
part_is_null
=
TRUE
;
}
else
{
*
buff
=
0
;
}
buff
++
;
buff_space
--
;
}
else
{
*
buff
=
0
;
fprintf
(
stderr
,
"WSREP: key truncated: %s
\n
"
,
wsrep_thd_query
(
thd
));
}
buff
++
;
}
if
(
!
part_is_null
)
*
key_is_null
=
FALSE
;
...
...
@@ -6845,8 +6854,15 @@ wsrep_store_key_val_for_row(
key_len
=
key_part
->
length
;
if
(
part_is_null
)
{
buff
+=
key_len
+
2
;
true_len
=
key_len
+
2
;
if
(
true_len
>
buff_space
)
{
fprintf
(
stderr
,
"WSREP: key truncated: %s
\n
"
,
wsrep_thd_query
(
thd
));
true_len
=
buff_space
;
}
buff
+=
true_len
;
buff_space
-=
true_len
;
continue
;
}
cs
=
field
->
charset
();
...
...
@@ -6886,13 +6902,20 @@ wsrep_store_key_val_for_row(
REC_VERSION_56_MAX_INDEX_COL_LEN
);
if
(
wsrep_protocol_version
>
1
)
{
memcpy
(
buff
,
sorted
,
true_len
);
/* Note that we always reserve the maximum possible
length of the true VARCHAR in the key value, though
only len first bytes after the 2 length bytes contain
actual data. The rest of the space was reset to zero
in the bzero() call above. */
buff
+=
true_len
;
/* Note that we always reserve the maximum possible
length of the true VARCHAR in the key value, though
only len first bytes after the 2 length bytes contain
actual data. The rest of the space was reset to zero
in the bzero() call above. */
if
(
true_len
>
buff_space
)
{
fprintf
(
stderr
,
"WSREP: key truncated: %s
\n
"
,
wsrep_thd_query
(
thd
));
true_len
=
buff_space
;
}
memcpy
(
buff
,
sorted
,
true_len
);
buff
+=
true_len
;
buff_space
-=
true_len
;
}
else
{
buff
+=
key_len
;
}
...
...
@@ -6916,7 +6939,15 @@ wsrep_store_key_val_for_row(
key_len
=
key_part
->
length
;
if
(
part_is_null
)
{
buff
+=
key_len
+
2
;
true_len
=
key_len
+
2
;
if
(
true_len
>
buff_space
)
{
fprintf
(
stderr
,
"WSREP: key truncated: %s
\n
"
,
wsrep_thd_query
(
thd
));
true_len
=
buff_space
;
}
buff
+=
true_len
;
buff_space
-=
true_len
;
continue
;
}
...
...
@@ -6959,15 +6990,22 @@ wsrep_store_key_val_for_row(
mysql_type
,
cs
->
number
,
sorted
,
true_len
,
REC_VERSION_56_MAX_INDEX_COL_LEN
);
memcpy
(
buff
,
sorted
,
true_len
);
/* Note that we always reserve the maximum possible
length of the BLOB prefix in the key value. */
if
(
wsrep_protocol_version
>
1
)
{
buff
+=
true_len
;
}
else
{
buff
+=
key_len
;
}
if
(
true_len
>
buff_space
)
{
fprintf
(
stderr
,
"WSREP: key truncated: %s
\n
"
,
wsrep_thd_query
(
thd
));
true_len
=
buff_space
;
}
buff
+=
true_len
;
buff_space
-=
true_len
;
}
else
{
buff
+=
key_len
;
}
memcpy
(
buff
,
sorted
,
true_len
);
}
else
{
/* Here we handle all other data types except the
true VARCHAR, BLOB and TEXT. Note that the column
...
...
@@ -6984,9 +7022,17 @@ wsrep_store_key_val_for_row(
key_len
=
key_part
->
length
;
if
(
part_is_null
)
{
buff
+=
key_len
;
true_len
=
key_len
;
if
(
true_len
>
buff_space
)
{
fprintf
(
stderr
,
"WSREP: key truncated: %s
\n
"
,
wsrep_thd_query
(
thd
));
true_len
=
buff_space
;
}
buff
+=
true_len
;
buff_space
-=
true_len
;
continue
;
continue
;
}
src_start
=
record
+
key_part
->
offset
;
...
...
@@ -7024,12 +7070,18 @@ wsrep_store_key_val_for_row(
mysql_type
,
cs
->
number
,
sorted
,
true_len
,
REC_VERSION_56_MAX_INDEX_COL_LEN
);
if
(
true_len
>
buff_space
)
{
fprintf
(
stderr
,
"WSREP: key truncated: %s
\n
"
,
wsrep_thd_query
(
thd
));
true_len
=
buff_space
;
}
memcpy
(
buff
,
sorted
,
true_len
);
}
else
{
memcpy
(
buff
,
src_start
,
true_len
);
}
buff
+=
true_len
;
buff
+=
true_len
;
buff_space
-=
true_len
;
}
}
...
...
@@ -10323,7 +10375,8 @@ ha_innobase::wsrep_append_keys(
ibool
is_null
;
len
=
wsrep_store_key_val_for_row
(
table
,
0
,
key
,
key_info
->
key_length
,
record0
,
&
is_null
);
thd
,
table
,
0
,
key
,
WSREP_MAX_SUPPORTED_KEY_LENGTH
,
record0
,
&
is_null
);
if
(
!
is_null
)
{
rcode
=
wsrep_append_key
(
...
...
@@ -10345,9 +10398,6 @@ ha_innobase::wsrep_append_keys(
KEY
*
key_info
=
table
->
key_info
+
i
;
if
(
key_info
->
flags
&
HA_NOSAME
)
{
hasPK
=
true
;
if
(
i
!=
table
->
s
->
primary_key
)
{
wsrep_thd_set_PA_safe
(
thd
,
FALSE
);
}
}
}
...
...
@@ -10378,7 +10428,8 @@ ha_innobase::wsrep_append_keys(
(
!
tab
&&
referenced_by_foreign_key
())))
{
len
=
wsrep_store_key_val_for_row
(
table
,
i
,
key0
,
key_info
->
key_length
,
thd
,
table
,
i
,
key0
,
WSREP_MAX_SUPPORTED_KEY_LENGTH
,
record0
,
&
is_null
);
if
(
!
is_null
)
{
rcode
=
wsrep_append_key
(
...
...
@@ -10388,7 +10439,6 @@ ha_innobase::wsrep_append_keys(
if
(
key_info
->
flags
&
HA_NOSAME
||
shared
)
key_appended
=
true
;
}
else
{
...
...
@@ -10397,7 +10447,8 @@ ha_innobase::wsrep_append_keys(
}
if
(
record1
)
{
len
=
wsrep_store_key_val_for_row
(
table
,
i
,
key1
,
key_info
->
key_length
,
thd
,
table
,
i
,
key1
,
WSREP_MAX_SUPPORTED_KEY_LENGTH
,
record1
,
&
is_null
);
if
(
!
is_null
&&
memcmp
(
key0
,
key1
,
len
))
{
rcode
=
wsrep_append_key
(
...
...
storage/xtradb/include/hash0hash.h
View file @
305c1ae1
...
...
@@ -144,6 +144,33 @@ do {\
}\
} while (0)
#ifdef WITH_WSREP
/*******************************************************************//**
Inserts a struct to the head of hash table. */
#define HASH_PREPEND(TYPE, NAME, TABLE, FOLD, DATA) \
do { \
hash_cell_t* cell3333; \
TYPE* struct3333; \
\
HASH_ASSERT_OWN(TABLE, FOLD) \
\
(DATA)->NAME = NULL; \
\
cell3333 = hash_get_nth_cell(TABLE, hash_calc_hash(FOLD, TABLE));\
\
if (cell3333->node == NULL) { \
cell3333->node = DATA; \
DATA->NAME = NULL; \
} else { \
struct3333 = (TYPE*) cell3333->node; \
\
DATA->NAME = struct3333; \
\
cell3333->node = DATA; \
} \
} while (0)
#endif
/*WITH_WSREP */
#ifdef UNIV_HASH_DEBUG
# define HASH_ASSERT_VALID(DATA) ut_a((void*) (DATA) != (void*) -1)
# define HASH_INVALIDATE(DATA, NAME) *(void**) (&DATA->NAME) = (void*) -1
...
...
storage/xtradb/lock/lock0lock.cc
View file @
305c1ae1
...
...
@@ -1089,7 +1089,8 @@ lock_rec_has_to_wait(
wsrep_thd_conflict_state
(
trx
->
mysql_thd
,
FALSE
),
wsrep_thd_conflict_state
(
lock2
->
trx
->
mysql_thd
,
FALSE
)
);
lock_rec_print
(
stderr
,
lock2
);
abort
();
return
FALSE
;
//abort();
}
else
{
/* if lock2->index->n_uniq <=
lock2->index->n_user_defined_cols
...
...
@@ -2048,7 +2049,8 @@ lock_rec_create(
ut_ad
(
index
->
table
->
n_ref_count
>
0
||
!
index
->
table
->
can_be_evicted
);
#ifdef WITH_WSREP
if
(
c_lock
&&
wsrep_thd_is_BF
(
trx
->
mysql_thd
,
FALSE
))
{
if
(
c_lock
&&
wsrep_thd_is_BF
(
trx
->
mysql_thd
,
FALSE
))
{
lock_t
*
hash
=
(
lock_t
*
)
c_lock
->
hash
;
lock_t
*
prev
=
NULL
;
...
...
@@ -2111,6 +2113,9 @@ lock_rec_create(
return
(
lock
);
}
trx_mutex_exit
(
c_lock
->
trx
);
}
else
if
(
wsrep_thd_is_BF
(
trx
->
mysql_thd
,
FALSE
))
{
HASH_PREPEND
(
lock_t
,
hash
,
lock_sys
->
rec_hash
,
lock_rec_fold
(
space
,
page_no
),
lock
);
}
else
{
HASH_INSERT
(
lock_t
,
hash
,
lock_sys
->
rec_hash
,
lock_rec_fold
(
space
,
page_no
),
lock
);
...
...
@@ -2128,7 +2133,6 @@ lock_rec_create(
ut_ad
(
trx_mutex_own
(
trx
));
if
(
type_mode
&
LOCK_WAIT
)
{
lock_set_lock_and_trx_wait
(
lock
,
trx
);
}
...
...
@@ -2140,7 +2144,6 @@ lock_rec_create(
MONITOR_INC
(
MONITOR_RECLOCK_CREATED
);
MONITOR_INC
(
MONITOR_NUM_RECLOCK
);
return
(
lock
);
}
...
...
@@ -2366,7 +2369,16 @@ lock_rec_add_to_queue(
if
(
lock_get_wait
(
lock
)
&&
lock_rec_get_nth_bit
(
lock
,
heap_no
))
{
#ifdef WITH_WSREP
if
(
wsrep_thd_is_BF
(
trx
->
mysql_thd
,
FALSE
))
{
if
(
wsrep_debug
)
{
fprintf
(
stderr
,
"BF skipping wait: %lu
\n
"
,
trx
->
id
);
lock_rec_print
(
stderr
,
lock
);
}
}
else
#endif
goto
somebody_waits
;
}
}
...
...
@@ -2678,7 +2690,13 @@ lock_rec_has_to_wait_in_queue(
if
(
heap_no
<
lock_rec_get_n_bits
(
lock
)
&&
(
p
[
bit_offset
]
&
bit_mask
)
&&
lock_has_to_wait
(
wait_lock
,
lock
))
{
#ifdef WITH_WSREP
if
(
wsrep_thd_is_BF
(
wait_lock
->
trx
->
mysql_thd
,
FALSE
)
&&
wsrep_thd_is_BF
(
lock
->
trx
->
mysql_thd
,
TRUE
))
{
/* don't wait for another BF lock */
continue
;
}
#endif
return
(
lock
);
}
}
...
...
storage/xtradb/row/row0upd.cc
View file @
305c1ae1
...
...
@@ -419,12 +419,9 @@ wsrep_row_upd_check_foreign_constraints(
}
if
(
foreign
->
referenced_table
)
{
mutex_enter
(
&
(
dict_sys
->
mutex
));
(
foreign
->
referenced_table
->
n_foreign_key_checks_running
)
++
;
mutex_exit
(
&
(
dict_sys
->
mutex
));
os_inc_counter
(
dict_sys
->
mutex
,
foreign
->
referenced_table
->
n_foreign_key_checks_running
);
}
/* NOTE that if the thread ends up waiting for a lock
...
...
@@ -436,20 +433,14 @@ wsrep_row_upd_check_foreign_constraints(
TRUE
,
foreign
,
table
,
entry
,
thr
);
if
(
foreign
->
referenced_table
)
{
mutex_enter
(
&
(
dict_sys
->
mutex
));
ut_a
(
foreign
->
referenced_table
->
n_foreign_key_checks_running
>
0
);
(
foreign
->
referenced_table
->
n_foreign_key_checks_running
)
--
;
os_dec_counter
(
dict_sys
->
mutex
,
foreign
->
referenced_table
->
n_foreign_key_checks_running
);
if
(
opened
==
TRUE
)
{
dict_table_close
(
foreign
->
referenced_table
,
TRUE
,
FALSE
);
opened
=
FALSE
;
}
mutex_exit
(
&
(
dict_sys
->
mutex
));
}
if
(
err
!=
DB_SUCCESS
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment