[Commits] Rev 2813: Use reverse/backwards buffer for keys (now works) in file:///home/psergey/dev2/maria-5.3-dsmrr-cpk-r5/

At file:///home/psergey/dev2/maria-5.3-dsmrr-cpk-r5/ ------------------------------------------------------------ revno: 2813 revision-id: psergey@askmonty.org-20100811105434-mh6nc8ece24wkgj1 parent: psergey@askmonty.org-20100809190140-j3nlb6enfoafqds2 committer: Sergey Petrunya <psergey@askmonty.org> branch nick: maria-5.3-dsmrr-cpk-r5 timestamp: Wed 2010-08-11 14:54:34 +0400 message: Use reverse/backwards buffer for keys (now works) - don't allocate space for rowid buffer when we don't really need it. - fix buffer iterator === modified file 'mysql-test/r/join_outer_jcl6.result' --- a/mysql-test/r/join_outer_jcl6.result 2010-06-26 10:05:41 +0000 +++ b/mysql-test/r/join_outer_jcl6.result 2010-08-11 10:54:34 +0000 @@ -352,14 +352,14 @@ Lilliana Angelovska NULL NULL NULL select t1.name, t2.name, t2.id,t3.id from t1 right join t2 on (t1.id = t2.owner) right join t1 as t3 on t3.id=t2.owner; name name id id +Antonio Paz Perrito 2 1 Antonio Paz El Gato 1 1 -Antonio Paz Perrito 2 1 Thimble Smith Happy 3 3 NULL NULL NULL 2 select t1.name, t2.name, t2.id, t2.owner, t3.id from t1 left join t2 on (t1.id = t2.owner) right join t1 as t3 on t3.id=t2.owner; name name id owner id +Antonio Paz Perrito 2 1 1 Antonio Paz El Gato 1 1 1 -Antonio Paz Perrito 2 1 1 Thimble Smith Happy 3 3 3 NULL NULL NULL NULL 2 drop table t1,t2; @@ -413,9 +413,9 @@ select t1.*, t2.* from t1 left join t2 on t1.n = t2.n and t1.m = t2.m where t1.n = 1; n m o n m o +1 2 9 1 2 3 +1 2 7 1 2 3 1 2 11 1 2 3 -1 2 7 1 2 3 -1 2 9 1 2 3 1 3 9 NULL NULL NULL select t1.*, t2.* from t1 left join t2 on t1.n = t2.n and t1.m = t2.m where t1.n = 1 order by t1.o; === modified file 'sql/multi_range_read.cc' --- a/sql/multi_range_read.cc 2010-08-08 20:38:42 +0000 +++ b/sql/multi_range_read.cc 2010-08-11 10:54:34 +0000 @@ -420,7 +420,8 @@ } do_rowid_fetch= FALSE; - doing_cpk_scan= check_cpk_scan(h->active_index, mode); + doing_cpk_scan= check_cpk_scan(h->inited == handler::INDEX? + h->active_index: h2->active_index, mode); if (!doing_cpk_scan /* && !index_only_read */) { /* Will use rowid buffer to store/sort rowids, etc */ @@ -754,7 +755,21 @@ key_tuple_length; key_buff_elem_size= key_size_in_keybuf + (int)is_mrr_assoc * sizeof(void*); + + if (!do_rowid_fetch) + { + /* Give all space to key buffer. */ + key_buffer.set_buffer_space(full_buf, full_buf_end, 1); + /* Just in case, tell rowid buffer that it has zero size: */ + rowid_buffer.set_buffer_space(full_buf_end, full_buf_end, 1); + return; + } + + /* + Ok if we got here we need to allocate one part of the buffer + for keys and another part for rowids. + */ uint rowid_buf_elem_size= h->ref_length + (int)is_mrr_assoc * sizeof(char*); @@ -790,9 +805,11 @@ (h->ref_length + (int)is_mrr_assoc * sizeof(char*) + 1)); } + //rowid_buffer.set_buffer_space(full_buf, full_buf + bytes_for_rowids, 1); + //key_buffer.set_buffer_space(full_buf + bytes_for_rowids, full_buf_end, 1); rowid_buffer.set_buffer_space(full_buf, full_buf + bytes_for_rowids, 1); - key_buffer.set_buffer_space(full_buf + bytes_for_rowids, full_buf_end, 1); - + key_buffer.set_buffer_space(full_buf + bytes_for_rowids, full_buf_end, -1); + index_ranges_unique= test(key_info->flags & HA_NOSAME && key_info->key_parts == my_count_bits(sample_key->keypart_map)); === modified file 'sql/multi_range_read.h' --- a/sql/multi_range_read.h 2010-08-08 07:13:54 +0000 +++ b/sql/multi_range_read.h 2010-08-11 10:54:34 +0000 @@ -118,7 +118,7 @@ } else { - if (pos - nbytes <= sb->write_pos) + if (pos - nbytes < sb->write_pos) return NULL; pos -= nbytes; return pos;
participants (1)
-
Sergey Petrunya