svnno****@sourc*****
svnno****@sourc*****
2008年 1月 25日 (金) 17:39:13 JST
Revision: 89 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=tritonn&view=rev&rev=89 Author: mir Date: 2008-01-25 17:39:13 +0900 (Fri, 25 Jan 2008) Log Message: ----------- Fixed a bug: sen_flags for 2ind. Modified Paths: -------------- tags/tritonn-1.0.9-mysql-5.0.51/sql/filesort.cc tags/tritonn-1.0.9-mysql-5.0.51/sql/item_sum.cc tags/tritonn-1.0.9-mysql-5.0.51/sql/records.cc tags/tritonn-1.0.9-mysql-5.0.51/sql/sql_select.cc Modified: tags/tritonn-1.0.9-mysql-5.0.51/sql/filesort.cc =================================================================== --- tags/tritonn-1.0.9-mysql-5.0.51/sql/filesort.cc 2008-01-23 08:38:35 UTC (rev 88) +++ tags/tritonn-1.0.9-mysql-5.0.51/sql/filesort.cc 2008-01-25 08:39:13 UTC (rev 89) @@ -1318,7 +1318,8 @@ if (sortorder->field->maybe_null()) length++; // Place for NULL marker #ifdef ENABLE_SENNA - my_thread_var->sen_flags |= SENNA_FILESORT; + if (my_thread_var->sen_flags & SENNA_USE_2IND) + my_thread_var->sen_flags |= SENNA_FILESORT; #endif /* ENABLE_SENNA */ } else Modified: tags/tritonn-1.0.9-mysql-5.0.51/sql/item_sum.cc =================================================================== --- tags/tritonn-1.0.9-mysql-5.0.51/sql/item_sum.cc 2008-01-23 08:38:35 UTC (rev 88) +++ tags/tritonn-1.0.9-mysql-5.0.51/sql/item_sum.cc 2008-01-25 08:39:13 UTC (rev 89) @@ -2452,7 +2452,8 @@ /* Create a table with an unique key over all parameters */ #ifdef ENABLE_SENNA - my_thread_var->sen_flags |= SENNA_DISTINCT; + if (my_thread_var->sen_flags & SENNA_USE_2IND) + my_thread_var->sen_flags |= SENNA_DISTINCT; #endif /* ENABLE_SENNA */ for (uint i=0; i < arg_count ; i++) { Modified: tags/tritonn-1.0.9-mysql-5.0.51/sql/records.cc =================================================================== --- tags/tritonn-1.0.9-mysql-5.0.51/sql/records.cc 2008-01-23 08:38:35 UTC (rev 88) +++ tags/tritonn-1.0.9-mysql-5.0.51/sql/records.cc 2008-01-25 08:39:13 UTC (rev 89) @@ -157,7 +157,8 @@ info->read_record= (table->sort.addon_field ? rr_unpack_from_buffer : rr_from_pointers); #ifdef ENABLE_SENNA - my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; + if (my_thread_var->sen_flags & SENNA_USE_2IND) + my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; #endif /* ENABLE_SENNA */ } else @@ -324,12 +325,13 @@ if (my_b_read(info->io_cache,info->ref_pos,info->ref_length)) return -1; /* End of file */ #ifdef ENABLE_SENNA - if ((my_thread_var->sen_flags & SENNA_USE_2IND) && - (my_thread_var->sen_flags & - (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) - == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { - SEN_LOG(sen_log_debug, "rr_from_tempfile: 2ind return 0"); - return 0; + if (my_thread_var->sen_flags & SENNA_USE_2IND) { + if ((my_thread_var->sen_flags & + (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) + == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { + SEN_LOG(sen_log_debug, "rr_from_tempfile: 2ind return 0"); + return 0; + } } #endif /* ENABLE_SENNA */ if (!(tmp=info->file->rnd_pos(info->record,info->ref_pos))) @@ -386,12 +388,13 @@ info->cache_pos+= info->ref_length; #ifdef ENABLE_SENNA - if ((my_thread_var->sen_flags & SENNA_USE_2IND) && - (my_thread_var->sen_flags & - (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) - == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { - SEN_LOG(sen_log_debug, "rr_from_pointers: 2ind return 0"); - return 0; + if (my_thread_var->sen_flags & SENNA_USE_2IND) { + if ((my_thread_var->sen_flags & + (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) + == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { + SEN_LOG(sen_log_debug, "rr_from_pointers: 2ind return 0"); + return 0; + } } #endif /* ENABLE_SENNA */ if (!(tmp=info->file->rnd_pos(info->record,cache_pos))) Modified: tags/tritonn-1.0.9-mysql-5.0.51/sql/sql_select.cc =================================================================== --- tags/tritonn-1.0.9-mysql-5.0.51/sql/sql_select.cc 2008-01-23 08:38:35 UTC (rev 88) +++ tags/tritonn-1.0.9-mysql-5.0.51/sql/sql_select.cc 2008-01-25 08:39:13 UTC (rev 89) @@ -1488,7 +1488,8 @@ } #ifdef ENABLE_SENNA - my_thread_var->sen_flags |= SENNA_FIRST_CALL; + if (my_thread_var->sen_flags & SENNA_USE_2IND) + my_thread_var->sen_flags |= SENNA_FIRST_CALL; #endif /* ENABLE_SENNA */ error= 0; @@ -2095,7 +2096,8 @@ curr_join->procedure= procedure; #ifdef ENABLE_SENNA - my_thread_var->sen_flags &= ~SENNA_FIRST_CALL; + if (my_thread_var->sen_flags & SENNA_USE_2IND) + my_thread_var->sen_flags &= ~SENNA_FIRST_CALL; #endif /* ENABLE_SENNA */ if (is_top_level_join() && thd->cursor && tables != const_tables) @@ -2288,8 +2290,10 @@ } } #ifdef ENABLE_SENNA - if (select_lex->ftfunc_list->elements) {my_thread_var->sen_flags |= SENNA_MATCH; } - if (join->select_distinct) { my_thread_var->sen_flags |= SENNA_DISTINCT; } + if (my_thread_var->sen_flags & SENNA_USE_2IND) { + if (select_lex->ftfunc_list->elements) {my_thread_var->sen_flags |= SENNA_MATCH; } + if (join->select_distinct) { my_thread_var->sen_flags |= SENNA_DISTINCT; } + } #endif /* ENABLE_SENNA */ if ((err= join->optimize())) { @@ -6181,7 +6185,8 @@ tab->read_first_record= join_ft_read_first; tab->read_record.read_record= join_ft_read_next; #ifdef ENABLE_SENNA - my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; + if (my_thread_var->sen_flags & SENNA_USE_2IND) + my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; #endif /* ENABLE_SENNA */ break; case JT_ALL: @@ -10604,7 +10609,8 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records) { #ifdef ENABLE_SENNA - if (join_tab->next_select == end_update) { my_thread_var->sen_flags &= ~SENNA_DO_READ_RECORD; } + if ((my_thread_var->sen_flags & SENNA_USE_2IND) && (join_tab->next_select == end_update)) + { my_thread_var->sen_flags &= ~SENNA_DO_READ_RECORD; } #endif /* ENABLE_SENNA */ join_tab->table->null_row=0; if (end_of_records) @@ -11320,17 +11326,18 @@ if (!table->file->inited) table->file->ha_index_init(tab->index); #ifdef ENABLE_SENNA - if (my_thread_var->sen_flags & SENNA_MATCH) { my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; } - if ((my_thread_var->sen_flags & SENNA_USE_2IND) && - (my_thread_var->sen_flags & - (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) - == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { - //error=tab->table->file->index_first(NULL); - //statistic_increment(tab->table->in_use->status_var.senna_2ind_count, &LOCK_status); - return 0; - } else + if (my_thread_var->sen_flags & SENNA_USE_2IND) { + if (my_thread_var->sen_flags & SENNA_MATCH) { my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; } + if ((my_thread_var->sen_flags & + (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) + == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { + //error=tab->table->file->index_first(NULL); + //statistic_increment(tab->table->in_use->status_var.senna_2ind_count, &LOCK_status); + return 0; + } + } #endif /* ENABLE_SENNA */ - error=tab->table->file->index_first(tab->table->record[0]); + error=tab->table->file->index_first(tab->table->record[0]); if (error) { if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) @@ -11346,14 +11353,15 @@ { int error; #ifdef ENABLE_SENNA - if ((my_thread_var->sen_flags & SENNA_USE_2IND) && - (my_thread_var->sen_flags & - (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) - == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { - //error=info->file->index_next(NULL); - //statistic_increment(info->thd->status_var.senna_2ind_count, &LOCK_status); - return 0; - } else + if (my_thread_var->sen_flags & SENNA_USE_2IND) { + if ((my_thread_var->sen_flags & + (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) + == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { + //error=info->file->index_next(NULL); + //statistic_increment(info->thd->status_var.senna_2ind_count, &LOCK_status); + return 0; + } + } #endif /* ENABLE_SENNA */ error=info->file->index_next(info->record); if (error) @@ -11382,15 +11390,16 @@ if (!table->file->inited) table->file->ha_index_init(tab->index); #ifdef ENABLE_SENNA - if (my_thread_var->sen_flags & SENNA_MATCH) { my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; } - if ((my_thread_var->sen_flags & SENNA_USE_2IND) && - (my_thread_var->sen_flags & - (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) - == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { - //error=tab->table->file->index_last(NULL); - //statistic_increment(tab->table->in_use->status_var.senna_2ind_count, &LOCK_status); - return 0; - } else + if (my_thread_var->sen_flags & SENNA_USE_2IND) { + if (my_thread_var->sen_flags & SENNA_MATCH) { my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; } + if ((my_thread_var->sen_flags & + (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) + == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { + //error=tab->table->file->index_last(NULL); + //statistic_increment(tab->table->in_use->status_var.senna_2ind_count, &LOCK_status); + return 0; + } + } #endif /* ENABLE_SENNA */ error=tab->table->file->index_last(tab->table->record[0]); if (error) @@ -11404,14 +11413,15 @@ { int error; #ifdef ENABLE_SENNA - if ((my_thread_var->sen_flags & SENNA_USE_2IND) && - (my_thread_var->sen_flags & - (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) - == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { - //error=info->file->index_prev(NULL); - //statistic_increment(info->thd->status_var.senna_2ind_count, &LOCK_status); - return 0; - } else + if (my_thread_var->sen_flags & SENNA_USE_2IND) { + if ((my_thread_var->sen_flags & + (SENNA_MATCH | SENNA_DO_READ_RECORD | SENNA_IF_READ_RECORD)) + == (SENNA_MATCH | SENNA_DO_READ_RECORD)) { + //error=info->file->index_prev(NULL); + //statistic_increment(info->thd->status_var.senna_2ind_count, &LOCK_status); + return 0; + } + } #endif /* ENABLE_SENNA */ error=info->file->index_prev(info->record); if (error) @@ -11429,7 +11439,8 @@ if (!table->file->inited) table->file->ha_index_init(tab->ref.key); #ifdef ENABLE_SENNA - if (my_thread_var->sen_flags & SENNA_MATCH) { my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; } + if (my_thread_var->sen_flags & SENNA_USE_2IND) + if (my_thread_var->sen_flags & SENNA_MATCH) { my_thread_var->sen_flags |= SENNA_DO_READ_RECORD; } #endif /* ENABLE_SENNA */ #if NOT_USED_YET if (cp_buffer_from_ref(tab->join->thd, &tab->ref)) // as ft-key doesn't use store_key's @@ -12725,8 +12736,10 @@ select= tab->select; #ifdef ENABLE_SENNA - if (tab->select_cond && tab->select_cond->needs_record()) { - my_thread_var->sen_flags |= SENNA_IF_READ_RECORD; + if (my_thread_var->sen_flags & SENNA_USE_2IND) { + if (tab->select_cond && tab->select_cond->needs_record()) { + my_thread_var->sen_flags |= SENNA_IF_READ_RECORD; + } } #endif /* ENABLE_SENNA */