summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-07-01 09:48:36 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-07-01 09:48:36 +0300
commit045771c05099cf75fea036fdc89308eb3c06549a (patch)
tree181142185d3a7a612ab0ad238c938ae1e6111131
parent6dc1bc3a5822007cdb2d5b79f0a37b4d6b9b65c7 (diff)
downloadmariadb-git-045771c05099cf75fea036fdc89308eb3c06549a.tar.gz
Fix most clang-15 -Wunused-but-set-variable
Also, refactor trx_i_s_common_fill_table() to remove dead code. Warnings about yynerrs in Bison-generated yyparse() will remain for now.
-rw-r--r--client/mysql.cc9
-rw-r--r--client/mysqlcheck.c5
-rw-r--r--client/mysqlslap.c12
m---------libmariadb0
-rw-r--r--scripts/comp_sql.c6
-rw-r--r--sql/field.cc5
-rw-r--r--sql/ha_partition.cc3
-rw-r--r--sql/partition_info.cc13
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_statistics.cc4
-rw-r--r--sql/sql_table.cc3
-rw-r--r--storage/innobase/btr/btr0bulk.cc2
-rw-r--r--storage/innobase/handler/i_s.cc219
-rw-r--r--storage/innobase/row/row0merge.cc2
14 files changed, 97 insertions, 188 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index ea92c84e1d1..28311defc81 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2009, 2021, MariaDB Corporation.
+ Copyright (c) 2009, 2022, MariaDB Corporation.
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
@@ -3591,7 +3591,6 @@ print_table_data(MYSQL_RES *result)
{
String separator(256);
MYSQL_ROW cur;
- MYSQL_FIELD *field;
bool *num_flag;
num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result));
@@ -3603,7 +3602,7 @@ print_table_data(MYSQL_RES *result)
mysql_field_seek(result,0);
}
separator.copy("+",1,charset_info);
- while ((field = mysql_fetch_field(result)))
+ while (MYSQL_FIELD *field= mysql_fetch_field(result))
{
uint length= column_names ? field->name_length : 0;
if (quick)
@@ -3625,7 +3624,7 @@ print_table_data(MYSQL_RES *result)
{
mysql_field_seek(result,0);
(void) tee_fputs("|", PAGER);
- for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
+ while (MYSQL_FIELD *field= mysql_fetch_field(result))
{
size_t name_length= (uint) strlen(field->name);
size_t numcells= charset_info->cset->numcells(charset_info,
@@ -3668,7 +3667,7 @@ print_table_data(MYSQL_RES *result)
data_length= (uint) lengths[off];
}
- field= mysql_fetch_field(result);
+ MYSQL_FIELD *field= mysql_fetch_field(result);
field_max_length= field->max_length;
/*
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index aaf77dbb743..27ccff2a840 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2017, MariaDB
+ Copyright (c) 2010, 2012, MariaDB
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
@@ -1006,7 +1006,6 @@ static void print_result()
char prev[(NAME_LEN+9)*3+2];
char prev_alter[MAX_ALTER_STR_SIZE];
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");
@@ -1015,7 +1014,7 @@ static void print_result()
prev[0] = '\0';
prev_alter[0]= 0;
- for (i = 0; (row = mysql_fetch_row(res)); i++)
+ while ((row = mysql_fetch_row(res)))
{
int changed = strcmp(prev, row[0]);
my_bool status = !strcmp(row[2], "status");
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 19544384670..0a3a7cd8582 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2015, Oracle and/or its affiliates.
- Copyright (c) 2010, 2017, MariaDB
+ Copyright (c) 2010, 2022, MariaDB
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
@@ -1846,12 +1846,11 @@ run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
pthread_handler_t run_task(void *p)
{
- ulonglong counter= 0, queries;
+ ulonglong queries;
ulonglong detach_counter;
unsigned int commit_counter;
MYSQL *mysql;
MYSQL_RES *result;
- MYSQL_ROW row;
statement *ptr;
thread_context *con= (thread_context *)p;
@@ -1972,8 +1971,7 @@ limit_not_met:
my_progname, mysql_errno(mysql), mysql_error(mysql));
else
{
- while ((row= mysql_fetch_row(result)))
- counter++;
+ while (mysql_fetch_row(result)) {}
mysql_free_result(result);
}
}
@@ -1983,7 +1981,7 @@ limit_not_met:
if (commit_rate && (++commit_counter == commit_rate))
{
commit_counter= 0;
- run_query(mysql, "COMMIT", strlen("COMMIT"));
+ run_query(mysql, C_STRING_WITH_LEN("COMMIT"));
}
if (con->limit && queries == con->limit)
@@ -1995,7 +1993,7 @@ limit_not_met:
end:
if (commit_rate)
- run_query(mysql, "COMMIT", strlen("COMMIT"));
+ run_query(mysql, C_STRING_WITH_LEN("COMMIT"));
mysql_close(mysql);
diff --git a/libmariadb b/libmariadb
-Subproject ab7a81e79e4be4324a2d09d19d4f5249801ef66
+Subproject d12fd88b6c0fafbf25f59e7fecd639cb2b38f15
diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c
index 748b2320f2a..abd59e85bb5 100644
--- a/scripts/comp_sql.c
+++ b/scripts/comp_sql.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2004, 2010, Oracle and/or its affiliates.
- Copyright (c) 2012, 2014, Monty Program Ab
+ Copyright (c) 2012, 2022, MariaDB Corporation.
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
@@ -77,7 +77,6 @@ char *fgets_fn(char *buffer, size_t size, fgets_input_t input, int *error)
static void print_query(FILE *out, const char *query)
{
const char *ptr= query;
- int column= 0;
fprintf(out, "\"");
while (*ptr)
@@ -90,21 +89,18 @@ static void print_query(FILE *out, const char *query)
and wrap to the next line, tabulated.
*/
fprintf(out, "\\n\"\n \"");
- column= 2;
break;
case '\r':
/* Skipped */
break;
case '\"':
fprintf(out, "\\\"");
- column++;
break;
case '\\':
fprintf(out, "\\\\");
break;
default:
putc(*ptr, out);
- column++;
break;
}
ptr++;
diff --git a/sql/field.cc b/sql/field.cc
index 57cf3deed35..3878d261f94 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2008, 2021, MariaDB
+ Copyright (c) 2008, 2022, MariaDB
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
@@ -9990,7 +9990,7 @@ int Field_bit::cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len)
}
-int Field_bit::key_cmp(const uchar *str, uint length)
+int Field_bit::key_cmp(const uchar *str, uint)
{
if (bit_len)
{
@@ -9999,7 +9999,6 @@ int Field_bit::key_cmp(const uchar *str, uint length)
if ((flag= (int) (bits - *str)))
return flag;
str++;
- length--;
}
return memcmp(ptr, str, bytes_in_rec);
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 5c08c934dde..6d5a54ad8b0 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2353,7 +2353,6 @@ uint ha_partition::del_ren_table(const char *from, const char *to)
char *name_buffer_ptr;
const char *from_path;
const char *to_path= NULL;
- uint i;
handler **file, **abort_file;
DBUG_ENTER("ha_partition::del_ren_table");
@@ -2382,7 +2381,6 @@ uint ha_partition::del_ren_table(const char *from, const char *to)
from_path= get_canonical_filename(*file, from, from_lc_buff);
if (to != NULL)
to_path= get_canonical_filename(*file, to, to_lc_buff);
- i= 0;
do
{
if (unlikely((error= create_partition_name(from_buff, sizeof(from_buff),
@@ -2407,7 +2405,6 @@ uint ha_partition::del_ren_table(const char *from, const char *to)
name_buffer_ptr= strend(name_buffer_ptr) + 1;
if (unlikely(error))
save_error= error;
- i++;
} while (*(++file));
if (to != NULL)
{
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index cf2536f3969..17a65ad8cd4 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2015, Oracle and/or its affiliates.
- Copyright (c) 2010, 2018, MariaDB Corporation.
+ Copyright (c) 2010, 2022, MariaDB Corporation.
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
@@ -1583,7 +1583,6 @@ bool partition_info::set_up_charset_field_preps(THD *thd)
uchar **char_ptrs;
unsigned i;
size_t size;
- uint tot_fields= 0;
uint tot_part_fields= 0;
uint tot_subpart_fields= 0;
DBUG_ENTER("set_up_charset_field_preps");
@@ -1595,13 +1594,8 @@ bool partition_info::set_up_charset_field_preps(THD *thd)
ptr= part_field_array;
/* Set up arrays and buffers for those fields */
while ((field= *(ptr++)))
- {
if (field_is_partition_charset(field))
- {
tot_part_fields++;
- tot_fields++;
- }
- }
size= tot_part_fields * sizeof(char*);
if (!(char_ptrs= (uchar**)thd->calloc(size)))
goto error;
@@ -1635,13 +1629,8 @@ bool partition_info::set_up_charset_field_preps(THD *thd)
/* Set up arrays and buffers for those fields */
ptr= subpart_field_array;
while ((field= *(ptr++)))
- {
if (field_is_partition_charset(field))
- {
tot_subpart_fields++;
- tot_fields++;
- }
- }
size= tot_subpart_fields * sizeof(char*);
if (!(char_ptrs= (uchar**) thd->calloc(size)))
goto error;
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 5a00518b806..e4c5b7cbd75 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2191,7 +2191,6 @@ int Lex_input_stream::scan_ident_delimited(THD *thd,
Lex_ident_cli_st *str)
{
CHARSET_INFO *const cs= thd->charset();
- uint double_quotes= 0;
uchar c, quote_char= m_tok_start[0];
DBUG_ASSERT(m_ptr == m_tok_start + 1);
@@ -2216,7 +2215,6 @@ int Lex_input_stream::scan_ident_delimited(THD *thd,
if (yyPeek() != quote_char)
break;
c= yyGet();
- double_quotes++;
continue;
}
}
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 721b2de75a3..5e31034847e 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -1,5 +1,5 @@
/* Copyright (C) 2009 MySQL AB
- Copyright (c) 2019, 2020, MariaDB Corporation.
+ Copyright (c) 2019, 2022, MariaDB Corporation.
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
@@ -2483,7 +2483,6 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index)
{
int rc= 0;
KEY *key_info= &table->key_info[index];
- ha_rows rows= 0;
DBUG_ENTER("collect_statistics_for_index");
@@ -2518,7 +2517,6 @@ int collect_statistics_for_index(THD *thd, TABLE *table, uint index)
if (rc)
break;
- rows++;
index_prefix_calc.add();
rc= table->file->ha_index_next(table->record[0]);
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 62b9cb22df0..cc9cb37ca15 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3633,7 +3633,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
List_iterator<Key> key_iterator(alter_info->key_list);
List_iterator<Key> key_iterator2(alter_info->key_list);
- uint key_parts=0, fk_key_count=0;
+ uint key_parts=0;
bool primary_key=0,unique_key=0;
Key *key, *key2;
uint tmp, key_number;
@@ -3649,7 +3649,6 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
"(none)" , key->type));
if (key->type == Key::FOREIGN_KEY)
{
- fk_key_count++;
Foreign_key *fk_key= (Foreign_key*) key;
if (fk_key->validate(alter_info->create_list))
DBUG_RETURN(TRUE);
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index c05cf2a7b7a..fdeba1e375b 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -301,7 +301,6 @@ PageBulk::finish()
#endif
ulint count = 0;
- ulint n_recs = 0;
ulint slot_index = 0;
rec_t* insert_rec = page_rec_get_next(page_get_infimum_rec(m_page));
page_dir_slot_t* slot = NULL;
@@ -309,7 +308,6 @@ PageBulk::finish()
/* Set owner & dir. */
while (!page_rec_is_supremum(insert_rec)) {
count++;
- n_recs++;
if (count == (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2) {
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index ff0bb9b9129..20297ce1d61 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -59,6 +59,7 @@ Modified Dec 29, 2014 Jan Lindström (Added sys_semaphore_waits)
#include "fil0crypt.h"
#include "dict0crea.h"
#include "fts0vlc.h"
+#include "log.h"
/** The latest successfully looked up innodb_fts_aux_table */
UNIV_INTERN table_id_t innodb_ft_aux_table_id;
@@ -190,19 +191,37 @@ sync_arr_fill_sys_semphore_waits_table(
TABLE_LIST* tables, /*!< in/out: tables to fill */
Item* ); /*!< in: condition (not used) */
-/*******************************************************************//**
+/**
Common function to fill any of the dynamic tables:
INFORMATION_SCHEMA.innodb_trx
INFORMATION_SCHEMA.innodb_locks
INFORMATION_SCHEMA.innodb_lock_waits
-@return 0 on success */
-static
-int
-trx_i_s_common_fill_table(
-/*======================*/
- THD* thd, /*!< in: thread */
- TABLE_LIST* tables, /*!< in/out: tables to fill */
- Item* ); /*!< in: condition (not used) */
+@retval false if access to the table is blocked
+@retval true if something should be filled in */
+static bool trx_i_s_common_fill_table(THD *thd, TABLE_LIST *tables)
+{
+ DBUG_ENTER("trx_i_s_common_fill_table");
+
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL))
+ DBUG_RETURN(false);
+
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
+
+ /* update the cache */
+ trx_i_s_cache_start_write(trx_i_s_cache);
+ trx_i_s_possibly_fetch_data_into_cache(trx_i_s_cache);
+ trx_i_s_cache_end_write(trx_i_s_cache);
+
+ if (trx_i_s_cache_is_truncated(trx_i_s_cache))
+ sql_print_warning("InnoDB: Data in %.*s truncated due to memory limit"
+ " of %u bytes",
+ int(tables->schema_table_name.length),
+ tables->schema_table_name.str,
+ TRX_I_S_MEM_LIMIT);
+
+ DBUG_RETURN(true);
+}
/*******************************************************************//**
Unbind a dynamic INFORMATION_SCHEMA table.
@@ -394,26 +413,29 @@ static ST_FIELD_INFO innodb_trx_fields_info[]=
/*******************************************************************//**
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_trx
table with it.
-@return 0 on success */
-static
-int
-fill_innodb_trx_from_cache(
-/*=======================*/
- trx_i_s_cache_t* cache, /*!< in: cache to read from */
- THD* thd, /*!< in: used to call
- schema_table_store_record() */
- TABLE* table) /*!< in/out: fill this table */
+@retval 0 on success
+@retval 1 on failure */
+static int fill_innodb_trx_from_cache(THD *thd, TABLE_LIST *tables, Item*)
{
- Field** fields;
ulint rows_num;
char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
ulint i;
DBUG_ENTER("fill_innodb_trx_from_cache");
- fields = table->field;
+ if (!trx_i_s_common_fill_table(thd, tables)) {
+ DBUG_RETURN(0);
+ }
- rows_num = trx_i_s_cache_get_rows_used(cache,
+ struct cache
+ {
+ cache() { trx_i_s_cache_start_read(trx_i_s_cache); }
+ ~cache() { trx_i_s_cache_end_read(trx_i_s_cache); }
+ } c;
+
+ Field** fields = tables->table->field;
+
+ rows_num = trx_i_s_cache_get_rows_used(trx_i_s_cache,
I_S_INNODB_TRX);
for (i = 0; i < rows_num; i++) {
@@ -423,7 +445,7 @@ fill_innodb_trx_from_cache(
row = (i_s_trx_row_t*)
trx_i_s_cache_get_nth_row(
- cache, I_S_INNODB_TRX, i);
+ trx_i_s_cache, I_S_INNODB_TRX, i);
/* trx_id */
snprintf(trx_id, sizeof(trx_id), TRX_ID_FMT, row->trx_id);
@@ -535,7 +557,7 @@ fill_innodb_trx_from_cache(
(longlong) row->trx_is_autocommit_non_locking,
true));
- OK(schema_table_store_record(thd, table));
+ OK(schema_table_store_record(thd, tables->table));
}
DBUG_RETURN(0);
@@ -557,7 +579,7 @@ innodb_trx_init(
schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_trx_fields_info;
- schema->fill_table = trx_i_s_common_fill_table;
+ schema->fill_table = fill_innodb_trx_from_cache;
DBUG_RETURN(0);
}
@@ -672,20 +694,29 @@ static
int
fill_innodb_locks_from_cache(
/*=========================*/
- trx_i_s_cache_t* cache, /*!< in: cache to read from */
THD* thd, /*!< in: MySQL client connection */
- TABLE* table) /*!< in/out: fill this table */
+ TABLE_LIST* tables, /*!< in/out: fill this table */
+ Item*)
{
- Field** fields;
ulint rows_num;
char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
ulint i;
DBUG_ENTER("fill_innodb_locks_from_cache");
- fields = table->field;
+ if (!trx_i_s_common_fill_table(thd, tables)) {
+ DBUG_RETURN(0);
+ }
+
+ struct cache
+ {
+ cache() { trx_i_s_cache_start_read(trx_i_s_cache); }
+ ~cache() { trx_i_s_cache_end_read(trx_i_s_cache); }
+ } c;
- rows_num = trx_i_s_cache_get_rows_used(cache,
+ Field** fields = tables->table->field;
+
+ rows_num = trx_i_s_cache_get_rows_used(trx_i_s_cache,
I_S_INNODB_LOCKS);
for (i = 0; i < rows_num; i++) {
@@ -698,7 +729,7 @@ fill_innodb_locks_from_cache(
row = (i_s_locks_row_t*)
trx_i_s_cache_get_nth_row(
- cache, I_S_INNODB_LOCKS, i);
+ trx_i_s_cache, I_S_INNODB_LOCKS, i);
/* lock_id */
trx_i_s_create_lock_id(row, lock_id, sizeof(lock_id));
@@ -746,7 +777,7 @@ fill_innodb_locks_from_cache(
OK(field_store_string(fields[IDX_LOCK_DATA],
row->lock_data));
- OK(schema_table_store_record(thd, table));
+ OK(schema_table_store_record(thd, tables->table));
}
DBUG_RETURN(0);
@@ -768,7 +799,7 @@ innodb_locks_init(
schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_locks_fields_info;
- schema->fill_table = trx_i_s_common_fill_table;
+ schema->fill_table = fill_innodb_locks_from_cache;
DBUG_RETURN(0);
}
@@ -852,12 +883,11 @@ static
int
fill_innodb_lock_waits_from_cache(
/*==============================*/
- trx_i_s_cache_t* cache, /*!< in: cache to read from */
THD* thd, /*!< in: used to call
schema_table_store_record() */
- TABLE* table) /*!< in/out: fill this table */
+ TABLE_LIST* tables, /*!< in/out: fill this table */
+ Item*)
{
- Field** fields;
ulint rows_num;
char requested_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
char blocking_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
@@ -865,9 +895,19 @@ fill_innodb_lock_waits_from_cache(
DBUG_ENTER("fill_innodb_lock_waits_from_cache");
- fields = table->field;
+ if (!trx_i_s_common_fill_table(thd, tables)) {
+ DBUG_RETURN(0);
+ }
+
+ struct cache
+ {
+ cache() { trx_i_s_cache_start_read(trx_i_s_cache); }
+ ~cache() { trx_i_s_cache_end_read(trx_i_s_cache); }
+ } c;
- rows_num = trx_i_s_cache_get_rows_used(cache,
+ Field** fields = tables->table->field;
+
+ rows_num = trx_i_s_cache_get_rows_used(trx_i_s_cache,
I_S_INNODB_LOCK_WAITS);
for (i = 0; i < rows_num; i++) {
@@ -879,7 +919,7 @@ fill_innodb_lock_waits_from_cache(
row = (i_s_lock_waits_row_t*)
trx_i_s_cache_get_nth_row(
- cache, I_S_INNODB_LOCK_WAITS, i);
+ trx_i_s_cache, I_S_INNODB_LOCK_WAITS, i);
/* requesting_trx_id */
snprintf(requesting_trx_id, sizeof(requesting_trx_id),
@@ -909,7 +949,7 @@ fill_innodb_lock_waits_from_cache(
blocking_lock_id,
sizeof(blocking_lock_id))));
- OK(schema_table_store_record(thd, table));
+ OK(schema_table_store_record(thd, tables->table));
}
DBUG_RETURN(0);
@@ -931,7 +971,7 @@ innodb_lock_waits_init(
schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = innodb_lock_waits_fields_info;
- schema->fill_table = trx_i_s_common_fill_table;
+ schema->fill_table = fill_innodb_lock_waits_from_cache;
DBUG_RETURN(0);
}
@@ -985,105 +1025,6 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits =
MariaDB_PLUGIN_MATURITY_STABLE,
};
-/*******************************************************************//**
-Common function to fill any of the dynamic tables:
-INFORMATION_SCHEMA.innodb_trx
-INFORMATION_SCHEMA.innodb_locks
-INFORMATION_SCHEMA.innodb_lock_waits
-@return 0 on success */
-static
-int
-trx_i_s_common_fill_table(
-/*======================*/
- THD* thd, /*!< in: thread */
- TABLE_LIST* tables, /*!< in/out: tables to fill */
- Item* ) /*!< in: condition (not used) */
-{
- LEX_CSTRING table_name;
- int ret;
- trx_i_s_cache_t* cache;
-
- DBUG_ENTER("trx_i_s_common_fill_table");
-
- /* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
-
- DBUG_RETURN(0);
- }
-
- /* minimize the number of places where global variables are
- referenced */
- cache = trx_i_s_cache;
-
- /* which table we have to fill? */
- table_name = tables->schema_table_name;
- /* or table_name = tables->schema_table->table_name; */
-
- RETURN_IF_INNODB_NOT_STARTED(table_name.str);
-
- /* update the cache */
- trx_i_s_cache_start_write(cache);
- trx_i_s_possibly_fetch_data_into_cache(cache);
- trx_i_s_cache_end_write(cache);
-
- if (trx_i_s_cache_is_truncated(cache)) {
-
- ib::warn() << "Data in " << table_name.str << " truncated due to"
- " memory limit of " << TRX_I_S_MEM_LIMIT << " bytes";
- }
-
- ret = 0;
-
- trx_i_s_cache_start_read(cache);
-
- if (innobase_strcasecmp(table_name.str, "innodb_trx") == 0) {
-
- if (fill_innodb_trx_from_cache(
- cache, thd, tables->table) != 0) {
-
- ret = 1;
- }
-
- } else if (innobase_strcasecmp(table_name.str, "innodb_locks") == 0) {
-
- if (fill_innodb_locks_from_cache(
- cache, thd, tables->table) != 0) {
-
- ret = 1;
- }
-
- } else if (innobase_strcasecmp(table_name.str, "innodb_lock_waits") == 0) {
-
- if (fill_innodb_lock_waits_from_cache(
- cache, thd, tables->table) != 0) {
-
- ret = 1;
- }
-
- } else {
- ib::error() << "trx_i_s_common_fill_table() was"
- " called to fill unknown table: " << table_name.str << "."
- " This function only knows how to fill"
- " innodb_trx, innodb_locks and"
- " innodb_lock_waits tables.";
-
- ret = 1;
- }
-
- trx_i_s_cache_end_read(cache);
-
-#if 0
- DBUG_RETURN(ret);
-#else
- /* if this function returns something else than 0 then a
- deadlock occurs between the mysqld server and mysql client,
- see http://bugs.mysql.com/29900 ; when that bug is resolved
- we can enable the DBUG_RETURN(ret) above */
- ret++; // silence a gcc46 warning
- DBUG_RETURN(0);
-#endif
-}
-
/* Fields of the dynamic table information_schema.innodb_cmp. */
static ST_FIELD_INFO i_s_cmp_fields_info[]=
{
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 71df96c5be1..cb2f10b5546 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -126,7 +126,6 @@ public:
rec_offs* ins_offsets = NULL;
dberr_t error = DB_SUCCESS;
dtuple_t* dtuple;
- ulint count = 0;
const ulint flag = BTR_NO_UNDO_LOG_FLAG
| BTR_NO_LOCKING_FLAG
| BTR_KEEP_SYS_FLAG | BTR_CREATE_FLAG;
@@ -234,7 +233,6 @@ public:
mtr_commit(&mtr);
rtr_clean_rtr_info(&rtr_info, true);
- count++;
}
m_dtuple_vec->clear();