summaryrefslogtreecommitdiff
path: root/mysys/thr_lock.c
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-06-03 19:40:41 +0300
committerMonty <monty@mariadb.org>2020-06-14 19:39:42 +0300
commit10b88deb74a77e75c49b8fc63fef666eaddc2e6e (patch)
treee0b12d095b2235b1a4df45f67674e580fcae0af2 /mysys/thr_lock.c
parent74df3c8024faa55faa361edb0a80548c9b36815c (diff)
downloadmariadb-git-10b88deb74a77e75c49b8fc63fef666eaddc2e6e.tar.gz
Changes needed for ColumnStore and insert cache
MCOL-3875 Columnstore write cache The main change is to change thr_lock function get_status to return a value that indicates we have to abort the lock. Other thing: - Made start_bulk_insert() and end_bulk_insert() protected so that the insert cache can use these
Diffstat (limited to 'mysys/thr_lock.c')
-rw-r--r--mysys/thr_lock.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 07ba1ec9eac..5004428505a 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -634,9 +634,10 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
else
{
result= THR_LOCK_SUCCESS;
- if (data->lock->get_status)
- (*data->lock->get_status)(data->status_param,
- data->type == TL_WRITE_CONCURRENT_INSERT);
+ if (data->lock->get_status &&
+ (*data->lock->get_status)(data->status_param,
+ data->type == TL_WRITE_CONCURRENT_INSERT))
+ result= THR_LOCK_ABORTED;
check_locks(data->lock,"got wait_for_lock", data->type, 0);
}
mysql_mutex_unlock(&data->lock->mutex);
@@ -811,8 +812,8 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
if (lock_type == TL_READ_NO_INSERT)
lock->read_no_write_count++;
check_locks(lock,"read lock with old write lock", lock_type, 0);
- if (lock->get_status)
- (*lock->get_status)(data->status_param, 0);
+ if ((lock->get_status) && (*lock->get_status)(data->status_param, 0))
+ result= THR_LOCK_ABORTED;
statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end;
}
@@ -835,8 +836,8 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
if (lock_type == TL_READ_NO_INSERT)
lock->read_no_write_count++;
check_locks(lock,"read lock with no write locks", lock_type, 0);
- if (lock->get_status)
- (*lock->get_status)(data->status_param, 0);
+ if ((lock->get_status) && (*lock->get_status)(data->status_param, 0))
+ result= THR_LOCK_ABORTED;
statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end;
}
@@ -951,9 +952,10 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
data->prev=lock->write.last;
lock->write.last= &data->next;
check_locks(lock,"second write lock", lock_type, 0);
- if (lock->get_status)
- (*lock->get_status)(data->status_param,
- lock_type == TL_WRITE_CONCURRENT_INSERT);
+ if ((lock->get_status) &&
+ (*lock->get_status)(data->status_param,
+ lock_type == TL_WRITE_CONCURRENT_INSERT))
+ result= THR_LOCK_ABORTED;
statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end;
}
@@ -986,8 +988,9 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout)
(*lock->write.last)=data; /* Add as current write lock */
data->prev=lock->write.last;
lock->write.last= &data->next;
- if (lock->get_status)
- (*lock->get_status)(data->status_param, concurrent_insert);
+ if ((lock->get_status) &&
+ (*lock->get_status)(data->status_param, concurrent_insert))
+ result= THR_LOCK_ABORTED;
check_locks(lock,"only write lock", lock_type, 0);
statistic_increment(locks_immediate,&THR_LOCK_lock);
goto end;
@@ -1581,6 +1584,7 @@ my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data,
{
if (!lock->read.data) /* No read locks */
{ /* We have the lock */
+ /* For this function, get_status is not allowed to fail */
if (data->lock->get_status)
(*data->lock->get_status)(data->status_param, 0);
mysql_mutex_unlock(&lock->mutex);
@@ -1781,9 +1785,10 @@ static ulong sum=0;
/* The following functions is for WRITE_CONCURRENT_INSERT */
-static void test_get_status(void* param __attribute__((unused)),
- my_bool concurrent_insert __attribute__((unused)))
+static my_bool test_get_status(void* param __attribute__((unused)),
+ my_bool concurrent_insert __attribute__((unused)))
{
+ return 0;
}
static void test_update_status(void* param __attribute__((unused)))