summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-05-18 16:45:59 +0300
committerMichael Widenius <monty@askmonty.org>2012-05-18 16:45:59 +0300
commit3f4ef5928e72faf2b7fd0c98c8705ac649d2faf9 (patch)
treec1dd9f5adbd4909ec398600775488c6951620396
parent32498ead2d79d8db2371aed8d648476041cb4e0e (diff)
parent960f6600c86d8b94e29825a3a6bf72f92353e17f (diff)
downloadmariadb-git-3f4ef5928e72faf2b7fd0c98c8705ac649d2faf9.tar.gz
Automatic merge
-rw-r--r--dbug/tests.c3
-rw-r--r--mysql-test/r/handlersocket.result11
-rwxr-xr-xmysql-test/suite/innodb/t/innodb_bug60196.test3
-rw-r--r--mysql-test/suite/maria/maria.result6
-rw-r--r--mysql-test/suite/maria/maria.test4
-rw-r--r--mysql-test/suite/maria/truncate.result37
-rw-r--r--mysql-test/suite/maria/truncate.test47
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_basic.test2
-rw-r--r--mysql-test/t/handlersocket.test2
-rw-r--r--plugin/handler_socket/handlersocket/handlersocket.cpp10
-rw-r--r--plugin/handler_socket/handlersocket/mysql_incl.hpp3
-rw-r--r--plugin/handler_socket/libhsclient/auto_addrinfo.hpp5
-rw-r--r--sql/handler.h2
-rw-r--r--sql/sql_plugin.cc5
-rw-r--r--storage/maria/ha_maria.cc114
-rw-r--r--storage/maria/ma_checkpoint.c2
-rw-r--r--storage/maria/ma_loghandler.c2
-rw-r--r--unittest/mysys/base64-t.c2
-rw-r--r--unittest/mysys/bitmap-t.c2
-rw-r--r--unittest/mysys/my_malloc-t.c2
20 files changed, 185 insertions, 79 deletions
diff --git a/dbug/tests.c b/dbug/tests.c
index 657ed638a5a..22a445fdeca 100644
--- a/dbug/tests.c
+++ b/dbug/tests.c
@@ -36,7 +36,8 @@ int func1()
DBUG_RETURN(10);
}
-int main (int argc, char *argv[])
+int main (int argc __attribute__((unused)),
+ char *argv[] __attribute__((unused)))
{
#ifdef DBUG_OFF
return 1;
diff --git a/mysql-test/r/handlersocket.result b/mysql-test/r/handlersocket.result
index dcea3c186b6..a415b12f92d 100644
--- a/mysql-test/r/handlersocket.result
+++ b/mysql-test/r/handlersocket.result
@@ -1,13 +1,14 @@
install plugin handlersocket soname 'handlersocket.so';
-select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket';
+select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description, plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket';
plugin_name handlersocket
plugin_version 1.0
plugin_status ACTIVE
plugin_type DAEMON
plugin_library handlersocket.so
-plugin_library_version 0.0
+plugin_library_version 1.3
plugin_author higuchi dot akira at dena dot jp
-plugin_license
-plugin_maturity Unknown
-plugin_auth_version Unknown
+plugin_description Direct access into InnoDB
+plugin_license BSD
+plugin_maturity Beta
+plugin_auth_version 1.0
uninstall plugin handlersocket;
diff --git a/mysql-test/suite/innodb/t/innodb_bug60196.test b/mysql-test/suite/innodb/t/innodb_bug60196.test
index 328c886351e..e479b8d6b82 100755
--- a/mysql-test/suite/innodb/t/innodb_bug60196.test
+++ b/mysql-test/suite/innodb/t/innodb_bug60196.test
@@ -78,7 +78,8 @@ SELECT * FROM Bug_60196;
INSERT INTO Bug_60196 VALUES (2, 1);
INSERT INTO Bug_60196 VALUES (2, 2);
INSERT INTO Bug_60196 VALUES (2, 3);
-SELECT * FROM Bug_60196 ORDER BY FK1_Key, FK2_Key;
+--sorted_result
+SELECT * FROM Bug_60196;
--echo
--echo # Clean up.
diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result
index c68a8871f83..888c1c10c5e 100644
--- a/mysql-test/suite/maria/maria.result
+++ b/mysql-test/suite/maria/maria.result
@@ -2542,8 +2542,12 @@ drop table t1;
create table t1 (a int) engine=aria transactional=1;
insert into t1 values (1);
lock table t1 write concurrent;
-delete from t1;
+delete from t1 where a>0;
ERROR 42000: The storage engine for the table doesn't support DELETE in WRITE CONCURRENT
+delete from t1;
+ERROR 42000: The storage engine for the table doesn't support TRUNCATE in WRITE CONCURRENT
+truncate t1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
unlock tables;
drop table t1;
create table t1 (p int primary key, i int, a char(10), key k1(i), key k2(a))
diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test
index b371394b2b3..6ebcf08d952 100644
--- a/mysql-test/suite/maria/maria.test
+++ b/mysql-test/suite/maria/maria.test
@@ -1805,7 +1805,11 @@ insert into t1 values (1);
lock table t1 write concurrent;
# should be fixed with fully implemented versioning
--error ER_CHECK_NOT_IMPLEMENTED
+delete from t1 where a>0;
+--error ER_CHECK_NOT_IMPLEMENTED
delete from t1;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+truncate t1;
unlock tables;
drop table t1;
diff --git a/mysql-test/suite/maria/truncate.result b/mysql-test/suite/maria/truncate.result
new file mode 100644
index 00000000000..467e0f915dd
--- /dev/null
+++ b/mysql-test/suite/maria/truncate.result
@@ -0,0 +1,37 @@
+CREATE TABLE t1 ( i INT ) ENGINE=Aria PARTITION BY HASH(i) PARTITIONS 2;
+SET AUTOCOMMIT = 0;
+TRUNCATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 ( i INT ) ENGINE=Aria;
+CREATE TABLE t2 ( i INT ) ENGINE=Aria;
+insert into t1 values(1);
+lock table t1 write;
+truncate table t1;
+select count(*) from t1;
+count(*)
+0
+insert into t1 values(2);
+select count(*) from t1;
+count(*)
+1
+truncate table t1;
+select count(*) from t1;
+count(*)
+0
+insert into t1 values(3);
+select count(*) from t1;
+count(*)
+1
+select * from t2;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+unlock tables;
+insert into t1 values(4);
+select * from t1;
+i
+3
+4
+truncate t1;
+select count(*) from t1;
+count(*)
+0
+drop table t1,t2;
diff --git a/mysql-test/suite/maria/truncate.test b/mysql-test/suite/maria/truncate.test
new file mode 100644
index 00000000000..3d6e70d9db6
--- /dev/null
+++ b/mysql-test/suite/maria/truncate.test
@@ -0,0 +1,47 @@
+#
+# Testing of potential problems in Aria
+#
+
+-- source include/have_maria.inc
+-- source include/have_partition.inc
+
+--disable_warnings
+--disable_query_log
+drop table if exists t1,t2;
+--enable_query_log
+--enable_warnings
+
+#
+# LP:997460 truncate table on partitioned Aria table fails with ER_ILLEGAL_HA
+#
+
+CREATE TABLE t1 ( i INT ) ENGINE=Aria PARTITION BY HASH(i) PARTITIONS 2;
+SET AUTOCOMMIT = 0;
+TRUNCATE TABLE t1;
+DROP TABLE t1;
+
+#
+# Other truncate tests
+#
+
+CREATE TABLE t1 ( i INT ) ENGINE=Aria;
+CREATE TABLE t2 ( i INT ) ENGINE=Aria;
+insert into t1 values(1);
+lock table t1 write;
+truncate table t1;
+select count(*) from t1;
+insert into t1 values(2);
+select count(*) from t1;
+truncate table t1;
+select count(*) from t1;
+insert into t1 values(3);
+select count(*) from t1;
+# Check that locking is still working
+--error 1100
+select * from t2;
+unlock tables;
+insert into t1 values(4);
+select * from t1;
+truncate t1;
+select count(*) from t1;
+drop table t1,t2;
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
index 78489449ab8..e736eb1ba12 100644
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
@@ -324,7 +324,7 @@ call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received w
let $slave_errno= ER_DUP_ENTRY
--source include/wait_for_slave_sql_error.inc
let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
-sleep 2;
+sleep 4;
let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result
diff --git a/mysql-test/t/handlersocket.test b/mysql-test/t/handlersocket.test
index 6a7b65797c5..10cb9728fb7 100644
--- a/mysql-test/t/handlersocket.test
+++ b/mysql-test/t/handlersocket.test
@@ -5,6 +5,6 @@ if (`select length('$HANDLERSOCKET_SO') = 0`) {
}
install plugin handlersocket soname 'handlersocket.so';
---query_vertical select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket'
+--query_vertical select plugin_name, plugin_version, plugin_status, plugin_type, plugin_library, plugin_library_version, plugin_author, plugin_description, plugin_license, plugin_maturity, plugin_auth_version from information_schema.plugins where plugin_name = 'handlersocket'
uninstall plugin handlersocket;
diff --git a/plugin/handler_socket/handlersocket/handlersocket.cpp b/plugin/handler_socket/handlersocket/handlersocket.cpp
index 7b60eaa28d3..2595d24a85c 100644
--- a/plugin/handler_socket/handlersocket/handlersocket.cpp
+++ b/plugin/handler_socket/handlersocket/handlersocket.cpp
@@ -197,20 +197,20 @@ static SHOW_VAR daemon_handlersocket_status_variables[] = {
};
-mysql_declare_plugin(handlersocket)
+maria_declare_plugin(handlersocket)
{
MYSQL_DAEMON_PLUGIN,
&daemon_handlersocket_plugin,
"handlersocket",
"higuchi dot akira at dena dot jp",
- "",
+ "Direct access into InnoDB",
PLUGIN_LICENSE_BSD,
daemon_handlersocket_init,
daemon_handlersocket_deinit,
0x0100 /* 1.0 */,
daemon_handlersocket_status_variables,
daemon_handlersocket_system_variables,
- 0
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_BETA
}
-mysql_declare_plugin_end;
-
+maria_declare_plugin_end;
diff --git a/plugin/handler_socket/handlersocket/mysql_incl.hpp b/plugin/handler_socket/handlersocket/mysql_incl.hpp
index ac937e4e74d..0fb4fceb143 100644
--- a/plugin/handler_socket/handlersocket/mysql_incl.hpp
+++ b/plugin/handler_socket/handlersocket/mysql_incl.hpp
@@ -36,6 +36,9 @@
#include <sql_base.h>
// FIXME FIXME FIXME
#define safeFree(X) my_free(X)
+#undef pthread_cond_timedwait
+#undef pthread_mutex_lock
+#undef pthread_mutex_unlock
#define pthread_cond_timedwait mysql_cond_timedwait
#define pthread_mutex_lock mysql_mutex_lock
#define pthread_mutex_unlock mysql_mutex_unlock
diff --git a/plugin/handler_socket/libhsclient/auto_addrinfo.hpp b/plugin/handler_socket/libhsclient/auto_addrinfo.hpp
index 6a807a6fcc7..aee22a1d0f6 100644
--- a/plugin/handler_socket/libhsclient/auto_addrinfo.hpp
+++ b/plugin/handler_socket/libhsclient/auto_addrinfo.hpp
@@ -13,7 +13,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
-
+#include <string.h>
#include "util.hpp"
typedef SOCKET_SIZE_TYPE size_socket;
@@ -34,8 +34,9 @@ struct auto_addrinfo : private noncopyable {
const addrinfo *get() const { return addr; }
int resolve(const char *node, const char *service, int flags = 0,
int family = AF_UNSPEC, int socktype = SOCK_STREAM, int protocol = 0) {
+ addrinfo hints;
reset();
- addrinfo hints = { };
+ memset(&hints, 0, sizeof(hints));
hints.ai_flags = flags;
hints.ai_family = family;
hints.ai_socktype = socktype;
diff --git a/sql/handler.h b/sql/handler.h
index f118f1d3c5b..142139dbabc 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1063,7 +1063,7 @@ inline LEX_STRING *hton_name(const handlerton *hton)
#define HTON_NO_FLAGS 0
#define HTON_CLOSE_CURSORS_AT_COMMIT (1 << 0)
#define HTON_ALTER_NOT_SUPPORTED (1 << 1) //Engine does not support alter
-#define HTON_CAN_RECREATE (1 << 2) //Delete all is used fro truncate
+#define HTON_CAN_RECREATE (1 << 2) //Delete all is used for truncate
#define HTON_HIDDEN (1 << 3) //Engine does not appear in lists
#define HTON_NOT_USER_SELECTABLE (1 << 5)
#define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index a7d7f464fca..ff43c7abd55 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -739,15 +739,14 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
}
bzero(&plugin_dl, sizeof(plugin_dl));
/* Compile dll path */
- dlpathlen=
- strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NullS) -
- dlpath;
+ strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NullS);
(void) unpack_filename(dlpath, dlpath);
plugin_dl.ref_count= 1;
/* Open new dll handle */
if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW)))
{
const char *errmsg=dlerror();
+ dlpathlen= strlen(dlpath);
if (!strncmp(dlpath, errmsg, dlpathlen))
{ // if errmsg starts from dlpath, trim this prefix.
errmsg+=dlpathlen;
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index ae7e686d2f0..2b67f29f9f8 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -2537,9 +2537,10 @@ int ha_maria::extra_opt(enum ha_extra_function operation, ulong cache_size)
int ha_maria::delete_all_rows()
{
-#ifdef EXTRA_DEBUG
THD *thd= table->in_use;
TRN *trn= file->trn;
+ CHECK_UNTIL_WE_FULLY_IMPLEMENTED_VERSIONING("TRUNCATE in WRITE CONCURRENT");
+#ifdef EXTRA_DEBUG
if (trn && ! (trnman_get_flags(trn) & TRN_STATE_INFO_LOGGED))
{
trnman_set_flags(trn, trnman_get_flags(trn) | TRN_STATE_INFO_LOGGED |
@@ -2548,16 +2549,19 @@ int ha_maria::delete_all_rows()
(uchar*) thd->query(), thd->query_length());
}
#endif
- if (file->s->now_transactional &&
- ((table->in_use->variables.option_bits & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ||
- table->in_use->locked_tables_mode))
+ /*
+ If we are under LOCK TABLES, we have to do a commit as
+ delete_all_rows() can't be rolled back
+ */
+ if (table->in_use->locked_tables_mode && trn &&
+ trnman_has_locked_tables(trn))
{
- /*
- We are not in autocommit mode or user have done LOCK TABLES.
- We must do the delete row by row to be able to rollback the command
- */
- return HA_ERR_WRONG_COMMAND;
+ int error;
+ if ((error= implicit_commit(thd, 1)))
+ return error;
}
+
+ /* Note that this can't be rolled back */
return maria_delete_all_rows(file);
}
@@ -2775,10 +2779,11 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn)
#error this method should be removed
#endif
TRN *trn;
- int error= 0;
+ int error;
+ uint locked_tables;
TABLE *table;
DBUG_ENTER("ha_maria::implicit_commit");
- if (!maria_hton)
+ if (!maria_hton || !(trn= THD_TRN))
DBUG_RETURN(0);
if (!new_trn && (thd->locked_tables_mode == LTM_LOCK_TABLES ||
thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES))
@@ -2792,60 +2797,59 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn)
DBUG_PRINT("info", ("locked_tables, skipping"));
DBUG_RETURN(0);
}
- if ((trn= THD_TRN) != NULL)
+ locked_tables= trnman_has_locked_tables(trn);
+ error= 0;
+ if (unlikely(ma_commit(trn)))
+ error= 1;
+ if (!new_trn)
{
- uint locked_tables= trnman_has_locked_tables(trn);
- if (unlikely(ma_commit(trn)))
- error= 1;
- if (!new_trn)
- {
- /*
- To be extra safe, we should also reset file->trn for all open
- tables as some calls, like extra() may access it. We take care
- of this in extra() by resetting file->trn if THD_TRN is 0.
- */
- THD_TRN= NULL;
- goto end;
- }
/*
- We need to create a new transaction and put it in THD_TRN. Indeed,
- tables may be under LOCK TABLES, and so they will start the next
- statement assuming they have a trn (see ha_maria::start_stmt()).
+ To be extra safe, we should also reset file->trn for all open
+ tables as some calls, like extra() may access it. We take care
+ of this in extra() by resetting file->trn if THD_TRN is 0.
*/
- trn= trnman_new_trn(& thd->transaction.wt);
- THD_TRN= trn;
- if (unlikely(trn == NULL))
- {
- error= HA_ERR_OUT_OF_MEM;
- goto end;
- }
- /*
- Move all locked tables to the new transaction
- We must do it here as otherwise file->thd and file->state may be
- stale pointers. We can't do this in start_stmt() as we don't know
- when we should call _ma_setup_live_state() and in some cases, like
- in check table, we use the table without calling start_stmt().
- */
- for (table=thd->open_tables; table ; table=table->next)
+ THD_TRN= NULL;
+ goto end;
+ }
+ /*
+ We need to create a new transaction and put it in THD_TRN. Indeed,
+ tables may be under LOCK TABLES, and so they will start the next
+ statement assuming they have a trn (see ha_maria::start_stmt()).
+ */
+ trn= trnman_new_trn(& thd->transaction.wt);
+ THD_TRN= trn;
+ if (unlikely(trn == NULL))
+ {
+ error= HA_ERR_OUT_OF_MEM;
+ goto end;
+ }
+ /*
+ Move all locked tables to the new transaction
+ We must do it here as otherwise file->thd and file->state may be
+ stale pointers. We can't do this in start_stmt() as we don't know
+ when we should call _ma_setup_live_state() and in some cases, like
+ in check table, we use the table without calling start_stmt().
+ */
+ for (table=thd->open_tables; table ; table=table->next)
+ {
+ if (table->db_stat && table->file->ht == maria_hton)
{
- if (table->db_stat && table->file->ht == maria_hton)
+ MARIA_HA *handler= ((ha_maria*) table->file)->file;
+ if (handler->s->base.born_transactional)
{
- MARIA_HA *handler= ((ha_maria*) table->file)->file;
- if (handler->s->base.born_transactional)
+ _ma_set_trn_for_table(handler, trn);
+ /* If handler uses versioning */
+ if (handler->s->lock_key_trees)
{
- _ma_set_trn_for_table(handler, trn);
- /* If handler uses versioning */
- if (handler->s->lock_key_trees)
- {
- if (_ma_setup_live_state(handler))
- error= HA_ERR_OUT_OF_MEM;
- }
+ if (_ma_setup_live_state(handler))
+ error= HA_ERR_OUT_OF_MEM;
}
}
}
- /* This is just a commit, tables stay locked if they were: */
- trnman_reset_locked_tables(trn, locked_tables);
}
+ /* This is just a commit, tables stay locked if they were: */
+ trnman_reset_locked_tables(trn, locked_tables);
+
end:
DBUG_RETURN(error);
}
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c
index 2f5ba72a40e..30124b2205d 100644
--- a/storage/maria/ma_checkpoint.c
+++ b/storage/maria/ma_checkpoint.c
@@ -763,6 +763,8 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
PAGECACHE_FLUSH_FILTER filter;
DBUG_ENTER("collect_tables");
+ LINT_INIT(state_copies_horizon);
+
/* let's make a list of distinct shares */
mysql_mutex_lock(&THR_LOCK_maria);
for (nb= 0, pos= maria_open_list; pos; pos= pos->next)
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 801efd3f07c..341bbc6088f 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -7474,6 +7474,8 @@ static void translog_force_current_buffer_to_finish()
uint16 left= TRANSLOG_PAGE_SIZE - log_descriptor.bc.current_page_fill;
uint16 current_page_fill, write_counter, previous_offset;
DBUG_ENTER("translog_force_current_buffer_to_finish");
+ LINT_INIT(current_page_fill);
+
DBUG_PRINT("enter", ("Buffer #%u 0x%lx "
"Buffer addr: (%lu,0x%lx) "
"Page addr: (%lu,0x%lx) "
diff --git a/unittest/mysys/base64-t.c b/unittest/mysys/base64-t.c
index a8a5d166a1a..ed19c4de851 100644
--- a/unittest/mysys/base64-t.c
+++ b/unittest/mysys/base64-t.c
@@ -24,7 +24,7 @@
#define BASE64_ROWS 4 /* Number of ok(..) */
int
-main(int argc,char *argv[])
+main(int argc __attribute__((unused)),char *argv[])
{
int i, cmp;
size_t j, k, l, dst_len, needed_length;
diff --git a/unittest/mysys/bitmap-t.c b/unittest/mysys/bitmap-t.c
index bcfb9835c10..0666f4eaa15 100644
--- a/unittest/mysys/bitmap-t.c
+++ b/unittest/mysys/bitmap-t.c
@@ -520,7 +520,7 @@ error:
return TRUE;
}
-int main(int argc,char *argv[])
+int main(int argc __attribute__((unused)),char *argv[])
{
int i;
int const min_size = 1;
diff --git a/unittest/mysys/my_malloc-t.c b/unittest/mysys/my_malloc-t.c
index 40d9492b039..52d73434150 100644
--- a/unittest/mysys/my_malloc-t.c
+++ b/unittest/mysys/my_malloc-t.c
@@ -17,7 +17,7 @@
#include <my_sys.h>
#include "tap.h"
-int main(int argc,char *argv[])
+int main(int argc __attribute__((unused)),char *argv[])
{
void *p;
MY_INIT(argv[0]);