Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-print_subselect-4.1
This commit is contained in:
commit
dde384d9ea
@ -68,13 +68,6 @@
|
|||||||
/* Size of buffer for dump's select query */
|
/* Size of buffer for dump's select query */
|
||||||
#define QUERY_LENGTH 1536
|
#define QUERY_LENGTH 1536
|
||||||
|
|
||||||
#define print_xml_tag(out_file, sbeg, sval, send) \
|
|
||||||
{ \
|
|
||||||
fputs(sbeg, out_file); \
|
|
||||||
print_quoted_xml(out_file, sval, 0); \
|
|
||||||
fputs(send, out_file); \
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *add_load_option(char *ptr, const char *object,
|
static char *add_load_option(char *ptr, const char *object,
|
||||||
const char *statement);
|
const char *statement);
|
||||||
static ulong find_set(TYPELIB *lib, const char *x, uint length,
|
static ulong find_set(TYPELIB *lib, const char *x, uint length,
|
||||||
@ -305,7 +298,6 @@ static int init_dumping(char *);
|
|||||||
static int dump_databases(char **);
|
static int dump_databases(char **);
|
||||||
static int dump_all_databases();
|
static int dump_all_databases();
|
||||||
static char *quote_name(const char *name, char *buff, my_bool force);
|
static char *quote_name(const char *name, char *buff, my_bool force);
|
||||||
static void print_quoted_xml(FILE *output, char *str, ulong len);
|
|
||||||
|
|
||||||
static void print_version(void)
|
static void print_version(void)
|
||||||
{
|
{
|
||||||
@ -658,8 +650,98 @@ static char *quote_name(const char *name, char *buff, my_bool force)
|
|||||||
} /* quote_name */
|
} /* quote_name */
|
||||||
|
|
||||||
|
|
||||||
void print_xml_row(FILE *xml_file, const char *row_name, MYSQL_RES *tableRes,
|
/*
|
||||||
MYSQL_ROW *row)
|
Quote and print a string.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
print_quoted_xml()
|
||||||
|
output - output file
|
||||||
|
str - string to print
|
||||||
|
len - its length
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Quote '<' '>' '&' '\"' singns and print a string to the xml_file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void print_quoted_xml(FILE *xml_file, const char *str, ulong len)
|
||||||
|
{
|
||||||
|
const char *end;
|
||||||
|
|
||||||
|
for (end= str + len; str != end; str++)
|
||||||
|
{
|
||||||
|
switch (*str) {
|
||||||
|
case '<':
|
||||||
|
fputs("<", xml_file);
|
||||||
|
break;
|
||||||
|
case '>':
|
||||||
|
fputs(">", xml_file);
|
||||||
|
break;
|
||||||
|
case '&':
|
||||||
|
fputs("&", xml_file);
|
||||||
|
break;
|
||||||
|
case '\"':
|
||||||
|
fputs(""", xml_file);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fputc(*str, xml_file);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Print xml tag with one attribute.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
print_xml_tag1()
|
||||||
|
xml_file - output file
|
||||||
|
sbeg - line beginning
|
||||||
|
stag_atr - tag and attribute
|
||||||
|
sval - value of attribute
|
||||||
|
send - line ending
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Print tag with one attribute to the xml_file. Format is:
|
||||||
|
sbeg<stag_atr="sval">send
|
||||||
|
NOTE
|
||||||
|
sval MUST be a NULL terminated string.
|
||||||
|
sval string will be qouted before output.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void print_xml_tag1(FILE * xml_file, const char* sbeg,
|
||||||
|
const char* stag_atr, const char* sval,
|
||||||
|
const char* send)
|
||||||
|
{
|
||||||
|
fputs(sbeg, xml_file);
|
||||||
|
fputs("<", xml_file);
|
||||||
|
fputs(stag_atr, xml_file);
|
||||||
|
fputs("\"", xml_file);
|
||||||
|
print_quoted_xml(xml_file, sval, strlen(sval));
|
||||||
|
fputs("\">", xml_file);
|
||||||
|
fputs(send, xml_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Print xml tag with many attributes.
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
print_xml_row()
|
||||||
|
xml_file - output file
|
||||||
|
row_name - xml tag name
|
||||||
|
tableRes - query result
|
||||||
|
row - result row
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Print tag with many attribute to the xml_file. Format is:
|
||||||
|
\t\t<row_name Atr1="Val1" Atr2="Val2"... />
|
||||||
|
NOTE
|
||||||
|
All atributes and values will be quoted before output.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void print_xml_row(FILE *xml_file, const char *row_name,
|
||||||
|
MYSQL_RES *tableRes, MYSQL_ROW *row)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
MYSQL_FIELD *field;
|
MYSQL_FIELD *field;
|
||||||
@ -669,10 +751,10 @@ void print_xml_row(FILE *xml_file, const char *row_name, MYSQL_RES *tableRes,
|
|||||||
mysql_field_seek(tableRes, 0);
|
mysql_field_seek(tableRes, 0);
|
||||||
for (i= 0; (field= mysql_fetch_field(tableRes)); i++)
|
for (i= 0; (field= mysql_fetch_field(tableRes)); i++)
|
||||||
{
|
{
|
||||||
if ((*row)[i] && (*row)[i][0])
|
if ((*row)[i])
|
||||||
{
|
{
|
||||||
fputs(" ", xml_file);
|
fputs(" ", xml_file);
|
||||||
print_quoted_xml(xml_file, field->name, 0);
|
print_quoted_xml(xml_file, field->name, field->name_length);
|
||||||
fputs("=\"", xml_file);
|
fputs("=\"", xml_file);
|
||||||
print_quoted_xml(xml_file, (*row)[i], lengths[i]);
|
print_quoted_xml(xml_file, (*row)[i], lengths[i]);
|
||||||
fputs("\"", xml_file);
|
fputs("\"", xml_file);
|
||||||
@ -849,7 +931,7 @@ static uint getTableStructure(char *table, char* db)
|
|||||||
if (!opt_xml)
|
if (!opt_xml)
|
||||||
fprintf(sql_file, "CREATE TABLE %s (\n", result_table);
|
fprintf(sql_file, "CREATE TABLE %s (\n", result_table);
|
||||||
else
|
else
|
||||||
print_xml_tag(sql_file, "\t<table_structure name=\"", table, "\">\n");
|
print_xml_tag1(sql_file, "\t", "table_structure name=", table, "\n");
|
||||||
}
|
}
|
||||||
if (cFlag)
|
if (cFlag)
|
||||||
sprintf(insert_pat, "INSERT %sINTO %s (", delayed, result_table);
|
sprintf(insert_pat, "INSERT %sINTO %s (", delayed, result_table);
|
||||||
@ -1192,9 +1274,7 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
rownr=0;
|
rownr=0;
|
||||||
init_length=(uint) strlen(insert_pat)+4;
|
init_length=(uint) strlen(insert_pat)+4;
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
print_xml_tag1(md_result_file, "\t", "table_data name=", table, "\n");
|
||||||
print_xml_tag(md_result_file, "\t<table_data name=\"", table, "\">\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_autocommit)
|
if (opt_autocommit)
|
||||||
fprintf(md_result_file, "set autocommit=0;\n");
|
fprintf(md_result_file, "set autocommit=0;\n");
|
||||||
@ -1275,8 +1355,8 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
{
|
{
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
{
|
||||||
print_xml_tag(md_result_file, "\t\t<field name=\"", field->name,
|
print_xml_tag1(md_result_file, "\t\t", "field name=",
|
||||||
"\">");
|
field->name, "");
|
||||||
print_quoted_xml(md_result_file, row[i], lengths[i]);
|
print_quoted_xml(md_result_file, row[i], lengths[i]);
|
||||||
fputs("</field>\n", md_result_file);
|
fputs("</field>\n", md_result_file);
|
||||||
}
|
}
|
||||||
@ -1289,8 +1369,8 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
char *ptr = row[i];
|
char *ptr = row[i];
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
{
|
||||||
print_xml_tag(md_result_file, "\t\t<field name=\"", field->name,
|
print_xml_tag1(md_result_file, "\t\t", "field name=",
|
||||||
"\">");
|
field->name, "");
|
||||||
fputs(!my_isalpha(charset_info, *ptr) ? ptr: "NULL",
|
fputs(!my_isalpha(charset_info, *ptr) ? ptr: "NULL",
|
||||||
md_result_file);
|
md_result_file);
|
||||||
fputs("</field>\n", md_result_file);
|
fputs("</field>\n", md_result_file);
|
||||||
@ -1303,10 +1383,8 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
print_xml_tag1(md_result_file, "\t\t", "field name=",
|
||||||
print_xml_tag(md_result_file, "\t\t<field name=\"", field->name,
|
field->name, "NULL</field>\n");
|
||||||
"\">NULL</field>\n");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
fputs("NULL", md_result_file);
|
fputs("NULL", md_result_file);
|
||||||
}
|
}
|
||||||
@ -1372,32 +1450,6 @@ static void dumpTable(uint numFields, char *table)
|
|||||||
} /* dumpTable */
|
} /* dumpTable */
|
||||||
|
|
||||||
|
|
||||||
static void print_quoted_xml(FILE *output, char *str, ulong len)
|
|
||||||
{
|
|
||||||
const char *end= str + (len ? len : strlen(str));
|
|
||||||
|
|
||||||
for (; str != end; str++)
|
|
||||||
{
|
|
||||||
switch (*str) {
|
|
||||||
case '<':
|
|
||||||
fputs("<", output);
|
|
||||||
break;
|
|
||||||
case '>':
|
|
||||||
fputs(">", output);
|
|
||||||
break;
|
|
||||||
case '&':
|
|
||||||
fputs("&", output);
|
|
||||||
break;
|
|
||||||
case '\"':
|
|
||||||
fputs(""", output);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fputc(*str, output);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *getTableName(int reset)
|
static char *getTableName(int reset)
|
||||||
{
|
{
|
||||||
static MYSQL_RES *res = NULL;
|
static MYSQL_RES *res = NULL;
|
||||||
@ -1516,9 +1568,7 @@ static int dump_all_tables_in_db(char *database)
|
|||||||
if (init_dumping(database))
|
if (init_dumping(database))
|
||||||
return 1;
|
return 1;
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
print_xml_tag1(md_result_file, "", "database name=", database, "\n");
|
||||||
print_xml_tag(md_result_file, "<database name=\"", database, "\">\n");
|
|
||||||
}
|
|
||||||
if (lock_tables)
|
if (lock_tables)
|
||||||
{
|
{
|
||||||
DYNAMIC_STRING query;
|
DYNAMIC_STRING query;
|
||||||
@ -1584,9 +1634,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
|||||||
/* We shall countinue here, if --force was given */
|
/* We shall countinue here, if --force was given */
|
||||||
}
|
}
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
{
|
print_xml_tag1(md_result_file, "", "database name=", db, "\n");
|
||||||
print_xml_tag(md_result_file, "<database name=\"", db, "\">\n");
|
|
||||||
}
|
|
||||||
for (; tables > 0 ; tables-- , table_names++)
|
for (; tables > 0 ; tables-- , table_names++)
|
||||||
{
|
{
|
||||||
numrows = getTableStructure(*table_names, db);
|
numrows = getTableStructure(*table_names, db);
|
||||||
|
@ -297,8 +297,9 @@ buf_page_is_corrupted(
|
|||||||
ulint old_checksum;
|
ulint old_checksum;
|
||||||
ulint checksum_field;
|
ulint checksum_field;
|
||||||
ulint old_checksum_field;
|
ulint old_checksum_field;
|
||||||
|
#ifndef UNIV_HOTBACKUP
|
||||||
dulint current_lsn;
|
dulint current_lsn;
|
||||||
|
#endif
|
||||||
if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
|
if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
|
||||||
!= mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
!= mach_read_from_4(read_buf + UNIV_PAGE_SIZE
|
||||||
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
|
||||||
|
@ -302,8 +302,11 @@ dict_build_table_def_step(
|
|||||||
- page 3 will contain the root of the clustered index of the
|
- page 3 will contain the root of the clustered index of the
|
||||||
table we create here. */
|
table we create here. */
|
||||||
|
|
||||||
|
table->space = 0; /* reset to zero for the call below */
|
||||||
|
|
||||||
error = fil_create_new_single_table_tablespace(
|
error = fil_create_new_single_table_tablespace(
|
||||||
&(table->space), table->name, 4);
|
&(table->space), table->name,
|
||||||
|
FIL_IBD_FILE_INITIAL_SIZE);
|
||||||
if (error != DB_SUCCESS) {
|
if (error != DB_SUCCESS) {
|
||||||
|
|
||||||
return(error);
|
return(error);
|
||||||
@ -311,7 +314,7 @@ dict_build_table_def_step(
|
|||||||
|
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
|
|
||||||
fsp_header_init(table->space, 4, &mtr);
|
fsp_header_init(table->space, FIL_IBD_FILE_INITIAL_SIZE, &mtr);
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
}
|
}
|
||||||
|
@ -2580,7 +2580,7 @@ dict_create_foreign_constraints_low(
|
|||||||
sprintf(buf + strlen(buf),
|
sprintf(buf + strlen(buf),
|
||||||
" Error in foreign key constraint of table %.500s.\n"
|
" Error in foreign key constraint of table %.500s.\n"
|
||||||
"Cannot find the table from the internal data dictionary of InnoDB.\n"
|
"Cannot find the table from the internal data dictionary of InnoDB.\n"
|
||||||
"Create table statement:\n%.2000\n", name, sql_string);
|
"Create table statement:\n%.2000s\n", name, sql_string);
|
||||||
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
|
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
|
||||||
mutex_exit(&dict_foreign_err_mutex);
|
mutex_exit(&dict_foreign_err_mutex);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,10 @@ Created 11/29/1995 Heikki Tuuri
|
|||||||
#include "dict0mem.h"
|
#include "dict0mem.h"
|
||||||
#include "log0log.h"
|
#include "log0log.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define FSP_HEADER_OFFSET FIL_PAGE_DATA /* Offset of the space header
|
||||||
|
within a file page */
|
||||||
|
|
||||||
/* The data structures in files are defined just as byte strings in C */
|
/* The data structures in files are defined just as byte strings in C */
|
||||||
typedef byte fsp_header_t;
|
typedef byte fsp_header_t;
|
||||||
typedef byte xdes_t;
|
typedef byte xdes_t;
|
||||||
@ -38,8 +42,6 @@ File space header data structure: this data structure is contained in the
|
|||||||
first page of a space. The space for this header is reserved in every extent
|
first page of a space. The space for this header is reserved in every extent
|
||||||
descriptor page, but used only in the first. */
|
descriptor page, but used only in the first. */
|
||||||
|
|
||||||
#define FSP_HEADER_OFFSET FIL_PAGE_DATA /* Offset of the space header
|
|
||||||
within a file page */
|
|
||||||
/*-------------------------------------*/
|
/*-------------------------------------*/
|
||||||
#define FSP_SPACE_ID 0 /* space id */
|
#define FSP_SPACE_ID 0 /* space id */
|
||||||
#define FSP_NOT_USED 4 /* this field contained a value up to
|
#define FSP_NOT_USED 4 /* this field contained a value up to
|
||||||
@ -91,7 +93,6 @@ descriptor page, but used only in the first. */
|
|||||||
to the free list from above
|
to the free list from above
|
||||||
FSP_FREE_LIMIT at a time */
|
FSP_FREE_LIMIT at a time */
|
||||||
|
|
||||||
|
|
||||||
/* FILE SEGMENT INODE
|
/* FILE SEGMENT INODE
|
||||||
==================
|
==================
|
||||||
|
|
||||||
@ -298,6 +299,19 @@ fseg_alloc_free_page_low(
|
|||||||
FSP_UP, FSP_NO_DIR */
|
FSP_UP, FSP_NO_DIR */
|
||||||
mtr_t* mtr); /* in: mtr handle */
|
mtr_t* mtr); /* in: mtr handle */
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
Reads the file space size stored in the header page. */
|
||||||
|
|
||||||
|
ulint
|
||||||
|
fsp_get_size_low(
|
||||||
|
/*=============*/
|
||||||
|
/* out: tablespace size stored in the space header */
|
||||||
|
page_t* page) /* in: header page (page 0 in the tablespace) */
|
||||||
|
{
|
||||||
|
return(mach_read_from_4(page + FSP_HEADER_OFFSET + FSP_SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Gets a pointer to the space header and x-locks its page. */
|
Gets a pointer to the space header and x-locks its page. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
@ -1034,8 +1048,9 @@ fsp_try_extend_data_file_with_pages(
|
|||||||
fsp_header_t* header, /* in: space header */
|
fsp_header_t* header, /* in: space header */
|
||||||
mtr_t* mtr) /* in: mtr */
|
mtr_t* mtr) /* in: mtr */
|
||||||
{
|
{
|
||||||
ulint size;
|
|
||||||
ibool success;
|
ibool success;
|
||||||
|
ulint actual_size;
|
||||||
|
ulint size;
|
||||||
|
|
||||||
ut_a(space != 0);
|
ut_a(space != 0);
|
||||||
|
|
||||||
@ -1043,12 +1058,12 @@ fsp_try_extend_data_file_with_pages(
|
|||||||
|
|
||||||
ut_a(page_no >= size);
|
ut_a(page_no >= size);
|
||||||
|
|
||||||
success = fil_extend_data_file_with_pages(space, size, page_no + 1);
|
success = fil_extend_space_to_desired_size(&actual_size, space,
|
||||||
|
page_no + 1);
|
||||||
|
/* actual_size now has the space size in pages; it may be less than
|
||||||
|
we wanted if we ran out of disk space */
|
||||||
|
|
||||||
if (success) {
|
mlog_write_ulint(header + FSP_SIZE, actual_size, MLOG_4BYTES, mtr);
|
||||||
mlog_write_ulint(header + FSP_SIZE, page_no + 1, MLOG_4BYTES,
|
|
||||||
mtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(success);
|
return(success);
|
||||||
}
|
}
|
||||||
@ -1060,13 +1075,20 @@ ibool
|
|||||||
fsp_try_extend_data_file(
|
fsp_try_extend_data_file(
|
||||||
/*=====================*/
|
/*=====================*/
|
||||||
/* out: FALSE if not auto-extending */
|
/* out: FALSE if not auto-extending */
|
||||||
ulint* actual_increase,/* out: actual increase in pages */
|
ulint* actual_increase,/* out: actual increase in pages, where
|
||||||
|
we measure the tablespace size from
|
||||||
|
what the header field says; it may be
|
||||||
|
the actual file size rounded down to
|
||||||
|
megabyte */
|
||||||
ulint space, /* in: space */
|
ulint space, /* in: space */
|
||||||
fsp_header_t* header, /* in: space header */
|
fsp_header_t* header, /* in: space header */
|
||||||
mtr_t* mtr) /* in: mtr */
|
mtr_t* mtr) /* in: mtr */
|
||||||
{
|
{
|
||||||
ulint size;
|
ulint size;
|
||||||
|
ulint new_size;
|
||||||
|
ulint old_size;
|
||||||
ulint size_increase;
|
ulint size_increase;
|
||||||
|
ulint actual_size;
|
||||||
ibool success;
|
ibool success;
|
||||||
|
|
||||||
*actual_increase = 0;
|
*actual_increase = 0;
|
||||||
@ -1078,6 +1100,8 @@ fsp_try_extend_data_file(
|
|||||||
|
|
||||||
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
|
old_size = size;
|
||||||
|
|
||||||
if (space == 0 && srv_last_file_size_max != 0) {
|
if (space == 0 && srv_last_file_size_max != 0) {
|
||||||
if (srv_last_file_size_max
|
if (srv_last_file_size_max
|
||||||
< srv_data_file_sizes[srv_n_data_files - 1]) {
|
< srv_data_file_sizes[srv_n_data_files - 1]) {
|
||||||
@ -1107,8 +1131,12 @@ fsp_try_extend_data_file(
|
|||||||
success = fsp_try_extend_data_file_with_pages(
|
success = fsp_try_extend_data_file_with_pages(
|
||||||
space, FSP_EXTENT_SIZE - 1,
|
space, FSP_EXTENT_SIZE - 1,
|
||||||
header, mtr);
|
header, mtr);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
new_size = mtr_read_ulint(
|
||||||
|
header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
|
*actual_increase = new_size - old_size;
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1118,7 +1146,10 @@ fsp_try_extend_data_file(
|
|||||||
if (size < 32 * FSP_EXTENT_SIZE) {
|
if (size < 32 * FSP_EXTENT_SIZE) {
|
||||||
size_increase = FSP_EXTENT_SIZE;
|
size_increase = FSP_EXTENT_SIZE;
|
||||||
} else {
|
} else {
|
||||||
size_increase = 8 * FSP_EXTENT_SIZE;
|
/* Below in fsp_fill_free_list() we assume
|
||||||
|
that we add at most FSP_FREE_ADD extents at
|
||||||
|
a time */
|
||||||
|
size_increase = FSP_FREE_ADD * FSP_EXTENT_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1128,18 +1159,17 @@ fsp_try_extend_data_file(
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extend the data file. If we are not able to extend the full
|
success = fil_extend_space_to_desired_size(&actual_size, space,
|
||||||
requested length, the function tells how many pages we were able to
|
size + size_increase);
|
||||||
extend so that the size of the tablespace would be divisible by 1 MB
|
/* We ignore any fragments of a full megabyte when storing the size
|
||||||
(we possibly managed to extend more, but we only take into account
|
to the space header */
|
||||||
full megabytes). */
|
|
||||||
|
|
||||||
success = fil_extend_last_data_file(actual_increase, space, size,
|
mlog_write_ulint(header + FSP_SIZE,
|
||||||
size_increase);
|
ut_calc_align_down(actual_size, (1024 * 1024) / UNIV_PAGE_SIZE),
|
||||||
if (success) {
|
|
||||||
mlog_write_ulint(header + FSP_SIZE, size + *actual_increase,
|
|
||||||
MLOG_4BYTES, mtr);
|
MLOG_4BYTES, mtr);
|
||||||
}
|
new_size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
|
*actual_increase = new_size - old_size;
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
@ -1186,8 +1216,10 @@ fsp_fill_free_list(
|
|||||||
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (space != 0 && !init_space) {
|
if (space != 0 && !init_space
|
||||||
/* Try to increase the data file size */
|
&& size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) {
|
||||||
|
|
||||||
|
/* Try to increase the .ibd file size */
|
||||||
fsp_try_extend_data_file(&actual_increase, space, header, mtr);
|
fsp_try_extend_data_file(&actual_increase, space, header, mtr);
|
||||||
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
|
||||||
}
|
}
|
||||||
@ -1222,7 +1254,7 @@ fsp_fill_free_list(
|
|||||||
fsp_init_file_page(descr_page, mtr);
|
fsp_init_file_page(descr_page, mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the ibuf page in a separate
|
/* Initialize the ibuf bitmap page in a separate
|
||||||
mini-transaction because it is low in the latching
|
mini-transaction because it is low in the latching
|
||||||
order, and we must be able to release its latch
|
order, and we must be able to release its latch
|
||||||
before returning from the fsp routine */
|
before returning from the fsp routine */
|
||||||
@ -3157,7 +3189,7 @@ fseg_free_step(
|
|||||||
freed yet */
|
freed yet */
|
||||||
|
|
||||||
ut_a(descr);
|
ut_a(descr);
|
||||||
ut_anp(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header)
|
ut_a(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header)
|
||||||
% FSP_EXTENT_SIZE, mtr) == FALSE);
|
% FSP_EXTENT_SIZE, mtr) == FALSE);
|
||||||
inode = fseg_inode_get(header, mtr);
|
inode = fseg_inode_get(header, mtr);
|
||||||
|
|
||||||
|
@ -16,6 +16,14 @@ Created 10/25/1995 Heikki Tuuri
|
|||||||
#include "ut0byte.h"
|
#include "ut0byte.h"
|
||||||
#include "os0file.h"
|
#include "os0file.h"
|
||||||
|
|
||||||
|
/* When mysqld is run, the default directory "." is the mysqld datadir, but in
|
||||||
|
ibbackup we must set it explicitly; the patgh must NOT contain the trailing
|
||||||
|
'/' or '\' */
|
||||||
|
extern char* fil_path_to_mysql_datadir;
|
||||||
|
|
||||||
|
/* Initial size of a single-table tablespace in pages */
|
||||||
|
#define FIL_IBD_FILE_INITIAL_SIZE 4
|
||||||
|
|
||||||
/* 'null' (undefined) page offset in the context of file spaces */
|
/* 'null' (undefined) page offset in the context of file spaces */
|
||||||
#define FIL_NULL ULINT32_UNDEFINED
|
#define FIL_NULL ULINT32_UNDEFINED
|
||||||
|
|
||||||
@ -261,6 +269,35 @@ fil_decr_pending_ibuf_merges(
|
|||||||
/*========================*/
|
/*========================*/
|
||||||
ulint id); /* in: space id */
|
ulint id); /* in: space id */
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
Parses the body of a log record written about an .ibd file operation. That is,
|
||||||
|
the log record part after the standard (type, space id, page no) header of the
|
||||||
|
log record.
|
||||||
|
|
||||||
|
If desired, also replays the delete or rename operation if the .ibd file
|
||||||
|
exists and the space id in it matches. Replays the create operation if a file
|
||||||
|
at that path does not exist yet. If the database directory for the file to be
|
||||||
|
created does not exist, then we create the directory, too.
|
||||||
|
|
||||||
|
Note that ibbackup --apply-log sets fil_path_to_mysql_datadir to point to the
|
||||||
|
datadir that we should use in replaying the file operations. */
|
||||||
|
|
||||||
|
byte*
|
||||||
|
fil_op_log_parse_or_replay(
|
||||||
|
/*=======================*/
|
||||||
|
/* out: end of log record, or NULL if the
|
||||||
|
record was not completely contained between
|
||||||
|
ptr and end_ptr */
|
||||||
|
byte* ptr, /* in: buffer containing the log record body,
|
||||||
|
or an initial segment of it, if the record does
|
||||||
|
not fir completely between ptr and end_ptr */
|
||||||
|
byte* end_ptr, /* in: buffer end */
|
||||||
|
ulint type, /* in: the type of this log record */
|
||||||
|
ibool do_replay, /* in: TRUE if we want to replay the
|
||||||
|
operation, and not just parse the log record */
|
||||||
|
ulint space_id); /* in: if do_replay is TRUE, the space id of
|
||||||
|
the tablespace in question; otherwise
|
||||||
|
ignored */
|
||||||
|
/***********************************************************************
|
||||||
Deletes a single-table tablespace. The tablespace must be cached in the
|
Deletes a single-table tablespace. The tablespace must be cached in the
|
||||||
memory cache. */
|
memory cache. */
|
||||||
|
|
||||||
@ -306,16 +343,18 @@ ulint
|
|||||||
fil_create_new_single_table_tablespace(
|
fil_create_new_single_table_tablespace(
|
||||||
/*===================================*/
|
/*===================================*/
|
||||||
/* out: DB_SUCCESS or error code */
|
/* out: DB_SUCCESS or error code */
|
||||||
ulint* space_id, /* out: space id */
|
ulint* space_id, /* in/out: space id; if this is != 0, then
|
||||||
|
this is an input parameter, otherwise
|
||||||
|
output */
|
||||||
char* tablename, /* in: the table name in the usual
|
char* tablename, /* in: the table name in the usual
|
||||||
databasename/tablename format of InnoDB */
|
databasename/tablename format of InnoDB */
|
||||||
ulint size); /* in: the initial size of the tablespace file
|
ulint size); /* in: the initial size of the tablespace file
|
||||||
in pages */
|
in pages, must be > 0 */
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Tries to open a single-table tablespace and checks the space id is right in
|
Tries to open a single-table tablespace and checks the space id is right in
|
||||||
it. If does not succeed, prints an error message to the .err log. This
|
it. If does not succeed, prints an error message to the .err log. This
|
||||||
function is used to open the tablespace when we load a table definition
|
function is used to open the tablespace when we load a table definition
|
||||||
to the dictionarky cache. NOTE that we assume this operation is used under the
|
to the dictionary cache. NOTE that we assume this operation is used under the
|
||||||
protection of the dictionary mutex, so that two users cannot race here. */
|
protection of the dictionary mutex, so that two users cannot race here. */
|
||||||
|
|
||||||
ibool
|
ibool
|
||||||
@ -410,39 +449,32 @@ fil_space_for_table_exists_in_mem(
|
|||||||
the .err log if a matching tablespace is
|
the .err log if a matching tablespace is
|
||||||
not found from memory */
|
not found from memory */
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Tries to extend a data file by the number of pages given. Fractions of 1 MB
|
|
||||||
are ignored. The tablespace must be cached in the memory cache. */
|
|
||||||
|
|
||||||
ibool
|
|
||||||
fil_extend_last_data_file(
|
|
||||||
/*======================*/
|
|
||||||
/* out: TRUE if success, also if we run
|
|
||||||
out of disk space we may return TRUE */
|
|
||||||
ulint* actual_increase,/* out: number of pages we were able to
|
|
||||||
extend, here the original size of the file and
|
|
||||||
the resulting size of the file are rounded
|
|
||||||
downwards to a full megabyte, and the
|
|
||||||
difference expressed in pages is returned */
|
|
||||||
ulint space_id, /* in: space id */
|
|
||||||
ulint size, /* in: current size of the space in pages, as
|
|
||||||
stored in the fsp header */
|
|
||||||
ulint size_increase); /* in: try to extend this many pages */
|
|
||||||
/**************************************************************************
|
|
||||||
Tries to extend a data file so that it would accommodate the number of pages
|
Tries to extend a data file so that it would accommodate the number of pages
|
||||||
given. The tablespace must be cached in the memory cache. */
|
given. The tablespace must be cached in the memory cache. If the space is big
|
||||||
|
enough already, does nothing. */
|
||||||
|
|
||||||
ibool
|
ibool
|
||||||
fil_extend_data_file_with_pages(
|
fil_extend_space_to_desired_size(
|
||||||
/*============================*/
|
/*=============================*/
|
||||||
/* out: TRUE if success */
|
/* out: TRUE if success */
|
||||||
|
ulint* actual_size, /* out: size of the space after extension;
|
||||||
|
if we ran out of disk space this may be lower
|
||||||
|
than the desired size */
|
||||||
ulint space_id, /* in: space id, must be != 0 */
|
ulint space_id, /* in: space id, must be != 0 */
|
||||||
ulint size, /* in: current size of the space in pages, as
|
|
||||||
stored in the fsp header */
|
|
||||||
ulint size_after_extend);/* in: desired size in pages after the
|
ulint size_after_extend);/* in: desired size in pages after the
|
||||||
extension, should be less than 4 GB (this
|
extension; if the current space size is bigger
|
||||||
function is primarily intended for increasing
|
than this already, the function does nothing */
|
||||||
the data file size from < 64 pages to up to
|
#ifdef UNIV_HOTBACKUP
|
||||||
64 pages) */
|
/************************************************************************
|
||||||
|
Extends all tablespaces to the size stored in the space header. During the
|
||||||
|
ibbackup --apply-log phase we extended the spaces on-demand so that log records
|
||||||
|
could be appllied, but that may have left spaces still too small compared to
|
||||||
|
the size stored in the space header. */
|
||||||
|
|
||||||
|
void
|
||||||
|
fil_extend_tablespaces_to_stored_len(void);
|
||||||
|
/*======================================*/
|
||||||
|
#endif
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Tries to reserve free extents in a file space. */
|
Tries to reserve free extents in a file space. */
|
||||||
|
|
||||||
|
@ -67,6 +67,14 @@ fsp_header_get_tablespace_size(
|
|||||||
/* out: size in pages */
|
/* out: size in pages */
|
||||||
ulint space); /* in: space id, must be 0 */
|
ulint space); /* in: space id, must be 0 */
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
Reads the file space size stored in the header page. */
|
||||||
|
|
||||||
|
ulint
|
||||||
|
fsp_get_size_low(
|
||||||
|
/*=============*/
|
||||||
|
/* out: tablespace size stored in the space header */
|
||||||
|
page_t* page); /* in: header page (page 0 in the tablespace) */
|
||||||
|
/**************************************************************************
|
||||||
Reads the space id from the first page of a tablespace. */
|
Reads the space id from the first page of a tablespace. */
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
|
@ -51,8 +51,6 @@ ha_chain_get_next(
|
|||||||
/* out: next node, NULL if none */
|
/* out: next node, NULL if none */
|
||||||
ha_node_t* node) /* in: hash chain node */
|
ha_node_t* node) /* in: hash chain node */
|
||||||
{
|
{
|
||||||
ut_ad(table);
|
|
||||||
|
|
||||||
return(node->next);
|
return(node->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,8 +142,6 @@ ha_next(
|
|||||||
|
|
||||||
fold = node->fold;
|
fold = node->fold;
|
||||||
|
|
||||||
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
|
||||||
|
|
||||||
node = ha_chain_get_next(node);
|
node = ha_chain_get_next(node);
|
||||||
|
|
||||||
while (node) {
|
while (node) {
|
||||||
|
@ -175,17 +175,14 @@ recv_apply_hashed_log_recs(
|
|||||||
disk and invalidated in buffer pool: this
|
disk and invalidated in buffer pool: this
|
||||||
alternative means that no new log records
|
alternative means that no new log records
|
||||||
can be generated during the application */
|
can be generated during the application */
|
||||||
|
#ifdef UNIV_HOTBACKUP
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Applies log records in the hash table to a backup. */
|
Applies log records in the hash table to a backup. */
|
||||||
|
|
||||||
void
|
void
|
||||||
recv_apply_log_recs_for_backup(
|
recv_apply_log_recs_for_backup(void);
|
||||||
/*===========================*/
|
/*================================*/
|
||||||
ulint n_data_files, /* in: number of data files */
|
#endif
|
||||||
char** data_files, /* in: array containing the paths to the
|
|
||||||
data files */
|
|
||||||
ulint* file_sizes); /* in: sizes of the data files in database
|
|
||||||
pages */
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Recovers from archived log files, and also from log files, if they exist. */
|
Recovers from archived log files, and also from log files, if they exist. */
|
||||||
|
|
||||||
|
@ -58,6 +58,19 @@ mlog_write_initial_log_record(
|
|||||||
byte type, /* in: log item type: MLOG_1BYTE, ... */
|
byte type, /* in: log item type: MLOG_1BYTE, ... */
|
||||||
mtr_t* mtr); /* in: mini-transaction handle */
|
mtr_t* mtr); /* in: mini-transaction handle */
|
||||||
/************************************************************
|
/************************************************************
|
||||||
|
Writes a log record about an .ibd file create/delete/rename. */
|
||||||
|
UNIV_INLINE
|
||||||
|
byte*
|
||||||
|
mlog_write_initial_log_record_for_file_op(
|
||||||
|
/*======================================*/
|
||||||
|
/* out: new value of log_ptr */
|
||||||
|
ulint type, /* in: MLOG_FILE_CREATE, MLOG_FILE_DELETE, or
|
||||||
|
MLOG_FILE_RENAME */
|
||||||
|
ulint space_id,/* in: space id, if applicable */
|
||||||
|
ulint page_no,/* in: page number (not relevant currently) */
|
||||||
|
byte* log_ptr,/* in: pointer to mtr log which has been opened */
|
||||||
|
mtr_t* mtr); /* in: mtr */
|
||||||
|
/************************************************************
|
||||||
Catenates 1 - 4 bytes to the mtr log. */
|
Catenates 1 - 4 bytes to the mtr log. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
void
|
void
|
||||||
|
@ -185,3 +185,31 @@ mlog_write_initial_log_record_fast(
|
|||||||
#endif
|
#endif
|
||||||
return(log_ptr);
|
return(log_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/************************************************************
|
||||||
|
Writes a log record about an .ibd file create/delete/rename. */
|
||||||
|
UNIV_INLINE
|
||||||
|
byte*
|
||||||
|
mlog_write_initial_log_record_for_file_op(
|
||||||
|
/*======================================*/
|
||||||
|
/* out: new value of log_ptr */
|
||||||
|
ulint type, /* in: MLOG_FILE_CREATE, MLOG_FILE_DELETE, or
|
||||||
|
MLOG_FILE_RENAME */
|
||||||
|
ulint space_id,/* in: space id, if applicable */
|
||||||
|
ulint page_no,/* in: page number (not relevant currently) */
|
||||||
|
byte* log_ptr,/* in: pointer to mtr log which has been opened */
|
||||||
|
mtr_t* mtr) /* in: mtr */
|
||||||
|
{
|
||||||
|
ut_ad(log_ptr);
|
||||||
|
|
||||||
|
mach_write_to_1(log_ptr, type);
|
||||||
|
log_ptr++;
|
||||||
|
|
||||||
|
/* We write dummy space id and page number */
|
||||||
|
log_ptr += mach_write_compressed(log_ptr, space_id);
|
||||||
|
log_ptr += mach_write_compressed(log_ptr, page_no);
|
||||||
|
|
||||||
|
mtr->n_log_recs++;
|
||||||
|
|
||||||
|
return(log_ptr);
|
||||||
|
}
|
||||||
|
@ -96,7 +96,13 @@ flag value must give the length also! */
|
|||||||
sequence of these records */
|
sequence of these records */
|
||||||
#define MLOG_DUMMY_RECORD ((byte)32) /* dummy log record used to
|
#define MLOG_DUMMY_RECORD ((byte)32) /* dummy log record used to
|
||||||
pad a log block full */
|
pad a log block full */
|
||||||
#define MLOG_BIGGEST_TYPE ((byte)32) /* biggest value (used in
|
#define MLOG_FILE_CREATE ((byte)33) /* log record about an .ibd
|
||||||
|
file creation */
|
||||||
|
#define MLOG_FILE_RENAME ((byte)34) /* log record about an .ibd
|
||||||
|
file rename */
|
||||||
|
#define MLOG_FILE_DELETE ((byte)35) /* log record about an .ibd
|
||||||
|
file deletion */
|
||||||
|
#define MLOG_BIGGEST_TYPE ((byte)35) /* biggest value (used in
|
||||||
asserts) */
|
asserts) */
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
|
@ -63,6 +63,7 @@ log. */
|
|||||||
|
|
||||||
#define OS_FILE_READ_ONLY 333
|
#define OS_FILE_READ_ONLY 333
|
||||||
#define OS_FILE_READ_WRITE 444
|
#define OS_FILE_READ_WRITE 444
|
||||||
|
#define OS_FILE_READ_ALLOW_DELETE 555 /* for ibbackup */
|
||||||
|
|
||||||
/* Options for file_create */
|
/* Options for file_create */
|
||||||
#define OS_FILE_AIO 61
|
#define OS_FILE_AIO 61
|
||||||
@ -199,6 +200,21 @@ os_file_readdir_next_file(
|
|||||||
char* dirname,/* in: directory name or path */
|
char* dirname,/* in: directory name or path */
|
||||||
os_file_dir_t dir, /* in: directory stream */
|
os_file_dir_t dir, /* in: directory stream */
|
||||||
os_file_stat_t* info); /* in/out: buffer where the info is returned */
|
os_file_stat_t* info); /* in/out: buffer where the info is returned */
|
||||||
|
/*********************************************************************
|
||||||
|
This function attempts to create a directory named pathname. The new directory
|
||||||
|
gets default permissions. On Unix, the permissions are (0770 & ~umask). If the
|
||||||
|
directory exists already, nothing is done and the call succeeds, unless the
|
||||||
|
fail_if_exists arguments is true. */
|
||||||
|
|
||||||
|
ibool
|
||||||
|
os_file_create_directory(
|
||||||
|
/*=====================*/
|
||||||
|
/* out: TRUE if call succeeds, FALSE on
|
||||||
|
error */
|
||||||
|
char* pathname, /* in: directory name as null-terminated
|
||||||
|
string */
|
||||||
|
ibool fail_if_exists);/* in: if TRUE, pre-existing directory is
|
||||||
|
treated as an error. */
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
A simple function to open or create a file. */
|
A simple function to open or create a file. */
|
||||||
|
|
||||||
@ -206,7 +222,8 @@ os_file_t
|
|||||||
os_file_create_simple(
|
os_file_create_simple(
|
||||||
/*==================*/
|
/*==================*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
@ -221,13 +238,16 @@ os_file_t
|
|||||||
os_file_create_simple_no_error_handling(
|
os_file_create_simple_no_error_handling(
|
||||||
/*====================================*/
|
/*====================================*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
(if does not exist, error), or OS_FILE_CREATE if a new
|
(if does not exist, error), or OS_FILE_CREATE if a new
|
||||||
file is created (if exists, error) */
|
file is created (if exists, error) */
|
||||||
ulint access_type,/* in: OS_FILE_READ_ONLY or OS_FILE_READ_WRITE */
|
ulint access_type,/* in: OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or
|
||||||
|
OS_FILE_READ_ALLOW_DELETE; the last option is used by
|
||||||
|
a backup program reading the file */
|
||||||
ibool* success);/* out: TRUE if succeed, FALSE if error */
|
ibool* success);/* out: TRUE if succeed, FALSE if error */
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Opens an existing file or creates a new. */
|
Opens an existing file or creates a new. */
|
||||||
@ -236,7 +256,8 @@ os_file_t
|
|||||||
os_file_create(
|
os_file_create(
|
||||||
/*===========*/
|
/*===========*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
|
@ -30,39 +30,8 @@ extern ulint* ut_dbg_null_ptr;
|
|||||||
" InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
|
" InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
|
os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
|
||||||
(ulint)__LINE__);\
|
(ulint)__LINE__);\
|
||||||
fprintf(stderr,\
|
fputs(\
|
||||||
"InnoDB: Failing assertion: " #EXPR);\
|
"InnoDB: Failing assertion: " #EXPR, stderr);\
|
||||||
fprintf(stderr,\
|
|
||||||
"\nInnoDB: We intentionally generate a memory trap.\n");\
|
|
||||||
fprintf(stderr,\
|
|
||||||
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com\n");\
|
|
||||||
ut_dbg_stop_threads = TRUE;\
|
|
||||||
dbg_i = *(ut_dbg_null_ptr);\
|
|
||||||
if (dbg_i) {\
|
|
||||||
ut_dbg_null_ptr = NULL;\
|
|
||||||
}\
|
|
||||||
}\
|
|
||||||
if (ut_dbg_stop_threads) {\
|
|
||||||
fprintf(stderr,\
|
|
||||||
"InnoDB: Thread %lu stopped in file %s line %lu\n",\
|
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
|
||||||
os_thread_sleep(1000000000);\
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This can be used if there are % characters in the assertion formula:
|
|
||||||
if we try to printf the formula gcc would complain of illegal print
|
|
||||||
format characters */
|
|
||||||
#define ut_anp(EXPR)\
|
|
||||||
{\
|
|
||||||
ulint dbg_i;\
|
|
||||||
\
|
|
||||||
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
|
|
||||||
ut_print_timestamp(stderr);\
|
|
||||||
fprintf(stderr,\
|
|
||||||
" InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
|
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
|
|
||||||
(ulint)__LINE__);\
|
|
||||||
fprintf(stderr,\
|
fprintf(stderr,\
|
||||||
"\nInnoDB: We intentionally generate a memory trap.\n");\
|
"\nInnoDB: We intentionally generate a memory trap.\n");\
|
||||||
fprintf(stderr,\
|
fprintf(stderr,\
|
||||||
|
@ -139,7 +139,7 @@ void
|
|||||||
ut_ulint_sort(ulint* arr, ulint* aux_arr, ulint low, ulint high);
|
ut_ulint_sort(ulint* arr, ulint* aux_arr, ulint low, ulint high);
|
||||||
/*============================================================*/
|
/*============================================================*/
|
||||||
/************************************************************
|
/************************************************************
|
||||||
The following function returns a clock time in milliseconds. */
|
The following function returns elapsed CPU time in milliseconds. */
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
ut_clock(void);
|
ut_clock(void);
|
||||||
@ -174,6 +174,14 @@ ut_sprintf_timestamp(
|
|||||||
/*=================*/
|
/*=================*/
|
||||||
char* buf); /* in: buffer where to sprintf */
|
char* buf); /* in: buffer where to sprintf */
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
|
Sprintfs a timestamp to a buffer with no spaces and with ':' characters
|
||||||
|
replaced by '_'. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ut_sprintf_timestamp_without_extra_chars(
|
||||||
|
/*=====================================*/
|
||||||
|
char* buf); /* in: buffer where to sprintf */
|
||||||
|
/**************************************************************
|
||||||
Returns current year, month, day. */
|
Returns current year, month, day. */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -95,14 +95,6 @@ static
|
|||||||
void
|
void
|
||||||
log_io_complete_archive(void);
|
log_io_complete_archive(void);
|
||||||
/*=========================*/
|
/*=========================*/
|
||||||
/********************************************************************
|
|
||||||
Tries to establish a big enough margin of free space in the log groups, such
|
|
||||||
that a new log entry can be catenated without an immediate need for a
|
|
||||||
archiving. */
|
|
||||||
static
|
|
||||||
void
|
|
||||||
log_archive_margin(void);
|
|
||||||
/*====================*/
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Sets the global variable log_fsp_current_free_limit. Also makes a checkpoint,
|
Sets the global variable log_fsp_current_free_limit. Also makes a checkpoint,
|
||||||
@ -407,7 +399,7 @@ log_pad_current_log_block(void)
|
|||||||
log_close();
|
log_close();
|
||||||
log_release();
|
log_release();
|
||||||
|
|
||||||
ut_anp((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
|
ut_a((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
|
||||||
== LOG_BLOCK_HDR_SIZE);
|
== LOG_BLOCK_HDR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -745,7 +737,8 @@ log_init(void)
|
|||||||
memset(log_sys->checkpoint_buf, '\0', OS_FILE_LOG_BLOCK_SIZE);
|
memset(log_sys->checkpoint_buf, '\0', OS_FILE_LOG_BLOCK_SIZE);
|
||||||
/*----------------------------*/
|
/*----------------------------*/
|
||||||
|
|
||||||
log_sys->archiving_state = LOG_ARCH_ON;
|
/* Under MySQL, log archiving is always off */
|
||||||
|
log_sys->archiving_state = LOG_ARCH_OFF;
|
||||||
log_sys->archived_lsn = log_sys->lsn;
|
log_sys->archived_lsn = log_sys->lsn;
|
||||||
log_sys->next_archived_lsn = ut_dulint_zero;
|
log_sys->next_archived_lsn = ut_dulint_zero;
|
||||||
|
|
||||||
@ -754,13 +747,15 @@ log_init(void)
|
|||||||
rw_lock_create(&(log_sys->archive_lock));
|
rw_lock_create(&(log_sys->archive_lock));
|
||||||
rw_lock_set_level(&(log_sys->archive_lock), SYNC_NO_ORDER_CHECK);
|
rw_lock_set_level(&(log_sys->archive_lock), SYNC_NO_ORDER_CHECK);
|
||||||
|
|
||||||
log_sys->archive_buf = ut_align(
|
log_sys->archive_buf = NULL;
|
||||||
|
|
||||||
|
/* ut_align(
|
||||||
ut_malloc(LOG_ARCHIVE_BUF_SIZE
|
ut_malloc(LOG_ARCHIVE_BUF_SIZE
|
||||||
+ OS_FILE_LOG_BLOCK_SIZE),
|
+ OS_FILE_LOG_BLOCK_SIZE),
|
||||||
OS_FILE_LOG_BLOCK_SIZE);
|
OS_FILE_LOG_BLOCK_SIZE); */
|
||||||
log_sys->archive_buf_size = LOG_ARCHIVE_BUF_SIZE;
|
log_sys->archive_buf_size = 0;
|
||||||
|
|
||||||
memset(log_sys->archive_buf, '\0', LOG_ARCHIVE_BUF_SIZE);
|
/* memset(log_sys->archive_buf, '\0', LOG_ARCHIVE_BUF_SIZE); */
|
||||||
|
|
||||||
log_sys->archiving_on = os_event_create(NULL);
|
log_sys->archiving_on = os_event_create(NULL);
|
||||||
|
|
||||||
@ -1107,8 +1102,8 @@ log_group_write_buf(
|
|||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
ut_anp(len % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
ut_anp(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
|
|
||||||
if (new_data_offset == 0) {
|
if (new_data_offset == 0) {
|
||||||
write_header = TRUE;
|
write_header = TRUE;
|
||||||
@ -2080,6 +2075,8 @@ log_archived_file_name_gen(
|
|||||||
ulint id, /* in: group id */
|
ulint id, /* in: group id */
|
||||||
ulint file_no)/* in: file number */
|
ulint file_no)/* in: file number */
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
UT_NOT_USED(id); /* Currently we only archive the first group */
|
UT_NOT_USED(id); /* Currently we only archive the first group */
|
||||||
|
|
||||||
sprintf(buf, "%sib_arch_log_%010lu", srv_arch_dir, file_no);
|
sprintf(buf, "%sib_arch_log_%010lu", srv_arch_dir, file_no);
|
||||||
@ -2101,6 +2098,8 @@ log_group_archive_file_header_write(
|
|||||||
byte* buf;
|
byte* buf;
|
||||||
ulint dest_offset;
|
ulint dest_offset;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
ut_a(nth_file < group->n_files);
|
ut_a(nth_file < group->n_files);
|
||||||
@ -2138,6 +2137,8 @@ log_group_archive_completed_header_write(
|
|||||||
byte* buf;
|
byte* buf;
|
||||||
ulint dest_offset;
|
ulint dest_offset;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
ut_a(nth_file < group->n_files);
|
ut_a(nth_file < group->n_files);
|
||||||
|
|
||||||
@ -2177,15 +2178,17 @@ log_group_archive(
|
|||||||
ulint n_files;
|
ulint n_files;
|
||||||
ulint open_mode;
|
ulint open_mode;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
start_lsn = log_sys->archived_lsn;
|
start_lsn = log_sys->archived_lsn;
|
||||||
|
|
||||||
ut_anp(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
|
|
||||||
end_lsn = log_sys->next_archived_lsn;
|
end_lsn = log_sys->next_archived_lsn;
|
||||||
|
|
||||||
ut_anp(ut_dulint_get_low(end_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(ut_dulint_get_low(end_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
|
|
||||||
buf = log_sys->archive_buf;
|
buf = log_sys->archive_buf;
|
||||||
|
|
||||||
@ -2289,7 +2292,7 @@ loop:
|
|||||||
group->next_archived_file_no = group->archived_file_no + n_files;
|
group->next_archived_file_no = group->archived_file_no + n_files;
|
||||||
group->next_archived_offset = next_offset % group->file_size;
|
group->next_archived_offset = next_offset % group->file_size;
|
||||||
|
|
||||||
ut_anp(group->next_archived_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(group->next_archived_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
@ -2302,6 +2305,8 @@ log_archive_groups(void)
|
|||||||
{
|
{
|
||||||
log_group_t* group;
|
log_group_t* group;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
@ -2325,6 +2330,8 @@ log_archive_write_complete_groups(void)
|
|||||||
dulint end_lsn;
|
dulint end_lsn;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
@ -2387,6 +2394,8 @@ void
|
|||||||
log_archive_check_completion_low(void)
|
log_archive_check_completion_low(void)
|
||||||
/*==================================*/
|
/*==================================*/
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
if (log_sys->n_pending_archive_ios == 0
|
if (log_sys->n_pending_archive_ios == 0
|
||||||
@ -2423,6 +2432,8 @@ log_io_complete_archive(void)
|
|||||||
{
|
{
|
||||||
log_group_t* group;
|
log_group_t* group;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
@ -2458,6 +2469,8 @@ log_archive_do(
|
|||||||
dulint start_lsn;
|
dulint start_lsn;
|
||||||
dulint limit_lsn;
|
dulint limit_lsn;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
calc_new_limit = TRUE;
|
calc_new_limit = TRUE;
|
||||||
loop:
|
loop:
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
@ -2484,7 +2497,7 @@ loop:
|
|||||||
start_lsn = log_sys->archived_lsn;
|
start_lsn = log_sys->archived_lsn;
|
||||||
|
|
||||||
if (calc_new_limit) {
|
if (calc_new_limit) {
|
||||||
ut_anp(log_sys->archive_buf_size % OS_FILE_LOG_BLOCK_SIZE
|
ut_a(log_sys->archive_buf_size % OS_FILE_LOG_BLOCK_SIZE
|
||||||
== 0);
|
== 0);
|
||||||
limit_lsn = ut_dulint_add(start_lsn,
|
limit_lsn = ut_dulint_add(start_lsn,
|
||||||
log_sys->archive_buf_size);
|
log_sys->archive_buf_size);
|
||||||
@ -2584,6 +2597,8 @@ log_archive_all(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
present_lsn = log_sys->lsn;
|
present_lsn = log_sys->lsn;
|
||||||
|
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
@ -2621,11 +2636,17 @@ log_archive_close_groups(
|
|||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
|
||||||
|
if (log_sys->archiving_state == LOG_ARCH_OFF) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
|
|
||||||
trunc_len = UNIV_PAGE_SIZE
|
trunc_len = UNIV_PAGE_SIZE
|
||||||
* fil_space_get_size(group->archive_space_id);
|
* fil_space_get_size(group->archive_space_id);
|
||||||
|
|
||||||
if (trunc_len > 0) {
|
if (trunc_len > 0) {
|
||||||
ut_a(trunc_len == group->file_size);
|
ut_a(trunc_len == group->file_size);
|
||||||
|
|
||||||
@ -2653,9 +2674,8 @@ log_archive_close_groups(
|
|||||||
/********************************************************************
|
/********************************************************************
|
||||||
Writes the log contents to the archive up to the lsn when this function was
|
Writes the log contents to the archive up to the lsn when this function was
|
||||||
called, and stops the archiving. When archiving is started again, the archived
|
called, and stops the archiving. When archiving is started again, the archived
|
||||||
log file numbers start from 2 higher, so that the archiving will
|
log file numbers start from 2 higher, so that the archiving will not write
|
||||||
not write again to the archived log files which exist when this function
|
again to the archived log files which exist when this function returns. */
|
||||||
returns. */
|
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
log_archive_stop(void)
|
log_archive_stop(void)
|
||||||
@ -2664,6 +2684,8 @@ log_archive_stop(void)
|
|||||||
{
|
{
|
||||||
ibool success;
|
ibool success;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
if (log_sys->archiving_state != LOG_ARCH_ON) {
|
if (log_sys->archiving_state != LOG_ARCH_ON) {
|
||||||
@ -2726,6 +2748,8 @@ log_archive_start(void)
|
|||||||
/*===================*/
|
/*===================*/
|
||||||
/* out: DB_SUCCESS or DB_ERROR */
|
/* out: DB_SUCCESS or DB_ERROR */
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
if (log_sys->archiving_state != LOG_ARCH_STOPPED) {
|
if (log_sys->archiving_state != LOG_ARCH_STOPPED) {
|
||||||
@ -2752,6 +2776,7 @@ log_archive_noarchivelog(void)
|
|||||||
/*==========================*/
|
/*==========================*/
|
||||||
/* out: DB_SUCCESS or DB_ERROR */
|
/* out: DB_SUCCESS or DB_ERROR */
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
loop:
|
loop:
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
@ -2784,6 +2809,7 @@ log_archive_archivelog(void)
|
|||||||
/*========================*/
|
/*========================*/
|
||||||
/* out: DB_SUCCESS or DB_ERROR */
|
/* out: DB_SUCCESS or DB_ERROR */
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
if (log_sys->archiving_state == LOG_ARCH_OFF) {
|
if (log_sys->archiving_state == LOG_ARCH_OFF) {
|
||||||
@ -2802,6 +2828,7 @@ log_archive_archivelog(void)
|
|||||||
return(DB_ERROR);
|
return(DB_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef notdefined
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Tries to establish a big enough margin of free space in the log groups, such
|
Tries to establish a big enough margin of free space in the log groups, such
|
||||||
that a new log entry can be catenated without an immediate need for
|
that a new log entry can be catenated without an immediate need for
|
||||||
@ -2855,6 +2882,7 @@ loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Checks that there is enough free space in the log to start a new query step.
|
Checks that there is enough free space in the log to start a new query step.
|
||||||
@ -2871,7 +2899,7 @@ loop:
|
|||||||
|
|
||||||
log_checkpoint_margin();
|
log_checkpoint_margin();
|
||||||
|
|
||||||
log_archive_margin();
|
/* log_archive_margin(); */
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
@ -3009,7 +3037,7 @@ loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_archive_all();
|
/* log_archive_all(); */
|
||||||
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
@ -3027,15 +3055,16 @@ loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
arch_log_no =
|
arch_log_no = 0;
|
||||||
|
/*
|
||||||
UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no;
|
UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no;
|
||||||
|
|
||||||
if (0 == UT_LIST_GET_FIRST(log_sys->log_groups)->archived_offset) {
|
if (0 == UT_LIST_GET_FIRST(log_sys->log_groups)->archived_offset) {
|
||||||
|
|
||||||
arch_log_no--;
|
arch_log_no--;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
log_archive_close_groups(TRUE);
|
/* log_archive_close_groups(TRUE); */
|
||||||
|
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
|
|
||||||
|
@ -721,7 +721,7 @@ recv_scan_log_seg_for_backup(
|
|||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Tries to parse a single log record body and also applies it to a page if
|
Tries to parse a single log record body and also applies it to a page if
|
||||||
specified. */
|
specified. File ops are parsed, but not applied in this function. */
|
||||||
static
|
static
|
||||||
byte*
|
byte*
|
||||||
recv_parse_or_apply_log_rec_body(
|
recv_parse_or_apply_log_rec_body(
|
||||||
@ -798,8 +798,14 @@ recv_parse_or_apply_log_rec_body(
|
|||||||
} else if (type == MLOG_INIT_FILE_PAGE) {
|
} else if (type == MLOG_INIT_FILE_PAGE) {
|
||||||
new_ptr = fsp_parse_init_file_page(ptr, end_ptr, page);
|
new_ptr = fsp_parse_init_file_page(ptr, end_ptr, page);
|
||||||
|
|
||||||
} else if (type <= MLOG_WRITE_STRING) {
|
} else if (type == MLOG_WRITE_STRING) {
|
||||||
new_ptr = mlog_parse_string(ptr, end_ptr, page);
|
new_ptr = mlog_parse_string(ptr, end_ptr, page);
|
||||||
|
|
||||||
|
} else if (type == MLOG_FILE_CREATE
|
||||||
|
|| type == MLOG_FILE_RENAME
|
||||||
|
|| type == MLOG_FILE_DELETE) {
|
||||||
|
new_ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, FALSE,
|
||||||
|
ULINT_UNDEFINED);
|
||||||
} else {
|
} else {
|
||||||
new_ptr = NULL;
|
new_ptr = NULL;
|
||||||
|
|
||||||
@ -1322,7 +1328,6 @@ loop:
|
|||||||
|
|
||||||
fprintf(stderr, "%lu ",
|
fprintf(stderr, "%lu ",
|
||||||
(i * 100) / hash_get_n_cells(recv_sys->addr_hash));
|
(i * 100) / hash_get_n_cells(recv_sys->addr_hash));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1376,130 +1381,132 @@ loop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIV_HOTBACKUP
|
#ifdef UNIV_HOTBACKUP
|
||||||
|
/* This page is allocated from the buffer pool and used in the function
|
||||||
|
below */
|
||||||
|
page_t* recv_backup_application_page = NULL;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Applies log records in the hash table to a backup. */
|
Applies log records in the hash table to a backup. */
|
||||||
|
|
||||||
void
|
void
|
||||||
recv_apply_log_recs_for_backup(
|
recv_apply_log_recs_for_backup(void)
|
||||||
/*===========================*/
|
/*================================*/
|
||||||
ulint n_data_files, /* in: number of data files */
|
|
||||||
char** data_files, /* in: array containing the paths to the
|
|
||||||
data files */
|
|
||||||
ulint* file_sizes) /* in: sizes of the data files in database
|
|
||||||
pages */
|
|
||||||
{
|
{
|
||||||
recv_addr_t* recv_addr;
|
recv_addr_t* recv_addr;
|
||||||
os_file_t data_file;
|
ulint n_hash_cells;
|
||||||
ulint n_pages_total = 0;
|
|
||||||
ulint nth_file = 0;
|
|
||||||
ulint nth_page_in_file= 0;
|
|
||||||
byte* page;
|
byte* page;
|
||||||
|
ulint actual_size;
|
||||||
ibool success;
|
ibool success;
|
||||||
|
ulint error;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
recv_sys->apply_log_recs = TRUE;
|
recv_sys->apply_log_recs = TRUE;
|
||||||
recv_sys->apply_batch_on = TRUE;
|
recv_sys->apply_batch_on = TRUE;
|
||||||
|
|
||||||
page = buf_pool->frame_zero;
|
if (recv_backup_application_page == NULL) {
|
||||||
|
recv_backup_application_page = buf_frame_alloc();
|
||||||
for (i = 0; i < n_data_files; i++) {
|
|
||||||
n_pages_total += file_sizes[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recv_max_parsed_page_no >= n_pages_total) {
|
page = recv_backup_application_page;
|
||||||
printf(
|
|
||||||
"InnoDB: Error: tablespace size %lu pages, but a log record on page %lu!\n"
|
|
||||||
"InnoDB: Are you sure you have specified all the ibdata files right in\n"
|
|
||||||
"InnoDB: the my.cnf file you gave as the argument to ibbackup --restore?\n",
|
|
||||||
n_pages_total, recv_max_parsed_page_no);
|
|
||||||
}
|
|
||||||
|
|
||||||
printf(
|
printf(
|
||||||
"InnoDB: Starting an apply batch of log records to the database...\n"
|
"InnoDB: Starting an apply batch of log records to the database...\n"
|
||||||
"InnoDB: Progress in percents: ");
|
"InnoDB: Progress in percents: ");
|
||||||
|
|
||||||
for (i = 0; i < n_pages_total; i++) {
|
n_hash_cells = hash_get_n_cells(recv_sys->addr_hash);
|
||||||
|
|
||||||
if (i == 0 || nth_page_in_file == file_sizes[nth_file]) {
|
for (i = 0; i < n_hash_cells; i++) {
|
||||||
if (i != 0) {
|
/* The address hash table is externally chained */
|
||||||
nth_file++;
|
recv_addr = hash_get_nth_cell(recv_sys->addr_hash, i)->node;
|
||||||
nth_page_in_file = 0;
|
|
||||||
os_file_flush(data_file);
|
|
||||||
os_file_close(data_file);
|
|
||||||
}
|
|
||||||
|
|
||||||
data_file = os_file_create_simple(data_files[nth_file],
|
while (recv_addr != NULL) {
|
||||||
OS_FILE_OPEN,
|
|
||||||
OS_FILE_READ_WRITE,
|
if (!fil_tablespace_exists_in_mem(recv_addr->space)) {
|
||||||
&success);
|
/*
|
||||||
if (!success) {
|
|
||||||
printf(
|
printf(
|
||||||
"InnoDB: Error: cannot open %lu'th data file\n", nth_file);
|
"InnoDB: Warning: cannot apply log record to tablespace %lu page %lu,\n"
|
||||||
|
"InnoDB: because tablespace with that id does not exist.\n",
|
||||||
|
recv_addr->space, recv_addr->page_no);
|
||||||
|
*/
|
||||||
|
recv_addr->state = RECV_PROCESSED;
|
||||||
|
|
||||||
exit(1);
|
ut_a(recv_sys->n_addrs);
|
||||||
}
|
recv_sys->n_addrs--;
|
||||||
|
|
||||||
|
goto skip_this_recv_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
recv_addr = recv_get_fil_addr_struct(0, i);
|
/* We simulate a page read made by the buffer pool, to
|
||||||
|
make sure the recovery apparatus works ok, for
|
||||||
|
example, the buf_frame_align() function. We must init
|
||||||
|
the block corresponding to buf_pool->frame_zero
|
||||||
|
(== page). */
|
||||||
|
|
||||||
if (recv_addr != NULL) {
|
buf_page_init_for_backup_restore(recv_addr->space,
|
||||||
success = os_file_read(data_file, page,
|
recv_addr->page_no,
|
||||||
(nth_page_in_file << UNIV_PAGE_SIZE_SHIFT)
|
|
||||||
& 0xFFFFFFFFUL,
|
|
||||||
nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT),
|
|
||||||
UNIV_PAGE_SIZE);
|
|
||||||
if (!success) {
|
|
||||||
printf(
|
|
||||||
"InnoDB: Error: cannot read page no %lu from %lu'th data file\n",
|
|
||||||
nth_page_in_file, nth_file);
|
|
||||||
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We simulate a page read made by the buffer pool,
|
|
||||||
to make sure recovery works ok. We must init the
|
|
||||||
block corresponding to buf_pool->frame_zero
|
|
||||||
(== page) */
|
|
||||||
|
|
||||||
buf_page_init_for_backup_restore(0, i,
|
|
||||||
buf_block_align(page));
|
buf_block_align(page));
|
||||||
|
|
||||||
recv_recover_page(TRUE, FALSE, page, 0, i);
|
/* Extend the tablespace's last file if the page_no
|
||||||
|
does not fall inside its bounds; we assume the last
|
||||||
|
file is auto-extending, and ibbackup copied the file
|
||||||
|
when it still was smaller */
|
||||||
|
|
||||||
|
success = fil_extend_space_to_desired_size(
|
||||||
|
&actual_size,
|
||||||
|
recv_addr->space,
|
||||||
|
recv_addr->page_no + 1);
|
||||||
|
if (!success) {
|
||||||
|
printf(
|
||||||
|
"InnoDB: Fatal error: cannot extend tablespace %lu to hold %lu pages\n",
|
||||||
|
recv_addr->space, recv_addr->page_no);
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the page from the tablespace file using the
|
||||||
|
fil0fil.c routines */
|
||||||
|
|
||||||
|
error = fil_io(OS_FILE_READ, TRUE, recv_addr->space,
|
||||||
|
recv_addr->page_no, 0, UNIV_PAGE_SIZE,
|
||||||
|
page, NULL);
|
||||||
|
if (error != DB_SUCCESS) {
|
||||||
|
printf(
|
||||||
|
"InnoDB: Fatal error: cannot read from tablespace %lu page number %lu\n",
|
||||||
|
recv_addr->space, recv_addr->page_no);
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Apply the log records to this page */
|
||||||
|
recv_recover_page(TRUE, FALSE, page, recv_addr->space,
|
||||||
|
recv_addr->page_no);
|
||||||
|
|
||||||
|
/* Write the page back to the tablespace file using the
|
||||||
|
fil0fil.c routines */
|
||||||
|
|
||||||
buf_flush_init_for_writing(page,
|
buf_flush_init_for_writing(page,
|
||||||
mach_read_from_8(page + FIL_PAGE_LSN),
|
mach_read_from_8(page + FIL_PAGE_LSN),
|
||||||
0, i);
|
recv_addr->space, recv_addr->page_no);
|
||||||
|
|
||||||
success = os_file_write(data_files[nth_file],
|
error = fil_io(OS_FILE_WRITE, TRUE, recv_addr->space,
|
||||||
data_file, page,
|
recv_addr->page_no, 0, UNIV_PAGE_SIZE,
|
||||||
(nth_page_in_file << UNIV_PAGE_SIZE_SHIFT)
|
page, NULL);
|
||||||
& 0xFFFFFFFF,
|
skip_this_recv_addr:
|
||||||
nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT),
|
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
|
||||||
UNIV_PAGE_SIZE);
|
|
||||||
if (!success) {
|
|
||||||
printf(
|
|
||||||
"InnoDB: Error: cannot write page no %lu to %lu'th data file\n",
|
|
||||||
nth_page_in_file, nth_file);
|
|
||||||
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((100 * i) / n_pages_total
|
if ((100 * i) / n_hash_cells
|
||||||
!= (100 * (i + 1)) / n_pages_total) {
|
!= (100 * (i + 1)) / n_hash_cells) {
|
||||||
printf("%lu ", (100 * i) / n_pages_total);
|
printf("%lu ", (100 * i) / n_hash_cells);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
nth_page_in_file++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
os_file_flush(data_file);
|
|
||||||
os_file_close(data_file);
|
|
||||||
|
|
||||||
recv_sys_empty_hash();
|
recv_sys_empty_hash();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef notdefined
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
In the debug version, updates the replica of a file page, based on a log
|
In the debug version, updates the replica of a file page, based on a log
|
||||||
record. */
|
record. */
|
||||||
@ -1737,7 +1744,7 @@ recv_parse_log_rec(
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that space id and page_no are sensible */
|
/* Check that page_no is sensible */
|
||||||
|
|
||||||
if (*page_no > 0x8FFFFFFFUL) {
|
if (*page_no > 0x8FFFFFFFUL) {
|
||||||
|
|
||||||
@ -1911,12 +1918,16 @@ loop:
|
|||||||
single_rec = (ulint)*ptr & MLOG_SINGLE_REC_FLAG;
|
single_rec = (ulint)*ptr & MLOG_SINGLE_REC_FLAG;
|
||||||
|
|
||||||
if (single_rec || *ptr == MLOG_DUMMY_RECORD) {
|
if (single_rec || *ptr == MLOG_DUMMY_RECORD) {
|
||||||
/* The mtr only modified a single page */
|
/* The mtr only modified a single page, or this is a file op */
|
||||||
|
|
||||||
old_lsn = recv_sys->recovered_lsn;
|
old_lsn = recv_sys->recovered_lsn;
|
||||||
|
|
||||||
|
/* Try to parse a log record, fetching its type, space id,
|
||||||
|
page no, and a pointer to the body of the log record */
|
||||||
|
|
||||||
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
|
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
|
||||||
&page_no, &body);
|
&page_no, &body);
|
||||||
|
|
||||||
if (len == 0 || recv_sys->found_corrupt_log) {
|
if (len == 0 || recv_sys->found_corrupt_log) {
|
||||||
if (recv_sys->found_corrupt_log) {
|
if (recv_sys->found_corrupt_log) {
|
||||||
|
|
||||||
@ -1954,6 +1965,26 @@ loop:
|
|||||||
if (type == MLOG_DUMMY_RECORD) {
|
if (type == MLOG_DUMMY_RECORD) {
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
|
|
||||||
|
} else if (store_to_hash && (type == MLOG_FILE_CREATE
|
||||||
|
|| type == MLOG_FILE_RENAME
|
||||||
|
|| type == MLOG_FILE_DELETE)) {
|
||||||
|
#ifdef UNIV_HOTBACKUP
|
||||||
|
/* In ibbackup --apply-log, replay an .ibd file
|
||||||
|
operation, if possible; note that
|
||||||
|
fil_path_to_mysql_datadir is set in ibbackup to
|
||||||
|
point to the datadir we should use there */
|
||||||
|
|
||||||
|
if (NULL == fil_op_log_parse_or_replay(body, end_ptr,
|
||||||
|
type, TRUE, space)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"InnoDB: Error: file op log record of type %lu space %lu not complete in\n"
|
||||||
|
"InnoDB: the replay phase. Path %s\n", (ulint)type, space, (char*)(body + 2));
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* In normal mysqld crash recovery we do not try to
|
||||||
|
replay file operations */
|
||||||
} else if (store_to_hash) {
|
} else if (store_to_hash) {
|
||||||
recv_add_to_hash_table(type, space, page_no, body,
|
recv_add_to_hash_table(type, space, page_no, body,
|
||||||
ptr + len, old_lsn,
|
ptr + len, old_lsn,
|
||||||
@ -2915,6 +2946,8 @@ recv_reset_log_files_for_backup(
|
|||||||
|
|
||||||
buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
|
buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
|
||||||
|
|
||||||
|
memset(buf, LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE, '\0');
|
||||||
|
|
||||||
for (i = 0; i < n_log_files; i++) {
|
for (i = 0; i < n_log_files; i++) {
|
||||||
|
|
||||||
sprintf(name, "%sib_logfile%lu", log_dir, i);
|
sprintf(name, "%sib_logfile%lu", log_dir, i);
|
||||||
@ -2954,7 +2987,7 @@ recv_reset_log_files_for_backup(
|
|||||||
log_block_init_in_old_format(buf + LOG_FILE_HDR_SIZE, lsn);
|
log_block_init_in_old_format(buf + LOG_FILE_HDR_SIZE, lsn);
|
||||||
log_block_set_first_rec_group(buf + LOG_FILE_HDR_SIZE,
|
log_block_set_first_rec_group(buf + LOG_FILE_HDR_SIZE,
|
||||||
LOG_BLOCK_HDR_SIZE);
|
LOG_BLOCK_HDR_SIZE);
|
||||||
sprintf(name, "%sib_logfile%lu", log_dir, 0);
|
sprintf(name, "%sib_logfile%lu", log_dir, 0UL);
|
||||||
|
|
||||||
log_file = os_file_create_simple(name, OS_FILE_OPEN,
|
log_file = os_file_create_simple(name, OS_FILE_OPEN,
|
||||||
OS_FILE_READ_WRITE, &success);
|
OS_FILE_READ_WRITE, &success);
|
||||||
@ -2996,6 +3029,8 @@ log_group_recover_from_archive_file(
|
|||||||
int input_char;
|
int input_char;
|
||||||
char name[10000];
|
char name[10000];
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
try_open_again:
|
try_open_again:
|
||||||
buf = log_sys->buf;
|
buf = log_sys->buf;
|
||||||
|
|
||||||
@ -3173,6 +3208,8 @@ recv_recovery_from_archive_start(
|
|||||||
ibool ret;
|
ibool ret;
|
||||||
ulint err;
|
ulint err;
|
||||||
|
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
recv_sys_create();
|
recv_sys_create();
|
||||||
recv_sys_init(FALSE, buf_pool_get_curr_size());
|
recv_sys_init(FALSE, buf_pool_get_curr_size());
|
||||||
|
|
||||||
@ -3271,6 +3308,8 @@ void
|
|||||||
recv_recovery_from_archive_finish(void)
|
recv_recovery_from_archive_finish(void)
|
||||||
/*===================================*/
|
/*===================================*/
|
||||||
{
|
{
|
||||||
|
ut_a(0);
|
||||||
|
|
||||||
recv_recovery_from_checkpoint_finish();
|
recv_recovery_from_checkpoint_finish();
|
||||||
|
|
||||||
recv_recovery_from_backup_on = FALSE;
|
recv_recovery_from_backup_on = FALSE;
|
||||||
|
@ -603,7 +603,7 @@ mem_pool_validate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_anp(free + pool->reserved == pool->size);
|
ut_a(free + pool->reserved == pool->size);
|
||||||
|
|
||||||
mutex_exit(&(pool->mutex));
|
mutex_exit(&(pool->mutex));
|
||||||
|
|
||||||
|
@ -595,6 +595,51 @@ next_file:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
This function attempts to create a directory named pathname. The new directory
|
||||||
|
gets default permissions. On Unix the permissions are (0770 & ~umask). If the
|
||||||
|
directory exists already, nothing is done and the call succeeds, unless the
|
||||||
|
fail_if_exists arguments is true. */
|
||||||
|
|
||||||
|
ibool
|
||||||
|
os_file_create_directory(
|
||||||
|
/*=====================*/
|
||||||
|
/* out: TRUE if call succeeds, FALSE on
|
||||||
|
error */
|
||||||
|
char* pathname, /* in: directory name as null-terminated
|
||||||
|
string */
|
||||||
|
ibool fail_if_exists) /* in: if TRUE, pre-existing directory is
|
||||||
|
treated as an error. */
|
||||||
|
{
|
||||||
|
#ifdef __WIN__
|
||||||
|
BOOL rcode;
|
||||||
|
|
||||||
|
rcode = CreateDirectory(pathname, NULL);
|
||||||
|
if (!(rcode != 0 ||
|
||||||
|
(GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) {
|
||||||
|
/* failure */
|
||||||
|
os_file_handle_error(NULL, pathname, "CreateDirectory");
|
||||||
|
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (TRUE);
|
||||||
|
#else
|
||||||
|
int rcode;
|
||||||
|
|
||||||
|
rcode = mkdir(pathname, 0770);
|
||||||
|
|
||||||
|
if (!(rcode == 0 || (errno == EEXIST && !fail_if_exists))) {
|
||||||
|
/* failure */
|
||||||
|
os_file_handle_error(0, pathname, "mkdir");
|
||||||
|
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (TRUE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
A simple function to open or create a file. */
|
A simple function to open or create a file. */
|
||||||
|
|
||||||
@ -602,7 +647,8 @@ os_file_t
|
|||||||
os_file_create_simple(
|
os_file_create_simple(
|
||||||
/*==================*/
|
/*==================*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
@ -714,13 +760,16 @@ os_file_t
|
|||||||
os_file_create_simple_no_error_handling(
|
os_file_create_simple_no_error_handling(
|
||||||
/*====================================*/
|
/*====================================*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode,/* in: OS_FILE_OPEN if an existing file is opened
|
||||||
(if does not exist, error), or OS_FILE_CREATE if a new
|
(if does not exist, error), or OS_FILE_CREATE if a new
|
||||||
file is created (if exists, error) */
|
file is created (if exists, error) */
|
||||||
ulint access_type,/* in: OS_FILE_READ_ONLY or OS_FILE_READ_WRITE */
|
ulint access_type,/* in: OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or
|
||||||
|
OS_FILE_READ_ALLOW_DELETE; the last option is used by
|
||||||
|
a backup program reading the file */
|
||||||
ibool* success)/* out: TRUE if succeed, FALSE if error */
|
ibool* success)/* out: TRUE if succeed, FALSE if error */
|
||||||
{
|
{
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
@ -728,6 +777,7 @@ os_file_create_simple_no_error_handling(
|
|||||||
DWORD create_flag;
|
DWORD create_flag;
|
||||||
DWORD access;
|
DWORD access;
|
||||||
DWORD attributes = 0;
|
DWORD attributes = 0;
|
||||||
|
DWORD share_mode = FILE_SHARE_READ;
|
||||||
|
|
||||||
ut_a(name);
|
ut_a(name);
|
||||||
|
|
||||||
@ -744,6 +794,13 @@ os_file_create_simple_no_error_handling(
|
|||||||
access = GENERIC_READ;
|
access = GENERIC_READ;
|
||||||
} else if (access_type == OS_FILE_READ_WRITE) {
|
} else if (access_type == OS_FILE_READ_WRITE) {
|
||||||
access = GENERIC_READ | GENERIC_WRITE;
|
access = GENERIC_READ | GENERIC_WRITE;
|
||||||
|
} else if (access_type == OS_FILE_READ_ALLOW_DELETE) {
|
||||||
|
access = GENERIC_READ;
|
||||||
|
share_mode = FILE_SHARE_DELETE | FILE_SHARE_READ
|
||||||
|
| FILE_SHARE_WRITE; /* A backup program has to give
|
||||||
|
mysqld the maximum freedom to
|
||||||
|
do what it likes with the
|
||||||
|
file */
|
||||||
} else {
|
} else {
|
||||||
access = 0;
|
access = 0;
|
||||||
ut_error;
|
ut_error;
|
||||||
@ -751,8 +808,7 @@ os_file_create_simple_no_error_handling(
|
|||||||
|
|
||||||
file = CreateFile(name,
|
file = CreateFile(name,
|
||||||
access,
|
access,
|
||||||
FILE_SHARE_READ,/* file can be read also by other
|
share_mode,
|
||||||
processes */
|
|
||||||
NULL, /* default security attributes */
|
NULL, /* default security attributes */
|
||||||
create_flag,
|
create_flag,
|
||||||
attributes,
|
attributes,
|
||||||
@ -808,7 +864,8 @@ os_file_t
|
|||||||
os_file_create(
|
os_file_create(
|
||||||
/*===========*/
|
/*===========*/
|
||||||
/* out, own: handle to the file, not defined if error,
|
/* out, own: handle to the file, not defined if error,
|
||||||
error number can be retrieved with os_get_last_error */
|
error number can be retrieved with
|
||||||
|
os_file_get_last_error */
|
||||||
char* name, /* in: name of the file or path as a null-terminated
|
char* name, /* in: name of the file or path as a null-terminated
|
||||||
string */
|
string */
|
||||||
ulint create_mode, /* in: OS_FILE_OPEN if an existing file is opened
|
ulint create_mode, /* in: OS_FILE_OPEN if an existing file is opened
|
||||||
@ -896,7 +953,7 @@ try_again:
|
|||||||
start 2 instances of mysqld on the
|
start 2 instances of mysqld on the
|
||||||
SAME files, that could cause severe
|
SAME files, that could cause severe
|
||||||
database corruption! When opening
|
database corruption! When opening
|
||||||
raw disk partitions Microsoft manuals
|
raw disk partitions, Microsoft manuals
|
||||||
say that we must give also the write
|
say that we must give also the write
|
||||||
permission. */
|
permission. */
|
||||||
NULL, /* default security attributes */
|
NULL, /* default security attributes */
|
||||||
@ -1017,6 +1074,10 @@ os_file_delete(
|
|||||||
{
|
{
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
ulint count = 0;
|
||||||
|
loop:
|
||||||
|
/* In Windows, deleting an .ibd file may fail if ibbackup is copying
|
||||||
|
it */
|
||||||
|
|
||||||
ret = DeleteFile((LPCTSTR)name);
|
ret = DeleteFile((LPCTSTR)name);
|
||||||
|
|
||||||
@ -1024,9 +1085,31 @@ os_file_delete(
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
os_file_handle_error(NULL, name, "delete");
|
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
|
||||||
|
/* If the file does not exist, we classify this as a 'mild'
|
||||||
|
error and return */
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
|
|
||||||
|
if (count > 100 && 0 == (count % 10)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"InnoDB: Warning: cannot delete file %s\n"
|
||||||
|
"InnoDB: Are you running ibbackup to back up the file?\n", name);
|
||||||
|
|
||||||
|
os_file_get_last_error(TRUE); /* print error information */
|
||||||
|
}
|
||||||
|
|
||||||
|
os_thread_sleep(1000000); /* sleep for a second */
|
||||||
|
|
||||||
|
if (count > 2000) {
|
||||||
|
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
goto loop;
|
||||||
#else
|
#else
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -1103,6 +1186,7 @@ os_file_close(
|
|||||||
}
|
}
|
||||||
|
|
||||||
os_file_handle_error(file, NULL, "close");
|
os_file_handle_error(file, NULL, "close");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
#else
|
#else
|
||||||
int ret;
|
int ret;
|
||||||
@ -1111,6 +1195,7 @@ os_file_close(
|
|||||||
|
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
os_file_handle_error(file, NULL, "close");
|
os_file_handle_error(file, NULL, "close");
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* A lexical scanner generated by flex */
|
/* A lexical scanner generated by flex */
|
||||||
|
|
||||||
/* Scanner skeleton version:
|
/* Scanner skeleton version:
|
||||||
* $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
|
* $Header: /home/heikki/cvsroot/ib/pars/lexyy.c,v 1.2 2003/10/30 20:27:19 heikki Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FLEX_SCANNER
|
#define FLEX_SCANNER
|
||||||
|
@ -2346,8 +2346,13 @@ row_drop_table_for_mysql(
|
|||||||
/* Do not drop possible .ibd tablespace if something went
|
/* Do not drop possible .ibd tablespace if something went
|
||||||
wrong: we do not want to delete valuable data of the user */
|
wrong: we do not want to delete valuable data of the user */
|
||||||
|
|
||||||
if (err == DB_SUCCESS && space_id != 0
|
if (err == DB_SUCCESS && space_id > 0) {
|
||||||
&& fil_tablespace_exists_in_mem(space_id)) {
|
if (!fil_space_for_table_exists_in_mem(space_id, name,
|
||||||
|
FALSE, TRUE)) {
|
||||||
|
err = DB_ERROR;
|
||||||
|
|
||||||
|
goto funct_exit;
|
||||||
|
}
|
||||||
|
|
||||||
success = fil_delete_tablespace(space_id);
|
success = fil_delete_tablespace(space_id);
|
||||||
|
|
||||||
|
@ -3288,7 +3288,13 @@ rec_loop:
|
|||||||
|
|
||||||
} else if (index == clust_index) {
|
} else if (index == clust_index) {
|
||||||
|
|
||||||
if (!lock_clust_rec_cons_read_sees(rec, index,
|
/* Fetch a previous version of the row if the current
|
||||||
|
one is not visible in the snapshot; if we have a very
|
||||||
|
high force recovery level set, we try to avoid crashes
|
||||||
|
by skipping this lookup */
|
||||||
|
|
||||||
|
if (srv_force_recovery < 5
|
||||||
|
&& !lock_clust_rec_cons_read_sees(rec, index,
|
||||||
trx->read_view)) {
|
trx->read_view)) {
|
||||||
|
|
||||||
err = row_sel_build_prev_vers_for_mysql(
|
err = row_sel_build_prev_vers_for_mysql(
|
||||||
|
@ -102,7 +102,7 @@ char** srv_log_group_home_dirs = NULL;
|
|||||||
ulint srv_n_log_groups = ULINT_MAX;
|
ulint srv_n_log_groups = ULINT_MAX;
|
||||||
ulint srv_n_log_files = ULINT_MAX;
|
ulint srv_n_log_files = ULINT_MAX;
|
||||||
ulint srv_log_file_size = ULINT_MAX; /* size in database pages */
|
ulint srv_log_file_size = ULINT_MAX; /* size in database pages */
|
||||||
ibool srv_log_archive_on = TRUE;
|
ibool srv_log_archive_on = FALSE;
|
||||||
ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */
|
ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */
|
||||||
ulint srv_flush_log_at_trx_commit = 1;
|
ulint srv_flush_log_at_trx_commit = 1;
|
||||||
|
|
||||||
@ -3209,11 +3209,13 @@ flush_loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
mutex_exit(&kernel_mutex);
|
mutex_exit(&kernel_mutex);
|
||||||
|
/*
|
||||||
srv_main_thread_op_info =
|
srv_main_thread_op_info =
|
||||||
(char*)"archiving log (if log archive is on)";
|
(char*)"archiving log (if log archive is on)";
|
||||||
|
|
||||||
log_archive_do(FALSE, &n_bytes_archived);
|
log_archive_do(FALSE, &n_bytes_archived);
|
||||||
|
*/
|
||||||
|
n_bytes_archived = 0;
|
||||||
|
|
||||||
/* Keep looping in the background loop if still work to do */
|
/* Keep looping in the background loop if still work to do */
|
||||||
|
|
||||||
|
@ -553,7 +553,6 @@ open_or_create_log_file(
|
|||||||
ulint i) /* in: log file number in group */
|
ulint i) /* in: log file number in group */
|
||||||
{
|
{
|
||||||
ibool ret;
|
ibool ret;
|
||||||
ulint arch_space_id;
|
|
||||||
ulint size;
|
ulint size;
|
||||||
ulint size_high;
|
ulint size_high;
|
||||||
char name[10000];
|
char name[10000];
|
||||||
@ -649,9 +648,10 @@ open_or_create_log_file(
|
|||||||
|
|
||||||
fil_node_create(name, srv_log_file_size,
|
fil_node_create(name, srv_log_file_size,
|
||||||
2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
|
2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
|
||||||
|
#ifdef notdefined
|
||||||
/* If this is the first log group, create the file space object
|
/* If this is the first log group, create the file space object
|
||||||
for archived logs */
|
for archived logs.
|
||||||
|
Under MySQL, no archiving ever done. */
|
||||||
|
|
||||||
if (k == 0 && i == 0) {
|
if (k == 0 && i == 0) {
|
||||||
arch_space_id = 2 * k + 1 + SRV_LOG_SPACE_FIRST_ID;
|
arch_space_id = 2 * k + 1 + SRV_LOG_SPACE_FIRST_ID;
|
||||||
@ -661,12 +661,13 @@ open_or_create_log_file(
|
|||||||
} else {
|
} else {
|
||||||
arch_space_id = ULINT_UNDEFINED;
|
arch_space_id = ULINT_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
log_group_init(k, srv_n_log_files,
|
log_group_init(k, srv_n_log_files,
|
||||||
srv_log_file_size * UNIV_PAGE_SIZE,
|
srv_log_file_size * UNIV_PAGE_SIZE,
|
||||||
2 * k + SRV_LOG_SPACE_FIRST_ID,
|
2 * k + SRV_LOG_SPACE_FIRST_ID,
|
||||||
arch_space_id);
|
SRV_LOG_SPACE_FIRST_ID + 1); /* dummy arch
|
||||||
|
space id */
|
||||||
}
|
}
|
||||||
|
|
||||||
return(DB_SUCCESS);
|
return(DB_SUCCESS);
|
||||||
@ -1000,7 +1001,6 @@ innobase_start_or_create_for_mysql(void)
|
|||||||
dulint max_flushed_lsn;
|
dulint max_flushed_lsn;
|
||||||
ulint min_arch_log_no;
|
ulint min_arch_log_no;
|
||||||
ulint max_arch_log_no;
|
ulint max_arch_log_no;
|
||||||
ibool start_archive;
|
|
||||||
ulint sum_of_new_sizes;
|
ulint sum_of_new_sizes;
|
||||||
ulint sum_of_data_file_sizes;
|
ulint sum_of_data_file_sizes;
|
||||||
ulint tablespace_size_in_header;
|
ulint tablespace_size_in_header;
|
||||||
@ -1341,7 +1341,9 @@ NetWare. */
|
|||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
recv_reset_logs(max_flushed_lsn, max_arch_log_no + 1, TRUE);
|
/* Do not + 1 arch_log_no because we do not use log
|
||||||
|
archiving */
|
||||||
|
recv_reset_logs(max_flushed_lsn, max_arch_log_no, TRUE);
|
||||||
|
|
||||||
mutex_exit(&(log_sys->mutex));
|
mutex_exit(&(log_sys->mutex));
|
||||||
}
|
}
|
||||||
@ -1430,6 +1432,8 @@ NetWare. */
|
|||||||
|
|
||||||
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
log_make_checkpoint_at(ut_dulint_max, TRUE);
|
||||||
|
|
||||||
|
#ifdef notdefined
|
||||||
|
/* Archiving is always off under MySQL */
|
||||||
if (!srv_log_archive_on) {
|
if (!srv_log_archive_on) {
|
||||||
ut_a(DB_SUCCESS == log_archive_noarchivelog());
|
ut_a(DB_SUCCESS == log_archive_noarchivelog());
|
||||||
} else {
|
} else {
|
||||||
@ -1447,7 +1451,7 @@ NetWare. */
|
|||||||
ut_a(DB_SUCCESS == log_archive_archivelog());
|
ut_a(DB_SUCCESS == log_archive_archivelog());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!create_new_db && srv_force_recovery == 0) {
|
if (!create_new_db && srv_force_recovery == 0) {
|
||||||
/* After a crash recovery we only check that the info in data
|
/* After a crash recovery we only check that the info in data
|
||||||
dictionary is consistent with what we already know about space
|
dictionary is consistent with what we already know about space
|
||||||
|
@ -71,9 +71,8 @@ ut_find_prime(
|
|||||||
|
|
||||||
/* Found a prime */
|
/* Found a prime */
|
||||||
break;
|
break;
|
||||||
next_n: ;
|
next_n: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ ut_get_high32(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************
|
/************************************************************
|
||||||
The following function returns a clock time in milliseconds. */
|
The following function returns elapsed CPU time in milliseconds. */
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
ut_clock(void)
|
ut_clock(void)
|
||||||
@ -181,6 +181,50 @@ ut_sprintf_timestamp(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************
|
||||||
|
Sprintfs a timestamp to a buffer with no spaces and with ':' characters
|
||||||
|
replaced by '_'. */
|
||||||
|
|
||||||
|
void
|
||||||
|
ut_sprintf_timestamp_without_extra_chars(
|
||||||
|
/*=====================================*/
|
||||||
|
char* buf) /* in: buffer where to sprintf */
|
||||||
|
{
|
||||||
|
#ifdef __WIN__
|
||||||
|
SYSTEMTIME cal_tm;
|
||||||
|
|
||||||
|
GetLocalTime(&cal_tm);
|
||||||
|
|
||||||
|
sprintf(buf, "%02d%02d%02d_%2d_%02d_%02d",
|
||||||
|
(int)cal_tm.wYear % 100,
|
||||||
|
(int)cal_tm.wMonth,
|
||||||
|
(int)cal_tm.wDay,
|
||||||
|
(int)cal_tm.wHour,
|
||||||
|
(int)cal_tm.wMinute,
|
||||||
|
(int)cal_tm.wSecond);
|
||||||
|
#else
|
||||||
|
struct tm cal_tm;
|
||||||
|
struct tm* cal_tm_ptr;
|
||||||
|
time_t tm;
|
||||||
|
|
||||||
|
time(&tm);
|
||||||
|
|
||||||
|
#ifdef HAVE_LOCALTIME_R
|
||||||
|
localtime_r(&tm, &cal_tm);
|
||||||
|
cal_tm_ptr = &cal_tm;
|
||||||
|
#else
|
||||||
|
cal_tm_ptr = localtime(&tm);
|
||||||
|
#endif
|
||||||
|
sprintf(buf, "%02d%02d%02d_%2d_%02d_%02d",
|
||||||
|
cal_tm_ptr->tm_year % 100,
|
||||||
|
cal_tm_ptr->tm_mon + 1,
|
||||||
|
cal_tm_ptr->tm_mday,
|
||||||
|
cal_tm_ptr->tm_hour,
|
||||||
|
cal_tm_ptr->tm_min,
|
||||||
|
cal_tm_ptr->tm_sec);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
Returns current year, month, day. */
|
Returns current year, month, day. */
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ INSERT INTO t1 VALUES (1), (2);
|
|||||||
<mysqldump>
|
<mysqldump>
|
||||||
<database name="test">
|
<database name="test">
|
||||||
<table_structure name="t1">
|
<table_structure name="t1">
|
||||||
<field Field="a" Type="int(11)" Null="YES" />
|
<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
|
||||||
</table_structure>
|
</table_structure>
|
||||||
<table_data name="t1">
|
<table_data name="t1">
|
||||||
<row>
|
<row>
|
||||||
@ -18,13 +18,38 @@ INSERT INTO t1 VALUES (1), (2);
|
|||||||
</database>
|
</database>
|
||||||
</mysqldump>
|
</mysqldump>
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1(a int, b text, c varchar(3));
|
||||||
|
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<mysqldump>
|
||||||
|
<database name="test">
|
||||||
|
<table_structure name="t1">
|
||||||
|
<field Field="a" Type="int(11)" Null="YES" Key="" Extra="" />
|
||||||
|
<field Field="b" Type="text" Null="YES" Key="" Extra="" />
|
||||||
|
<field Field="c" Type="char(3)" Null="YES" Key="" Extra="" />
|
||||||
|
</table_structure>
|
||||||
|
<table_data name="t1">
|
||||||
|
<row>
|
||||||
|
<field name="a">1</field>
|
||||||
|
<field name="b">test</field>
|
||||||
|
<field name="c">tes</field>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<field name="a">2</field>
|
||||||
|
<field name="b">TEST</field>
|
||||||
|
<field name="c">TES</field>
|
||||||
|
</row>
|
||||||
|
</table_data>
|
||||||
|
</database>
|
||||||
|
</mysqldump>
|
||||||
|
DROP TABLE t1;
|
||||||
CREATE TABLE `"t"1` (`a"b"` char(2));
|
CREATE TABLE `"t"1` (`a"b"` char(2));
|
||||||
INSERT INTO `"t"1` VALUES ("1\""), ("\"2");
|
INSERT INTO `"t"1` VALUES ("1\""), ("\"2");
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<mysqldump>
|
<mysqldump>
|
||||||
<database name="test">
|
<database name="test">
|
||||||
<table_structure name=""t"1">
|
<table_structure name=""t"1">
|
||||||
<field Field="a"b"" Type="char(2)" Null="YES" />
|
<field Field="a"b"" Type="char(2)" Null="YES" Key="" Extra="" />
|
||||||
</table_structure>
|
</table_structure>
|
||||||
<table_data name=""t"1">
|
<table_data name=""t"1">
|
||||||
<row>
|
<row>
|
||||||
|
@ -9,6 +9,11 @@ INSERT INTO t1 VALUES (1), (2);
|
|||||||
--exec $MYSQL_DUMP --skip-all -X test t1
|
--exec $MYSQL_DUMP --skip-all -X test t1
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
CREATE TABLE t1(a int, b text, c varchar(3));
|
||||||
|
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
|
||||||
|
--exec $MYSQL_DUMP --skip-all -X test t1
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #1707
|
# Bug #1707
|
||||||
#
|
#
|
||||||
|
@ -170,7 +170,7 @@ my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
|
|||||||
|
|
||||||
DBUG_ASSERT(map->bitmap && prefix_size <= map->bitmap_size*8);
|
DBUG_ASSERT(map->bitmap && prefix_size <= map->bitmap_size*8);
|
||||||
|
|
||||||
bitmap_lock(map);
|
bitmap_lock((MY_BITMAP *)map);
|
||||||
while (m < end_prefix)
|
while (m < end_prefix)
|
||||||
if (*m++ != 0xff)
|
if (*m++ != 0xff)
|
||||||
goto ret;
|
goto ret;
|
||||||
@ -184,7 +184,7 @@ my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
|
|||||||
|
|
||||||
res=1;
|
res=1;
|
||||||
ret:
|
ret:
|
||||||
bitmap_unlock(map);
|
bitmap_unlock((MY_BITMAP *)map);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,8 +211,8 @@ my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
|
|||||||
|
|
||||||
DBUG_ASSERT(map1->bitmap && map2->bitmap &&
|
DBUG_ASSERT(map1->bitmap && map2->bitmap &&
|
||||||
map1->bitmap_size==map2->bitmap_size);
|
map1->bitmap_size==map2->bitmap_size);
|
||||||
bitmap_lock(map1);
|
bitmap_lock((MY_BITMAP *)map1);
|
||||||
bitmap_lock(map2);
|
bitmap_lock((MY_BITMAP *)map2);
|
||||||
|
|
||||||
end= m1+map1->bitmap_size;
|
end= m1+map1->bitmap_size;
|
||||||
|
|
||||||
@ -222,8 +222,8 @@ my_bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
|
|||||||
|
|
||||||
res=1;
|
res=1;
|
||||||
ret:
|
ret:
|
||||||
bitmap_unlock(map2);
|
bitmap_unlock((MY_BITMAP *)map2);
|
||||||
bitmap_unlock(map1);
|
bitmap_unlock((MY_BITMAP *)map1);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,24 +233,24 @@ my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
|
|||||||
|
|
||||||
DBUG_ASSERT(map1->bitmap && map2->bitmap &&
|
DBUG_ASSERT(map1->bitmap && map2->bitmap &&
|
||||||
map1->bitmap_size==map2->bitmap_size);
|
map1->bitmap_size==map2->bitmap_size);
|
||||||
bitmap_lock(map1);
|
bitmap_lock((MY_BITMAP *)map1);
|
||||||
bitmap_lock(map2);
|
bitmap_lock((MY_BITMAP *)map2);
|
||||||
|
|
||||||
res= memcmp(map1->bitmap, map2->bitmap, map1->bitmap_size)==0;
|
res= memcmp(map1->bitmap, map2->bitmap, map1->bitmap_size)==0;
|
||||||
|
|
||||||
bitmap_unlock(map2);
|
bitmap_unlock((MY_BITMAP *)map2);
|
||||||
bitmap_unlock(map1);
|
bitmap_unlock((MY_BITMAP *)map1);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
|
void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
|
||||||
{
|
{
|
||||||
uchar *to=map->bitmap, *from=map2->bitmap, *end;
|
uchar *to=map->bitmap, *from=map2->bitmap, *end;
|
||||||
uint len=map->bitmap_size, len2=map2->bitmap;
|
uint len=map->bitmap_size, len2=map2->bitmap_size;
|
||||||
|
|
||||||
DBUG_ASSERT(map->bitmap && map2->bitmap);
|
DBUG_ASSERT(map->bitmap && map2->bitmap);
|
||||||
bitmap_lock(map);
|
bitmap_lock(map);
|
||||||
bitmap_lock(map2);
|
bitmap_lock((MY_BITMAP *)map2);
|
||||||
|
|
||||||
end= to+min(len,len2);
|
end= to+min(len,len2);
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
|
|||||||
*to++=0;
|
*to++=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmap_unlock(map2);
|
bitmap_unlock((MY_BITMAP *)map2);
|
||||||
bitmap_unlock(map);
|
bitmap_unlock(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,14 +275,14 @@ void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
|
|||||||
DBUG_ASSERT(map->bitmap && map2->bitmap &&
|
DBUG_ASSERT(map->bitmap && map2->bitmap &&
|
||||||
map->bitmap_size==map2->bitmap_size);
|
map->bitmap_size==map2->bitmap_size);
|
||||||
bitmap_lock(map);
|
bitmap_lock(map);
|
||||||
bitmap_lock(map2);
|
bitmap_lock((MY_BITMAP *)map2);
|
||||||
|
|
||||||
end= to+map->bitmap_size;
|
end= to+map->bitmap_size;
|
||||||
|
|
||||||
while (to < end)
|
while (to < end)
|
||||||
*to++ &= ~(*from++);
|
*to++ &= ~(*from++);
|
||||||
|
|
||||||
bitmap_unlock(map2);
|
bitmap_unlock((MY_BITMAP *)map2);
|
||||||
bitmap_unlock(map);
|
bitmap_unlock(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,14 +293,14 @@ void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
|
|||||||
DBUG_ASSERT(map->bitmap && map2->bitmap &&
|
DBUG_ASSERT(map->bitmap && map2->bitmap &&
|
||||||
map->bitmap_size==map2->bitmap_size);
|
map->bitmap_size==map2->bitmap_size);
|
||||||
bitmap_lock(map);
|
bitmap_lock(map);
|
||||||
bitmap_lock(map2);
|
bitmap_lock((MY_BITMAP *)map2);
|
||||||
|
|
||||||
end= to+map->bitmap_size;
|
end= to+map->bitmap_size;
|
||||||
|
|
||||||
while (to < end)
|
while (to < end)
|
||||||
*to++ |= *from++;
|
*to++ |= *from++;
|
||||||
|
|
||||||
bitmap_unlock(map2);
|
bitmap_unlock((MY_BITMAP *)map2);
|
||||||
bitmap_unlock(map);
|
bitmap_unlock(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -982,7 +982,7 @@ JOIN::optimize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select_lex->master_unit()->dependent)
|
if (select_lex->master_unit()->uncacheable)
|
||||||
{
|
{
|
||||||
if (!(tmp_join= (JOIN*)thd->alloc(sizeof(JOIN))))
|
if (!(tmp_join= (JOIN*)thd->alloc(sizeof(JOIN))))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
@ -1053,11 +1053,11 @@ JOIN::reinit()
|
|||||||
bool
|
bool
|
||||||
JOIN::save_join_tab()
|
JOIN::save_join_tab()
|
||||||
{
|
{
|
||||||
if (!join_tab_save && select_lex->master_unit()->dependent)
|
if (!join_tab_save && select_lex->master_unit()->uncacheable)
|
||||||
{
|
{
|
||||||
if (!(join_tab_save= (JOIN_TAB*) thd->alloc(sizeof(JOIN_TAB) * tables)))
|
if (!(join_tab_save= (JOIN_TAB*)thd->memdup((gptr) join_tab,
|
||||||
|
sizeof(JOIN_TAB) * tables)))
|
||||||
return 1;
|
return 1;
|
||||||
memcpy(join_tab_save, join_tab, sizeof(JOIN_TAB) * tables);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user