Commit b037a7ca authored by unknown's avatar unknown

Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-5.1-wl2826

into  c-9a08e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/wl2826


sql/sql_table.cc:
  Auto merged
parents 256d8527 836912d1
......@@ -391,88 +391,6 @@ int ha_partition::ha_initialise()
/****************************************************************************
MODULE meta data changes
****************************************************************************/
/*
Create partition names
SYNOPSIS
create_partition_name()
out:out Created partition name string
in1 First part
in2 Second part
name_variant Normal, temporary or renamed partition name
RETURN VALUE
NONE
DESCRIPTION
This method is used to calculate the partition name, service routine to
the del_ren_cre_table method.
*/
#define NORMAL_PART_NAME 0
#define TEMP_PART_NAME 1
#define RENAMED_PART_NAME 2
static void create_partition_name(char *out, const char *in1,
const char *in2, uint name_variant,
bool translate)
{
char transl_part_name[FN_REFLEN];
const char *transl_part;
if (translate)
{
tablename_to_filename(in2, transl_part_name, FN_REFLEN);
transl_part= transl_part_name;
}
else
transl_part= in2;
if (name_variant == NORMAL_PART_NAME)
strxmov(out, in1, "#P#", transl_part, NullS);
else if (name_variant == TEMP_PART_NAME)
strxmov(out, in1, "#P#", transl_part, "#TMP#", NullS);
else if (name_variant == RENAMED_PART_NAME)
strxmov(out, in1, "#P#", transl_part, "#REN#", NullS);
}
/*
Create subpartition name
SYNOPSIS
create_subpartition_name()
out:out Created partition name string
in1 First part
in2 Second part
in3 Third part
name_variant Normal, temporary or renamed partition name
RETURN VALUE
NONE
DESCRIPTION
This method is used to calculate the subpartition name, service routine to
the del_ren_cre_table method.
*/
static void create_subpartition_name(char *out, const char *in1,
const char *in2, const char *in3,
uint name_variant)
{
char transl_part_name[FN_REFLEN], transl_subpart_name[FN_REFLEN];
tablename_to_filename(in2, transl_part_name, FN_REFLEN);
tablename_to_filename(in3, transl_subpart_name, FN_REFLEN);
if (name_variant == NORMAL_PART_NAME)
strxmov(out, in1, "#P#", transl_part_name,
"#SP#", transl_subpart_name, NullS);
else if (name_variant == TEMP_PART_NAME)
strxmov(out, in1, "#P#", transl_part_name,
"#SP#", transl_subpart_name, "#TMP#", NullS);
else if (name_variant == RENAMED_PART_NAME)
strxmov(out, in1, "#P#", transl_part_name,
"#SP#", transl_subpart_name, "#REN#", NullS);
}
/*
Delete a table
......
......@@ -799,6 +799,8 @@ typedef int (*get_partitions_in_range_iter)(partition_info *part_info,
PARTITION_ITERATOR *part_iter);
struct TABLE_LOG_MEMORY_ENTRY;
class partition_info : public Sql_alloc
{
public:
......@@ -845,7 +847,9 @@ class partition_info : public Sql_alloc
Item *subpart_expr;
Item *item_free_list;
TABLE_LOG_MEMORY_ENTRY *first_log_entry;
TABLE_LOG_MEMORY_ENTRY *exec_log_entry;
/*
A bitmap of partitions used by the current query.
Usage pattern:
......
......@@ -1135,6 +1135,16 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info,
bool remove_table_from_cache(THD *thd, const char *db, const char *table,
uint flags);
#define NORMAL_PART_NAME 0
#define TEMP_PART_NAME 1
#define RENAMED_PART_NAME 2
void create_partition_name(char *out, const char *in1,
const char *in2, uint name_variant,
bool translate);
void create_subpartition_name(char *out, const char *in1,
const char *in2, const char *in3,
uint name_variant);
typedef struct st_lock_param_type
{
ulonglong copied;
......
This diff is collapsed.
......@@ -282,6 +282,7 @@ typedef struct st_global_table_log
File file_id;
uint name_len;
uint handler_type_len;
uint io_size;
} GLOBAL_TABLE_LOG;
GLOBAL_TABLE_LOG global_table_log;
......@@ -361,6 +362,8 @@ write_table_log_header()
int2store(&global_table_log.file_entry[4], const_var);
const_var= 32;
int2store(&global_table_log.file_entry[6], const_var);
const_var= IO_SIZE;
int4store(&global_table_log.file_entry[8], const_var);
if (write_table_log_file_entry(0UL))
error= TRUE;
DBUG_RETURN(error);
......@@ -384,9 +387,10 @@ read_table_log_file_entry(uint entry_no)
bool error= FALSE;
File file_id= global_table_log.file_id;
char *file_entry= (char*)global_table_log.file_entry;
uint io_size= global_table_log.io_size;
DBUG_ENTER("read_table_log_file_entry");
if (my_pread(file_id, file_entry, IO_SIZE, IO_SIZE * entry_no, MYF(0)))
if (my_pread(file_id, file_entry, io_size, io_size * entry_no, MYF(0)))
error= TRUE;
DBUG_RETURN(error);
}
......@@ -429,6 +433,7 @@ read_table_log_header()
char *file_entry= (char*)global_table_log.file_entry;
char file_name[FN_REFLEN];
uint entry_no;
bool successful_open= FALSE;
DBUG_ENTER("read_table_log_header");
bzero(file_entry, sizeof(global_table_log.file_entry));
......@@ -439,10 +444,14 @@ read_table_log_header()
{
/* Write message into error log */
}
else
successful_open= TRUE;
}
entry_no= uint4korr(&file_entry[0]);
global_table_log.name_len= uint2korr(&file_entry[4]);
global_table_log.handler_type_len= uint2korr(&file_entry[6]);
if (successful_open)
global_table_log.io_size= uint4korr(&file_entry[8]);
global_table_log.first_free= NULL;
global_table_log.first_used= NULL;
global_table_log.no_entries= 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment