summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster_binlog.cc12
-rw-r--r--sql/ha_ndbcluster_cond.h12
-rw-r--r--sql/ha_partition.cc28
-rw-r--r--sql/handler.cc4
-rw-r--r--sql/item_subselect.cc16
-rw-r--r--sql/log_event.cc30
-rw-r--r--sql/log_event_old.cc16
-rw-r--r--sql/mysqld.cc17
-rw-r--r--sql/opt_range.cc16
-rw-r--r--sql/opt_table_elimination.cc2
-rw-r--r--sql/partition_info.cc2
-rw-r--r--sql/rpl_injector.h4
-rw-r--r--sql/set_var.h7
-rw-r--r--sql/slave.cc2
-rw-r--r--sql/sql_bitmap.h4
-rw-r--r--sql/sql_insert.cc2
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_parse.cc13
-rw-r--r--sql/sql_partition.cc6
-rw-r--r--sql/sql_select.cc10
-rw-r--r--sql/sql_show.cc2
-rw-r--r--sql/sql_update.cc2
-rw-r--r--sql/sys_vars.cc30
-rw-r--r--sql/sys_vars.h1
-rw-r--r--sql/table.cc14
-rw-r--r--sql/table.h1
26 files changed, 142 insertions, 112 deletions
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index fc53183ca7a..531211eb175 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -446,7 +446,7 @@ int ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table)
alloc_root(mem_root, no_nodes * sizeof(MY_BITMAP));
for (i= 0; i < no_nodes; i++)
{
- bitmap_init(&share->subscriber_bitmap[i],
+ my_bitmap_init(&share->subscriber_bitmap[i],
(Uint32*)alloc_root(mem_root, max_ndb_nodes/8),
max_ndb_nodes, FALSE);
bitmap_clear_all(&share->subscriber_bitmap[i]);
@@ -1119,7 +1119,7 @@ ndbcluster_update_slock(THD *thd,
MY_BITMAP slock;
uint32 bitbuf[SCHEMA_SLOCK_SIZE/4];
- bitmap_init(&slock, bitbuf, sizeof(bitbuf)*8, false);
+ my_bitmap_init(&slock, bitbuf, sizeof(bitbuf)*8, false);
if (ndbtab == 0)
{
@@ -1370,7 +1370,7 @@ int ndbcluster_log_schema_op(THD *thd, NDB_SHARE *share,
{
int i, updated= 0;
int no_storage_nodes= g_ndb_cluster_connection->no_db_nodes();
- bitmap_init(&schema_subscribers, bitbuf, sizeof(bitbuf)*8, FALSE);
+ my_bitmap_init(&schema_subscribers, bitbuf, sizeof(bitbuf)*8, FALSE);
bitmap_set_all(&schema_subscribers);
/* begin protect ndb_schema_share */
@@ -1908,7 +1908,7 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
Cluster_schema *schema= (Cluster_schema *)
sql_alloc(sizeof(Cluster_schema));
MY_BITMAP slock;
- bitmap_init(&slock, schema->slock, 8*SCHEMA_SLOCK_SIZE, FALSE);
+ my_bitmap_init(&slock, schema->slock, 8*SCHEMA_SLOCK_SIZE, FALSE);
uint node_id= g_ndb_cluster_connection->node_id();
{
ndbcluster_get_schema(tmp_share, schema);
@@ -3353,7 +3353,7 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp,
MY_BITMAP b;
/* Potential buffer for the bitmap */
uint32 bitbuf[128 / (sizeof(uint32) * 8)];
- bitmap_init(&b, n_fields <= sizeof(bitbuf) * 8 ? bitbuf : NULL,
+ my_bitmap_init(&b, n_fields <= sizeof(bitbuf) * 8 ? bitbuf : NULL,
n_fields, FALSE);
bitmap_set_all(&b);
@@ -3573,7 +3573,7 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key,
break;
}
mysql_mutex_init(key_ndb_schema_object_mutex, &ndb_schema_object->mutex, MY_MUTEX_INIT_FAST);
- bitmap_init(&ndb_schema_object->slock_bitmap, ndb_schema_object->slock,
+ my_bitmap_init(&ndb_schema_object->slock_bitmap, ndb_schema_object->slock,
sizeof(ndb_schema_object->slock)*8, FALSE);
bitmap_clear_all(&ndb_schema_object->slock_bitmap);
break;
diff --git a/sql/ha_ndbcluster_cond.h b/sql/ha_ndbcluster_cond.h
index 27675588ed7..9ea0438a348 100644
--- a/sql/ha_ndbcluster_cond.h
+++ b/sql/ha_ndbcluster_cond.h
@@ -350,18 +350,18 @@ class Ndb_cond_traverse_context : public Sql_alloc
skip(0), collation(NULL), rewrite_stack(NULL)
{
// Allocate type checking bitmaps
- bitmap_init(&expect_mask, 0, 512, FALSE);
- bitmap_init(&expect_field_type_mask, 0, 512, FALSE);
- bitmap_init(&expect_field_result_mask, 0, 512, FALSE);
+ my_bitmap_init(&expect_mask, 0, 512, FALSE);
+ my_bitmap_init(&expect_field_type_mask, 0, 512, FALSE);
+ my_bitmap_init(&expect_field_result_mask, 0, 512, FALSE);
if (stack)
cond_ptr= stack->ndb_cond;
};
~Ndb_cond_traverse_context()
{
- bitmap_free(&expect_mask);
- bitmap_free(&expect_field_type_mask);
- bitmap_free(&expect_field_result_mask);
+ my_bitmap_free(&expect_mask);
+ my_bitmap_free(&expect_field_type_mask);
+ my_bitmap_free(&expect_field_result_mask);
if (rewrite_stack) delete rewrite_stack;
}
void expect(Item::Type type)
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 603e0bf59dc..0d16107bdd8 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -3301,10 +3301,10 @@ err:
void ha_partition::free_partition_bitmaps()
{
/* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
- bitmap_free(&m_bulk_insert_started);
- bitmap_free(&m_locked_partitions);
- bitmap_free(&m_partitions_to_reset);
- bitmap_free(&m_key_not_found_partitions);
+ my_bitmap_free(&m_bulk_insert_started);
+ my_bitmap_free(&m_locked_partitions);
+ my_bitmap_free(&m_partitions_to_reset);
+ my_bitmap_free(&m_key_not_found_partitions);
}
@@ -3316,14 +3316,14 @@ bool ha_partition::init_partition_bitmaps()
{
DBUG_ENTER("ha_partition::init_partition_bitmaps");
/* Initialize the bitmap we use to minimize ha_start_bulk_insert calls */
- if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
+ if (my_bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
DBUG_RETURN(true);
bitmap_clear_all(&m_bulk_insert_started);
/* Initialize the bitmap we use to keep track of locked partitions */
- if (bitmap_init(&m_locked_partitions, NULL, m_tot_parts, FALSE))
+ if (my_bitmap_init(&m_locked_partitions, NULL, m_tot_parts, FALSE))
{
- bitmap_free(&m_bulk_insert_started);
+ my_bitmap_free(&m_bulk_insert_started);
DBUG_RETURN(true);
}
bitmap_clear_all(&m_locked_partitions);
@@ -3332,10 +3332,10 @@ bool ha_partition::init_partition_bitmaps()
Initialize the bitmap we use to keep track of partitions which may have
something to reset in ha_reset().
*/
- if (bitmap_init(&m_partitions_to_reset, NULL, m_tot_parts, FALSE))
+ if (my_bitmap_init(&m_partitions_to_reset, NULL, m_tot_parts, FALSE))
{
- bitmap_free(&m_bulk_insert_started);
- bitmap_free(&m_locked_partitions);
+ my_bitmap_free(&m_bulk_insert_started);
+ my_bitmap_free(&m_locked_partitions);
DBUG_RETURN(true);
}
bitmap_clear_all(&m_partitions_to_reset);
@@ -3344,11 +3344,11 @@ bool ha_partition::init_partition_bitmaps()
Initialize the bitmap we use to keep track of partitions which returned
HA_ERR_KEY_NOT_FOUND from index_read_map.
*/
- if (bitmap_init(&m_key_not_found_partitions, NULL, m_tot_parts, FALSE))
+ if (my_bitmap_init(&m_key_not_found_partitions, NULL, m_tot_parts, FALSE))
{
- bitmap_free(&m_bulk_insert_started);
- bitmap_free(&m_locked_partitions);
- bitmap_free(&m_partitions_to_reset);
+ my_bitmap_free(&m_bulk_insert_started);
+ my_bitmap_free(&m_locked_partitions);
+ my_bitmap_free(&m_partitions_to_reset);
DBUG_RETURN(true);
}
bitmap_clear_all(&m_key_not_found_partitions);
diff --git a/sql/handler.cc b/sql/handler.cc
index ae337f4a153..6af1682e080 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -5719,7 +5719,7 @@ static int binlog_log_row(TABLE* table,
the first row handled in this statement. In that case, we need
to write table maps for all locked tables to the binary log.
*/
- if (likely(!(error= bitmap_init(&cols,
+ if (likely(!(error= my_bitmap_init(&cols,
use_bitbuf ? bitbuf : NULL,
(n_fields + 7) & ~7UL,
FALSE))))
@@ -5741,7 +5741,7 @@ static int binlog_log_row(TABLE* table,
before_record, after_record);
}
if (!use_bitbuf)
- bitmap_free(&cols);
+ my_bitmap_free(&cols);
}
}
return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 81c4f0f51e5..88cae108039 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -4685,13 +4685,13 @@ ulonglong subselect_hash_sj_engine::rowid_merge_buff_size(
*/
static my_bool
-bitmap_init_memroot(MY_BITMAP *map, uint n_bits, MEM_ROOT *mem_root)
+my_bitmap_init_memroot(MY_BITMAP *map, uint n_bits, MEM_ROOT *mem_root)
{
my_bitmap_map *bitmap_buf;
if (!(bitmap_buf= (my_bitmap_map*) alloc_root(mem_root,
bitmap_buffer_size(n_bits))) ||
- bitmap_init(map, bitmap_buf, n_bits, FALSE))
+ my_bitmap_init(map, bitmap_buf, n_bits, FALSE))
return TRUE;
bitmap_clear_all(map);
return FALSE;
@@ -4729,9 +4729,9 @@ bool subselect_hash_sj_engine::init(List<Item> *tmp_columns, uint subquery_id)
DBUG_ENTER("subselect_hash_sj_engine::init");
- if (bitmap_init_memroot(&non_null_key_parts, tmp_columns->elements,
+ if (my_bitmap_init_memroot(&non_null_key_parts, tmp_columns->elements,
thd->mem_root) ||
- bitmap_init_memroot(&partial_match_key_parts, tmp_columns->elements,
+ my_bitmap_init_memroot(&partial_match_key_parts, tmp_columns->elements,
thd->mem_root))
DBUG_RETURN(TRUE);
@@ -5453,7 +5453,7 @@ Ordered_key::Ordered_key(uint keyid_arg, TABLE *tbl_arg, Item *search_key_arg,
Ordered_key::~Ordered_key()
{
my_free(key_buff);
- bitmap_free(&null_key);
+ my_bitmap_free(&null_key);
}
@@ -5563,7 +5563,7 @@ bool Ordered_key::alloc_keys_buffers()
lookup offset.
*/
/* Notice that max_null_row is max array index, we need count, so +1. */
- if (bitmap_init(&null_key, NULL, (uint)(max_null_row + 1), FALSE))
+ if (my_bitmap_init(&null_key, NULL, (uint)(max_null_row + 1), FALSE))
return TRUE;
cur_key_idx= HA_POS_ERROR;
@@ -6002,8 +6002,8 @@ subselect_rowid_merge_engine::init(MY_BITMAP *non_null_key_parts,
*/
if (!has_covering_null_columns)
{
- if (bitmap_init_memroot(&matching_keys, merge_keys_count, thd->mem_root) ||
- bitmap_init_memroot(&matching_outer_cols, merge_keys_count, thd->mem_root))
+ if (my_bitmap_init_memroot(&matching_keys, merge_keys_count, thd->mem_root) ||
+ my_bitmap_init_memroot(&matching_outer_cols, merge_keys_count, thd->mem_root))
return TRUE;
/*
diff --git a/sql/log_event.cc b/sql/log_event.cc
index f24e85eff70..7f0933792be 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -9114,8 +9114,8 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
set_flags(NO_FOREIGN_KEY_CHECKS_F);
if (thd_arg->variables.option_bits & OPTION_RELAXED_UNIQUE_CHECKS)
set_flags(RELAXED_UNIQUE_CHECKS_F);
- /* if bitmap_init fails, caught in is_valid() */
- if (likely(!bitmap_init(&m_cols,
+ /* if my_bitmap_init fails, caught in is_valid() */
+ if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
false)))
@@ -9129,7 +9129,7 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
}
else
{
- // Needed because bitmap_init() does not set it to null on failure
+ // Needed because my_bitmap_init() does not set it to null on failure
m_cols.bitmap= 0;
}
}
@@ -9230,8 +9230,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
m_width = net_field_length(&ptr_after_width);
DBUG_PRINT("debug", ("m_width=%lu", m_width));
- /* if bitmap_init fails, catched in is_valid() */
- if (likely(!bitmap_init(&m_cols,
+ /* if my_bitmap_init fails, catched in is_valid() */
+ if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
false)))
@@ -9244,7 +9244,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
}
else
{
- // Needed because bitmap_init() does not set it to null on failure
+ // Needed because my_bitmap_init() does not set it to null on failure
m_cols.bitmap= NULL;
DBUG_VOID_RETURN;
}
@@ -9256,8 +9256,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
{
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
- /* if bitmap_init fails, caught in is_valid() */
- if (likely(!bitmap_init(&m_cols_ai,
+ /* if my_bitmap_init fails, caught in is_valid() */
+ if (likely(!my_bitmap_init(&m_cols_ai,
m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL,
m_width,
false)))
@@ -9271,7 +9271,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
}
else
{
- // Needed because bitmap_init() does not set it to null on failure
+ // Needed because my_bitmap_init() does not set it to null on failure
m_cols_ai.bitmap= 0;
DBUG_VOID_RETURN;
}
@@ -9302,8 +9302,8 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
Rows_log_event::~Rows_log_event()
{
if (m_cols.bitmap == m_bitbuf) // no my_malloc happened
- m_cols.bitmap= 0; // so no my_free in bitmap_free
- bitmap_free(&m_cols); // To pair with bitmap_init().
+ m_cols.bitmap= 0; // so no my_free in my_bitmap_free
+ my_bitmap_free(&m_cols); // To pair with my_bitmap_init().
my_free(m_rows_buf);
my_free(m_extra_row_data);
}
@@ -11962,8 +11962,8 @@ Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg,
void Update_rows_log_event::init(MY_BITMAP const *cols)
{
- /* if bitmap_init fails, caught in is_valid() */
- if (likely(!bitmap_init(&m_cols_ai,
+ /* if my_bitmap_init fails, caught in is_valid() */
+ if (likely(!my_bitmap_init(&m_cols_ai,
m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL,
m_width,
false)))
@@ -11982,8 +11982,8 @@ void Update_rows_log_event::init(MY_BITMAP const *cols)
Update_rows_log_event::~Update_rows_log_event()
{
if (m_cols_ai.bitmap == m_bitbuf_ai) // no my_malloc happened
- m_cols_ai.bitmap= 0; // so no my_free in bitmap_free
- bitmap_free(&m_cols_ai); // To pair with bitmap_init().
+ m_cols_ai.bitmap= 0; // so no my_free in my_bitmap_free
+ my_bitmap_free(&m_cols_ai); // To pair with my_bitmap_init().
}
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 7b89d5bdf08..0cb78686243 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -1244,8 +1244,8 @@ Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
set_flags(NO_FOREIGN_KEY_CHECKS_F);
if (thd_arg->variables.option_bits & OPTION_RELAXED_UNIQUE_CHECKS)
set_flags(RELAXED_UNIQUE_CHECKS_F);
- /* if bitmap_init fails, caught in is_valid() */
- if (likely(!bitmap_init(&m_cols,
+ /* if my_bitmap_init fails, caught in is_valid() */
+ if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
false)))
@@ -1259,7 +1259,7 @@ Old_rows_log_event::Old_rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
}
else
{
- // Needed because bitmap_init() does not set it to null on failure
+ // Needed because my_bitmap_init() does not set it to null on failure
m_cols.bitmap= 0;
}
}
@@ -1313,8 +1313,8 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
DBUG_PRINT("debug", ("Reading from %p", ptr_after_width));
m_width = net_field_length(&ptr_after_width);
DBUG_PRINT("debug", ("m_width=%lu", m_width));
- /* if bitmap_init fails, catched in is_valid() */
- if (likely(!bitmap_init(&m_cols,
+ /* if my_bitmap_init fails, catched in is_valid() */
+ if (likely(!my_bitmap_init(&m_cols,
m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
m_width,
false)))
@@ -1327,7 +1327,7 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
}
else
{
- // Needed because bitmap_init() does not set it to null on failure
+ // Needed because my_bitmap_init() does not set it to null on failure
m_cols.bitmap= NULL;
DBUG_VOID_RETURN;
}
@@ -1358,8 +1358,8 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
Old_rows_log_event::~Old_rows_log_event()
{
if (m_cols.bitmap == m_bitbuf) // no my_malloc happened
- m_cols.bitmap= 0; // so no my_free in bitmap_free
- bitmap_free(&m_cols); // To pair with bitmap_init().
+ m_cols.bitmap= 0; // so no my_free in my_bitmap_free
+ my_bitmap_free(&m_cols); // To pair with my_bitmap_init().
my_free(m_rows_buf);
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b5e22c874f2..a52251462b1 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -366,7 +366,8 @@ static DYNAMIC_ARRAY all_options;
/* Global variables */
bool opt_bin_log, opt_bin_log_used=0, opt_ignore_builtin_innodb= 0;
-my_bool opt_log, opt_slow_log, debug_assert_if_crashed_table= 0, opt_help= 0, opt_abort;
+my_bool opt_log, opt_slow_log, debug_assert_if_crashed_table= 0, opt_help= 0;
+static my_bool opt_abort;
ulonglong log_output_options;
my_bool opt_userstat_running;
my_bool opt_log_queries_not_using_indexes= 0;
@@ -1964,7 +1965,7 @@ void clean_up(bool print_message)
// We must call end_slave() as clean_up may have been called during startup
end_slave();
if (use_slave_mask)
- bitmap_free(&slave_error_mask);
+ my_bitmap_free(&slave_error_mask);
#endif
stop_handle_manager();
release_ddl_log();
@@ -2018,7 +2019,7 @@ void clean_up(bool print_message)
if (defaults_argv)
free_defaults(defaults_argv);
free_tmpdir(&mysql_tmpdir_list);
- bitmap_free(&temp_pool);
+ my_bitmap_free(&temp_pool);
free_max_user_conn();
free_global_user_stats();
free_global_client_stats();
@@ -4251,7 +4252,7 @@ static int init_common_variables()
#endif /* defined(ENABLED_DEBUG_SYNC) */
#if (ENABLE_TEMP_POOL)
- if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
+ if (use_temp_pool && my_bitmap_init(&temp_pool,0,1024,1))
return 1;
#else
use_temp_pool= 0;
@@ -7965,7 +7966,6 @@ static int option_cmp(my_option *a, my_option *b)
return 1;
}
}
- DBUG_ASSERT(a->name == b->name);
return 0;
}
@@ -7980,9 +7980,16 @@ static void print_help()
sys_var_add_options(&all_options, sys_var::PARSE_EARLY);
add_plugin_options(&all_options, &mem_root);
sort_dynamic(&all_options, (qsort_cmp) option_cmp);
+ sort_dynamic(&all_options, (qsort_cmp) option_cmp);
add_terminator(&all_options);
my_print_help((my_option*) all_options.buffer);
+
+ /* Add variables that can be shown but not changed, like version numbers */
+ pop_dynamic(&all_options);
+ sys_var_add_options(&all_options, sys_var::SHOW_VALUE_IN_HELP);
+ sort_dynamic(&all_options, (qsort_cmp) option_cmp);
+ add_terminator(&all_options);
my_print_variables((my_option*) all_options.buffer);
free_root(&mem_root, MYF(0));
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 6982db898fb..4766934845f 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1823,7 +1823,7 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
*create_error= 1;
}
else
- bitmap_init(&column_bitmap, bitmap, head->s->fields, FALSE);
+ my_bitmap_init(&column_bitmap, bitmap, head->s->fields, FALSE);
DBUG_VOID_RETURN;
}
@@ -2847,7 +2847,7 @@ static int fill_used_fields_bitmap(PARAM *param)
param->fields_bitmap_size= table->s->column_bitmap_size;
if (!(tmp= (my_bitmap_map*) alloc_root(param->mem_root,
param->fields_bitmap_size)) ||
- bitmap_init(&param->needed_fields, tmp, table->s->fields, FALSE))
+ my_bitmap_init(&param->needed_fields, tmp, table->s->fields, FALSE))
return 1;
bitmap_copy(&param->needed_fields, table->read_set);
@@ -4104,7 +4104,7 @@ static int find_used_partitions_imerge_list(PART_PRUNE_PARAM *ppar,
*/
return find_used_partitions_imerge(ppar, merges.head());
}
- bitmap_init(&all_merges, bitmap_buf, n_bits, FALSE);
+ my_bitmap_init(&all_merges, bitmap_buf, n_bits, FALSE);
bitmap_set_prefix(&all_merges, n_bits);
List_iterator<SEL_IMERGE> it(merges);
@@ -4751,7 +4751,7 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
uint32 bufsize= bitmap_buffer_size(ppar->part_info->num_subparts);
if (!(buf= (my_bitmap_map*) alloc_root(alloc, bufsize)))
return TRUE;
- bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->num_subparts,
+ my_bitmap_init(&ppar->subparts_bitmap, buf, ppar->part_info->num_subparts,
FALSE);
}
range_par->key_parts= key_part;
@@ -5511,7 +5511,7 @@ bool create_fields_bitmap(PARAM *param, MY_BITMAP *fields_bitmap)
if (!(bitmap_buf= (my_bitmap_map *) alloc_root(param->mem_root,
param->fields_bitmap_size)))
return TRUE;
- if (bitmap_init(fields_bitmap, bitmap_buf, param->table->s->fields, FALSE))
+ if (my_bitmap_init(fields_bitmap, bitmap_buf, param->table->s->fields, FALSE))
return TRUE;
return FALSE;
@@ -6329,7 +6329,7 @@ ROR_SCAN_INFO *make_ror_scan(const PARAM *param, int idx, SEL_ARG *sel_arg)
param->fields_bitmap_size)))
DBUG_RETURN(NULL);
- if (bitmap_init(&ror_scan->covered_fields, bitmap_buf,
+ if (my_bitmap_init(&ror_scan->covered_fields, bitmap_buf,
param->table->s->fields, FALSE))
DBUG_RETURN(NULL);
bitmap_clear_all(&ror_scan->covered_fields);
@@ -6447,7 +6447,7 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param)
if (!(buf= (my_bitmap_map*) alloc_root(param->mem_root,
param->fields_bitmap_size)))
return NULL;
- if (bitmap_init(&info->covered_fields, buf, param->table->s->fields,
+ if (my_bitmap_init(&info->covered_fields, buf, param->table->s->fields,
FALSE))
return NULL;
info->is_covering= FALSE;
@@ -7024,7 +7024,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
covered_fields->bitmap= (my_bitmap_map*)alloc_root(param->mem_root,
param->fields_bitmap_size);
if (!covered_fields->bitmap ||
- bitmap_init(covered_fields, covered_fields->bitmap,
+ my_bitmap_init(covered_fields, covered_fields->bitmap,
param->table->s->fields, FALSE))
DBUG_RETURN(0);
bitmap_clear_all(covered_fields);
diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc
index 46bed0e60e7..9b58f5f3126 100644
--- a/sql/opt_table_elimination.cc
+++ b/sql/opt_table_elimination.cc
@@ -1042,7 +1042,7 @@ bool Dep_analysis_context::setup_equality_modules_deps(List<Dep_module>
void *buf;
if (!(buf= current_thd->alloc(bitmap_buffer_size(offset))) ||
- bitmap_init(&expr_deps, (my_bitmap_map*)buf, offset, FALSE))
+ my_bitmap_init(&expr_deps, (my_bitmap_map*)buf, offset, FALSE))
{
DBUG_RETURN(TRUE); /* purecov: inspected */
}
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 44407bd737f..09f1c2986df 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -385,7 +385,7 @@ bool partition_info::can_prune_insert(THD* thd,
DBUG_RETURN(true);
}
/* Also clears all bits. */
- if (bitmap_init(used_partitions, bitmap_buf, num_partitions, false))
+ if (my_bitmap_init(used_partitions, bitmap_buf, num_partitions, false))
{
/* purecov: begin deadcode */
/* Cannot happen, due to pre-alloc. */
diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h
index f4790cc963a..98788955e24 100644
--- a/sql/rpl_injector.h
+++ b/sql/rpl_injector.h
@@ -94,13 +94,13 @@ public:
injector::transaction::table tbl(share->table, true);
MY_BITMAP cols;
- bitmap_init(&cols, NULL, (i + 7) / 8, false);
+ my_bitmap_init(&cols, NULL, (i + 7) / 8, false);
inj->write_row(::server_id, tbl, &cols, row_data);
or
MY_BITMAP cols;
- bitmap_init(&cols, NULL, (i + 7) / 8, false);
+ my_bitmap_init(&cols, NULL, (i + 7) / 8, false);
inj->write_row(::server_id,
injector::transaction::table(share->table, true),
&cols, row_data);
diff --git a/sql/set_var.h b/sql/set_var.h
index 11501c4212a..b5005874d8f 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -60,7 +60,7 @@ public:
sys_var *next;
LEX_CSTRING name;
enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023,
- READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096 };
+ READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096, SHOW_VALUE_IN_HELP=8192 };
/**
Enumeration type to indicate for a system variable whether
it will be written to the binlog or not.
@@ -142,8 +142,9 @@ public:
}
bool register_option(DYNAMIC_ARRAY *array, int parse_flags)
{
- return (option.id != -1) && ((flags & PARSE_EARLY) == parse_flags) &&
- insert_dynamic(array, (uchar*)&option);
+ return ((((option.id != -1) && ((flags & PARSE_EARLY) == parse_flags)) ||
+ (flags & parse_flags)) &&
+ insert_dynamic(array, (uchar*)&option));
}
private:
diff --git a/sql/slave.cc b/sql/slave.cc
index 835b0d9b15a..f6665a6a436 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -573,7 +573,7 @@ void init_slave_skip_errors(const char* arg)
const char *p;
DBUG_ENTER("init_slave_skip_errors");
- if (bitmap_init(&slave_error_mask,0,MAX_SLAVE_ERROR,0))
+ if (my_bitmap_init(&slave_error_mask,0,MAX_SLAVE_ERROR,0))
{
fprintf(stderr, "Badly out of memory, please check your system status\n");
exit(1);
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index 7e163b0dbcc..2e07695f605 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -34,7 +34,7 @@ public:
Bitmap() { init(); }
Bitmap(const Bitmap& from) { *this=from; }
explicit Bitmap(uint prefix_to_set) { init(prefix_to_set); }
- void init() { bitmap_init(&map, buffer, default_width, 0); }
+ void init() { my_bitmap_init(&map, buffer, default_width, 0); }
void init(uint prefix_to_set) { init(); set_prefix(prefix_to_set); }
uint length() const { return default_width; }
Bitmap& operator=(const Bitmap& map2)
@@ -52,7 +52,7 @@ public:
void intersect(ulonglong map2buff)
{
MY_BITMAP map2;
- bitmap_init(&map2, (uint32 *)&map2buff, sizeof(ulonglong)*8, 0);
+ my_bitmap_init(&map2, (uint32 *)&map2buff, sizeof(ulonglong)*8, 0);
bitmap_intersect(&map, &map2);
}
/* Use highest bit for all bits above sizeof(ulonglong)*8. */
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 0acb7e747ad..8e3826eff48 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1229,7 +1229,7 @@ static bool check_view_insertability(THD * thd, TABLE_LIST *view)
DBUG_ASSERT(view->table != 0 && view->field_translation != 0);
- (void) bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0);
+ (void) my_bitmap_init(&used_fields, used_fields_buff, table->s->fields, 0);
bitmap_clear_all(&used_fields);
view->contain_auto_increment= 0;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 479fa81edd7..06c78ba81a8 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -2470,6 +2470,7 @@ struct LEX: public Query_tables_list
uint8 context_analysis_only;
bool drop_temporary, local_file, one_shot_set;
bool check_exists;
+ bool replace;
bool autocommit;
bool verbose, no_write_to_binlog;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index f9bfa6d120b..f8af7873a50 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2828,11 +2828,16 @@ case SQLCOM_PREPARE:
goto end_with_restore_list;
}
+ /* Check privileges */
if ((res= create_table_precheck(thd, select_tables, create_table)))
goto end_with_restore_list;
+#ifndef QQ
/* Might have been updated in create_table_precheck */
create_info.alias= create_table->alias;
+#else
+ create_table->alias= (char*) create_info.alias;
+#endif
#ifdef HAVE_READLINK
/* Fix names if symlinked tables */
@@ -7954,6 +7959,10 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
want_priv= lex->create_info.tmp_table() ? CREATE_TMP_ACL :
(CREATE_ACL | (select_lex->item_list.elements ? INSERT_ACL : 0));
+ /* CREATE OR REPLACE on not temporary tables require DROP_ACL */
+ if (lex->replace && !lex->create_info.tmp_table())
+ want_priv= DROP_ACL;
+
if (check_access(thd, want_priv, create_table->db,
&create_table->grant.privilege,
&create_table->grant.m_internal,
@@ -7990,8 +7999,8 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
- For temporary MERGE tables we do not track if their child tables are
base or temporary. As result we can't guarantee that privilege check
- which was done in presence of temporary child will stay relevant later
- as this temporary table might be removed.
+ which was done in presence of temporary child will stay relevant
+ later as this temporary table might be removed.
If SELECT_ACL | UPDATE_ACL | DELETE_ACL privileges were not checked for
the underlying *base* tables, it would create a security breach as in
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 3e19a33ee32..2e8a6efe8e4 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -651,7 +651,7 @@ static bool create_full_part_field_array(THD *thd, TABLE *table,
result= TRUE;
goto end;
}
- if (bitmap_init(&part_info->full_part_field_set, bitmap_buf,
+ if (my_bitmap_init(&part_info->full_part_field_set, bitmap_buf,
table->s->fields, FALSE))
{
mem_alloc_error(table->s->fields);
@@ -1230,9 +1230,9 @@ static bool set_up_partition_bitmaps(THD *thd, partition_info *part_info)
mem_alloc_error(bitmap_bytes * 2);
DBUG_RETURN(TRUE);
}
- bitmap_init(&part_info->read_partitions, bitmap_buf, bitmap_bits, FALSE);
+ my_bitmap_init(&part_info->read_partitions, bitmap_buf, bitmap_bits, FALSE);
/* Use the second half of the allocated buffer for lock_partitions */
- bitmap_init(&part_info->lock_partitions, bitmap_buf + (bitmap_bytes / 4),
+ my_bitmap_init(&part_info->lock_partitions, bitmap_buf + (bitmap_bytes / 4),
bitmap_bits, FALSE);
part_info->bitmaps_are_initialized= TRUE;
part_info->set_partition_bitmaps(NULL);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c109ee10877..307cf99b61f 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -15333,18 +15333,18 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
void setup_tmp_table_column_bitmaps(TABLE *table, uchar *bitmaps)
{
uint field_count= table->s->fields;
- bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
+ my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
FALSE);
- bitmap_init(&table->def_vcol_set,
+ my_bitmap_init(&table->def_vcol_set,
(my_bitmap_map*) (bitmaps+ bitmap_buffer_size(field_count)),
field_count, FALSE);
- bitmap_init(&table->tmp_set,
+ my_bitmap_init(&table->tmp_set,
(my_bitmap_map*) (bitmaps+ 2*bitmap_buffer_size(field_count)),
field_count, FALSE);
- bitmap_init(&table->eq_join_set,
+ my_bitmap_init(&table->eq_join_set,
(my_bitmap_map*) (bitmaps+ 3*bitmap_buffer_size(field_count)),
field_count, FALSE);
- bitmap_init(&table->cond_set,
+ my_bitmap_init(&table->cond_set,
(my_bitmap_map*) (bitmaps+ 4*bitmap_buffer_size(field_count)),
field_count, FALSE);
/* write_set and all_set are copies of read_set */
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 17767a2afb3..bcbe544b99c 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -7678,7 +7678,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(0);
my_bitmap_map* bitmaps=
(my_bitmap_map*) thd->alloc(bitmap_buffer_size(field_count));
- bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
+ my_bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
FALSE);
table->read_set= &table->def_read_set;
bitmap_clear_all(table->read_set);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 889eaf5fceb..ccdc91e10df 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -191,7 +191,7 @@ static void prepare_record_for_error_message(int error, TABLE *table)
DBUG_VOID_RETURN;
/* Create unique_map with all fields used by that index. */
- bitmap_init(&unique_map, unique_map_buf, table->s->fields, FALSE);
+ my_bitmap_init(&unique_map, unique_map_buf, table->s->fields, FALSE);
table->mark_columns_used_by_index_no_reset(keynr, &unique_map);
/* Subtract read_set and write_set. */
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index a1fa9a45e99..864808cff32 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -593,7 +593,7 @@ static bool check_charset_db(sys_var *self, THD *thd, set_var *var)
}
static Sys_var_struct Sys_character_set_database(
"character_set_database",
- " The character set used by the default database",
+ "The character set used by the default database",
SESSION_VAR(collation_database), NO_CMD_LINE,
offsetof(CHARSET_INFO, csname), DEFAULT(&default_charset_info),
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_db));
@@ -1062,7 +1062,7 @@ static Sys_var_keycache Sys_key_cache_age_threshold(
static Sys_var_mybool Sys_large_files_support(
"large_files_support",
"Whether mysqld was compiled with options for large file support",
- READ_ONLY GLOBAL_VAR(opt_large_files),
+ READ_ONLY SHOW_VALUE_IN_HELP GLOBAL_VAR(opt_large_files),
NO_CMD_LINE, DEFAULT(sizeof(my_off_t) > 4));
static Sys_var_uint Sys_large_page_size(
@@ -1184,7 +1184,8 @@ static Sys_var_mybool Sys_lower_case_file_system(
"lower_case_file_system",
"Case sensitivity of file names on the file system where the "
"data directory is located",
- READ_ONLY GLOBAL_VAR(lower_case_file_system), NO_CMD_LINE,
+ READ_ONLY SHOW_VALUE_IN_HELP GLOBAL_VAR(lower_case_file_system),
+ NO_CMD_LINE,
DEFAULT(FALSE));
static Sys_var_uint Sys_lower_case_table_names(
@@ -2145,7 +2146,7 @@ static Sys_var_ulong Sys_preload_buff_size(
static Sys_var_uint Sys_protocol_version(
"protocol_version",
"The version of the client/server protocol used by the MySQL server",
- READ_ONLY GLOBAL_VAR(protocol_version), NO_CMD_LINE,
+ READ_ONLY SHOW_VALUE_IN_HELP GLOBAL_VAR(protocol_version), NO_CMD_LINE,
VALID_RANGE(0, ~0), DEFAULT(PROTOCOL_VERSION), BLOCK_SIZE(1));
static Sys_var_proxy_user Sys_proxy_user(
@@ -2853,7 +2854,8 @@ static Sys_var_mybool Sys_sync_frm(
static char *system_time_zone_ptr;
static Sys_var_charptr Sys_system_time_zone(
"system_time_zone", "The server system time zone",
- READ_ONLY GLOBAL_VAR(system_time_zone_ptr), NO_CMD_LINE,
+ READ_ONLY SHOW_VALUE_IN_HELP GLOBAL_VAR(system_time_zone_ptr),
+ NO_CMD_LINE,
IN_SYSTEM_CHARSET, DEFAULT(system_time_zone));
static Sys_var_ulong Sys_table_def_size(
@@ -3063,27 +3065,37 @@ static Sys_var_mybool Sys_timed_mutexes(
static char *server_version_ptr;
static Sys_var_charptr Sys_version(
"version", "Server version",
- READ_ONLY GLOBAL_VAR(server_version_ptr), NO_CMD_LINE,
+ READ_ONLY SHOW_VALUE_IN_HELP GLOBAL_VAR(server_version_ptr),
+ NO_CMD_LINE,
IN_SYSTEM_CHARSET, DEFAULT(server_version));
static char *server_version_comment_ptr;
static Sys_var_charptr Sys_version_comment(
"version_comment", "version_comment",
- READ_ONLY GLOBAL_VAR(server_version_comment_ptr), NO_CMD_LINE,
+ READ_ONLY SHOW_VALUE_IN_HELP GLOBAL_VAR(server_version_comment_ptr),
+ NO_CMD_LINE,
IN_SYSTEM_CHARSET, DEFAULT(MYSQL_COMPILATION_COMMENT));
static char *server_version_compile_machine_ptr;
static Sys_var_charptr Sys_version_compile_machine(
"version_compile_machine", "version_compile_machine",
- READ_ONLY GLOBAL_VAR(server_version_compile_machine_ptr), NO_CMD_LINE,
+ READ_ONLY SHOW_VALUE_IN_HELP
+ GLOBAL_VAR(server_version_compile_machine_ptr), NO_CMD_LINE,
IN_SYSTEM_CHARSET, DEFAULT(MACHINE_TYPE));
static char *server_version_compile_os_ptr;
static Sys_var_charptr Sys_version_compile_os(
"version_compile_os", "version_compile_os",
- READ_ONLY GLOBAL_VAR(server_version_compile_os_ptr), NO_CMD_LINE,
+ READ_ONLY SHOW_VALUE_IN_HELP GLOBAL_VAR(server_version_compile_os_ptr),
+ NO_CMD_LINE,
IN_SYSTEM_CHARSET, DEFAULT(SYSTEM_TYPE));
+static char *malloc_library;
+static Sys_var_charptr Sys_malloc_library(
+ "version_malloc_library", "Version of the used malloc library",
+ READ_ONLY SHOW_VALUE_IN_HELP GLOBAL_VAR(malloc_library), NO_CMD_LINE,
+ IN_SYSTEM_CHARSET, DEFAULT(MALLOC_LIBRARY));
+
static Sys_var_ulong Sys_net_wait_timeout(
"wait_timeout",
"The number of seconds the server waits for activity on a "
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index bef5fbdd126..6c0228fd6a0 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -56,6 +56,7 @@
// this means that Sys_var_charptr initial value was malloc()ed
#define PREALLOCATED sys_var::ALLOCATED+
#define PARSED_EARLY sys_var::PARSE_EARLY+
+#define SHOW_VALUE_IN_HELP sys_var::SHOW_VALUE_IN_HELP+
/*
Sys_var_bit meaning is reversed, like in
diff --git a/sql/table.cc b/sql/table.cc
index ecab578d97d..954383e231b 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2013,7 +2013,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (!(bitmaps= (my_bitmap_map*) alloc_root(&share->mem_root,
share->column_bitmap_size)))
goto err;
- bitmap_init(&share->all_set, bitmaps, share->fields, FALSE);
+ my_bitmap_init(&share->all_set, bitmaps, share->fields, FALSE);
bitmap_set_all(&share->all_set);
delete handler_file;
@@ -2821,17 +2821,17 @@ partititon_err:
bitmap_size= share->column_bitmap_size;
if (!(bitmaps= (uchar*) alloc_root(&outparam->mem_root, bitmap_size*6)))
goto err;
- bitmap_init(&outparam->def_read_set,
+ my_bitmap_init(&outparam->def_read_set,
(my_bitmap_map*) bitmaps, share->fields, FALSE);
- bitmap_init(&outparam->def_write_set,
+ my_bitmap_init(&outparam->def_write_set,
(my_bitmap_map*) (bitmaps+bitmap_size), share->fields, FALSE);
- bitmap_init(&outparam->def_vcol_set,
+ my_bitmap_init(&outparam->def_vcol_set,
(my_bitmap_map*) (bitmaps+bitmap_size*2), share->fields, FALSE);
- bitmap_init(&outparam->tmp_set,
+ my_bitmap_init(&outparam->tmp_set,
(my_bitmap_map*) (bitmaps+bitmap_size*3), share->fields, FALSE);
- bitmap_init(&outparam->eq_join_set,
+ my_bitmap_init(&outparam->eq_join_set,
(my_bitmap_map*) (bitmaps+bitmap_size*4), share->fields, FALSE);
- bitmap_init(&outparam->cond_set,
+ my_bitmap_init(&outparam->cond_set,
(my_bitmap_map*) (bitmaps+bitmap_size*5), share->fields, FALSE);
outparam->default_column_bitmaps();
diff --git a/sql/table.h b/sql/table.h
index c25e2c8a83a..0d0f8c49f21 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1067,7 +1067,6 @@ public:
ORDER *group;
String alias; /* alias or table name */
uchar *null_flags;
- my_bitmap_map *bitmap_init_value;
MY_BITMAP def_read_set, def_write_set, def_vcol_set, tmp_set;
MY_BITMAP eq_join_set; /* used to mark equi-joined fields */
MY_BITMAP cond_set; /* used to mark fields from sargable conditions*/