Skip to content

Commit

Permalink
Merge branch '10.0' into 10.0-galera
Browse files Browse the repository at this point in the history
  • Loading branch information
Nirbhay Choubey committed Aug 24, 2016
2 parents 8b09db8 + 5bbe929 commit c309e99
Show file tree
Hide file tree
Showing 418 changed files with 7,082 additions and 5,994 deletions.
34 changes: 18 additions & 16 deletions CREDITS
@@ -1,24 +1,26 @@
MariaDB is brought to you by the MariaDB Foundation, a non profit
organization registered in the USA.

The current main members and sponsors of the MariaDB Foundation are:

MariaDB Corporation http://www.mariadb.com (2013 - 2016)
Booking.com http://www.booking.com (2013 - 2016)
Parallels http://www.parallels.com/products/plesk (2013 - 2016)
Automattic http://automattic.com (2014 - 2016)
Verkkokauppa.com http://verkkokauppa.com (2015 - 2016)
Visma http://visma.com/ (2015 - 2016)
Webyog http://webyog.com (2015 - 2016)
Wikimedia Foundation http://wikimedia.org (2015 - 2016)
Acronis http://acronis.com (2016)

For a full list of supporters and sponsors see
The current main sponsors of the MariaDB Foundation are:

Booking.com http://www.booking.com (2013 - 2016)
Development Bank of Singapore http://dbs.com (2016)
MariaDB Corporation https://www.mariadb.com (2013 - 2016)
Visma http://visma.com (2015 - 2016)
Acronis http://acronis.com (2016)
Nexedi https://www.nexedi.com (2016)
Automattic https://automattic.com (2014 - 2016)
Verkkokauppa.com https://www.verkkokauppa.com (2015 - 2016)
Virtuozzo https://virtuozzo.com (2016)

For a full list of sponsors, see
https://mariadb.org/about/supporters/
and for individual contributors, see
https://mariadb.org/donate/individual-sponsors/

You can also do this by running SHOW CONTRIBUTORS.
You can also get the list of sponsors by running SHOW CONTRIBUTORS.

For all corporate memberships and sponsorships please contact the
For all corporate sponsorships please contact the
MariaDB Foundation Board via foundation@mariadb.org.

The MariaDB Foundation is responsible for the MariaDB source
Expand All @@ -38,7 +40,7 @@ following services to the MariaDB community:
To be able to do the above we need help from corporations and individuals!

You can help support MariaDB by becoming a MariaDB developer or a
member or sponsor of the MariaDB Foundation. To donate or sponsor,
sponsor of the MariaDB Foundation. To donate or sponsor,
go to https://mariadb.org/donate/

You can get a list of all the main authors of MariaDB / MySQL by running
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1,3 +1,3 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=0
MYSQL_VERSION_PATCH=26
MYSQL_VERSION_PATCH=27
67 changes: 27 additions & 40 deletions client/mysqlcheck.c
Expand Up @@ -240,7 +240,7 @@ static int process_selected_tables(char *db, char **table_names, int tables);
static int process_all_tables_in_db(char *database);
static int process_one_db(char *database);
static int use_db(char *database);
static int handle_request_for_tables(char *tables, size_t length, my_bool view);
static int handle_request_for_tables(char *, size_t, my_bool, my_bool);
static int dbConnect(char *host, char *user,char *passwd);
static void dbDisconnect(char *host);
static void DBerror(MYSQL *mysql, const char *when);
Expand Down Expand Up @@ -577,7 +577,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
}
*--end = 0;
handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1,
opt_do_views != 0);
opt_do_views != 0, opt_all_in_1);
my_free(table_names_comma_sep);
}
else
Expand All @@ -588,7 +588,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
view= is_view(table);
if (view < 0)
continue;
handle_request_for_tables(table, table_len, (view == 1));
handle_request_for_tables(table, table_len, view == 1, opt_all_in_1);
}
DBUG_RETURN(0);
} /* process_selected_tables */
Expand Down Expand Up @@ -616,13 +616,9 @@ static char *fix_table_name(char *dest, char *src)
*dest++= '`';
for (; *src; src++)
{
switch (*src) {
case '`': /* escape backtick character */
if (*src == '`')
*dest++= '`';
/* fall through */
default:
*dest++= *src;
}
*dest++= *src;
}
*dest++= '`';

Expand Down Expand Up @@ -711,9 +707,9 @@ static int process_all_tables_in_db(char *database)
*--end = 0;
*--views_end = 0;
if (tot_length)
handle_request_for_tables(tables + 1, tot_length - 1, FALSE);
handle_request_for_tables(tables + 1, tot_length - 1, FALSE, opt_all_in_1);
if (tot_views_length)
handle_request_for_tables(views + 1, tot_views_length - 1, TRUE);
handle_request_for_tables(views + 1, tot_views_length - 1, TRUE, opt_all_in_1);
my_free(tables);
my_free(views);
}
Expand All @@ -739,7 +735,7 @@ static int process_all_tables_in_db(char *database)
!strcmp(row[0], "slow_log")))
continue; /* Skip logging tables */

