mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Manual merge of mysql-trunk into mysql-trunk-merge.
Conflicts: Text conflict in client/mysqlbinlog.cc Text conflict in mysql-test/Makefile.am Text conflict in mysql-test/collections/default.daily Text conflict in mysql-test/r/mysqlbinlog_row_innodb.result Text conflict in mysql-test/suite/rpl/r/rpl_typeconv_innodb.result Text conflict in mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test Text conflict in mysql-test/suite/rpl/t/rpl_row_create_table.test Text conflict in mysql-test/suite/rpl/t/rpl_slave_skip.test Text conflict in mysql-test/suite/rpl/t/rpl_typeconv_innodb.test Text conflict in mysys/charset.c Text conflict in sql/field.cc Text conflict in sql/field.h Text conflict in sql/item.h Text conflict in sql/item_func.cc Text conflict in sql/log.cc Text conflict in sql/log_event.cc Text conflict in sql/log_event_old.cc Text conflict in sql/mysqld.cc Text conflict in sql/rpl_utility.cc Text conflict in sql/rpl_utility.h Text conflict in sql/set_var.cc Text conflict in sql/share/Makefile.am Text conflict in sql/sql_delete.cc Text conflict in sql/sql_plugin.cc Text conflict in sql/sql_select.cc Text conflict in sql/sql_table.cc Text conflict in storage/example/ha_example.h Text conflict in storage/federated/ha_federated.cc Text conflict in storage/myisammrg/ha_myisammrg.cc Text conflict in storage/myisammrg/myrg_open.c
This commit is contained in:
@ -13,6 +13,6 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake")
|
||||
SET(EXAMPLE_PLUGIN_DYNAMIC "ha_example")
|
||||
SET(EXAMPLE_SOURCES ha_example.cc)
|
||||
MYSQL_STORAGE_ENGINE(EXAMPLE)
|
||||
MYSQL_ADD_PLUGIN(example ${EXAMPLE_SOURCES} STORAGE_ENGINE MODULE_ONLY)
|
||||
|
@ -112,7 +112,7 @@ handlerton *example_hton;
|
||||
static HASH example_open_tables;
|
||||
|
||||
/* The mutex used to init the hash; variable for example share methods */
|
||||
pthread_mutex_t example_mutex;
|
||||
mysql_mutex_t example_mutex;
|
||||
|
||||
/**
|
||||
@brief
|
||||
@ -126,13 +126,39 @@ static uchar* example_get_key(EXAMPLE_SHARE *share, size_t *length,
|
||||
return (uchar*) share->table_name;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
static PSI_mutex_key ex_key_mutex_example, ex_key_mutex_EXAMPLE_SHARE_mutex;
|
||||
|
||||
static PSI_mutex_info all_example_mutexes[]=
|
||||
{
|
||||
{ &ex_key_mutex_example, "example", PSI_FLAG_GLOBAL},
|
||||
{ &ex_key_mutex_EXAMPLE_SHARE_mutex, "EXAMPLE_SHARE::mutex", 0}
|
||||
};
|
||||
|
||||
static void init_example_psi_keys()
|
||||
{
|
||||
const char* category= "example";
|
||||
int count;
|
||||
|
||||
if (PSI_server == NULL)
|
||||
return;
|
||||
|
||||
count= array_elements(all_example_mutexes);
|
||||
PSI_server->register_mutex(category, all_example_mutexes, count);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int example_init_func(void *p)
|
||||
{
|
||||
DBUG_ENTER("example_init_func");
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
init_example_psi_keys();
|
||||
#endif
|
||||
|
||||
example_hton= (handlerton *)p;
|
||||
VOID(pthread_mutex_init(&example_mutex,MY_MUTEX_INIT_FAST));
|
||||
mysql_mutex_init(ex_key_mutex_example, &example_mutex, MY_MUTEX_INIT_FAST);
|
||||
(void) my_hash_init(&example_open_tables,system_charset_info,32,0,0,
|
||||
(my_hash_get_key) example_get_key,0,0);
|
||||
|
||||
@ -152,7 +178,7 @@ static int example_done_func(void *p)
|
||||
if (example_open_tables.records)
|
||||
error= 1;
|
||||
my_hash_free(&example_open_tables);
|
||||
pthread_mutex_destroy(&example_mutex);
|
||||
mysql_mutex_destroy(&example_mutex);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@ -172,7 +198,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
|
||||
uint length;
|
||||
char *tmp_name;
|
||||
|
||||
pthread_mutex_lock(&example_mutex);
|
||||
mysql_mutex_lock(&example_mutex);
|
||||
length=(uint) strlen(table_name);
|
||||
|
||||
if (!(share=(EXAMPLE_SHARE*) my_hash_search(&example_open_tables,
|
||||
@ -185,7 +211,7 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
|
||||
&tmp_name, length+1,
|
||||
NullS)))
|
||||
{
|
||||
pthread_mutex_unlock(&example_mutex);
|
||||
mysql_mutex_unlock(&example_mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -196,15 +222,16 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
|
||||
if (my_hash_insert(&example_open_tables, (uchar*) share))
|
||||
goto error;
|
||||
thr_lock_init(&share->lock);
|
||||
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
|
||||
mysql_mutex_init(ex_key_mutex_EXAMPLE_SHARE_mutex,
|
||||
&share->mutex, MY_MUTEX_INIT_FAST);
|
||||
}
|
||||
share->use_count++;
|
||||
pthread_mutex_unlock(&example_mutex);
|
||||
mysql_mutex_unlock(&example_mutex);
|
||||
|
||||
return share;
|
||||
|
||||
error:
|
||||
pthread_mutex_destroy(&share->mutex);
|
||||
mysql_mutex_destroy(&share->mutex);
|
||||
my_free(share, MYF(0));
|
||||
|
||||
return NULL;
|
||||
@ -219,15 +246,15 @@ error:
|
||||
|
||||
static int free_share(EXAMPLE_SHARE *share)
|
||||
{
|
||||
pthread_mutex_lock(&example_mutex);
|
||||
mysql_mutex_lock(&example_mutex);
|
||||
if (!--share->use_count)
|
||||
{
|
||||
my_hash_delete(&example_open_tables, (uchar*) share);
|
||||
thr_lock_delete(&share->lock);
|
||||
pthread_mutex_destroy(&share->mutex);
|
||||
mysql_mutex_destroy(&share->mutex);
|
||||
my_free(share, MYF(0));
|
||||
}
|
||||
pthread_mutex_unlock(&example_mutex);
|
||||
mysql_mutex_unlock(&example_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -356,7 +383,13 @@ int ha_example::close(void)
|
||||
int ha_example::write_row(uchar *buf)
|
||||
{
|
||||
DBUG_ENTER("ha_example::write_row");
|
||||
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
|
||||
/*
|
||||
Example of a successful write_row. We don't store the data
|
||||
anywhere; they are thrown away. A real implementation will
|
||||
probably need to do something with 'buf'. We report a success
|
||||
here, to pretend that the insert was successful.
|
||||
*/
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
typedef struct st_example_share {
|
||||
char *table_name;
|
||||
uint table_name_length,use_count;
|
||||
pthread_mutex_t mutex;
|
||||
mysql_mutex_t mutex;
|
||||
THR_LOCK lock;
|
||||
} EXAMPLE_SHARE;
|
||||
|
||||
@ -83,11 +83,11 @@ public:
|
||||
ulonglong table_flags() const
|
||||
{
|
||||
/*
|
||||
We are saying that this engine is just row capable to have an
|
||||
engine that can only handle row-based logging. This is used in
|
||||
testing.
|
||||
We are saying that this engine is just statement capable to have
|
||||
an engine that can only handle statement-based logging. This is
|
||||
used in testing.
|
||||
*/
|
||||
return HA_BINLOG_ROW_CAPABLE;
|
||||
return HA_BINLOG_STMT_CAPABLE;
|
||||
}
|
||||
|
||||
/** @brief
|
||||
|
Reference in New Issue
Block a user