summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-12-13 00:10:40 +0100
committerSergei Golubchik <serg@mariadb.org>2015-12-13 00:10:40 +0100
commit162399515813a4e23c8735473f9d2dd622a6679b (patch)
tree39077fdabea60983c59899ce3d28e84c4d97c7e6 /plugin
parent5908d7ebb81bc2d52c67e519a4643372cb9f08bd (diff)
parent0ed474484c037a32bea32abaecd3ff770f40bd49 (diff)
downloadmariadb-git-162399515813a4e23c8735473f9d2dd622a6679b.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'plugin')
-rw-r--r--plugin/daemon_example/daemon_example.cc12
-rw-r--r--plugin/feedback/feedback.cc2
-rw-r--r--plugin/feedback/feedback.h6
-rw-r--r--plugin/feedback/sender_thread.cc7
4 files changed, 17 insertions, 10 deletions
diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc
index ffa9789a0e9..dbc3c5c49e3 100644
--- a/plugin/daemon_example/daemon_example.cc
+++ b/plugin/daemon_example/daemon_example.cc
@@ -1,4 +1,5 @@
-/* Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights
+ reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,7 +47,6 @@ pthread_handler_t mysql_heartbeat(void *p)
DBUG_ENTER("mysql_heartbeat");
struct mysql_heartbeat_context *con= (struct mysql_heartbeat_context *)p;
char buffer[HEART_STRING_BUFFER];
- unsigned int x= 0;
time_t result;
struct tm tm_tmp;
@@ -65,7 +65,6 @@ pthread_handler_t mysql_heartbeat(void *p)
tm_tmp.tm_min,
tm_tmp.tm_sec);
my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
- x++;
}
DBUG_RETURN(0);
@@ -174,6 +173,13 @@ static int daemon_example_plugin_deinit(void *p __attribute__ ((unused)))
tm_tmp.tm_min,
tm_tmp.tm_sec);
my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
+
+ /*
+ Need to wait for the hearbeat thread to terminate before closing
+ the file it writes to and freeing the memory it uses.
+ */
+ pthread_join(con->heartbeat_thread, NULL);
+
my_close(con->heartbeat_file, MYF(0));
my_free(con);
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index 1a2504c5f6f..de7b2c9060b 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -262,7 +262,7 @@ static int init(void *p)
startup_interval= debug_startup_interval;
first_interval= debug_first_interval;
interval= debug_interval;
- user_info= "mysql-test";
+ user_info= const_cast<char*>("mysql-test");
}
#endif
diff --git a/plugin/feedback/feedback.h b/plugin/feedback/feedback.h
index 52ab32dfb2b..2cfbeed4eb5 100644
--- a/plugin/feedback/feedback.h
+++ b/plugin/feedback/feedback.h
@@ -59,9 +59,9 @@ class Url {
extern Url **urls;
extern uint url_count;
-extern time_t startup_interval;
-extern time_t first_interval;
-extern time_t interval;
+extern ulong startup_interval;
+extern ulong first_interval;
+extern ulong interval;
/* these are used to communicate with the background thread */
extern mysql_mutex_t sleep_mutex;
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index 5114fd48726..9417dc85b7d 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -25,9 +25,9 @@ static my_thread_id thd_thread_id; ///< its thread_id
static size_t needed_size= 20480;
-time_t startup_interval= 60*5; ///< in seconds (5 minutes)
-time_t first_interval= 60*60*24; ///< in seconds (one day)
-time_t interval= 60*60*24*7; ///< in seconds (one week)
+ulong startup_interval= 60*5; ///< in seconds (5 minutes)
+ulong first_interval= 60*60*24; ///< in seconds (one day)
+ulong interval= 60*60*24*7; ///< in seconds (one week)
/**
reads the rows from a table and puts them, concatenated, in a String
@@ -254,6 +254,7 @@ ret:
{
if (tables.table)
free_tmp_table(thd, tables.table);
+ thd->cleanup_after_query();
/*
clean up, free the thd.
reset all thread local status variables to minimize