diff options
Diffstat (limited to 'storage/innobase/dict/dict0stats.cc')
-rw-r--r-- | storage/innobase/dict/dict0stats.cc | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index c9e3929cf1d..f3cd26f5527 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1018,8 +1018,8 @@ dict_stats_analyze_index_level( bool prev_rec_is_copied; byte* prev_rec_buf = NULL; ulint prev_rec_buf_size = 0; - ulint* rec_offsets; - ulint* prev_rec_offsets; + offset_t* rec_offsets; + offset_t* prev_rec_offsets; ulint i; DEBUG_PRINTF(" %s(table=%s, index=%s, level=" ULINTPF ")\n", @@ -1040,9 +1040,9 @@ dict_stats_analyze_index_level( i = (REC_OFFS_HEADER_SIZE + 1 + 1) + index->n_fields; heap = mem_heap_create((2 * sizeof *rec_offsets) * i); - rec_offsets = static_cast<ulint*>( + rec_offsets = static_cast<offset_t*>( mem_heap_alloc(heap, i * sizeof *rec_offsets)); - prev_rec_offsets = static_cast<ulint*>( + prev_rec_offsets = static_cast<offset_t*>( mem_heap_alloc(heap, i * sizeof *prev_rec_offsets)); rec_offs_set_n_alloc(rec_offsets, i); rec_offs_set_n_alloc(prev_rec_offsets, i); @@ -1328,11 +1328,11 @@ to the number of externally stored pages which were encountered @return offsets1 or offsets2 (the offsets of *out_rec), or NULL if the page is empty and does not contain user records. */ UNIV_INLINE -ulint* +offset_t* dict_stats_scan_page( const rec_t** out_rec, - ulint* offsets1, - ulint* offsets2, + offset_t* offsets1, + offset_t* offsets2, const dict_index_t* index, const page_t* page, ulint n_prefix, @@ -1340,8 +1340,8 @@ dict_stats_scan_page( ib_uint64_t* n_diff, ib_uint64_t* n_external_pages) { - ulint* offsets_rec = offsets1; - ulint* offsets_next_rec = offsets2; + offset_t* offsets_rec = offsets1; + offset_t* offsets_next_rec = offsets2; const rec_t* rec; const rec_t* next_rec; /* A dummy heap, to be passed to rec_get_offsets(). @@ -1407,23 +1407,16 @@ dict_stats_scan_page( } rec = next_rec; - { - /* Assign offsets_rec = offsets_next_rec - so that offsets_rec matches with rec which - was just assigned rec = next_rec above. - Also need to point offsets_next_rec to the - place where offsets_rec was pointing before - because we have just 2 placeholders where - data is actually stored: - offsets1 and offsets2 and we - are using them in circular fashion - (offsets[_next]_rec are just pointers to - those placeholders). */ - ulint* offsets_tmp; - offsets_tmp = offsets_rec; - offsets_rec = offsets_next_rec; - offsets_next_rec = offsets_tmp; - } + /* Assign offsets_rec = offsets_next_rec so that + offsets_rec matches with rec which was just assigned + rec = next_rec above. Also need to point + offsets_next_rec to the place where offsets_rec was + pointing before because we have just 2 placeholders + where data is actually stored: offsets1 and offsets2 + and we are using them in circular fashion + (offsets[_next]_rec are just pointers to those + placeholders). */ + std::swap(offsets_rec, offsets_next_rec); if (should_count_external_pages) { *n_external_pages += btr_rec_get_externally_stored_len( @@ -1462,9 +1455,9 @@ dict_stats_analyze_index_below_cur( const page_t* page; mem_heap_t* heap; const rec_t* rec; - ulint* offsets1; - ulint* offsets2; - ulint* offsets_rec; + offset_t* offsets1; + offset_t* offsets2; + offset_t* offsets_rec; ulint size; mtr_t mtr; @@ -1482,10 +1475,10 @@ dict_stats_analyze_index_below_cur( heap = mem_heap_create(size * (sizeof *offsets1 + sizeof *offsets2)); - offsets1 = static_cast<ulint*>(mem_heap_alloc( + offsets1 = static_cast<offset_t*>(mem_heap_alloc( heap, size * sizeof *offsets1)); - offsets2 = static_cast<ulint*>(mem_heap_alloc( + offsets2 = static_cast<offset_t*>(mem_heap_alloc( heap, size * sizeof *offsets2)); rec_offs_set_n_alloc(offsets1, size); |