Hi, scut_tang!
On Jun 30, scut_tang wrote:
>
> KEY ACCOMPLISHMENTS LAST WEEK
> =============================
> Almost finish infoschema_discover function, but meet some problems in debugging.
> It will be described in KEY CONCERNS section.
>
> KEY TASKS THAT STALLED LAST WEEK
> ==============================
> May be I should perfect discover function.
>
> KEY CONCERNS
> ============
> 1.I want to know more about how to debug MySQL internal. Before this
> project, I always used gdb to debug mysqld and it worked well.
> But in this project, I meet some problems. For example, the source
> code like:
...<skip>
> Does the source code text file have some problems? Sergei, how do
> you debug MySQL internal?
I've seen that you solved that already. Great!
Yes, I always compile with -O0 for debugging.
> 2. What kinds of members in TABLE_SHARE must be initialized in
> open_table? In my discover, I fill TABLE_SHARE members:
> share->mem_root; share->field; share->fields; share->key_info;
> share->keys; share->set_table_cache_key;
> share->version; share->table_space; share->table_map_id;
> share->LOCK_ha_data; share->null_fields;
> share->blob_fields; share->db_plugin; share->reclength;
> share->rec_buff_length;
you don't need to initialize manually mem_root and some other fields -
just call init_tmp_table_share(), it'll do it for you.
You need to set fields that describe the table, such as:
Field **field;
Field **found_next_number_field; // will be 0 for you
Field *timestamp_field; // same here
KEY *key_info;
uint *blob_field;
uchar *default_values;
LEX_STRING comment;
CHARSET_INFO *table_charset;
key_map keys_in_use;
key_map keys_for_keyread;
ha_rows min_rows, max_rows;
ulong avg_row_length;
ulong version, mysql_version;
ulong timestamp_offset;
ulong reclength;
plugin_ref db_plugin;
enum row_type row_type;
enum ha_storage_media default_storage_media;
char *tablespace;
enum tmp_table_type tmp_table;
enum ha_choice transactional;
enum ha_choice page_checksum;
uint null_bytes, last_null_bit_pos;
uint fields;
uint rec_buff_length;
uint keys, key_parts;
uint max_key_length, max_unique_length, total_key_length;
uint uniques;
uint null_fields;
uint blob_fields;
uint timestamp_field_offset;
uint varchar_fields;
uint db_create_options;
uint db_options_in_use;
uint primary_key;
uint column_bitmap_size;
uchar frm_version;
bool null_field_first;
bool db_low_byte_first;
But fear not! :)
Most of these fields can be set to the default values, as they don't
apply to the information_schema tables. Many others can be generated -
that is, the engine in discover() don't need to set them - but after
successful discovery MySQL will need to set these fields. They are
fields like 'name_hash' (hash of field names), 'varchar_fields' (number
of varchar fields), etc. The engine will need to set only 'field',
'key_info', 'default_values' and few others, everything else can be
calculated from them.
> Because I can not still push my branch, I write these here.
On your
https://answers.edge.launchpad.net/launchpad-code/+question/75673
there was a comment that you should try bzr 1.16.1, perhaps it'll
help...
Regards / Mit vielen Grüßen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring