mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
5.6.24
This commit is contained in:
parent
6d06fbbd1d
commit
085297a121
19 changed files with 438 additions and 491 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
|
|
@ -540,11 +540,12 @@ extern ulong zip_failure_threshold_pct;
|
|||
compression failures */
|
||||
extern ulong zip_pad_max;
|
||||
|
||||
/** Data structure to hold information about about how much space in
|
||||
/** Data structure to hold information about how much space in
|
||||
an uncompressed page should be left as padding to avoid compression
|
||||
failures. This estimate is based on a self-adapting heuristic. */
|
||||
struct zip_pad_info_t {
|
||||
os_fast_mutex_t mutex; /*!< mutex protecting the info */
|
||||
os_fast_mutex_t*
|
||||
mutex; /*!< mutex protecting the info */
|
||||
ulint pad; /*!< number of bytes used as pad */
|
||||
ulint success;/*!< successful compression ops during
|
||||
current round */
|
||||
|
|
@ -552,6 +553,9 @@ struct zip_pad_info_t {
|
|||
current round */
|
||||
ulint n_rounds;/*!< number of currently successful
|
||||
rounds */
|
||||
volatile os_once::state_t
|
||||
mutex_created;
|
||||
/*!< Creation state of mutex member */
|
||||
};
|
||||
|
||||
/** Data structure for an index. Most fields will be
|
||||
|
|
@ -1142,9 +1146,14 @@ struct dict_table_t{
|
|||
space from the lock heap of the trx:
|
||||
otherwise the lock heap would grow rapidly
|
||||
if we do a large insert from a select */
|
||||
ib_mutex_t autoinc_mutex;
|
||||
ib_mutex_t* autoinc_mutex;
|
||||
/*!< mutex protecting the autoincrement
|
||||
counter */
|
||||
|
||||
/** Creation state of autoinc_mutex member */
|
||||
volatile os_once::state_t
|
||||
autoinc_mutex_created;
|
||||
|
||||
ib_uint64_t autoinc;/*!< autoinc counter value to give to the
|
||||
next inserted row */
|
||||
ulong n_waiting_or_granted_auto_inc_locks;
|
||||
|
|
@ -1207,6 +1216,111 @@ struct dict_foreign_add_to_referenced_table {
|
|||
}
|
||||
};
|
||||
|
||||
/** Destroy the autoinc latch of the given table.
|
||||
This function is only called from either single threaded environment
|
||||
or from a thread that has not shared the table object with other threads.
|
||||
@param[in,out] table table whose stats latch to destroy */
|
||||
inline
|
||||
void
|
||||
dict_table_autoinc_destroy(
|
||||
dict_table_t* table)
|
||||
{
|
||||
if (table->autoinc_mutex_created == os_once::DONE
|
||||
&& table->autoinc_mutex != NULL) {
|
||||
mutex_free(table->autoinc_mutex);
|
||||
delete table->autoinc_mutex;
|
||||
}
|
||||
}
|
||||
|
||||
/** Allocate and init the autoinc latch of a given table.
|
||||
This function must not be called concurrently on the same table object.
|
||||
@param[in,out] table_void table whose autoinc latch to create */
|
||||
void
|
||||
dict_table_autoinc_alloc(
|
||||
void* table_void);
|
||||
|
||||
/** Allocate and init the zip_pad_mutex of a given index.
|
||||
This function must not be called concurrently on the same index object.
|
||||
@param[in,out] index_void index whose zip_pad_mutex to create */
|
||||
void
|
||||
dict_index_zip_pad_alloc(
|
||||
void* index_void);
|
||||
|
||||
/** Request for lazy creation of the autoinc latch of a given table.
|
||||
This function is only called from either single threaded environment
|
||||
or from a thread that has not shared the table object with other threads.
|
||||
@param[in,out] table table whose autoinc latch is to be created. */
|
||||
inline
|
||||
void
|
||||
dict_table_autoinc_create_lazy(
|
||||
dict_table_t* table)
|
||||
{
|
||||
#ifdef HAVE_ATOMIC_BUILTINS
|
||||
table->autoinc_mutex = NULL;
|
||||
table->autoinc_mutex_created = os_once::NEVER_DONE;
|
||||
#else /* HAVE_ATOMIC_BUILTINS */
|
||||
dict_table_autoinc_alloc(table);
|
||||
table->autoinc_mutex_created = os_once::DONE;
|
||||
#endif /* HAVE_ATOMIC_BUILTINS */
|
||||
}
|
||||
|
||||
/** Request a lazy creation of dict_index_t::zip_pad::mutex.
|
||||
This function is only called from either single threaded environment
|
||||
or from a thread that has not shared the table object with other threads.
|
||||
@param[in,out] index index whose zip_pad mutex is to be created */
|
||||
inline
|
||||
void
|
||||
dict_index_zip_pad_mutex_create_lazy(
|
||||
dict_index_t* index)
|
||||
{
|
||||
#ifdef HAVE_ATOMIC_BUILTINS
|
||||
index->zip_pad.mutex = NULL;
|
||||
index->zip_pad.mutex_created = os_once::NEVER_DONE;
|
||||
#else /* HAVE_ATOMIC_BUILTINS */
|
||||
dict_index_zip_pad_alloc(index);
|
||||
index->zip_pad.mutex_created = os_once::DONE;
|
||||
#endif /* HAVE_ATOMIC_BUILTINS */
|
||||
}
|
||||
|
||||
/** Destroy the zip_pad_mutex of the given index.
|
||||
This function is only called from either single threaded environment
|
||||
or from a thread that has not shared the table object with other threads.
|
||||
@param[in,out] table table whose stats latch to destroy */
|
||||
inline
|
||||
void
|
||||
dict_index_zip_pad_mutex_destroy(
|
||||
dict_index_t* index)
|
||||
{
|
||||
if (index->zip_pad.mutex_created == os_once::DONE
|
||||
&& index->zip_pad.mutex != NULL) {
|
||||
os_fast_mutex_free(index->zip_pad.mutex);
|
||||
delete index->zip_pad.mutex;
|
||||
}
|
||||
}
|
||||
|
||||
/** Release the zip_pad_mutex of a given index.
|
||||
@param[in,out] index index whose zip_pad_mutex is to be released */
|
||||
inline
|
||||
void
|
||||
dict_index_zip_pad_unlock(
|
||||
dict_index_t* index)
|
||||
{
|
||||
os_fast_mutex_unlock(index->zip_pad.mutex);
|
||||
}
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
/** Check if the current thread owns the autoinc_mutex of a given table.
|
||||
@param[in] table the autoinc_mutex belongs to this table
|
||||
@return true, if the current thread owns the autoinc_mutex, false otherwise.*/
|
||||
inline
|
||||
bool
|
||||
dict_table_autoinc_own(
|
||||
const dict_table_t* table)
|
||||
{
|
||||
return(mutex_own(table->autoinc_mutex));
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
#include "dict0mem.ic"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue