Commit b409731f authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#3213 fix the store_lock function (pattern after innodb's storage_lock function) refs[t:3213]

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@27607 c7de825b-a66e-492c-adef-691d508d4ae1
parent 889be002
......@@ -5561,24 +5561,24 @@ THR_LOCK_DATA **ha_tokudb::store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_l
if (tokudb_debug & TOKUDB_DEBUG_LOCK) {
TOKUDB_TRACE("%s lock_type=%d cmd=%d\n", __FUNCTION__, lock_type, thd_sql_command(thd));
}
if (get_create_index_online(thd) &&
thd_sql_command(thd)== SQLCOM_CREATE_INDEX
)
{
rw_rdlock(&share->num_DBs_lock);
if (share->num_DBs == (table->s->keys + test(hidden_primary_key))) {
lock_type = TL_WRITE_ALLOW_WRITE;
}
lock.type = lock_type;
rw_unlock(&share->num_DBs_lock);
}
else if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) {
/* If we are not doing a LOCK TABLE, then allow multiple writers */
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE) &&
!thd->in_lock_tables && thd_sql_command(thd) != SQLCOM_TRUNCATE && !thd_tablespace_op(thd)) {
lock_type = TL_WRITE_ALLOW_WRITE;
if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) {
// if creating a hot index
if (get_create_index_online(thd) && thd_sql_command(thd)== SQLCOM_CREATE_INDEX) {
rw_rdlock(&share->num_DBs_lock);
if (share->num_DBs == (table->s->keys + test(hidden_primary_key))) {
lock_type = TL_WRITE_ALLOW_WRITE;
}
lock.type = lock_type;
rw_unlock(&share->num_DBs_lock);
} else {
// If we are not doing a LOCK TABLE, then allow multiple writers
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE) &&
!thd->in_lock_tables && thd_sql_command(thd) != SQLCOM_TRUNCATE && !thd_tablespace_op(thd)) {
lock_type = TL_WRITE_ALLOW_WRITE;
}
lock.type = lock_type;
}
lock.type = lock_type;
}
*to++ = &lock;
if (tokudb_debug & TOKUDB_DEBUG_LOCK)
......
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