Reviewed this second round of changes. Missing interface for rnd_pos()
was added.
No issues. Ok to push.
On 5/25/10 3:19 AM, Marc Alff wrote:
> #At file:///Users/malff/BZR_TREE/mysql-next-mr-wl4895/ based on
> revid:marc.alff@stripped
>
> 3151 Marc Alff 2010-05-25
> WL#4895 PERFORMANCE SCHEMA TABLE IO
>
> Implemented code review comments:
> - move the implementation of handler::ha_rnd_next() and related to handler.cc
> - add instrumentation for rnd_pos
>
> modified:
> mysql-test/suite/perfschema/r/myisam_table_io.result
> sql/filesort.cc
> sql/ha_partition.cc
> sql/handler.cc
> sql/handler.h
> sql/log_event.cc
> sql/log_event_old.cc
> sql/opt_range.cc
> sql/records.cc
> sql/sql_insert.cc
> sql/sql_select.cc
> sql/sql_update.cc
> === modified file 'mysql-test/suite/perfschema/r/myisam_table_io.result'
> --- a/mysql-test/suite/perfschema/r/myisam_table_io.result 2010-05-07 12:14:13 +0000
> +++ b/mysql-test/suite/perfschema/r/myisam_table_io.result 2010-05-25 08:19:01 +0000
> @@ -60,51 +60,51 @@ event_name short_source object_type obje
> wait/io/table/sql/handler handler.cc: TABLE test no_index_tab insert NULL
> wait/io/table/sql/handler handler.cc: TABLE test no_index_tab insert NULL
> wait/io/table/sql/handler handler.cc: TABLE test no_index_tab insert NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> wait/io/table/sql/handler handler.cc: TABLE test no_index_tab update NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> wait/io/table/sql/handler handler.cc: TABLE test no_index_tab update NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> wait/io/table/sql/handler handler.cc: TABLE test no_index_tab update NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> wait/io/table/sql/handler handler.cc: TABLE test no_index_tab delete NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TABLE test no_index_tab fetch NULL
> wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab insert NULL
> wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab insert NULL
> wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab insert NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab update NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab update NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab update NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab delete NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> -wait/io/table/sql/handler handler.h: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> +wait/io/table/sql/handler handler.cc: TEMPORARY TABLE test temp_tab fetch NULL
> show status like 'performance_schema_%';
> Variable_name Value
> Performance_schema_cond_classes_lost 0
>
> === modified file 'sql/filesort.cc'
> --- a/sql/filesort.cc 2010-05-05 08:16:47 +0000
> +++ b/sql/filesort.cc 2010-05-25 08:19:01 +0000
> @@ -585,11 +585,11 @@ static ha_rows find_all_keys(SORTPARAM *
> error= my_errno ? my_errno : -1; /* Abort */
> break;
> }
> - error=file->rnd_pos(sort_form->record[0],next_pos);
> + error= file->ha_rnd_pos(sort_form->record[0], next_pos);
> }
> else
> {
> - error=file->ha_rnd_next(sort_form->record[0]);
> + error= file->ha_rnd_next(sort_form->record[0]);
> if (!flag)
> {
> my_store_ptr(ref_pos,ref_length,record); // Position to row
>
> === modified file 'sql/ha_partition.cc'
> --- a/sql/ha_partition.cc 2010-05-05 08:16:47 +0000
> +++ b/sql/ha_partition.cc 2010-05-25 08:19:01 +0000
> @@ -3933,7 +3933,7 @@ int ha_partition::rnd_pos(uchar * buf, u
> DBUG_ASSERT(part_id< m_tot_parts);
> file= m_file[part_id];
> m_last_part= part_id;
> - DBUG_RETURN(file->rnd_pos(buf, (pos + PARTITION_BYTES_IN_POS)));
> + DBUG_RETURN(file->ha_rnd_pos(buf, (pos + PARTITION_BYTES_IN_POS)));
> }
>
>
>
> === modified file 'sql/handler.cc'
> --- a/sql/handler.cc 2010-05-05 08:16:47 +0000
> +++ b/sql/handler.cc 2010-05-25 08:19:01 +0000
> @@ -2125,7 +2125,17 @@ int handler::ha_open(TABLE *table_arg, c
> }
> else
> {
> - psi_open();
> + DBUG_ASSERT(m_psi == NULL);
> + DBUG_ASSERT(table_share != NULL);
> +#ifdef HAVE_PSI_INTERFACE
> + if (likely(PSI_server != NULL))
> + {
> + PSI_table_share *share_psi= ha_table_share_psi(table_share);
> + if (likely(share_psi != NULL))
> + m_psi= PSI_server->open_table(share_psi, this);
> + }
> +#endif
> +
> if (table->s->db_options_in_use& HA_OPTION_READ_ONLY_DATA)
> table->db_stat|=HA_READ_ONLY;
> (void) extra(HA_EXTRA_NO_READCHECK); // Not needed in SQL
> @@ -2134,8 +2144,7 @@ int handler::ha_open(TABLE *table_arg, c
> if (!ref&& !(ref= (uchar*) alloc_root(&table->mem_root,
> ALIGN_SIZE(ref_length)*2)))
> {
> - psi_close();
> - close();
> + ha_close();
> error=HA_ERR_OUT_OF_MEM;
> }
> else
> @@ -2145,6 +2154,133 @@ int handler::ha_open(TABLE *table_arg, c
> DBUG_RETURN(error);
> }
>
> +int handler::ha_close(void)
> +{
> +#ifdef HAVE_PSI_INTERFACE
> + if (likely(PSI_server&& m_psi))
> + {
> + PSI_server->close_table(m_psi);
> + m_psi= NULL; /* instrumentation handle, invalid after close_table() */
> + }
> +#endif
> + DBUG_ASSERT(m_psi == NULL);
> + return close();
> +}
> +
> +int handler::ha_rnd_next(uchar *buf)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, MAX_KEY, 0);
> + result= rnd_next(buf);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_rnd_pos(uchar *buf, uchar *pos)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, MAX_KEY, 0);
> + result= rnd_pos(buf, pos);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_index_read_map(uchar *buf, const uchar *key,
> + key_part_map keypart_map,
> + enum ha_rkey_function find_flag)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> + result= index_read_map(buf, key, keypart_map, find_flag);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_index_read_idx_map(uchar *buf, uint index, const uchar *key,
> + key_part_map keypart_map,
> + enum ha_rkey_function find_flag)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, index, 0);
> + result= index_read_idx_map(buf, index, key, keypart_map, find_flag);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_index_next(uchar * buf)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> + result= index_next(buf);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_index_prev(uchar * buf)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> + result= index_prev(buf);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_index_first(uchar * buf)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> + result= index_first(buf);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_index_last(uchar * buf)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> + result= index_last(buf);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_index_next_same(uchar *buf, const uchar *key, uint keylen)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> + result= index_next_same(buf, key, keylen);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_index_read(uchar *buf, const uchar *key, uint key_len,
> + enum ha_rkey_function find_flag)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> + result= index_read(buf, key, key_len, find_flag);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
> +
> +int handler::ha_index_read_last(uchar *buf, const uchar *key, uint key_len)
> +{
> + int result;
> + struct PSI_table_locker *locker;
> + locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> + result= index_read_last(buf, key, key_len);
> + MYSQL_END_TABLE_WAIT(locker);
> + return result;
> +}
>
> /**
> Read first row (only) from a table.
> @@ -2168,14 +2304,14 @@ int handler::read_first_row(uchar * buf,
> !(index_flags(primary_key, 0, 0)& HA_READ_ORDER))
> {
> (void) ha_rnd_init(1);
> - while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
> + while ((error= ha_rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
> (void) ha_rnd_end();
> }
> else
> {
> /* Find the first row through the primary key */
> (void) ha_index_init(primary_key, 0);
> - error=index_first(buf);
> + error= ha_index_first(buf);
> (void) ha_index_end();
> }
> DBUG_RETURN(error);
> @@ -2549,7 +2685,7 @@ void handler::get_auto_increment(ulonglo
> index_init(table->s->next_number_index, 1);
> if (table->s->next_number_keypart == 0)
> { // Autoincrement at key-start
> - error=index_last(table->record[1]);
> + error= ha_index_last(table->record[1]);
> /*
> MySQL implicitely assumes such method does locking (as MySQL decides to
> use nr+increment without checking again with the handler, in
> @@ -2563,9 +2699,9 @@ void handler::get_auto_increment(ulonglo
> key_copy(key, table->record[0],
> table->key_info + table->s->next_number_index,
> table->s->next_number_key_offset);
> - error= index_read_map(table->record[1], key,
> -
> make_prev_keypart_map(table->s->next_number_keypart),
> - HA_READ_PREFIX_LAST);
> + error= ha_index_read_map(table->record[1], key,
> +
> make_prev_keypart_map(table->s->next_number_keypart),
> + HA_READ_PREFIX_LAST);
> /*
> MySQL needs to call us for next row: assume we are inserting ("a",null)
> here, we return 3, and next this statement will want to insert
> @@ -4227,12 +4363,12 @@ int handler::read_range_first(const key_
> range_key_part= table->key_info[active_index].key_part;
>
> if (!start_key) // Read first record
> - result= index_first(table->record[0]);
> + result= ha_index_first(table->record[0]);
> else
> - result= index_read_map(table->record[0],
> - start_key->key,
> - start_key->keypart_map,
> - start_key->flag);
> + result= ha_index_read_map(table->record[0],
> + start_key->key,
> + start_key->keypart_map,
> + start_key->flag);
> if (result)
> DBUG_RETURN((result == HA_ERR_KEY_NOT_FOUND)
> ? HA_ERR_END_OF_FILE
> @@ -4263,11 +4399,11 @@ int handler::read_range_next()
> if (eq_range)
> {
> /* We trust that index_next_same always gives a row in range */
> - DBUG_RETURN(index_next_same(table->record[0],
> - end_range->key,
> - end_range->length));
> + DBUG_RETURN(ha_index_next_same(table->record[0],
> + end_range->key,
> + end_range->length));
> }
> - result= index_next(table->record[0]);
> + result= ha_index_next(table->record[0]);
> if (result)
> DBUG_RETURN(result);
> DBUG_RETURN(compare_key(end_range)<= 0 ? 0 : HA_ERR_END_OF_FILE);
>
> === modified file 'sql/handler.h'
> --- a/sql/handler.h 2010-05-05 08:16:47 +0000
> +++ b/sql/handler.h 2010-05-25 08:19:01 +0000
> @@ -32,7 +32,6 @@
> #include<my_handler.h>
> #include<ft_global.h>
> #include<keycache.h>
> -#include<mysql/psi/mysql_table.h>
>
> #ifndef NO_HASH
> #define NO_HASH /* Not yet implemented */
> @@ -1266,11 +1265,7 @@ public:
> /* ha_ methods: public wrappers for private virtual API */
>
> int ha_open(TABLE *table, const char *name, int mode, int test_if_locked);
> - int ha_close(void)
> - {
> - psi_close();
> - return close();
> - }
> + int ha_close(void);
> int ha_index_init(uint idx, bool sorted)
> {
> int result;
> @@ -1302,15 +1297,22 @@ public:
> inited=NONE;
> DBUG_RETURN(rnd_end());
> }
> - int ha_rnd_next(uchar *buf)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, MAX_KEY, 0);
> - result= rnd_next(buf);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> + int ha_rnd_next(uchar *buf);
> + int ha_rnd_pos(uchar * buf, uchar *pos);
> + int ha_index_read_map(uchar *buf, const uchar *key,
> + key_part_map keypart_map,
> + enum ha_rkey_function find_flag);
> + int ha_index_read_idx_map(uchar *buf, uint index, const uchar *key,
> + key_part_map keypart_map,
> + enum ha_rkey_function find_flag);
> + int ha_index_next(uchar * buf);
> + int ha_index_prev(uchar * buf);
> + int ha_index_first(uchar * buf);
> + int ha_index_last(uchar * buf);
> + int ha_index_next_same(uchar *buf, const uchar *key, uint keylen);
> + int ha_index_read(uchar *buf, const uchar *key, uint key_len,
> + enum ha_rkey_function find_flag);
> + int ha_index_read_last(uchar *buf, const uchar *key, uint key_len);
> int ha_reset();
> /* this is necessary in many places, e.g. in HANDLER command */
> int ha_index_or_rnd_end()
> @@ -1492,73 +1494,6 @@ public:
> DBUG_ASSERT(FALSE);
> return HA_ERR_WRONG_COMMAND;
> }
> - int ha_index_read_map(uchar *buf, const uchar *key,
> - key_part_map keypart_map,
> - enum ha_rkey_function find_flag)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> - result= index_read_map(buf, key, keypart_map, find_flag);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> - int ha_index_read_idx_map(uchar *buf, uint index, const uchar *key,
> - key_part_map keypart_map,
> - enum ha_rkey_function find_flag)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, index, 0);
> - result= index_read_idx_map(buf, index, key, keypart_map, find_flag);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> - int ha_index_next(uchar * buf)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> - result= index_next(buf);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> - int ha_index_prev(uchar * buf)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> - result= index_prev(buf);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> - int ha_index_first(uchar * buf)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> - result= index_first(buf);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> - int ha_index_last(uchar * buf)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> - result= index_last(buf);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> - int ha_index_next_same(uchar *buf, const uchar *key, uint keylen)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> - result= index_next_same(buf, key, keylen);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> protected:
> /**
> @brief
> @@ -1619,8 +1554,8 @@ public:
> virtual int ft_read(uchar *buf) { return HA_ERR_WRONG_COMMAND; }
> protected:
> virtual int rnd_next(uchar *buf)=0;
> -public:
> virtual int rnd_pos(uchar * buf, uchar *pos)=0;
> +public:
> /**
> One has to use this method when to find
> random position by record as the plain
> @@ -1630,7 +1565,7 @@ public:
> virtual int rnd_pos_by_record(uchar *record)
> {
> position(record);
> - return rnd_pos(record, ref);
> + return ha_rnd_pos(record, ref);
> }
> virtual int read_first_row(uchar *buf, uint primary_key);
> /**
> @@ -1941,32 +1876,6 @@ protected:
> */
> PSI_table_share *ha_table_share_psi(const TABLE_SHARE *share) const;
>
> - inline void psi_open()
> - {
> - DBUG_ASSERT(m_psi == NULL);
> - DBUG_ASSERT(table_share != NULL);
> -#ifdef HAVE_PSI_INTERFACE
> - if (likely(PSI_server != NULL))
> - {
> - PSI_table_share *share_psi= ha_table_share_psi(table_share);
> - if (likely(share_psi != NULL))
> - m_psi= PSI_server->open_table(share_psi, this);
> - }
> -#endif
> - }
> -
> - inline void psi_close()
> - {
> -#ifdef HAVE_PSI_INTERFACE
> - if (likely(PSI_server&& m_psi))
> - {
> - PSI_server->close_table(m_psi);
> - m_psi= NULL; /* instrumentation handle, invalid after close_table() */
> - }
> -#endif
> - DBUG_ASSERT(m_psi == NULL);
> - }
> -
> /**
> Default rename_table() and delete_table() rename/delete files with a
> given name and extensions from bas_ext().
> @@ -2068,25 +1977,6 @@ private:
> { return HA_ADMIN_NOT_IMPLEMENTED; }
> virtual void start_bulk_insert(ha_rows rows) {}
> virtual int end_bulk_insert() { return 0; }
> - int ha_index_read(uchar *buf, const uchar *key, uint key_len,
> - enum ha_rkey_function find_flag)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> - result= index_read(buf, key, key_len, find_flag);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> - int ha_index_read_last(uchar *buf, const uchar *key, uint key_len)
> - {
> - int result;
> - struct PSI_table_locker *locker;
> - locker= MYSQL_START_TABLE_WAIT(m_psi, PSI_TABLE_FETCH_ROW, active_index, 0);
> - result= index_read_last(buf, key, key_len);
> - MYSQL_END_TABLE_WAIT(locker);
> - return result;
> - }
> protected:
> virtual int index_read(uchar * buf, const uchar * key, uint key_len,
> enum ha_rkey_function find_flag)
>
> === modified file 'sql/log_event.cc'
> --- a/sql/log_event.cc 2010-05-20 14:42:09 +0000
> +++ b/sql/log_event.cc 2010-05-25 08:19:01 +0000
> @@ -8739,19 +8739,19 @@ Rows_log_event::write_row(const Relay_lo
> We need to retrieve the old row into record[1] to be able to
> either update or delete the offending record. We either:
>
> - - use rnd_pos() with a row-id (available as dupp_row) to the
> + - use ha_rnd_pos() with a row-id (available as dupp_row) to the
> offending row, if that is possible (MyISAM and Blackhole), or else
>
> - - use index_read_idx() with the key that is duplicated, to
> + - use ha_index_read_idx_map() with the key that is duplicated, to
> retrieve the offending row.
> */
> if (table->file->ha_table_flags()& HA_DUPLICATE_POS)
> {
> - DBUG_PRINT("info",("Locating offending record using rnd_pos()"));
> - error= table->file->rnd_pos(table->record[1],
> table->file->dup_ref);
> + DBUG_PRINT("info",("Locating offending record using ha_rnd_pos()"));
> + error= table->file->ha_rnd_pos(table->record[1],
> table->file->dup_ref);
> if (error)
> {
> - DBUG_PRINT("info",("rnd_pos() returns error %d",error));
> + DBUG_PRINT("info",("ha_rnd_pos() returns error %d",error));
> if (error == HA_ERR_RECORD_DELETED)
> error= HA_ERR_KEY_NOT_FOUND;
> table->file->print_error(error, MYF(0));
> @@ -8786,7 +8786,7 @@ Rows_log_event::write_row(const Relay_lo
> HA_READ_KEY_EXACT);
> if (error)
> {
> - DBUG_PRINT("info",("index_read_idx() returns %s", HA_ERR(error)));
> + DBUG_PRINT("info",("ha_index_read_idx_map() returns %s", HA_ERR(error)));
> if (error == HA_ERR_RECORD_DELETED)
> error= HA_ERR_KEY_NOT_FOUND;
> table->file->print_error(error, MYF(0));
>
> === modified file 'sql/log_event_old.cc'
> --- a/sql/log_event_old.cc 2010-05-05 08:16:47 +0000
> +++ b/sql/log_event_old.cc 2010-05-25 08:19:01 +0000
> @@ -517,18 +517,18 @@ replace_record(THD *thd, TABLE *table,
> We need to retrieve the old row into record[1] to be able to
> either update or delete the offending record. We either:
>
> - - use rnd_pos() with a row-id (available as dupp_row) to the
> + - use ha_rnd_pos() with a row-id (available as dupp_row) to the
> offending row, if that is possible (MyISAM and Blackhole), or else
>
> - - use index_read_idx() with the key that is duplicated, to
> + - use ha_index_read_idx_map() with the key that is duplicated, to
> retrieve the offending row.
> */
> if (table->file->ha_table_flags()& HA_DUPLICATE_POS)
> {
> - error= table->file->rnd_pos(table->record[1],
> table->file->dup_ref);
> + error= table->file->ha_rnd_pos(table->record[1],
> table->file->dup_ref);
> if (error)
> {
> - DBUG_PRINT("info",("rnd_pos() returns error %d",error));
> + DBUG_PRINT("info",("ha_rnd_pos() returns error %d",error));
> if (error == HA_ERR_RECORD_DELETED)
> error= HA_ERR_KEY_NOT_FOUND;
> table->file->print_error(error, MYF(0));
> @@ -557,7 +557,7 @@ replace_record(THD *thd, TABLE *table,
> HA_READ_KEY_EXACT);
> if (error)
> {
> - DBUG_PRINT("info", ("index_read_idx() returns error %d", error));
> + DBUG_PRINT("info", ("ha_index_read_idx_map() returns error %d", error));
> if (error == HA_ERR_RECORD_DELETED)
> error= HA_ERR_KEY_NOT_FOUND;
> table->file->print_error(error, MYF(0));
> @@ -672,9 +672,9 @@ static int find_and_fetch_row(TABLE *tab
>
> */
> table->file->position(table->record[0]);
> - int error= table->file->rnd_pos(table->record[0],
> table->file->ref);
> + int error= table->file->ha_rnd_pos(table->record[0],
> table->file->ref);
> /*
> - rnd_pos() returns the record in table->record[0], so we have to
> + ha_rnd_pos() returns the record in table->record[0], so we have to
> move it to table->record[1].
> */
> bmove_align(table->record[1], table->record[0],
> table->s->reclength);
> @@ -2022,19 +2022,19 @@ Old_rows_log_event::write_row(const Rela
> We need to retrieve the old row into record[1] to be able to
> either update or delete the offending record. We either:
>
> - - use rnd_pos() with a row-id (available as dupp_row) to the
> + - use ha_rnd_pos() with a row-id (available as dupp_row) to the
> offending row, if that is possible (MyISAM and Blackhole), or else
>
> - - use index_read_idx() with the key that is duplicated, to
> + - use ha_index_read_idx_map() with the key that is duplicated, to
> retrieve the offending row.
> */
> if (table->file->ha_table_flags()& HA_DUPLICATE_POS)
> {
> - DBUG_PRINT("info",("Locating offending record using rnd_pos()"));
> - error= table->file->rnd_pos(table->record[1],
> table->file->dup_ref);
> + DBUG_PRINT("info",("Locating offending record using ha_rnd_pos()"));
> + error= table->file->ha_rnd_pos(table->record[1],
> table->file->dup_ref);
> if (error)
> {
> - DBUG_PRINT("info",("rnd_pos() returns error %d",error));
> + DBUG_PRINT("info",("ha_rnd_pos() returns error %d",error));
> if (error == HA_ERR_RECORD_DELETED)
> error= HA_ERR_KEY_NOT_FOUND;
> table->file->print_error(error, MYF(0));
> @@ -2069,7 +2069,7 @@ Old_rows_log_event::write_row(const Rela
> HA_READ_KEY_EXACT);
> if (error)
> {
> - DBUG_PRINT("info",("index_read_idx() returns error %d", error));
> + DBUG_PRINT("info",("ha_index_read_idx_map() returns error %d", error));
> if (error == HA_ERR_RECORD_DELETED)
> error= HA_ERR_KEY_NOT_FOUND;
> table->file->print_error(error, MYF(0));
>
> === modified file 'sql/opt_range.cc'
> --- a/sql/opt_range.cc 2010-05-05 08:16:47 +0000
> +++ b/sql/opt_range.cc 2010-05-25 08:19:01 +0000
> @@ -8547,7 +8547,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next
>
> /* We get here if we got the same row ref in all scans. */
> if (need_to_fetch_row)
> - error= head->file->rnd_pos(head->record[0], last_rowid);
> + error= head->file->ha_rnd_pos(head->record[0], last_rowid);
> } while (error == HA_ERR_RECORD_DELETED);
> DBUG_RETURN(error);
> }
> @@ -8613,7 +8613,7 @@ int QUICK_ROR_UNION_SELECT::get_next()
> cur_rowid= prev_rowid;
> prev_rowid= tmp;
>
> - error= head->file->rnd_pos(quick->record, prev_rowid);
> + error= head->file->ha_rnd_pos(quick->record, prev_rowid);
> } while (error == HA_ERR_RECORD_DELETED);
> DBUG_RETURN(error);
> }
>
> === modified file 'sql/records.cc'
> --- a/sql/records.cc 2010-05-05 08:16:47 +0000
> +++ b/sql/records.cc 2010-05-25 08:19:01 +0000
> @@ -415,7 +415,7 @@ static int rr_from_tempfile(READ_RECORD
> {
> if (my_b_read(info->io_cache,info->ref_pos,info->ref_length))
> return -1; /* End of file */
> - if (!(tmp=info->file->rnd_pos(info->record,info->ref_pos)))
> + if (!(tmp=info->file->ha_rnd_pos(info->record,info->ref_pos)))
> break;
> /* The following is extremely unlikely to happen */
> if (tmp == HA_ERR_RECORD_DELETED ||
> @@ -466,7 +466,7 @@ static int rr_from_pointers(READ_RECORD
> cache_pos= info->cache_pos;
> info->cache_pos+= info->ref_length;
>
> - if (!(tmp=info->file->rnd_pos(info->record,cache_pos)))
> + if (!(tmp=info->file->ha_rnd_pos(info->record,cache_pos)))
> break;
>
> /* The following is extremely unlikely to happen */
> @@ -599,7 +599,7 @@ static int rr_from_cache(READ_RECORD *in
> record=uint3korr(position);
> position+=3;
> record_pos=info->cache+record*info->reclength;
> - if ((error=(int16) info->file->rnd_pos(record_pos,info->ref_pos)))
> + if ((error=(int16)
> info->file->ha_rnd_pos(record_pos,info->ref_pos)))
> {
> record_pos[info->error_offset]=1;
> shortstore(record_pos,error);
>
> === modified file 'sql/sql_insert.cc'
> --- a/sql/sql_insert.cc 2010-05-20 14:42:09 +0000
> +++ b/sql/sql_insert.cc 2010-05-25 08:19:01 +0000
> @@ -1487,7 +1487,7 @@ int write_record(THD *thd, TABLE *table,
> goto err;
> if (table->file->ha_table_flags()& HA_DUPLICATE_POS)
> {
> - if (table->file->rnd_pos(table->record[1],table->file->dup_ref))
> + if (table->file->ha_rnd_pos(table->record[1],table->file->dup_ref))
> goto err;
> }
> else
>
> === modified file 'sql/sql_select.cc'
> --- a/sql/sql_select.cc 2010-05-05 08:16:47 +0000
> +++ b/sql/sql_select.cc 2010-05-25 08:19:01 +0000
> @@ -12775,7 +12775,7 @@ end_unique_update(JOIN *join, JOIN_TAB *
> table->file->print_error(error,MYF(0)); /* purecov: inspected */
> DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
> }
> - if (table->file->rnd_pos(table->record[1],table->file->dup_ref))
> + if (table->file->ha_rnd_pos(table->record[1],
> table->file->dup_ref))
> {
> table->file->print_error(error,MYF(0)); /* purecov: inspected */
> DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
>
> === modified file 'sql/sql_update.cc'
> --- a/sql/sql_update.cc 2010-05-20 14:42:09 +0000
> +++ b/sql/sql_update.cc 2010-05-25 08:19:01 +0000
> @@ -160,7 +160,7 @@ static void prepare_record_for_error_mes
> /* Tell the engine about the new set. */
> table->file->column_bitmaps_signal();
> /* Read record that is identified by table->file->ref. */
> - (void) table->file->rnd_pos(table->record[1], table->file->ref);
> + (void) table->file->ha_rnd_pos(table->record[1],
> table->file->ref);
> /* Copy the newly read columns into the new record. */
> for (field_p= table->field; (field= *field_p); field_p++)
> if (bitmap_is_set(&unique_map, field->field_index))
> @@ -1969,15 +1969,15 @@ int multi_update::do_updates()
> goto err;
> }
>
> - /* call rnd_pos() using rowids from temporary table */
> + /* call ha_rnd_pos() using rowids from temporary table */
> check_opt_it.rewind();
> TABLE *tbl= table;
> uint field_num= 0;
> do
> {
> if((local_error=
> - tbl->file->rnd_pos(tbl->record[0],
> - (uchar *) tmp_table->field[field_num]->ptr)))
> + tbl->file->ha_rnd_pos(tbl->record[0],
> + (uchar *)
> tmp_table->field[field_num]->ptr)))
> goto err;
> field_num++;
> } while((tbl= check_opt_it++));
>
>
>
>
>