1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

First stage of table definition cache

Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon)
Created Field::make_field() and made Field_num::make_field() to call this
Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead
Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer.
Renamed TABLE_SHARE->real_name to table_name
Renamed TABLE->table_name to alias
Renamed TABLE_LIST->real_name to table_name
This commit is contained in:
monty@mysql.com
2005-01-06 13:00:13 +02:00
parent 7cf8285b3f
commit d35140a851
57 changed files with 1542 additions and 1475 deletions

View File

@@ -79,7 +79,7 @@ void print_cached_tables(void)
{
TABLE *entry=(TABLE*) hash_element(&open_cache,idx);
printf("%-14.14s %-32s%6ld%8ld%10ld%6d %s\n",
entry->table_cache_key,entry->real_name,entry->version,
entry->s->db, entry->s->table_name, entry->s->version,
entry->in_use ? entry->in_use->thread_id : 0L,
entry->in_use ? entry->in_use->dbug_thread_id : 0L,
entry->db_stat ? 1 : 0, entry->in_use ? lock_descriptions[(int)entry->reginfo.lock_type] : "Not in use");
@@ -131,7 +131,7 @@ void TEST_filesort(SORT_FIELD *sortorder,uint s_length)
{
if (sortorder->field->table_name)
{
out.append(sortorder->field->table_name);
out.append(*sortorder->field->table_name);
out.append('.');
}
out.append(sortorder->field->field_name ? sortorder->field->field_name:
@@ -167,7 +167,7 @@ TEST_join(JOIN *join)
TABLE *form=tab->table;
char key_map_buff[128];
fprintf(DBUG_FILE,"%-16.16s type: %-7s q_keys: %s refs: %d key: %d len: %d\n",
form->table_name,
form->alias,
join_type_str[tab->type],
tab->keys.print(key_map_buff),
tab->ref.key_parts,
@@ -261,7 +261,7 @@ print_plan(JOIN* join, double read_time, double record_count,
pos = join->positions[i];
table= pos.table->table;
if (table)
fputs(table->real_name, DBUG_FILE);
fputs(table->s->table_name, DBUG_FILE);
fputc(' ', DBUG_FILE);
}
fputc('\n', DBUG_FILE);
@@ -278,7 +278,7 @@ print_plan(JOIN* join, double read_time, double record_count,
pos= join->best_positions[i];
table= pos.table->table;
if (table)
fputs(table->real_name, DBUG_FILE);
fputs(table->s->table_name, DBUG_FILE);
fputc(' ', DBUG_FILE);
}
}
@@ -289,7 +289,7 @@ print_plan(JOIN* join, double read_time, double record_count,
for (plan_nodes= join->best_ref ; *plan_nodes ; plan_nodes++)
{
join_table= (*plan_nodes);
fputs(join_table->table->real_name, DBUG_FILE);
fputs(join_table->table->s->table_name, DBUG_FILE);
fprintf(DBUG_FILE, "(%lu,%lu,%lu)",
(ulong) join_table->found_records,
(ulong) join_table->records,
@@ -332,12 +332,12 @@ static void push_locks_into_array(DYNAMIC_ARRAY *ar, THR_LOCK_DATA *data,
if (data)
{
TABLE *table=(TABLE *)data->debug_print_param;
if (table && table->tmp_table == NO_TMP_TABLE)
if (table && table->s->tmp_table == NO_TMP_TABLE)
{
TABLE_LOCK_INFO table_lock_info;
table_lock_info.thread_id=table->in_use->thread_id;
memcpy(table_lock_info.table_name, table->table_cache_key,
table->key_length);
table_lock_info.thread_id= table->in_use->thread_id;
memcpy(table_lock_info.table_name, table->s->table_cache_key,
table->s->key_length);
table_lock_info.table_name[strlen(table_lock_info.table_name)]='.';
table_lock_info.waiting=wait;
table_lock_info.lock_text=text;