diff options
author | Nikita Malyavin <nikitamalyavin@gmail.com> | 2022-06-24 01:45:44 +0300 |
---|---|---|
committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2022-06-24 01:45:44 +0300 |
commit | 074c211faf9cd5ce8d0e6104ef5685e8f4c9d8f3 (patch) | |
tree | f1342843be757793c9e8a99a5dc9e340c433ba8e /storage/innobase/btr/btr0cur.cc | |
parent | 69af61a4ee04fa22efb5a35b2e91fb1a809170de (diff) | |
download | mariadb-git-kakurin_sampling.tar.gz |
sampling analysiskakurin_sampling
file=open(...)
for l in file:
if l.startswith('SAMPLE') and not l.startswith('SAMPLE root'):
print(l)
n = dict((p.split('=')
for p in l.replace('SAMPLE ', '').replace(' REJECT', '').split()
))
if 'REJECT' in l:
n['rej']=True
nodes.append(n)
max(int(n['size']) for n in nodes)
max((float(n['p']), serialize(n)) for n in nodes)
max((float(n['size']), serialize(n)) for n in nodes if n['height'] == '0')
Diffstat (limited to 'storage/innobase/btr/btr0cur.cc')
-rw-r--r-- | storage/innobase/btr/btr0cur.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 04ee06bf032..027ef598d50 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -2847,6 +2847,7 @@ btr_cur_open_at_index_side( return err; } extern unsigned long long my_counter; +ulint get_last_nth(); /**********************************************************************//** Positions a cursor at a randomly chosen position within a B-tree. @return DB_SUCCESS if the index is available and we have put the cursor, @@ -2952,8 +2953,10 @@ btr_cur_open_at_rnd_pos( } height = ULINT_UNDEFINED; + fprintf(stderr, "SAMPLE root page_id=%d\n", page_id.page_no()); for (;;) { + bool root= false; page_t* page; ut_ad(n_blocks < BTR_MAX_LEVELS); @@ -3012,6 +3015,7 @@ btr_cur_open_at_rnd_pos( /* We are in the root node */ height = btr_page_get_level(page); + root= true; } else { if(sim_uniform_dist) { ulint n_recs = page_get_n_recs(block->page.frame); @@ -3059,6 +3063,12 @@ btr_cur_open_at_rnd_pos( page_cur_open_on_rnd_user_rec(block, page_cursor); + fprintf(stderr, "SAMPLE node=%x root=%d p=%lf height=%ld size=%d child_no=%ld ", + page_id.page_no(), root, + p, + height, + page_get_n_recs(block->page.frame), + get_last_nth()); if (height == 0) { break; @@ -3145,6 +3155,8 @@ btr_cur_open_at_rnd_pos( page_id.set_page_no( btr_node_ptr_get_child_page_no(node_ptr, offsets)); + fprintf(stderr, "child_page=%x\n", page_id.page_no()); + n_blocks++; } @@ -3156,10 +3168,12 @@ btr_cur_open_at_rnd_pos( // getting 0..1 pseudo random number from ut_rnd_gen() // and exchange division by multiplication like // (b / c) < a <=> b < (a * c) - if(sim_uniform_dist && (ut_rnd_gen() < (p * ~(uint32_t)0))) { + if(sim_uniform_dist && (ut_rnd_gen() > (p * ~(uint32_t)0))) { err = DB_RECORD_NOT_FOUND; my_counter++; + fprintf(stderr, "REJECT\n"); } + else fprintf(stderr, "\n"); return err; } |