handle_request_for_tables(row[0], fixed_name_length(row[0]), view);
handle_request_for_tables(row[0], fixed_name_length(row[0]), view, opt_all_in_1);
}
}
mysql_free_result(res);
Expand Down Expand Up @@ -800,13 +796,11 @@ static int rebuild_table(char *name)
int rc= 0;
DBUG_ENTER("rebuild_table");

query= (char*)my_malloc(sizeof(char) * (12 + fixed_name_length(name) + 6 + 1),
query= (char*)my_malloc(sizeof(char) * (12 + strlen(name) + 6 + 1),
MYF(MY_WME));
if (!query)
DBUG_RETURN(1);
ptr= strmov(query, "ALTER TABLE ");
ptr= fix_table_name(ptr, name);
ptr= strxmov(ptr, " FORCE", NullS);
ptr= strxmov(query, "ALTER TABLE ", name, " FORCE", NullS);
if (verbose >= 3)
puts(query);
if (mysql_real_query(sock, query, (ulong)(ptr - query)))
Expand Down Expand Up @@ -875,7 +869,8 @@ static int disable_binlog()
return run_query(stmt, 0);
}

static int handle_request_for_tables(char *tables, size_t length, my_bool view)
static int handle_request_for_tables(char *tables, size_t length,
my_bool view, my_bool dont_quote)
{
char *query, *end, options[100], message[100];
char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name;
Expand Down Expand Up @@ -934,7 +929,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)

if (!(query =(char *) my_malloc(query_size, MYF(MY_WME))))
DBUG_RETURN(1);
if (opt_all_in_1)
if (dont_quote)
{
DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size);

Expand Down Expand Up @@ -979,23 +974,27 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view)
DBUG_RETURN(0);
}

static void insert_table_name(DYNAMIC_ARRAY *arr, char *in, size_t dblen)
{
char buf[NAME_LEN*2+2];
in[dblen]= 0;
my_snprintf(buf, sizeof(buf), "%`s.%`s", in, in + dblen + 1);
insert_dynamic(arr, (uchar*) buf);
}

static void print_result()
{
MYSQL_RES *res;
MYSQL_ROW row;
char prev[(NAME_LEN+9)*3+2];
char prev_alter[MAX_ALTER_STR_SIZE];
char *db_name;
uint length_of_db;
size_t length_of_db= strlen(sock->db);
uint i;
my_bool found_error=0, table_rebuild=0;
DYNAMIC_ARRAY *array4repair= &tables4repair;
DBUG_ENTER("print_result");

res = mysql_use_result(sock);
db_name= sock->db;
length_of_db= strlen(db_name);

prev[0] = '\0';
prev_alter[0]= 0;
Expand All @@ -1019,16 +1018,10 @@ static void print_result()
if (prev_alter[0])
insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
else
{
char *table_name= prev + (length_of_db+1);
insert_dynamic(&tables4rebuild, (uchar*) table_name);
}
insert_table_name(&tables4rebuild, prev, length_of_db);
}
else
{
char *table_name= prev + (length_of_db+1);
insert_dynamic(array4repair, table_name);
}
insert_table_name(array4repair, prev, length_of_db);
}
array4repair= &tables4repair;
found_error=0;
Expand Down Expand Up @@ -1073,16 +1066,10 @@ static void print_result()
if (prev_alter[0])
insert_dynamic(&alter_table_cmds, prev_alter);
else
{
char *table_name= prev + (length_of_db+1);
insert_dynamic(&tables4rebuild, table_name);
}
insert_table_name(&tables4rebuild, prev, length_of_db);
}
else
{
char *table_name= prev + (length_of_db+1);
insert_dynamic(array4repair, table_name);
}
insert_table_name(array4repair, prev, length_of_db);
}
mysql_free_result(res);
DBUG_VOID_RETURN;
Expand Down Expand Up @@ -1227,7 +1214,7 @@ int main(int argc, char **argv)
for (i = 0; i < tables4repair.elements ; i++)
{
char *name= (char*) dynamic_array_ptr(&tables4repair, i);
handle_request_for_tables(name, fixed_name_length(name), FALSE);
handle_request_for_tables(name, fixed_name_length(name), FALSE, TRUE);
}
for (i = 0; i < tables4rebuild.elements ; i++)
rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i));
Expand All @@ -1238,7 +1225,7 @@ int main(int argc, char **argv)
for (i = 0; i < views4repair.elements ; i++)
{
char *name= (char*) dynamic_array_ptr(&views4repair, i);
handle_request_for_tables(name, fixed_name_length(name), TRUE);
handle_request_for_tables(name, fixed_name_length(name), TRUE, TRUE);
}
}
ret= MY_TEST(first_error);
Expand Down
58 changes: 48 additions & 10 deletions client/mysqlimport.c
Expand Up @@ -37,6 +37,7 @@

/* Global Thread counter */
uint counter= 0;
pthread_mutex_t init_mutex;
pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold;

