Commit d93653bf authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-17441 - InnoDB transition to C++11 atomics

btr_defragment_compression_failures, btr_defragment_failures and
btr_defragment_count transition to Atomic_counter.
parent 8c82ca17
...@@ -63,14 +63,14 @@ UNIV_INTERN mysql_pfs_key_t btr_defragment_mutex_key; ...@@ -63,14 +63,14 @@ UNIV_INTERN mysql_pfs_key_t btr_defragment_mutex_key;
/* Number of compression failures caused by defragmentation since server /* Number of compression failures caused by defragmentation since server
start. */ start. */
ulint btr_defragment_compression_failures = 0; Atomic_counter<ulint> btr_defragment_compression_failures;
/* Number of btr_defragment_n_pages calls that altered page but didn't /* Number of btr_defragment_n_pages calls that altered page but didn't
manage to release any page. */ manage to release any page. */
ulint btr_defragment_failures = 0; Atomic_counter<ulint> btr_defragment_failures;
/* Total number of btr_defragment_n_pages calls that altered page. /* Total number of btr_defragment_n_pages calls that altered page.
The difference between btr_defragment_count and btr_defragment_failures shows The difference between btr_defragment_count and btr_defragment_failures shows
the amount of effort wasted. */ the amount of effort wasted. */
ulint btr_defragment_count = 0; Atomic_counter<ulint> btr_defragment_count;
/******************************************************************//** /******************************************************************//**
Constructor for btr_defragment_item_t. */ Constructor for btr_defragment_item_t. */
...@@ -448,8 +448,7 @@ btr_defragment_merge_pages( ...@@ -448,8 +448,7 @@ btr_defragment_merge_pages(
// n_recs_to_move number of records to to_page. We try to reduce // n_recs_to_move number of records to to_page. We try to reduce
// the targeted data size on the to_page by // the targeted data size on the to_page by
// BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE and try again. // BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE and try again.
my_atomic_addlint( btr_defragment_compression_failures++;
&btr_defragment_compression_failures, 1);
max_ins_size_to_use = max_ins_size_to_use =
move_size > BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE move_size > BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE
? move_size - BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE ? move_size - BTR_DEFRAGMENT_PAGE_REDUCTION_STEP_SIZE
...@@ -668,11 +667,9 @@ btr_defragment_n_pages( ...@@ -668,11 +667,9 @@ btr_defragment_n_pages(
} }
mem_heap_free(heap); mem_heap_free(heap);
n_defragmented ++; n_defragmented ++;
my_atomic_addlint( btr_defragment_count++;
&btr_defragment_count, 1);
if (n_pages == n_defragmented) { if (n_pages == n_defragmented) {
my_atomic_addlint( btr_defragment_failures++;
&btr_defragment_failures, 1);
} else { } else {
index->stat_defrag_n_pages_freed += (n_pages - n_defragmented); index->stat_defrag_n_pages_freed += (n_pages - n_defragmented);
} }
......
...@@ -26,9 +26,9 @@ this program; if not, write to the Free Software Foundation, Inc., ...@@ -26,9 +26,9 @@ this program; if not, write to the Free Software Foundation, Inc.,
#define BTR_DEFRAGMENT_MAX_N_PAGES 32 #define BTR_DEFRAGMENT_MAX_N_PAGES 32
/** stats in btr_defragment */ /** stats in btr_defragment */
extern ulint btr_defragment_compression_failures; extern Atomic_counter<ulint> btr_defragment_compression_failures;
extern ulint btr_defragment_failures; extern Atomic_counter<ulint> btr_defragment_failures;
extern ulint btr_defragment_count; extern Atomic_counter<ulint> btr_defragment_count;
/** Item in the work queue for btr_degrament_thread. */ /** Item in the work queue for btr_degrament_thread. */
struct btr_defragment_item_t struct btr_defragment_item_t
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment