summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-07-17 08:57:29 +0200
committerSergei Golubchik <serg@mariadb.org>2021-08-26 23:39:52 +0200
commit0299ec29d4af3230741a62d5443c0562269b05b2 (patch)
treeab7faa1a142651632acaaa7b224fc51a8644b52a /storage
parent05e29e177df243b700392b797e26cae43fd3181e (diff)
downloadmariadb-git-0299ec29d4af3230741a62d5443c0562269b05b2.tar.gz
cleanup: MY_BITMAP mutex
in about a hundred of users of MY_BITMAP, only two were using its built-in mutex, and only one of those two was actually needing it. Remove the mutex from MY_BITMAP, remove all associated conditions and checks in bitmap functions. Use an external LOCK_temp_pool mutex and temp_pool_set_next/temp_pool_clear_bit acccessors. Remove bitmap_init/bitmap_free, always use my_* versions.
Diffstat (limited to 'storage')
-rw-r--r--storage/maria/ma_open.c3
-rw-r--r--storage/mroonga/ha_mroonga.cpp6
-rw-r--r--storage/mroonga/lib/mrn_smart_bitmap.cpp2
-rw-r--r--storage/rocksdb/ha_rocksdb.cc2
-rw-r--r--storage/rocksdb/ha_rocksdb.h2
-rw-r--r--storage/rocksdb/rdb_datadic.cc22
6 files changed, 18 insertions, 19 deletions
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index f84f0b8e938..4a1ee8b0505 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -156,8 +156,7 @@ static MARIA_HA *maria_clone_internal(MARIA_SHARE *share,
info.lock_type= F_WRLCK;
_ma_set_data_pagecache_callbacks(&info.dfile, share);
- my_bitmap_init(&info.changed_fields, changed_fields_bitmap,
- share->base.fields, 0);
+ my_bitmap_init(&info.changed_fields, changed_fields_bitmap, share->base.fields);
if ((*share->init)(&info))
goto err;
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index 1cddd8fc4a8..83c2d15a36c 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -4926,7 +4926,7 @@ int ha_mroonga::open(const char *name,
DBUG_RETURN(error);
thr_lock_data_init(&share->lock,&thr_lock_data,NULL);
- if (bitmap_init(&multiple_column_key_bitmap, NULL, table->s->fields, false))
+ if (my_bitmap_init(&multiple_column_key_bitmap, NULL, table->s->fields))
{
mrn_free_share(share);
share = NULL;
@@ -4942,7 +4942,7 @@ int ha_mroonga::open(const char *name,
if (error)
{
- bitmap_free(&multiple_column_key_bitmap);
+ my_bitmap_free(&multiple_column_key_bitmap);
mrn_free_share(share);
share = NULL;
}
@@ -5009,7 +5009,7 @@ int ha_mroonga::close()
{
error = add_wrap_hton(share->table_name, share->hton);
}
- bitmap_free(&multiple_column_key_bitmap);
+ my_bitmap_free(&multiple_column_key_bitmap);
if (share->use_count == 1) {
mrn_free_long_term_share(share->long_term_share);
}
diff --git a/storage/mroonga/lib/mrn_smart_bitmap.cpp b/storage/mroonga/lib/mrn_smart_bitmap.cpp
index f8fd4f727bb..cdedeb677cd 100644
--- a/storage/mroonga/lib/mrn_smart_bitmap.cpp
+++ b/storage/mroonga/lib/mrn_smart_bitmap.cpp
@@ -26,7 +26,7 @@ namespace mrn {
SmartBitmap::~SmartBitmap() {
if (bitmap_) {
- bitmap_free(bitmap_);
+ my_bitmap_free(bitmap_);
}
}
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 7388f223b1b..ce51c9d325e 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -10786,7 +10786,7 @@ int ha_rocksdb::index_end() {
release_scan_iterator();
- bitmap_free(&m_lookup_bitmap);
+ my_bitmap_free(&m_lookup_bitmap);
active_index = MAX_KEY;
in_range_check_pushed_down = FALSE;
diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h
index 05f0b2bf984..6d2d877c8ec 100644
--- a/storage/rocksdb/ha_rocksdb.h
+++ b/storage/rocksdb/ha_rocksdb.h
@@ -397,7 +397,7 @@ class ha_rocksdb : public my_core::handler {
current lookup to be covered. If the bitmap field is null, that means this
index does not cover the current lookup for any record.
*/
- MY_BITMAP m_lookup_bitmap = {nullptr, nullptr, nullptr, 0, 0};
+ MY_BITMAP m_lookup_bitmap = {nullptr, nullptr, 0, 0};
int alloc_key_buffers(const TABLE *const table_arg,
const Rdb_tbl_def *const tbl_def_arg,
diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc
index 6c3e99be55e..797ef68f72a 100644
--- a/storage/rocksdb/rdb_datadic.cc
+++ b/storage/rocksdb/rdb_datadic.cc
@@ -1102,12 +1102,12 @@ size_t Rdb_key_def::get_unpack_header_size(char tag) {
*/
void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
DBUG_ASSERT(map->bitmap == nullptr);
- bitmap_init(map, nullptr, MAX_REF_PARTS, false);
+ my_bitmap_init(map, nullptr, MAX_REF_PARTS);
uint curr_bitmap_pos = 0;
// Indicates which columns in the read set might be covered.
MY_BITMAP maybe_covered_bitmap;
- bitmap_init(&maybe_covered_bitmap, nullptr, table->read_set->n_bits, false);
+ my_bitmap_init(&maybe_covered_bitmap, nullptr, table->read_set->n_bits);
for (uint i = 0; i < m_key_parts; i++) {
if (table_has_hidden_pk(table) && i + 1 == m_key_parts) {
@@ -1135,8 +1135,8 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
}
curr_bitmap_pos++;
} else {
- bitmap_free(&maybe_covered_bitmap);
- bitmap_free(map);
+ my_bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(map);
return;
}
break;
@@ -1144,8 +1144,8 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
// know this lookup will never be covered.
default:
if (bitmap_is_set(table->read_set, field->field_index)) {
- bitmap_free(&maybe_covered_bitmap);
- bitmap_free(map);
+ my_bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(map);
return;
}
break;
@@ -1155,9 +1155,9 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
// If there are columns which are not covered in the read set, the lookup
// can't be covered.
if (!bitmap_cmp(table->read_set, &maybe_covered_bitmap)) {
- bitmap_free(map);
+ my_bitmap_free(map);
}
- bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(&maybe_covered_bitmap);
}
/*
@@ -1187,7 +1187,7 @@ bool Rdb_key_def::covers_lookup(const rocksdb::Slice *const unpack_info,
MY_BITMAP covered_bitmap;
my_bitmap_map covered_bits;
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
covered_bits = rdb_netbuf_to_uint16((const uchar *)unpack_header +
sizeof(RDB_UNPACK_COVERED_DATA_TAG) +
RDB_UNPACK_COVERED_DATA_LEN_SIZE);
@@ -1356,7 +1356,7 @@ uint Rdb_key_def::pack_record(const TABLE *const tbl, uchar *const pack_buffer,
MY_BITMAP covered_bitmap;
my_bitmap_map covered_bits;
uint curr_bitmap_pos = 0;
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
for (uint i = 0; i < n_key_parts; i++) {
// Fill hidden pk id into the last key part for secondary keys for tables
@@ -1661,7 +1661,7 @@ int Rdb_key_def::unpack_record(TABLE *const table, uchar *const buf,
bool has_covered_bitmap =
has_unpack_info && (unpack_header[0] == RDB_UNPACK_COVERED_DATA_TAG);
if (has_covered_bitmap) {
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
covered_bits = rdb_netbuf_to_uint16((const uchar *)unpack_header +
sizeof(RDB_UNPACK_COVERED_DATA_TAG) +
RDB_UNPACK_COVERED_DATA_LEN_SIZE);