Expand Down Expand Up @@ -421,8 +422,19 @@ static MYSQL *db_connect(char *host, char *database,
MYSQL *mysql;
if (verbose)
fprintf(stdout, "Connecting to %s\n", host ? host : "localhost");
if (!(mysql= mysql_init(NULL)))
return 0;
if (opt_use_threads && !lock_tables)
{
pthread_mutex_lock(&init_mutex);
if (!(mysql= mysql_init(NULL)))
{
pthread_mutex_unlock(&init_mutex);
return 0;
}
pthread_mutex_unlock(&init_mutex);
}
else
if (!(mysql= mysql_init(NULL)))
return 0;
if (opt_compress)
mysql_options(mysql,MYSQL_OPT_COMPRESS,NullS);
if (opt_local_file)
Expand Down Expand Up @@ -614,7 +626,7 @@ pthread_handler_t worker_thread(void *arg)
pthread_cond_signal(&count_threshhold);
pthread_mutex_unlock(&counter_mutex);
mysql_thread_end();

pthread_exit(0);
return 0;
}

Expand All @@ -638,15 +650,31 @@ int main(int argc, char **argv)

if (opt_use_threads && !lock_tables)
{
pthread_t mainthread; /* Thread descriptor */
pthread_attr_t attr; /* Thread attributes */
char **save_argv;
uint worker_thread_count= 0, table_count= 0, i= 0;
pthread_t *worker_threads; /* Thread descriptor */
pthread_attr_t attr; /* Thread attributes */
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr,
PTHREAD_CREATE_DETACHED);
PTHREAD_CREATE_JOINABLE);

pthread_mutex_init(&init_mutex, NULL);
pthread_mutex_init(&counter_mutex, NULL);
pthread_cond_init(&count_threshhold, NULL);

/* Count the number of tables. This number denotes the total number
of threads spawn.
*/
save_argv= argv;
for (table_count= 0; *argv != NULL; argv++)
table_count++;
argv= save_argv;

if (!(worker_threads= (pthread_t*) my_malloc(table_count *
sizeof(*worker_threads),
MYF(0))))
return -2;

for (counter= 0; *argv != NULL; argv++) /* Loop through tables */
{
pthread_mutex_lock(&counter_mutex);
Expand All @@ -661,15 +689,16 @@ int main(int argc, char **argv)
counter++;
pthread_mutex_unlock(&counter_mutex);
/* now create the thread */
if (pthread_create(&mainthread, &attr, worker_thread,
(void *)*argv) != 0)
if (pthread_create(&worker_threads[worker_thread_count], &attr,
worker_thread, (void *)*argv) != 0)
{
pthread_mutex_lock(&counter_mutex);
counter--;
pthread_mutex_unlock(&counter_mutex);
fprintf(stderr,"%s: Could not create thread\n",
my_progname);
fprintf(stderr,"%s: Could not create thread\n", my_progname);
continue;
}
worker_thread_count++;
}

/*
Expand All @@ -684,9 +713,18 @@ int main(int argc, char **argv)
pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime);
}
pthread_mutex_unlock(&counter_mutex);
pthread_mutex_destroy(&init_mutex);
pthread_mutex_destroy(&counter_mutex);
pthread_cond_destroy(&count_threshhold);
pthread_attr_destroy(&attr);

for(i= 0; i < worker_thread_count; i++)
{
if (pthread_join(worker_threads[i], NULL))
fprintf(stderr,"%s: Could not join worker thread.\n", my_progname);
}

my_free(worker_threads);
}
else
{
Expand Down
7 changes: 6 additions & 1 deletion client/mysqltest.cc
Expand Up @@ -181,6 +181,7 @@ static uint my_end_arg= 0;
static uint opt_tail_lines= 0;

static uint opt_connect_timeout= 0;
static uint opt_wait_for_pos_timeout= 0;

static char delimiter[MAX_DELIMITER_LENGTH]= ";";
static uint delimiter_length= 1;
Expand Down Expand Up @@ -4659,7 +4660,7 @@ void do_sync_with_master2(struct st_command *command, long offset,
MYSQL_ROW row;
MYSQL *mysql= cur_con->mysql;
char query_buf[FN_REFLEN+128];
int timeout= 300; /* seconds */
int timeout= opt_wait_for_pos_timeout;

if (!master_pos.file[0])
die("Calling 'sync_with_master' without calling 'save_master_pos'");
Expand Down Expand Up @@ -7098,6 +7099,10 @@ static struct my_option my_long_options[] =
"Number of seconds before connection timeout.",
&opt_connect_timeout, &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG,
120, 0, 3600 * 12, 0, 0, 0},
{"wait_for_pos_timeout", 0,
"Number of seconds to wait for master_pos_wait",
&opt_wait_for_pos_timeout, &opt_wait_for_pos_timeout, 0, GET_UINT,
REQUIRED_ARG, 300, 0, 3600 * 12, 0, 0, 0},
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
Expand Down
2 changes: 1 addition & 1 deletion extra/perror.c
Expand Up @@ -250,7 +250,7 @@ static my_bool print_win_error_msg(DWORD error, my_bool verbose)
will ignore calls to register already registered error numbers.
*/

static const char **get_handler_error_messages()
static const char **get_handler_error_messages(void)
{
return handler_error_messages;
}
Expand Down

0 comments on commit c309e99

Please sign in to comment.