Merge joreland@bk-internal.mysql.com:mysql-4.1-ndb-jonas

into mysql.com:/home/jonas/src/mysql-4.1-ndb-jonas
This commit is contained in:
joreland@mysql.com 2004-05-27 23:42:32 +02:00
commit 79c4dcf3ee
77 changed files with 713 additions and 553 deletions

View file

@ -312,6 +312,10 @@ SOURCE=.\pars\pars0sym.c
# End Source File
# Begin Source File
SOURCE=.\que\que0que.c
# End Source File
# Begin Source File
SOURCE=.\read\read0read.c
# End Source File
# Begin Source File

View file

@ -1872,7 +1872,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
{
*pos++= ',';
*pos++= ' ';
pos=int2str(warnings, pos, 10);
pos=int10_to_str(warnings, pos, 10);
pos=strmov(pos, " warning");
if (warnings != 1)
*pos++= 's';
@ -3090,21 +3090,21 @@ static void nice_time(double sec,char *buff,bool part_second)
{
tmp=(ulong) floor(sec/(3600.0*24));
sec-=3600.0*24*tmp;
buff=int2str((long) tmp,buff,10);
buff=int10_to_str((long) tmp, buff, 10);
buff=strmov(buff,tmp > 1 ? " days " : " day ");
}
if (sec >= 3600.0)
{
tmp=(ulong) floor(sec/3600.0);
sec-=3600.0*tmp;
buff=int2str((long) tmp,buff,10);
buff=int10_to_str((long) tmp, buff, 10);
buff=strmov(buff,tmp > 1 ? " hours " : " hour ");
}
if (sec >= 60.0)
{
tmp=(ulong) floor(sec/60.0);
sec-=60.0*tmp;
buff=int2str((long) tmp,buff,10);
buff=int10_to_str((long) tmp, buff, 10);
buff=strmov(buff," min ");
}
if (part_second)

View file

@ -961,24 +961,24 @@ static void nice_time(ulong sec,char *buff)
{
tmp=sec/(3600L*24);
sec-=3600L*24*tmp;
buff=int2str(tmp,buff,10);
buff=int10_to_str(tmp, buff, 10);
buff=strmov(buff,tmp > 1 ? " days " : " day ");
}
if (sec >= 3600L)
{
tmp=sec/3600L;
sec-=3600L*tmp;
buff=int2str(tmp,buff,10);
buff=int10_to_str(tmp, buff, 10);
buff=strmov(buff,tmp > 1 ? " hours " : " hour ");
}
if (sec >= 60)
{
tmp=sec/60;
sec-=60*tmp;
buff=int2str(tmp,buff,10);
buff=int10_to_str(tmp, buff, 10);
buff=strmov(buff," min ");
}
strmov(int2str(sec,buff,10)," sec");
strmov(int10_to_str(sec, buff, 10)," sec");
}

View file

@ -985,8 +985,8 @@ uint length)
fputc('\n',_db_fp_);
pos=3;
}
fputc(_dig_vec[((tmp >> 4) & 15)], _db_fp_);
fputc(_dig_vec[tmp & 15], _db_fp_);
fputc(_dig_vec_upper[((tmp >> 4) & 15)], _db_fp_);
fputc(_dig_vec_upper[tmp & 15], _db_fp_);
fputc(' ',_db_fp_);
}
(void) fputc('\n',_db_fp_);

View file

@ -95,7 +95,9 @@ extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
#endif
#endif
extern char NEAR _dig_vec[]; /* Declared in int2str() */
/* Declared in int2str() */
extern char NEAR _dig_vec_upper[];
extern char NEAR _dig_vec_lower[];
#ifdef BAD_STRING_COMPILER
#define strmov(A,B) (memccpy(A,B,0,INT_MAX)-1)
@ -113,8 +115,6 @@ extern char NEAR _dig_vec[]; /* Declared in int2str() */
#ifdef MSDOS
#undef bmove_align
#define bmove512(A,B,C) bmove_align(A,B,C)
#define my_itoa(A,B,C) itoa(A,B,C)
#define my_ltoa(A,B,C) ltoa(A,B,C)
extern void bmove_align(gptr dst,const gptr src,uint len);
#endif
@ -219,24 +219,19 @@ extern int is_prefix(const char *, const char *);
double my_strtod(const char *str, char **end);
double my_atof(const char *nptr);
#ifdef USE_MY_ITOA
extern char *my_itoa(int val,char *dst,int radix);
extern char *my_ltoa(long val,char *dst,int radix);
#endif
extern char *llstr(longlong value,char *buff);
#ifndef HAVE_STRTOUL
extern long strtol(const char *str, char **ptr, int base);
extern ulong strtoul(const char *str, char **ptr, int base);
#endif
extern char *int2str(long val,char *dst,int radix);
extern char *int2str(long val, char *dst, int radix, char upcase);
extern char *int10_to_str(long val,char *dst,int radix);
extern char *str2int(const char *src,int radix,long lower,long upper,
long *val);
longlong my_strtoll10(const char *nptr, char **endptr, int *error);
#if SIZEOF_LONG == SIZEOF_LONG_LONG
#define longlong2str(A,B,C) int2str((A),(B),(C))
#define longlong2str(A,B,C) int2str((A),(B),(C),1)
#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
#undef strtoll
#define strtoll(A,B,C) strtol((A),(B),(C))

View file

@ -587,12 +587,6 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define USE_MY_STAT_STRUCT /* For my_lib */
#endif
/* Some things that this system does have */
#ifndef HAVE_ITOA
#define USE_MY_ITOA /* There is no itoa */
#endif
/* Some defines of functions for portability */
#undef remove /* Crashes MySQL on SCO 5.0.0 */

View file

@ -2937,7 +2937,7 @@ btr_cur_mark_dtuple_inherited_extern(
if (!is_updated) {
dfield = dtuple_get_nth_field(entry, ext_vec[i]);
data = dfield_get_data(dfield);
data = (byte*) dfield_get_data(dfield);
len = dfield_get_len(dfield);
len -= BTR_EXTERN_FIELD_REF_SIZE;
@ -2997,7 +2997,7 @@ btr_cur_unmark_dtuple_extern_fields(
for (i = 0; i < n_ext_vec; i++) {
dfield = dtuple_get_nth_field(entry, ext_vec[i]);
data = dfield_get_data(dfield);
data = (byte*) dfield_get_data(dfield);
len = dfield_get_len(dfield);
len -= BTR_EXTERN_FIELD_REF_SIZE;

View file

@ -719,7 +719,9 @@ buf_awe_map_page_to_frame(
{
buf_block_t* bck;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(block);
if (block->frame) {

View file

@ -640,7 +640,7 @@ buf_read_ibuf_merge_pages(
if (buf_debug_prints) {
fprintf(stderr,
"Ibuf merge read-ahead space %lu pages %lu\n",
(ulong) space, (ulong) n_stored);
(ulong) space_ids[0], (ulong) n_stored);
}
#endif /* UNIV_DEBUG */
}

View file

@ -254,29 +254,26 @@ dict_boot(void)
/* Insert into the dictionary cache the descriptions of the basic
system tables */
/*-------------------------*/
table = dict_mem_table_create((char *) "SYS_TABLES", DICT_HDR_SPACE,8);
table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE,8);
dict_mem_table_add_col(table, (char *) "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, (char *) "ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, (char *) "N_COLS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "TYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "MIX_ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, (char *) "MIX_LEN", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "CLUSTER_NAME", DATA_BINARY,
0, 0, 0);
dict_mem_table_add_col(table, (char *) "SPACE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0);
table->id = DICT_TABLES_ID;
dict_table_add_to_cache(table);
dict_sys->sys_tables = table;
index = dict_mem_index_create((char *) "SYS_TABLES", (char *)
"CLUST_IND",
DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 1);
index = dict_mem_index_create("SYS_TABLES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 1);
dict_mem_index_add_field(index, (char *) "NAME", 0, 0);
dict_mem_index_add_field(index, "NAME", 0, 0);
index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr);
@ -284,52 +281,50 @@ dict_boot(void)
ut_a(dict_index_add_to_cache(table, index));
/*-------------------------*/
index = dict_mem_index_create((char *) "SYS_TABLES",
(char *) "ID_IND", DICT_HDR_SPACE,
DICT_UNIQUE, 1);
dict_mem_index_add_field(index, (char *) "ID", 0, 0);
index = dict_mem_index_create("SYS_TABLES", "ID_IND",
DICT_HDR_SPACE, DICT_UNIQUE, 1);
dict_mem_index_add_field(index, "ID", 0, 0);
index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_TABLE_IDS,
MLOG_4BYTES, &mtr);
index->id = DICT_TABLE_IDS_ID;
ut_a(dict_index_add_to_cache(table, index));
/*-------------------------*/
table = dict_mem_table_create((char *) "SYS_COLUMNS",DICT_HDR_SPACE,7);
table = dict_mem_table_create("SYS_COLUMNS",DICT_HDR_SPACE,7);
dict_mem_table_add_col(table, (char *) "TABLE_ID", DATA_BINARY,0,0,0);
dict_mem_table_add_col(table, (char *) "POS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, (char *) "MTYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "PRTYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "LEN", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "PREC", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY,0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4, 0);
table->id = DICT_COLUMNS_ID;
dict_table_add_to_cache(table);
dict_sys->sys_columns = table;
index = dict_mem_index_create((char *) "SYS_COLUMNS",
(char *) "CLUST_IND", DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, (char *) "TABLE_ID", 0, 0);
dict_mem_index_add_field(index, (char *) "POS", 0, 0);
dict_mem_index_add_field(index, "TABLE_ID", 0, 0);
dict_mem_index_add_field(index, "POS", 0, 0);
index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr);
index->id = DICT_COLUMNS_ID;
ut_a(dict_index_add_to_cache(table, index));
/*-------------------------*/
table = dict_mem_table_create((char *) "SYS_INDEXES",DICT_HDR_SPACE,7);
table = dict_mem_table_create("SYS_INDEXES",DICT_HDR_SPACE,7);
dict_mem_table_add_col(table, (char *) "TABLE_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, (char *) "ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, (char *) "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, (char *) "N_FIELDS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "TYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "SPACE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "PAGE_NO", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4, 0);
/* The '+ 2' below comes from the 2 system fields */
#if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2
@ -343,34 +338,32 @@ dict_boot(void)
dict_table_add_to_cache(table);
dict_sys->sys_indexes = table;
index = dict_mem_index_create((char *) "SYS_INDEXES",
(char *) "CLUST_IND", DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, (char *) "TABLE_ID", 0, 0);
dict_mem_index_add_field(index, (char *) "ID", 0, 0);
dict_mem_index_add_field(index, "TABLE_ID", 0, 0);
dict_mem_index_add_field(index, "ID", 0, 0);
index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr);
index->id = DICT_INDEXES_ID;
ut_a(dict_index_add_to_cache(table, index));
/*-------------------------*/
table = dict_mem_table_create((char *) "SYS_FIELDS", DICT_HDR_SPACE,3);
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE,3);
dict_mem_table_add_col(table, (char *) "INDEX_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, (char *) "POS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, (char *) "COL_NAME", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0,0,0);
table->id = DICT_FIELDS_ID;
dict_table_add_to_cache(table);
dict_sys->sys_fields = table;
index = dict_mem_index_create((char *) "SYS_FIELDS",
(char *) "CLUST_IND", DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, (char *) "INDEX_ID", 0, 0);
dict_mem_index_add_field(index, (char *) "POS", 0, 0);
dict_mem_index_add_field(index, "INDEX_ID", 0, 0);
dict_mem_index_add_field(index, "POS", 0, 0);
index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr);

View file

@ -1004,12 +1004,12 @@ dict_create_or_check_foreign_constraint_tables(void)
que_t* graph;
ulint error;
trx_t* trx;
char* str;
const char* str;
mutex_enter(&(dict_sys->mutex));
table1 = dict_table_get_low((char *) "SYS_FOREIGN");
table2 = dict_table_get_low((char *) "SYS_FOREIGN_COLS");
table1 = dict_table_get_low("SYS_FOREIGN");
table2 = dict_table_get_low("SYS_FOREIGN_COLS");
if (table1 && table2
&& UT_LIST_GET_LEN(table1->indexes) == 3
@ -1027,20 +1027,20 @@ dict_create_or_check_foreign_constraint_tables(void)
trx = trx_allocate_for_mysql();
trx->op_info = (char *) "creating foreign key sys tables";
trx->op_info = "creating foreign key sys tables";
row_mysql_lock_data_dictionary(trx);
if (table1) {
fprintf(stderr,
"InnoDB: dropping incompletely created SYS_FOREIGN table\n");
row_drop_table_for_mysql((char*)"SYS_FOREIGN", trx, TRUE);
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
}
if (table2) {
fprintf(stderr,
"InnoDB: dropping incompletely created SYS_FOREIGN_COLS table\n");
row_drop_table_for_mysql((char*)"SYS_FOREIGN_COLS", trx, TRUE);
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
}
fprintf(stderr,
@ -1050,7 +1050,7 @@ dict_create_or_check_foreign_constraint_tables(void)
there are 2 secondary indexes on SYS_FOREIGN, and they
are defined just like below */
str = (char *)
str =
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
"BEGIN\n"
"CREATE TABLE\n"
@ -1090,15 +1090,15 @@ dict_create_or_check_foreign_constraint_tables(void)
fprintf(stderr,
"InnoDB: dropping incompletely created SYS_FOREIGN tables\n");
row_drop_table_for_mysql((char*)"SYS_FOREIGN", trx, TRUE);
row_drop_table_for_mysql((char*)"SYS_FOREIGN_COLS", trx, TRUE);
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
error = DB_MUST_GET_MORE_FILE_SPACE;
}
que_graph_free(graph);
trx->op_info = (char *) "";
trx->op_info = "";
row_mysql_unlock_data_dictionary(trx);
@ -1161,7 +1161,7 @@ dict_create_add_foreigns_to_dictionary(
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
if (NULL == dict_table_get_low((char *) "SYS_FOREIGN")) {
if (NULL == dict_table_get_low("SYS_FOREIGN")) {
fprintf(stderr,
"InnoDB: table SYS_FOREIGN not found from internal data dictionary\n");

View file

@ -198,13 +198,14 @@ dict_tables_have_same_db(
/************************************************************************
Return the end of table name where we have removed dbname and '/'. */
static
char*
const char*
dict_remove_db_name(
/*================*/
/* out: table name */
char* name) /* in: table name in the form dbname '/' tablename */
/* out: table name */
const char* name) /* in: table name in the form
dbname '/' tablename */
{
char* s;
const char* s;
s = strchr(name, '/');
ut_a(s);
if (s) s++;
@ -783,23 +784,33 @@ dict_table_add_to_cache(
The clustered index will not always physically contain all
system columns. */
dict_mem_table_add_col(table, (char *) "DB_ROW_ID", DATA_SYS,
dict_mem_table_add_col(table, "DB_ROW_ID", DATA_SYS,
DATA_ROW_ID, 0, 0);
ut_ad(DATA_ROW_ID == 0);
dict_mem_table_add_col(table, (char *) "DB_TRX_ID", DATA_SYS,
#if DATA_ROW_ID != 0
#error "DATA_ROW_ID != 0"
#endif
dict_mem_table_add_col(table, "DB_TRX_ID", DATA_SYS,
DATA_TRX_ID, 0, 0);
ut_ad(DATA_TRX_ID == 1);
dict_mem_table_add_col(table, (char *) "DB_ROLL_PTR", DATA_SYS,
DATA_ROLL_PTR,
0, 0);
ut_ad(DATA_ROLL_PTR == 2);
#if DATA_TRX_ID != 1
#error "DATA_TRX_ID != 1"
#endif
dict_mem_table_add_col(table, "DB_ROLL_PTR", DATA_SYS,
DATA_ROLL_PTR, 0, 0);
#if DATA_ROLL_PTR != 2
#error "DATA_ROLL_PTR != 2"
#endif
dict_mem_table_add_col(table, (char *) "DB_MIX_ID", DATA_SYS,
dict_mem_table_add_col(table, "DB_MIX_ID", DATA_SYS,
DATA_MIX_ID, 0, 0);
ut_ad(DATA_MIX_ID == 3);
ut_ad(DATA_N_SYS_COLS == 4); /* This assert reminds that if a new
system column is added to the program,
it should be dealt with here */
#if DATA_MIX_ID != 3
#error "DATA_MIX_ID != 3"
#endif
/* This check reminds that if a new system column is added to
the program, it should be dealt with here */
#if DATA_N_SYS_COLS != 4
#error "DATA_N_SYS_COLS != 4"
#endif
/* Look for a table with the same name: error if such exists */
{
@ -1107,7 +1118,9 @@ dict_table_change_id_in_cache(
dulint new_id) /* in: new id to set */
{
ut_ad(table);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* Remove the table from the hash table of id's */
@ -1973,7 +1986,7 @@ dict_foreign_find(
/*==============*/
/* out: foreign constraint */
dict_table_t* table, /* in: table object */
char* id) /* in: foreign constraint id */
const char* id) /* in: foreign constraint id */
{
dict_foreign_t* foreign;
@ -2367,7 +2380,7 @@ dict_scan_id(
*id = mem_heap_strdupl(heap, s, len);
} else {
/* no heap given: id will point to source string */
*id = (char*) s;
*id = s;
}
return(ptr);
@ -2750,7 +2763,7 @@ dict_create_foreign_constraints_low(
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
table = dict_table_get_low((char*) name);
table = dict_table_get_low(name);
if (table == NULL) {
mutex_enter(&dict_foreign_err_mutex);
@ -3936,7 +3949,7 @@ Prints a table data when we know the table name. */
void
dict_table_print_by_name(
/*=====================*/
char* name)
const char* name)
{
dict_table_t* table;

View file

@ -51,7 +51,7 @@ dict_get_first_table_name_in_db(
mtr_start(&mtr);
sys_tables = dict_table_get_low((char *) "SYS_TABLES");
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
tuple = dtuple_create(heap, 1);
@ -127,7 +127,7 @@ dict_print(void)
mtr_start(&mtr);
sys_tables = dict_table_get_low((char *) "SYS_TABLES");
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
@ -213,7 +213,7 @@ dict_check_tablespaces_or_store_max_id(
mtr_start(&mtr);
sys_tables = dict_table_get_low((char *) "SYS_TABLES");
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
@ -312,7 +312,7 @@ dict_load_columns(
mtr_start(&mtr);
sys_columns = dict_table_get_low((char*) "SYS_COLUMNS");
sys_columns = dict_table_get_low("SYS_COLUMNS");
sys_index = UT_LIST_GET_FIRST(sys_columns->indexes);
tuple = dtuple_create(heap, 1);
@ -342,7 +342,7 @@ dict_load_columns(
ut_ad(len == 4);
ut_a(i == mach_read_from_4(field));
ut_a(0 == ut_strcmp((char*) "NAME",
ut_a(0 == ut_strcmp("NAME",
dict_field_get_col(
dict_index_get_nth_field(
dict_table_get_first_index(sys_columns), 4))->name));
@ -368,7 +368,7 @@ dict_load_columns(
field = rec_get_nth_field(rec, 7, &len);
col_len = mach_read_from_4(field);
ut_a(0 == ut_strcmp((char*) "PREC",
ut_a(0 == ut_strcmp("PREC",
dict_field_get_col(
dict_index_get_nth_field(
dict_table_get_first_index(sys_columns), 8))->name));
@ -438,7 +438,7 @@ dict_load_fields(
mtr_start(&mtr);
sys_fields = dict_table_get_low((char*) "SYS_FIELDS");
sys_fields = dict_table_get_low("SYS_FIELDS");
sys_index = UT_LIST_GET_FIRST(sys_fields->indexes);
tuple = dtuple_create(heap, 1);
@ -489,7 +489,7 @@ dict_load_fields(
prefix_len = 0;
}
ut_a(0 == ut_strcmp((char*) "COL_NAME",
ut_a(0 == ut_strcmp("COL_NAME",
dict_field_get_col(
dict_index_get_nth_field(
dict_table_get_first_index(sys_fields), 4))->name));
@ -551,7 +551,7 @@ dict_load_indexes(
mtr_start(&mtr);
sys_indexes = dict_table_get_low((char*) "SYS_INDEXES");
sys_indexes = dict_table_get_low("SYS_INDEXES");
sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes);
tuple = dtuple_create(heap, 1);
@ -594,7 +594,7 @@ dict_load_indexes(
ut_ad(len == 8);
id = mach_read_from_8(field);
ut_a(0 == ut_strcmp((char*) "NAME",
ut_a(0 == ut_strcmp("NAME",
dict_field_get_col(
dict_index_get_nth_field(
dict_table_get_first_index(sys_indexes), 4))->name));
@ -611,7 +611,7 @@ dict_load_indexes(
field = rec_get_nth_field(rec, 7, &len);
space = mach_read_from_4(field);
ut_a(0 == ut_strcmp((char*) "PAGE_NO",
ut_a(0 == ut_strcmp("PAGE_NO",
dict_field_get_col(
dict_index_get_nth_field(
dict_table_get_first_index(sys_indexes), 8))->name));
@ -654,7 +654,7 @@ dict_load_indexes(
&& ((type & DICT_CLUSTERED)
|| ((table == dict_sys->sys_tables)
&& (name_len == (sizeof "ID_IND") - 1)
&& (0 == ut_memcmp(name_buf, (char*) "ID_IND",
&& (0 == ut_memcmp(name_buf, "ID_IND",
name_len))))) {
/* The index was created in memory already at booting
@ -721,7 +721,7 @@ dict_load_table(
mtr_start(&mtr);
sys_tables = dict_table_get_low((char *) "SYS_TABLES");
sys_tables = dict_table_get_low("SYS_TABLES");
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
tuple = dtuple_create(heap, 1);
@ -757,7 +757,7 @@ dict_load_table(
return(NULL);
}
ut_a(0 == ut_strcmp((char *) "SPACE",
ut_a(0 == ut_strcmp("SPACE",
dict_field_get_col(
dict_index_get_nth_field(
dict_table_get_first_index(sys_tables), 9))->name));
@ -782,7 +782,7 @@ dict_load_table(
}
}
ut_a(0 == ut_strcmp((char *) "N_COLS",
ut_a(0 == ut_strcmp("N_COLS",
dict_field_get_col(
dict_index_get_nth_field(
dict_table_get_first_index(sys_tables), 4))->name));
@ -794,7 +794,7 @@ dict_load_table(
table->ibd_file_missing = ibd_file_missing;
ut_a(0 == ut_strcmp((char *) "ID",
ut_a(0 == ut_strcmp("ID",
dict_field_get_col(
dict_index_get_nth_field(
dict_table_get_first_index(sys_tables), 3))->name));
@ -983,7 +983,7 @@ static
void
dict_load_foreign_cols(
/*===================*/
char* id, /* in: foreign constraint id as a null-
const char* id, /* in: foreign constraint id as a null-
terminated string */
dict_foreign_t* foreign)/* in: foreign constraint object */
{
@ -1009,7 +1009,7 @@ dict_load_foreign_cols(
foreign->n_fields * sizeof(void*));
mtr_start(&mtr);
sys_foreign_cols = dict_table_get_low((char *) "SYS_FOREIGN_COLS");
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS");
sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes);
tuple = dtuple_create(foreign->heap, 1);
@ -1056,9 +1056,9 @@ static
ulint
dict_load_foreign(
/*==============*/
/* out: DB_SUCCESS or error code */
char* id) /* in: foreign constraint id as a null-terminated
string */
/* out: DB_SUCCESS or error code */
const char* id) /* in: foreign constraint id as a
null-terminated string */
{
dict_foreign_t* foreign;
dict_table_t* sys_foreign;
@ -1081,7 +1081,7 @@ dict_load_foreign(
mtr_start(&mtr);
sys_foreign = dict_table_get_low((char *) "SYS_FOREIGN");
sys_foreign = dict_table_get_low("SYS_FOREIGN");
sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes);
tuple = dtuple_create(heap2, 1);
@ -1207,7 +1207,7 @@ dict_load_foreigns(
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
sys_foreign = dict_table_get_low((char *) "SYS_FOREIGN");
sys_foreign = dict_table_get_low("SYS_FOREIGN");
if (sys_foreign == NULL) {
/* No foreign keys defined yet in this database */

View file

@ -274,7 +274,7 @@ fil_get_space_id_for_table(
/*=======================*/
/* out: space id, ULINT_UNDEFINED if not
found */
char* name); /* in: table name in the standard
const char* name); /* in: table name in the standard
'databasename/tablename' format */
@ -463,8 +463,9 @@ fil_node_open_file(
ulint size_high;
ibool ret;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(node->n_pending == 0);
ut_a(node->open == FALSE);
@ -575,8 +576,9 @@ fil_try_to_close_file_in_LRU(
fil_system_t* system = fil_system;
fil_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
node = UT_LIST_GET_LAST(system->LRU);
if (print_info) {
@ -630,7 +632,9 @@ fil_mutex_enter_and_prepare_for_io(
ulint count = 0;
ulint count2 = 0;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&(system->mutex)));
#endif /* UNIV_SYNC_DEBUG */
retry:
mutex_enter(&(system->mutex));
@ -1311,13 +1315,12 @@ fil_write_lsn_and_arch_no_to_file(
ulint sum_of_sizes, /* in: combined size of previous files in
space, in database pages */
dulint lsn, /* in: lsn to write */
ulint arch_log_no) /* in: archived log number to write */
ulint arch_log_no /* in: archived log number to write */
__attribute__((unused)))
{
byte* buf1;
byte* buf;
UT_NOT_USED(arch_log_no);
buf1 = mem_alloc(2 * UNIV_PAGE_SIZE);
buf = ut_align(buf1, UNIV_PAGE_SIZE);
@ -1396,17 +1399,16 @@ fil_read_flushed_lsn_and_arch_log_no(
os_file_t data_file, /* in: open data file */
ibool one_read_already, /* in: TRUE if min and max parameters
below already contain sensible data */
dulint* min_flushed_lsn, /* in/out: */
#ifdef UNIV_LOG_ARCHIVE
ulint* min_arch_log_no, /* in/out: */
dulint* max_flushed_lsn, /* in/out: */
ulint* max_arch_log_no) /* in/out: */
ulint* max_arch_log_no, /* in/out: */
#endif /* UNIV_LOG_ARCHIVE */
dulint* min_flushed_lsn, /* in/out: */
dulint* max_flushed_lsn) /* in/out: */
{
byte* buf;
byte* buf2;
dulint flushed_lsn;
ulint arch_log_no = 0; /* since InnoDB does not archive
its own logs under MySQL, this
parameter is not relevant */
buf2 = ut_malloc(2 * UNIV_PAGE_SIZE);
/* Align the memory for a possible read from a raw device */
buf = ut_align(buf2, UNIV_PAGE_SIZE);
@ -1420,9 +1422,10 @@ fil_read_flushed_lsn_and_arch_log_no(
if (!one_read_already) {
*min_flushed_lsn = flushed_lsn;
*max_flushed_lsn = flushed_lsn;
#ifdef UNIV_LOG_ARCHIVE
*min_arch_log_no = arch_log_no;
*max_arch_log_no = arch_log_no;
#endif /* UNIV_LOG_ARCHIVE */
return;
}
@ -1432,12 +1435,14 @@ fil_read_flushed_lsn_and_arch_log_no(
if (ut_dulint_cmp(*max_flushed_lsn, flushed_lsn) < 0) {
*max_flushed_lsn = flushed_lsn;
}
#ifdef UNIV_LOG_ARCHIVE
if (*min_arch_log_no > arch_log_no) {
*min_arch_log_no = arch_log_no;
}
if (*max_arch_log_no < arch_log_no) {
*max_arch_log_no = arch_log_no;
}
#endif /* UNIV_LOG_ARCHIVE */
}
/*================ SINGLE-TABLE TABLESPACES ==========================*/
@ -1507,33 +1512,31 @@ fil_decr_pending_ibuf_merges(
mutex_exit(&(system->mutex));
}
/************************************************************
Creates the database directory for a table if it does not exist yet. */
static
void
fil_create_directory_for_tablename(
/*===============================*/
char* name) /* in: name in the standard 'databasename/tablename'
format */
const char* name) /* in: name in the standard
'databasename/tablename' format */
{
char* ptr;
char path[OS_FILE_MAX_PATH];
const char* namend;
char* path;
ulint len;
sprintf(path, "%s/%s", fil_path_to_mysql_datadir, name);
len = strlen(fil_path_to_mysql_datadir);
namend = strchr(name, '/');
ut_a(namend);
path = mem_alloc(len + (namend - name) + 2);
ptr = path + ut_strlen(path);
while (*ptr != '/') {
ptr--;
ut_a(ptr >= path);
}
*ptr = '\0';
memcpy(path, fil_path_to_mysql_datadir, len);
path[len] = '/';
memcpy(path + len + 1, name, namend - name);
path[len + (namend - name) + 1] = 0;
srv_normalize_path_for_win(path);
ut_a(os_file_create_directory(path, FALSE));
mem_free(path);
}
#ifndef UNIV_HOTBACKUP
@ -1615,10 +1618,10 @@ fil_op_log_parse_or_replay(
the tablespace in question; otherwise
ignored */
{
ulint name_len;
ulint new_name_len;
char* name;
char* new_name = NULL;
ulint name_len;
ulint new_name_len;
const char* name;
const char* new_name = NULL;
if (end_ptr < ptr + 2) {
@ -1634,7 +1637,7 @@ fil_op_log_parse_or_replay(
return(NULL);
}
name = (char*) ptr;
name = (const char*) ptr;
ptr += name_len;
@ -1653,7 +1656,7 @@ fil_op_log_parse_or_replay(
return(NULL);
}
new_name = (char*) ptr;
new_name = (const char*) ptr;
ptr += new_name_len;
}
@ -1916,11 +1919,11 @@ fil_rename_tablespace_in_mem(
/* out: TRUE if success */
fil_space_t* space, /* in: tablespace memory object */
fil_node_t* node, /* in: file node of that tablespace */
char* path) /* in: new name */
const char* path) /* in: new name */
{
fil_system_t* system = fil_system;
fil_space_t* space2;
char* old_name = space->name;
const char* old_name = space->name;
HASH_SEARCH(name_hash, system->name_hash, ut_fold_string(old_name),
space2, 0 == strcmp(old_name, space2->name));
@ -1945,11 +1948,8 @@ fil_rename_tablespace_in_mem(
mem_free(space->name);
mem_free(node->name);
space->name = mem_alloc(strlen(path) + 1);
node->name = mem_alloc(strlen(path) + 1);
strcpy(space->name, path);
strcpy(node->name, path);
space->name = mem_strdup(path);
node->name = mem_strdup(path);
HASH_INSERT(fil_space_t, name_hash, system->name_hash,
ut_fold_string(path), space);
@ -1985,7 +1985,7 @@ fil_rename_tablespace(
ut_a(id != 0);
if (old_name == NULL) {
old_name = (char*)"(name not specified)";
old_name = "(name not specified)";
old_name_was_specified = FALSE;
}
retry:
@ -2532,9 +2532,9 @@ static
void
fil_load_single_table_tablespace(
/*=============================*/
char* dbname, /* in: database name */
char* filename) /* in: file name (not a path), including the
.ibd extension */
const char* dbname, /* in: database name */
const char* filename) /* in: file name (not a path),
including the .ibd extension */
{
os_file_t file;
char* filepath;
@ -2732,7 +2732,7 @@ fil_load_single_table_tablespaces(void)
/* The datadir of MySQL is always the default directory of mysqld */
dir = os_file_opendir((char*) fil_path_to_mysql_datadir, TRUE);
dir = os_file_opendir(fil_path_to_mysql_datadir, TRUE);
if (dir == NULL) {
@ -2744,7 +2744,7 @@ fil_load_single_table_tablespaces(void)
/* Scan all directories under the datadir. They are the database
directories of MySQL. */
ret = os_file_readdir_next_file((char*) fil_path_to_mysql_datadir, dir,
ret = os_file_readdir_next_file(fil_path_to_mysql_datadir, dir,
&dbinfo);
while (ret == 0) {
/* printf("Looking at %s in datadir\n", dbinfo.name); */
@ -2805,7 +2805,7 @@ next_file_item:
}
next_datadir_item:
ret = os_file_readdir_next_file((char*) fil_path_to_mysql_datadir,
ret = os_file_readdir_next_file(fil_path_to_mysql_datadir,
dir, &dbinfo);
}
@ -3066,7 +3066,7 @@ fil_get_space_id_for_table(
/*=======================*/
/* out: space id, ULINT_UNDEFINED if not
found */
char* name) /* in: table name in the standard
const char* name) /* in: table name in the standard
'databasename/tablename' format */
{
fil_system_t* system = fil_system;

View file

@ -211,7 +211,9 @@ ha_search_and_update_if_found(
{
ha_node_t* node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
node = ha_search_with_data(table, fold, data);

View file

@ -530,18 +530,18 @@ ibuf_data_init_for_space(
table = dict_mem_table_create(buf, space, 2);
dict_mem_table_add_col(table,(char *) "PAGE_NO", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table,(char *) "TYPES", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "PAGE_NO", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "TYPES", DATA_BINARY, 0, 0, 0);
table->id = ut_dulint_add(DICT_IBUF_ID_MIN, space);
dict_table_add_to_cache(table);
index = dict_mem_index_create(buf, (char *) "CLUST_IND", space,
index = dict_mem_index_create(buf, "CLUST_IND", space,
DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,2);
dict_mem_index_add_field(index, (char *) "PAGE_NO", 0, 0);
dict_mem_index_add_field(index, (char *) "TYPES", 0, 0);
dict_mem_index_add_field(index, "PAGE_NO", 0, 0);
dict_mem_index_add_field(index, "TYPES", 0, 0);
index->page_no = FSP_IBUF_TREE_ROOT_PAGE_NO;

View file

@ -508,7 +508,7 @@ void
buf_block_buf_fix_inc_debug(
/*========================*/
buf_block_t* block, /* in: block to bufferfix */
char* file __attribute__ ((unused)), /* in: file name */
const char* file __attribute__ ((unused)), /* in: file name */
ulint line __attribute__ ((unused))) /* in: line */
{
#ifdef UNIV_SYNC_DEBUG

View file

@ -248,10 +248,12 @@ fil_read_flushed_lsn_and_arch_log_no(
os_file_t data_file, /* in: open data file */
ibool one_read_already, /* in: TRUE if min and max parameters
below already contain sensible data */
dulint* min_flushed_lsn, /* in/out: */
#ifdef UNIV_LOG_ARCHIVE
ulint* min_arch_log_no, /* in/out: */
dulint* max_flushed_lsn, /* in/out: */
ulint* max_arch_log_no); /* in/out: */
ulint* max_arch_log_no, /* in/out: */
#endif /* UNIV_LOG_ARCHIVE */
dulint* min_flushed_lsn, /* in/out: */
dulint* max_flushed_lsn); /* in/out: */
/***********************************************************************
Increments the count of pending insert buffer page merges, if space is not
being deleted. */

View file

@ -15,7 +15,9 @@ Created 9/20/1997 Heikki Tuuri
#include "hash0hash.h"
#include "log0log.h"
#ifdef UNIV_HOTBACKUP
extern ibool recv_replay_file_ops;
#endif /* UNIV_HOTBACKUP */
/***********************************************************************
Reads the checkpoint info needed in hot backup. */
@ -134,20 +136,25 @@ recv_reset_logs(
dulint lsn, /* in: reset to this lsn rounded up to
be divisible by OS_FILE_LOG_BLOCK_SIZE,
after which we add LOG_BLOCK_HDR_SIZE */
#ifdef UNIV_LOG_ARCHIVE
ulint arch_log_no, /* in: next archived log file number */
#endif /* UNIV_LOG_ARCHIVE */
ibool new_logs_created);/* in: TRUE if resetting logs is done
at the log creation; FALSE if it is done
after archive recovery */
#ifdef UNIV_HOTBACKUP
/**********************************************************
Creates new log files after a backup has been restored. */
void
recv_reset_log_files_for_backup(
/*============================*/
char* log_dir, /* in: log file directory path */
ulint n_log_files, /* in: number of log files */
ulint log_file_size, /* in: log file size */
dulint lsn); /* in: new start lsn */
const char* log_dir, /* in: log file directory path */
ulint n_log_files, /* in: number of log files */
ulint log_file_size, /* in: log file size */
dulint lsn); /* in: new start lsn, must be
divisible by OS_FILE_LOG_BLOCK_SIZE */
#endif /* UNIV_HOTBACKUP */
/************************************************************
Creates the recovery system. */
@ -185,6 +192,7 @@ void
recv_apply_log_recs_for_backup(void);
/*================================*/
#endif
#ifdef UNIV_LOG_ARCHIVE
/************************************************************
Recovers from archived log files, and also from log files, if they exist. */
@ -205,6 +213,7 @@ Completes recovery from archive. */
void
recv_recovery_from_archive_finish(void);
/*===================================*/
#endif /* UNIV_LOG_ARCHIVE */
/***********************************************************************
Checks that a replica of a space is identical to the original space. */
@ -333,7 +342,9 @@ extern ibool recv_no_ibuf_operations;
extern ibool recv_needed_recovery;
extern ibool recv_lsn_checks_on;
#ifdef UNIV_HOTBACKUP
extern ibool recv_is_making_a_backup;
#endif /* UNIV_HOTBACKUP */
extern ulint recv_max_parsed_page_no;
/* Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many

View file

@ -54,7 +54,7 @@ void
mem_hash_insert(
/*============*/
mem_heap_t* heap, /* in: the created heap */
char* file_name, /* in: file name of creation */
const char* file_name, /* in: file name of creation */
ulint line); /* in: line where created */
#ifdef UNIV_MEM_DEBUG
/*******************************************************************
@ -70,7 +70,7 @@ void
mem_hash_remove(
/*============*/
mem_heap_t* heap, /* in: the heap to be freed */
char* file_name, /* in: file name of freeing */
const char* file_name, /* in: file name of freeing */
ulint line); /* in: line where freed */
#endif /* UNIV_MEM_DEBUG */

View file

@ -16,10 +16,7 @@ Created 10/10/1995 Heikki Tuuri
#include "que0types.h"
#include "trx0types.h"
extern char* srv_main_thread_op_info;
/* Buffer which can be used in printing fatal error messages */
extern char srv_fatal_errbuf[];
extern const char* srv_main_thread_op_info;
/* When this event is set the lock timeout and InnoDB monitor
thread starts running */
@ -40,7 +37,9 @@ extern FILE* srv_monitor_file;
/* Server parameters which are read from the initfile */
extern char* srv_data_home;
#ifdef UNIV_LOG_ARCHIVE
extern char* srv_arch_dir;
#endif /* UNIV_LOG_ARCHIVE */
extern ibool srv_file_per_table;
@ -62,7 +61,6 @@ extern char** srv_log_group_home_dirs;
extern ulint srv_n_log_groups;
extern ulint srv_n_log_files;
extern ulint srv_log_file_size;
extern ibool srv_log_archive_on;
extern ulint srv_log_buffer_size;
extern ulint srv_flush_log_at_trx_commit;
@ -75,8 +73,11 @@ extern ulint srv_lock_table_size;
extern ulint srv_n_file_io_threads;
#ifdef UNIV_LOG_ARCHIVE
extern ibool srv_log_archive_on;
extern ibool srv_archive_recovery;
extern dulint srv_archive_recovery_limit_lsn;
#endif /* UNIV_LOG_ARCHIVE */
extern ulint srv_lock_wait_timeout;

View file

@ -30,7 +30,7 @@ rw_lock_add_debug_info(
rw_lock_t* lock, /* in: rw-lock */
ulint pass, /* in: pass value */
ulint lock_type, /* in: lock type */
char* file_name, /* in: file where requested */
const char* file_name, /* in: file where requested */
ulint line); /* in: line where requested */
/**********************************************************************
Removes a debug information struct for an rw-lock. */

View file

@ -33,7 +33,7 @@ void
mutex_set_debug_info(
/*=================*/
mutex_t* mutex, /* in: mutex */
char* file_name, /* in: file where requested */
const char* file_name, /* in: file where requested */
ulint line); /* in: line where requested */
#endif /* UNIV_SYNC_DEBUG */
/**********************************************************************

View file

@ -41,9 +41,11 @@ old */
ibool log_has_printed_chkp_warning = FALSE;
time_t log_last_warning_time;
#ifdef UNIV_LOG_ARCHIVE
/* Pointer to this variable is used as the i/o-message when we do i/o to an
archive */
byte log_archive_io;
#endif /* UNIV_LOG_ARCHIVE */
/* A margin for free space in the log buffer before a log entry is catenated */
#define LOG_BUF_WRITE_MARGIN (4 * OS_FILE_LOG_BLOCK_SIZE)
@ -90,12 +92,14 @@ static
void
log_io_complete_checkpoint(void);
/*============================*/
#ifdef UNIV_LOG_ARCHIVE
/**********************************************************
Completes an archiving i/o. */
static
void
log_io_complete_archive(void);
/*=========================*/
#endif /* UNIV_LOG_ARCHIVE */
/********************************************************************
Sets the global variable log_fsp_current_free_limit. Also makes a checkpoint,
@ -160,9 +164,13 @@ log_reserve_and_open(
{
log_t* log = log_sys;
ulint len_upper_limit;
#ifdef UNIV_LOG_ARCHIVE
ulint archived_lsn_age;
ulint count = 0;
ulint dummy;
#endif /* UNIV_LOG_ARCHIVE */
#ifdef UNIV_DEBUG
ulint count = 0;
#endif /* UNIV_DEBUG */
ut_a(len < log->buf_size / 2);
loop:
@ -182,13 +190,12 @@ loop:
log_buffer_flush_to_disk();
count++;
ut_ad(count < 50);
ut_ad(++count < 50);
goto loop;
}
#ifdef UNIV_LOG_ARCHIVE
if (log->archiving_state != LOG_ARCH_OFF) {
archived_lsn_age = ut_dulint_minus(log->lsn,
@ -204,13 +211,12 @@ loop:
log_archive_do(TRUE, &dummy);
count++;
ut_ad(count < 50);
ut_ad(++count < 50);
goto loop;
}
}
#endif /* UNIV_LOG_ARCHIVE */
#ifdef UNIV_LOG_DEBUG
log->old_buf_free = log->buf_free;
@ -378,6 +384,7 @@ function_exit:
return(lsn);
}
#ifdef UNIV_LOG_ARCHIVE
/**********************************************************
Pads the current log block full with dummy log records. Used in producing
consistent archived log files. */
@ -410,6 +417,7 @@ log_pad_current_log_block(void)
ut_a((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
== LOG_BLOCK_HDR_SIZE);
}
#endif /* UNIV_LOG_ARCHIVE */
/**********************************************************
Calculates the data capacity of a log group, when the log file headers are not
@ -663,11 +671,13 @@ log_calc_max_ages(void)
/ LOG_POOL_CHECKPOINT_RATIO_ASYNC;
log_sys->max_checkpoint_age = margin;
#ifdef UNIV_LOG_ARCHIVE
log_sys->max_archived_lsn_age = smallest_archive_margin;
log_sys->max_archived_lsn_age_async = smallest_archive_margin
- smallest_archive_margin /
LOG_ARCHIVE_RATIO_ASYNC;
#endif /* UNIV_LOG_ARCHIVE */
failure:
mutex_exit(&(log_sys->mutex));
@ -767,6 +777,7 @@ log_init(void)
memset(log_sys->checkpoint_buf, '\0', OS_FILE_LOG_BLOCK_SIZE);
/*----------------------------*/
#ifdef UNIV_LOG_ARCHIVE
/* Under MySQL, log archiving is always off */
log_sys->archiving_state = LOG_ARCH_OFF;
log_sys->archived_lsn = log_sys->lsn;
@ -788,6 +799,7 @@ log_init(void)
/* memset(log_sys->archive_buf, '\0', LOG_ARCHIVE_BUF_SIZE); */
log_sys->archiving_on = os_event_create(NULL);
#endif /* UNIV_LOG_ARCHIVE */
/*----------------------------*/
@ -823,7 +835,8 @@ log_group_init(
ulint space_id, /* in: space id of the file space
which contains the log files of this
group */
ulint archive_space_id) /* in: space id of the file space
ulint archive_space_id __attribute__((unused)))
/* in: space id of the file space
which contains some archived log
files for this group; currently, only
for the first log group this is
@ -845,7 +858,9 @@ log_group_init(
group->n_pending_writes = 0;
group->file_header_bufs = mem_alloc(sizeof(byte*) * n_files);
#ifdef UNIV_LOG_ARCHIVE
group->archive_file_header_bufs = mem_alloc(sizeof(byte*) * n_files);
#endif /* UNIV_LOG_ARCHIVE */
for (i = 0; i < n_files; i++) {
*(group->file_header_bufs + i) = ut_align(
@ -855,17 +870,21 @@ log_group_init(
memset(*(group->file_header_bufs + i), '\0',
LOG_FILE_HDR_SIZE);
#ifdef UNIV_LOG_ARCHIVE
*(group->archive_file_header_bufs + i) = ut_align(
mem_alloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE),
OS_FILE_LOG_BLOCK_SIZE);
memset(*(group->archive_file_header_bufs + i), '\0',
LOG_FILE_HDR_SIZE);
#endif /* UNIV_LOG_ARCHIVE */
}
#ifdef UNIV_LOG_ARCHIVE
group->archive_space_id = archive_space_id;
group->archived_file_no = 0;
group->archived_offset = 0;
#endif /* UNIV_LOG_ARCHIVE */
group->checkpoint_buf = ut_align(
mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE),
@ -1002,6 +1021,7 @@ log_io_complete(
{
ulint unlock;
#ifdef UNIV_LOG_ARCHIVE
if ((byte*)group == &log_archive_io) {
/* It was an archive write */
@ -1009,6 +1029,7 @@ log_io_complete(
return;
}
#endif /* UNIV_LOG_ARCHIVE */
if ((ulint)group & 0x1UL) {
/* It was a checkpoint write */
@ -1189,7 +1210,7 @@ loop:
(ulong) group->id, (ulong) next_offset,
(ulong) write_len,
(ulong) ut_dulint_get_high(start_lsn),
(ulong) ut_dulint_get_low(start_lsn).
(ulong) ut_dulint_get_low(start_lsn),
(ulong) log_block_get_hdr_no(buf),
(ulong) log_block_get_hdr_no(
buf + write_len - OS_FILE_LOG_BLOCK_SIZE));
@ -1629,8 +1650,10 @@ log_group_checkpoint(
log_group_t* group) /* in: log group */
{
log_group_t* group2;
#ifdef UNIV_LOG_ARCHIVE
dulint archived_lsn;
dulint next_archived_lsn;
#endif /* UNIV_LOG_ARCHIVE */
ulint write_offset;
ulint fold;
byte* buf;
@ -1653,6 +1676,7 @@ log_group_checkpoint(
mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size);
#ifdef UNIV_LOG_ARCHIVE
if (log_sys->archiving_state == LOG_ARCH_OFF) {
archived_lsn = ut_dulint_max;
} else {
@ -1664,8 +1688,11 @@ log_group_checkpoint(
/* For debugging only */
}
}
mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, archived_lsn);
#else /* UNIV_LOG_ARCHIVE */
mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, ut_dulint_max);
#endif /* UNIV_LOG_ARCHIVE */
for (i = 0; i < LOG_MAX_N_GROUPS; i++) {
log_checkpoint_set_nth_group_info(buf, i, 0, 0);
@ -1675,8 +1702,13 @@ log_group_checkpoint(
while (group2) {
log_checkpoint_set_nth_group_info(buf, group2->id,
#ifdef UNIV_LOG_ARCHIVE
group2->archived_file_no,
group2->archived_offset);
group2->archived_offset
#else /* UNIV_LOG_ARCHIVE */
0, 0
#endif /* UNIV_LOG_ARCHIVE */
);
group2 = UT_LIST_GET_NEXT(log_groups, group2);
}
@ -2102,16 +2134,18 @@ loop:
len = group->file_size - (source_offset % group->file_size);
}
#ifdef UNIV_LOG_ARCHIVE
if (type == LOG_ARCHIVE) {
log_sys->n_pending_archive_ios++;
}
#endif /* UNIV_LOG_ARCHIVE */
log_sys->n_log_ios++;
fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id,
source_offset / UNIV_PAGE_SIZE, source_offset % UNIV_PAGE_SIZE,
len, buf, &log_archive_io);
len, buf, NULL);
start_lsn = ut_dulint_add(start_lsn, len);
buf += len;
@ -2122,6 +2156,7 @@ loop:
}
}
#ifdef UNIV_LOG_ARCHIVE
/**********************************************************
Generates an archived log file name. */
@ -2134,8 +2169,6 @@ log_archived_file_name_gen(
currently we only archive the first group */
ulint file_no)/* in: file number */
{
ut_a(0);
sprintf(buf, "%sib_arch_log_%010lu", srv_arch_dir, (ulong) file_no);
}
@ -2156,8 +2189,6 @@ log_group_archive_file_header_write(
ulint dest_offset;
#ifdef UNIV_SYNC_DEBUG
ut_a(0);
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
@ -2197,8 +2228,6 @@ log_group_archive_completed_header_write(
ulint dest_offset;
#ifdef UNIV_SYNC_DEBUG
ut_a(0);
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
ut_a(nth_file < group->n_files);
@ -2240,8 +2269,6 @@ log_group_archive(
ulint open_mode;
#ifdef UNIV_SYNC_DEBUG
ut_a(0);
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
@ -2372,8 +2399,6 @@ log_archive_groups(void)
log_group_t* group;
#ifdef UNIV_SYNC_DEBUG
ut_a(0);
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
@ -2399,8 +2424,6 @@ log_archive_write_complete_groups(void)
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_a(0);
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
@ -2470,8 +2493,6 @@ log_archive_check_completion_low(void)
/*==================================*/
{
#ifdef UNIV_SYNC_DEBUG
ut_a(0);
ut_ad(mutex_own(&(log_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
@ -2511,8 +2532,6 @@ log_io_complete_archive(void)
{
log_group_t* group;
ut_a(0);
mutex_enter(&(log_sys->mutex));
group = UT_LIST_GET_FIRST(log_sys->log_groups);
@ -2548,8 +2567,6 @@ log_archive_do(
dulint start_lsn;
dulint limit_lsn;
ut_a(0);
calc_new_limit = TRUE;
loop:
mutex_enter(&(log_sys->mutex));
@ -2678,8 +2695,6 @@ log_archive_all(void)
return;
}
ut_a(0);
present_lsn = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
@ -2724,8 +2739,6 @@ log_archive_close_groups(
return;
}
ut_a(0);
group = UT_LIST_GET_FIRST(log_sys->log_groups);
trunc_len = UNIV_PAGE_SIZE
@ -2770,8 +2783,6 @@ log_archive_stop(void)
{
ibool success;
ut_a(0);
mutex_enter(&(log_sys->mutex));
if (log_sys->archiving_state != LOG_ARCH_ON) {
@ -2834,8 +2845,6 @@ log_archive_start(void)
/*===================*/
/* out: DB_SUCCESS or DB_ERROR */
{
ut_a(0);
mutex_enter(&(log_sys->mutex));
if (log_sys->archiving_state != LOG_ARCH_STOPPED) {
@ -2862,7 +2871,6 @@ log_archive_noarchivelog(void)
/*==========================*/
/* out: DB_SUCCESS or DB_ERROR */
{
ut_a(0);
loop:
mutex_enter(&(log_sys->mutex));
@ -2895,7 +2903,6 @@ log_archive_archivelog(void)
/*========================*/
/* out: DB_SUCCESS or DB_ERROR */
{
ut_a(0);
mutex_enter(&(log_sys->mutex));
if (log_sys->archiving_state == LOG_ARCH_OFF) {
@ -2914,7 +2921,6 @@ log_archive_archivelog(void)
return(DB_ERROR);
}
#ifdef notdefined
/********************************************************************
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
@ -2968,7 +2974,7 @@ loop:
goto loop;
}
}
#endif
#endif /* UNIV_LOG_ARCHIVE */
/************************************************************************
Checks that there is enough free space in the log to start a new query step.
@ -2985,7 +2991,9 @@ loop:
log_checkpoint_margin();
/* log_archive_margin(); */
#ifdef UNIV_LOG_ARCHIVE
log_archive_margin();
#endif /* UNIV_LOG_ARCHIVE */
mutex_enter(&(log_sys->mutex));
@ -3047,9 +3055,12 @@ loop:
mutex_enter(&(log_sys->mutex));
if (log_sys->n_pending_archive_ios
+ log_sys->n_pending_checkpoint_writes
+ log_sys->n_pending_writes > 0) {
if (
#ifdef UNIV_LOG_ARCHIVE
log_sys->n_pending_archive_ios ||
#endif /* UNIV_LOG_ARCHIVE */
log_sys->n_pending_checkpoint_writes ||
log_sys->n_pending_writes) {
mutex_exit(&(log_sys->mutex));
@ -3063,7 +3074,9 @@ loop:
goto loop;
}
/* log_archive_all(); */
#ifdef UNIV_LOG_ARCHIVE
log_archive_all();
#endif /* UNIV_LOG_ARCHIVE */
log_make_checkpoint_at(ut_dulint_max, TRUE);
mutex_enter(&(log_sys->mutex));
@ -3071,10 +3084,13 @@ loop:
lsn = log_sys->lsn;
if (ut_dulint_cmp(lsn, log_sys->last_checkpoint_lsn) != 0
#ifdef UNIV_LOG_ARCHIVE
|| (srv_log_archive_on
&& ut_dulint_cmp(lsn,
ut_dulint_add(log_sys->archived_lsn, LOG_BLOCK_HDR_SIZE))
!= 0)) {
!= 0)
#endif /* UNIV_LOG_ARCHIVE */
) {
mutex_exit(&(log_sys->mutex));
@ -3082,15 +3098,17 @@ loop:
}
arch_log_no = 0;
/*
UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no;
#ifdef UNIV_LOG_ARCHIVE
UT_LIST_GET_FIRST(log_sys->log_groups)->archived_file_no;
if (0 == UT_LIST_GET_FIRST(log_sys->log_groups)->archived_offset) {
arch_log_no--;
}
*/
/* log_archive_close_groups(TRUE); */
log_archive_close_groups(TRUE);
#endif /* UNIV_LOG_ARCHIVE */
mutex_exit(&(log_sys->mutex));
@ -3228,8 +3246,7 @@ log_peek_lsn(
log system mutex */
dulint* lsn) /* out: if returns TRUE, current lsn is here */
{
if (0 == mutex_enter_nowait(&(log_sys->mutex), (char*)__FILE__,
__LINE__)) {
if (0 == mutex_enter_nowait(&(log_sys->mutex), __FILE__, __LINE__)) {
*lsn = log_sys->lsn;
mutex_exit(&(log_sys->mutex));

View file

@ -34,10 +34,12 @@ Created 9/20/1997 Heikki Tuuri
#include "dict0boot.h"
#include "fil0fil.h"
#ifdef UNIV_HOTBACKUP
/* This is set to FALSE if the backup was originally taken with the
ibbackup --include regexp option: then we do not want to create tables in
directories which were not included */
ibool recv_replay_file_ops = TRUE;
#endif /* UNIV_HOTBACKUP */
/* Log records are stored in the hash table in chunks at most of this size;
this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
@ -71,7 +73,11 @@ log scan */
ulint recv_scan_print_counter = 0;
ibool recv_is_from_backup = FALSE;
#ifdef UNIV_HOTBACKUP
ibool recv_is_making_a_backup = FALSE;
#else
# define recv_is_making_a_backup FALSE
#endif /* UNIV_HOTBACKUP */
ulint recv_previous_parsed_rec_type = 999999;
ulint recv_previous_parsed_rec_offset = 0;
@ -1516,9 +1522,9 @@ skip_this_recv_addr:
recv_sys_empty_hash();
}
#endif
#endif /* UNIV_HOTBACKUP */
#ifdef notdefined
#ifdef UNIV_LOG_REPLICATE
/***********************************************************************
In the debug version, updates the replica of a file page, based on a log
record. */
@ -1718,7 +1724,7 @@ recv_compare_spaces_low(
recv_compare_spaces(space1, space2, n_pages);
}
#endif
#endif /* UNIV_LOG_REPLICATE */
/***********************************************************************
Tries to parse a single log record and returns its length. */
@ -2018,11 +2024,13 @@ loop:
becomes identical with the original page */
#ifdef UNIV_LOG_DEBUG
recv_check_incomplete_log_recs(ptr, len);
#endif
/* recv_update_replicate(type, space, page_no, body,
#endif/* UNIV_LOG_DEBUG */
#ifdef UNIV_LOG_REPLICATE
recv_update_replicate(type, space, page_no, body,
ptr + len);
recv_compare_replicate(space, page_no);
*/
#endif /* UNIV_LOG_REPLICATE */
}
} else {
/* Check that all the records associated with the single mtr
@ -2055,11 +2063,11 @@ loop:
according to the log record */
#ifdef UNIV_LOG_DEBUG
recv_check_incomplete_log_recs(ptr, len);
#endif
/*
#endif /* UNIV_LOG_DEBUG */
#ifdef UNIV_LOG_REPLICATE
recv_update_replicate(type, space, page_no,
body, ptr + len);
*/
#endif /* UNIV_LOG_REPLICATE */
}
#ifdef UNIV_LOG_DEBUG
@ -2127,12 +2135,13 @@ loop:
recv_add_to_hash_table(type, space, page_no,
body, ptr + len, old_lsn,
new_recovered_lsn);
#ifdef UNIV_LOG_REPLICATE
} else {
/* In debug checking, check that the replicate
page has become identical with the original
page */
/* recv_compare_replicate(space, page_no); */
recv_compare_replicate(space, page_no);
#endif /* UNIV_LOG_REPLICATE */
}
ptr += len;
@ -2576,15 +2585,16 @@ recv_recovery_from_checkpoint_start(
/* Wipe over the label now */
ut_memcpy(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
(char*)" ", 4);
memset(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
' ', 4);
/* Write to the log file to wipe over the label */
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE,
max_cp_group->space_id,
0, 0, OS_FILE_LOG_BLOCK_SIZE,
log_hdr_buf, max_cp_group);
}
#ifdef UNIV_LOG_ARCHIVE
group = UT_LIST_GET_FIRST(log_sys->log_groups);
while (group) {
@ -2594,6 +2604,7 @@ recv_recovery_from_checkpoint_start(
group = UT_LIST_GET_NEXT(log_groups, group);
}
#endif /* UNIV_LOG_ARCHIVE */
if (type == LOG_CHECKPOINT) {
/* Start reading the log groups from the checkpoint lsn up. The
@ -2789,7 +2800,9 @@ recv_recovery_from_checkpoint_start(
log_sys->next_checkpoint_lsn = checkpoint_lsn;
log_sys->next_checkpoint_no = ut_dulint_add(checkpoint_no, 1);
#ifdef UNIV_LOG_ARCHIVE
log_sys->archived_lsn = archived_lsn;
#endif /* UNIV_LOG_ARCHIVE */
recv_synchronize_groups(up_to_date_group);
@ -2822,10 +2835,12 @@ recv_recovery_from_checkpoint_start(
log_sys->next_checkpoint_no = ut_dulint_add(checkpoint_no, 1);
#ifdef UNIV_LOG_ARCHIVE
if (ut_dulint_cmp(archived_lsn, ut_dulint_max) == 0) {
log_sys->archiving_state = LOG_ARCH_OFF;
}
#endif /* UNIV_LOG_ARCHIVE */
mutex_enter(&(recv_sys->mutex));
@ -2904,7 +2919,9 @@ recv_reset_logs(
dulint lsn, /* in: reset to this lsn rounded up to
be divisible by OS_FILE_LOG_BLOCK_SIZE,
after which we add LOG_BLOCK_HDR_SIZE */
#ifdef UNIV_LOG_ARCHIVE
ulint arch_log_no, /* in: next archived log file number */
#endif /* UNIV_LOG_ARCHIVE */
ibool new_logs_created)/* in: TRUE if resetting logs is done
at the log creation; FALSE if it is done
after archive recovery */
@ -2921,9 +2938,10 @@ recv_reset_logs(
while (group) {
group->lsn = log_sys->lsn;
group->lsn_offset = LOG_FILE_HDR_SIZE;
#ifdef UNIV_LOG_ARCHIVE
group->archived_file_no = arch_log_no;
group->archived_offset = 0;
#endif /* UNIV_LOG_ARCHIVE */
if (!new_logs_created) {
recv_truncate_group(group, group->lsn, group->lsn,
@ -2940,7 +2958,9 @@ recv_reset_logs(
log_sys->next_checkpoint_no = ut_dulint_zero;
log_sys->last_checkpoint_lsn = ut_dulint_zero;
#ifdef UNIV_LOG_ARCHIVE
log_sys->archived_lsn = log_sys->lsn;
#endif /* UNIV_LOG_ARCHIVE */
log_block_init(log_sys->buf, log_sys->lsn);
log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE);
@ -2958,17 +2978,18 @@ recv_reset_logs(
mutex_enter(&(log_sys->mutex));
}
#ifdef UNIV_HOTBACKUP
/**********************************************************
Creates new log files after a backup has been restored. */
void
recv_reset_log_files_for_backup(
/*============================*/
char* log_dir, /* in: log file directory path */
ulint n_log_files, /* in: number of log files */
ulint log_file_size, /* in: log file size */
dulint lsn) /* in: new start lsn, must be divisible by
OS_FILE_LOG_BLOCK_SIZE */
const char* log_dir, /* in: log file directory path */
ulint n_log_files, /* in: number of log files */
ulint log_file_size, /* in: log file size */
dulint lsn) /* in: new start lsn, must be
divisible by OS_FILE_LOG_BLOCK_SIZE */
{
os_file_t log_file;
ibool success;
@ -2976,8 +2997,8 @@ recv_reset_log_files_for_backup(
ulint i;
ulint log_dir_len;
char* name;
static
char logfilename[] = "ib_logfile";
static const
char logfilename[] = "ib_logfile";
log_dir_len = strlen(log_dir);
/* reserve space for log_dir, "ib_logfile" and a number */
@ -3047,7 +3068,9 @@ recv_reset_log_files_for_backup(
mem_free(name);
ut_free(buf);
}
#endif /* UNIV_HOTBACKUP */
#ifdef UNIV_LOG_ARCHIVE
/**********************************************************
Reads from the archive of a log group and performs recovery. */
static
@ -3353,9 +3376,8 @@ void
recv_recovery_from_archive_finish(void)
/*===================================*/
{
ut_a(0);
recv_recovery_from_checkpoint_finish();
recv_recovery_from_backup_on = FALSE;
}
#endif /* UNIV_LOG_ARCHIVE */

View file

@ -33,7 +33,7 @@ struct mem_hash_node_struct {
UT_LIST_NODE_T(mem_hash_node_t)
list; /* hash list node */
mem_heap_t* heap; /* memory heap */
char* file_name;/* file where heap was created*/
const char* file_name;/* file where heap was created*/
ulint line; /* file line of creation */
ulint nth_heap;/* this is the nth heap created */
UT_LIST_NODE_T(mem_hash_node_t)
@ -266,7 +266,7 @@ void
mem_hash_insert(
/*============*/
mem_heap_t* heap, /* in: the created heap */
char* file_name, /* in: file name of creation */
const char* file_name, /* in: file name of creation */
ulint line) /* in: line where created */
{
mem_hash_node_t* new_node;
@ -309,7 +309,7 @@ void
mem_hash_remove(
/*============*/
mem_heap_t* heap, /* in: the heap to be freed */
char* file_name, /* in: file name of freeing */
const char* file_name, /* in: file name of freeing */
ulint line) /* in: line where freed */
{
mem_hash_node_t* node;

View file

@ -201,6 +201,7 @@ os_thread_exit(
#endif
}
#ifdef HAVE_PTHREAD_JOIN
int
os_thread_join(
/*=============*/
@ -208,6 +209,7 @@ os_thread_join(
{
return pthread_join(thread_id, NULL);
}
#endif
/*********************************************************************
Returns handle to the current thread. */

View file

@ -325,7 +325,7 @@ page_create(
tuple = dtuple_create(heap, 1);
field = dtuple_get_nth_field(tuple, 0);
dfield_set_data(field,(char *) "infimum", strlen("infimum") + 1);
dfield_set_data(field, "infimum", sizeof "infimum");
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 20, 0);
/* Set the corresponding physical record to its place in the page
@ -347,7 +347,7 @@ page_create(
tuple = dtuple_create(heap, 1);
field = dtuple_get_nth_field(tuple, 0);
dfield_set_data(field, (char *) "supremum", strlen("supremum") + 1);
dfield_set_data(field, "supremum", sizeof "supremum");
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 20, 0);
supremum_rec = rec_convert_dtuple_to_rec(heap_top, tuple);

View file

@ -530,7 +530,7 @@ pars_retrieve_table_def(
/*====================*/
sym_node_t* sym_node) /* in: table node */
{
char* table_name;
const char* table_name;
ut_a(sym_node);
ut_a(que_node_get_type(sym_node) == QUE_NODE_SYMBOL);
@ -538,7 +538,7 @@ pars_retrieve_table_def(
sym_node->resolved = TRUE;
sym_node->token_type = SYM_TABLE;
table_name = (char*) sym_node->name;
table_name = (const char*) sym_node->name;
sym_node->table = dict_table_get_low(table_name);

View file

@ -42,13 +42,14 @@ extern
void
innobase_invalidate_query_cache(
/*============================*/
trx_t* trx, /* in: transaction which modifies the table */
char* full_name, /* in: concatenation of database name, null
char '\0', table name, null char'\0';
NOTE that in Windows this is always
in LOWER CASE! */
ulint full_name_len); /* in: full name length where also the null
chars count */
trx_t* trx, /* in: transaction which modifies
the table */
const char* full_name, /* in: concatenation of database name,
null char '\0', table name, null char
'\0'; NOTE that in Windows this is
always in LOWER CASE! */
ulint full_name_len); /* in: full name length where also the
null chars count */
/*************************************************************************
@ -518,7 +519,7 @@ static
void
row_ins_foreign_report_err(
/*=======================*/
char* errstr, /* in: error string from the viewpoint
const char* errstr, /* in: error string from the viewpoint
of the parent table */
que_thr_t* thr, /* in: query thread whose run_node
is an update node */
@ -651,25 +652,23 @@ row_ins_foreign_check_on_constraint(
ulint n_to_update;
ulint err;
ulint i;
char* ptr;
char table_name_buf[1000];
const char* ptr;
char* table_name;
ut_a(thr && foreign && pcur && mtr);
#ifndef UNIV_HOTBACKUP
/* Since we are going to delete or update a row, we have to invalidate
the MySQL query cache for table */
ut_a(ut_strlen(table->name) < 998);
strcpy(table_name_buf, table->name);
ptr = strchr(table_name_buf, '/');
ptr = strchr(table->name, '/');
ut_a(ptr);
*ptr = '\0';
table_name = mem_strdupl(table->name, ptr - table->name);
/* We call a function in ha_innodb.cc */
#ifndef UNIV_HOTBACKUP
innobase_invalidate_query_cache(thr_get_trx(thr), table_name_buf,
ut_strlen(table->name) + 1);
innobase_invalidate_query_cache(thr_get_trx(thr), table_name,
ptr - table->name + 1);
mem_free(table_name);
#endif
node = thr->run_node;
@ -677,7 +676,7 @@ row_ins_foreign_check_on_constraint(
(DICT_FOREIGN_ON_DELETE_CASCADE
| DICT_FOREIGN_ON_DELETE_SET_NULL))) {
row_ins_foreign_report_err((char*)"Trying to delete",
row_ins_foreign_report_err("Trying to delete",
thr, foreign,
btr_pcur_get_rec(pcur), entry);
@ -690,7 +689,7 @@ row_ins_foreign_check_on_constraint(
/* This is an UPDATE */
row_ins_foreign_report_err((char*)"Trying to update",
row_ins_foreign_report_err("Trying to update",
thr, foreign,
btr_pcur_get_rec(pcur), entry);
@ -751,7 +750,7 @@ row_ins_foreign_check_on_constraint(
err = DB_ROW_IS_REFERENCED;
row_ins_foreign_report_err(
(char*)"Trying an update, possibly causing a cyclic cascaded update\n"
"Trying an update, possibly causing a cyclic cascaded update\n"
"in the child table,", thr, foreign, btr_pcur_get_rec(pcur), entry);
goto nonstandard_exit_func;
@ -876,7 +875,7 @@ row_ins_foreign_check_on_constraint(
err = DB_ROW_IS_REFERENCED;
row_ins_foreign_report_err(
(char*)"Trying a cascaded update where the updated value in the child\n"
"Trying a cascaded update where the updated value in the child\n"
"table would not fit in the length of the column, or the value would\n"
"be NULL and the column is declared as not NULL in the child table,",
thr, foreign, btr_pcur_get_rec(pcur), entry);
@ -1194,7 +1193,7 @@ run_again:
}
} else {
row_ins_foreign_report_err(
(char*)"Trying to delete or update",
"Trying to delete or update",
thr, foreign, rec, entry);
err = DB_ROW_IS_REFERENCED;

View file

@ -691,7 +691,7 @@ row_lock_table_autoinc_for_mysql(
return(DB_SUCCESS);
}
trx->op_info = (char *) "setting auto-inc lock";
trx->op_info = "setting auto-inc lock";
if (node == NULL) {
row_get_prebuilt_insert_row(prebuilt);
@ -727,14 +727,14 @@ run_again:
goto run_again;
}
trx->op_info = (char *) "";
trx->op_info = "";
return(err);
}
que_thr_stop_for_mysql_no_error(thr, trx);
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -774,7 +774,7 @@ row_lock_table_for_mysql(
ut_ad(trx);
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
trx->op_info = (char *) "setting table lock";
trx->op_info = "setting table lock";
if (prebuilt->sel_graph == NULL) {
/* Build a dummy select query graph */
@ -811,14 +811,14 @@ run_again:
goto run_again;
}
trx->op_info = (char *) "";
trx->op_info = "";
return(err);
}
que_thr_stop_for_mysql_no_error(thr, trx);
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -869,7 +869,7 @@ row_insert_for_mysql(
return(DB_ERROR);
}
trx->op_info = (char *) "inserting";
trx->op_info = "inserting";
trx_start_if_not_started(trx);
@ -910,7 +910,7 @@ run_again:
goto run_again;
}
trx->op_info = (char *) "";
trx->op_info = "";
return(err);
}
@ -927,7 +927,7 @@ run_again:
}
row_update_statistics_if_needed(prebuilt->table);
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -1084,7 +1084,7 @@ row_update_for_mysql(
return(DB_ERROR);
}
trx->op_info = (char *) "updating or deleting";
trx->op_info = "updating or deleting";
trx_start_if_not_started(trx);
@ -1131,7 +1131,7 @@ run_again:
if (err == DB_RECORD_NOT_FOUND) {
trx->error_state = DB_SUCCESS;
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -1142,7 +1142,7 @@ run_again:
goto run_again;
}
trx->op_info = (char *) "";
trx->op_info = "";
return(err);
}
@ -1161,7 +1161,7 @@ run_again:
row_update_statistics_if_needed(prebuilt->table);
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -1437,7 +1437,7 @@ row_create_table_for_mysql(
return(DB_ERROR);
}
trx->op_info = (char *) "creating table";
trx->op_info = "creating table";
if (row_mysql_is_system_table(table->name)) {
@ -1572,7 +1572,7 @@ row_create_table_for_mysql(
que_graph_free((que_t*) que_node_get_parent(thr));
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -1601,7 +1601,7 @@ row_create_index_for_mysql(
#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
trx->op_info = (char *) "creating index";
trx->op_info = "creating index";
/* Check that the same column does not appear twice in the index.
Starting from 4.0.14, InnoDB should be able to cope with that, but
@ -1669,7 +1669,7 @@ error_handling:
trx->error_state = DB_SUCCESS;
}
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -1705,7 +1705,7 @@ row_table_add_foreign_constraints(
#endif /* UNIV_SYNC_DEBUG */
ut_a(sql_string);
trx->op_info = (char *) "adding foreign keys";
trx->op_info = "adding foreign keys";
trx_start_if_not_started(trx);
@ -1749,8 +1749,8 @@ static
int
row_drop_table_for_mysql_in_background(
/*===================================*/
/* out: error code or DB_SUCCESS */
char* name) /* in: table name */
/* out: error code or DB_SUCCESS */
const char* name) /* in: table name */
{
ulint error;
trx_t* trx;
@ -1955,7 +1955,7 @@ row_discard_tablespace_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
trx->op_info = (char *) "discarding tablespace";
trx->op_info = "discarding tablespace";
trx_start_if_not_started(trx);
/* Serialize data dictionary operations with dictionary mutex:
@ -2060,7 +2060,7 @@ funct_exit:
trx_commit_for_mysql(trx);
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -2085,7 +2085,7 @@ row_import_tablespace_for_mysql(
trx_start_if_not_started(trx);
trx->op_info = (char*) "importing tablespace";
trx->op_info = "importing tablespace";
current_lsn = log_get_lsn();
@ -2165,7 +2165,7 @@ funct_exit:
trx_commit_for_mysql(trx);
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -2274,7 +2274,7 @@ row_drop_table_for_mysql(
return(DB_ERROR);
}
trx->op_info = (char *) "dropping table";
trx->op_info = "dropping table";
trx_start_if_not_started(trx);
@ -2507,7 +2507,7 @@ funct_exit:
trx_commit_for_mysql(trx);
trx->op_info = (char *) "";
trx->op_info = "";
srv_wake_master_thread();
@ -2533,7 +2533,7 @@ row_drop_database_for_mysql(
ut_a(name != NULL);
ut_a(name[namelen - 1] == '/');
trx->op_info = (char *) "dropping database";
trx->op_info = "dropping database";
trx_start_if_not_started(trx);
loop:
@ -2587,7 +2587,7 @@ loop:
trx_commit_for_mysql(trx);
trx->op_info = (char *) "";
trx->op_info = "";
return(err);
}
@ -2738,7 +2738,7 @@ row_rename_table_for_mysql(
return(DB_ERROR);
}
trx->op_info = (char *) "renaming table";
trx->op_info = "renaming table";
trx_start_if_not_started(trx);
if (row_mysql_is_recovered_tmp_table(new_name)) {
@ -2987,7 +2987,7 @@ funct_exit:
trx_commit_for_mysql(trx);
trx->op_info = (char *) "";
trx->op_info = "";
return((int) err);
}
@ -3125,7 +3125,7 @@ row_check_table_for_mysql(
ulint ret = DB_SUCCESS;
ulint old_isolation_level;
prebuilt->trx->op_info = (char *) "checking table";
prebuilt->trx->op_info = "checking table";
old_isolation_level = prebuilt->trx->isolation_level;
@ -3181,7 +3181,7 @@ row_check_table_for_mysql(
ret = DB_ERROR;
}
prebuilt->trx->op_info = (char *) "";
prebuilt->trx->op_info = "";
return(ret);
}

View file

@ -2806,7 +2806,7 @@ row_search_for_mysql(
/* PHASE 1: Try to pop the row from the prefetch cache */
if (direction == 0) {
trx->op_info = (char *) "starting index read";
trx->op_info = "starting index read";
prebuilt->n_rows_fetched = 0;
prebuilt->n_fetch_cached = 0;
@ -2817,7 +2817,7 @@ row_search_for_mysql(
row_prebuild_sel_graph(prebuilt);
}
} else {
trx->op_info = (char *) "fetching rows";
trx->op_info = "fetching rows";
if (prebuilt->n_rows_fetched == 0) {
prebuilt->fetch_direction = direction;
@ -2842,7 +2842,7 @@ row_search_for_mysql(
prebuilt->n_rows_fetched++;
srv_n_rows_read++;
trx->op_info = (char *) "";
trx->op_info = "";
return(DB_SUCCESS);
}
@ -2854,7 +2854,7 @@ row_search_for_mysql(
cache, but the cache was not full at the time of the
popping: no more rows can exist in the result set */
trx->op_info = (char *) "";
trx->op_info = "";
return(DB_RECORD_NOT_FOUND);
}
@ -2899,7 +2899,7 @@ row_search_for_mysql(
if (direction != 0 && !prebuilt->used_in_HANDLER) {
trx->op_info = (char *) "";
trx->op_info = "";
return(DB_RECORD_NOT_FOUND);
}
}
@ -2980,7 +2980,7 @@ row_search_for_mysql(
trx->has_search_latch = FALSE;
}
trx->op_info = (char *) "";
trx->op_info = "";
/* NOTE that we do NOT store the cursor
position */
@ -3003,7 +3003,7 @@ row_search_for_mysql(
trx->has_search_latch = FALSE;
}
trx->op_info = (char *) "";
trx->op_info = "";
/* NOTE that we do NOT store the cursor
position */
@ -3550,7 +3550,7 @@ lock_wait_or_error:
/* fputs("Using ", stderr);
dict_index_name_print(stderr, index);
fprintf(stderr, " cnt %lu ret value %lu err\n", cnt, err); */
trx->op_info = (char *) "";
trx->op_info = "";
return(err);
@ -3573,7 +3573,7 @@ normal_return:
srv_n_rows_read++;
}
trx->op_info = (char *) "";
trx->op_info = "";
return(ret);
}

View file

@ -57,7 +57,7 @@ ulint srv_activity_count = 0;
ibool srv_lock_timeout_and_monitor_active = FALSE;
ibool srv_error_monitor_active = FALSE;
char* srv_main_thread_op_info = (char*) "";
const char* srv_main_thread_op_info = "";
/* Server parameters which are read from the initfile */
@ -65,7 +65,9 @@ char* srv_main_thread_op_info = (char*) "";
names, where the file name itself may also contain a path */
char* srv_data_home = NULL;
#ifdef UNIV_LOG_ARCHIVE
char* srv_arch_dir = NULL;
#endif /* UNIV_LOG_ARCHIVE */
ibool srv_file_per_table = FALSE; /* store to its own file each table
created by an user; data dictionary
@ -94,7 +96,6 @@ char** srv_log_group_home_dirs = NULL;
ulint srv_n_log_groups = ULINT_MAX;
ulint srv_n_log_files = ULINT_MAX;
ulint srv_log_file_size = ULINT_MAX; /* size in database pages */
ibool srv_log_archive_on = FALSE;
ulint srv_log_buffer_size = ULINT_MAX; /* size in database pages */
ulint srv_flush_log_at_trx_commit = 1;
@ -149,8 +150,11 @@ ulint srv_lock_table_size = ULINT_MAX;
ulint srv_n_file_io_threads = ULINT_MAX;
#ifdef UNIV_LOG_ARCHIVE
ibool srv_log_archive_on = FALSE;
ibool srv_archive_recovery = 0;
dulint srv_archive_recovery_limit_lsn;
#endif /* UNIV_LOG_ARCHIVE */
ulint srv_lock_wait_timeout = 1024 * 1024 * 1024;
@ -921,11 +925,11 @@ retry:
os_fast_mutex_unlock(&srv_conc_mutex);
trx->op_info = (char*)"sleeping before joining InnoDB queue";
trx->op_info = "sleeping before joining InnoDB queue";
os_thread_sleep(50000);
trx->op_info = (char*)"";
trx->op_info = "";
os_fast_mutex_lock(&srv_conc_mutex);
@ -978,11 +982,11 @@ retry:
/* Go to wait for the event; when a thread leaves InnoDB it will
release this thread */
trx->op_info = (char*)"waiting in InnoDB queue";
trx->op_info = "waiting in InnoDB queue";
os_event_wait(slot->event);
trx->op_info = (char*)"";
trx->op_info = "";
os_fast_mutex_lock(&srv_conc_mutex);
@ -1946,7 +1950,7 @@ loop:
/* ---- When there is database activity by users, we cycle in this
loop */
srv_main_thread_op_info = (char*) "reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
n_ios_very_old = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
@ -1970,7 +1974,7 @@ loop:
for (i = 0; i < 10; i++) {
n_ios_old = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
srv_main_thread_op_info = (char*)"sleeping";
srv_main_thread_op_info = "sleeping";
if (!skip_sleep) {
@ -1983,12 +1987,11 @@ loop:
can drop tables lazily after there no longer are SELECT
queries to them. */
srv_main_thread_op_info =
(char*)"doing background drop tables";
srv_main_thread_op_info = "doing background drop tables";
row_drop_tables_for_mysql_in_background();
srv_main_thread_op_info = (char*)"";
srv_main_thread_op_info = "";
if (srv_fast_shutdown && srv_shutdown_state > 0) {
@ -1999,10 +2002,10 @@ loop:
is issued or the we have specified in my.cnf no flush
at transaction commit */
srv_main_thread_op_info = (char*)"flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
srv_main_thread_op_info = (char*)"making checkpoint";
srv_main_thread_op_info = "making checkpoint";
log_free_check();
/* If there were less than 5 i/os during the
@ -2015,11 +2018,10 @@ loop:
n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
+ buf_pool->n_pages_written;
if (n_pend_ios < 3 && (n_ios - n_ios_old < 5)) {
srv_main_thread_op_info =
(char*)"doing insert buffer merge";
srv_main_thread_op_info = "doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
srv_main_thread_op_info = (char*)"flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
}
@ -2067,20 +2069,20 @@ loop:
+ buf_pool->n_pages_written;
if (n_pend_ios < 3 && (n_ios - n_ios_very_old < 200)) {
srv_main_thread_op_info = (char*) "flushing buffer pool pages";
srv_main_thread_op_info = "flushing buffer pool pages";
buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
srv_main_thread_op_info = (char*) "flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
}
/* We run a batch of insert buffer merge every 10 seconds,
even if the server were active */
srv_main_thread_op_info = (char*)"doing insert buffer merge";
srv_main_thread_op_info = "doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
srv_main_thread_op_info = (char*)"flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
/* We run a full purge every 10 seconds, even if the server
@ -2097,20 +2099,20 @@ loop:
goto background_loop;
}
srv_main_thread_op_info = (char*)"purging";
srv_main_thread_op_info = "purging";
n_pages_purged = trx_purge();
current_time = time(NULL);
if (difftime(current_time, last_flush_time) > 1) {
srv_main_thread_op_info = (char*) "flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
last_flush_time = current_time;
}
}
srv_main_thread_op_info = (char*)"flushing buffer pool pages";
srv_main_thread_op_info = "flushing buffer pool pages";
/* Flush a few oldest pages to make a new checkpoint younger */
@ -2131,13 +2133,13 @@ loop:
ut_dulint_max);
}
srv_main_thread_op_info = (char*)"making checkpoint";
srv_main_thread_op_info = "making checkpoint";
/* Make a new checkpoint about once in 10 seconds */
log_checkpoint(TRUE, FALSE);
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
@ -2161,7 +2163,7 @@ background_loop:
/* The server has been quiet for a while: start running background
operations */
srv_main_thread_op_info = (char*)"doing background drop tables";
srv_main_thread_op_info = "doing background drop tables";
n_tables_to_drop = row_drop_tables_for_mysql_in_background();
@ -2174,7 +2176,7 @@ background_loop:
os_thread_sleep(100000);
}
srv_main_thread_op_info = (char*)"purging";
srv_main_thread_op_info = "purging";
/* Run a full purge */
@ -2188,20 +2190,20 @@ background_loop:
break;
}
srv_main_thread_op_info = (char*)"purging";
srv_main_thread_op_info = "purging";
n_pages_purged = trx_purge();
current_time = time(NULL);
if (difftime(current_time, last_flush_time) > 1) {
srv_main_thread_op_info = (char*) "flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
last_flush_time = current_time;
}
}
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
if (srv_activity_count != old_activity_count) {
@ -2210,7 +2212,7 @@ background_loop:
}
mutex_exit(&kernel_mutex);
srv_main_thread_op_info = (char*)"doing insert buffer merge";
srv_main_thread_op_info = "doing insert buffer merge";
if (srv_fast_shutdown && srv_shutdown_state > 0) {
n_bytes_merged = 0;
@ -2218,7 +2220,7 @@ background_loop:
n_bytes_merged = ibuf_contract_for_n_pages(TRUE, 20);
}
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
if (srv_activity_count != old_activity_count) {
@ -2228,10 +2230,10 @@ background_loop:
mutex_exit(&kernel_mutex);
flush_loop:
srv_main_thread_op_info = (char*)"flushing buffer pool pages";
srv_main_thread_op_info = "flushing buffer pool pages";
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
if (srv_activity_count != old_activity_count) {
@ -2240,15 +2242,14 @@ flush_loop:
}
mutex_exit(&kernel_mutex);
srv_main_thread_op_info =
(char*) "waiting for buffer pool flush to end";
srv_main_thread_op_info = "waiting for buffer pool flush to end";
buf_flush_wait_batch_end(BUF_FLUSH_LIST);
srv_main_thread_op_info = (char*) "flushing log";
srv_main_thread_op_info = "flushing log";
log_buffer_flush_to_disk();
srv_main_thread_op_info = (char*)"making checkpoint";
srv_main_thread_op_info = "making checkpoint";
log_checkpoint(TRUE, FALSE);
@ -2260,7 +2261,7 @@ flush_loop:
goto flush_loop;
}
srv_main_thread_op_info = (char*)"reserving kernel mutex";
srv_main_thread_op_info = "reserving kernel mutex";
mutex_enter(&kernel_mutex);
if (srv_activity_count != old_activity_count) {
@ -2269,8 +2270,7 @@ flush_loop:
}
mutex_exit(&kernel_mutex);
/*
srv_main_thread_op_info =
(char*)"archiving log (if log archive is on)";
srv_main_thread_op_info = "archiving log (if log archive is on)";
log_archive_do(FALSE, &n_bytes_archived);
*/
@ -2301,7 +2301,7 @@ flush_loop:
master thread to wait for more server activity */
suspend_thread:
srv_main_thread_op_info = (char*)"suspending";
srv_main_thread_op_info = "suspending";
mutex_enter(&kernel_mutex);
@ -2315,7 +2315,7 @@ suspend_thread:
mutex_exit(&kernel_mutex);
srv_main_thread_op_info = (char*)"waiting for server activity";
srv_main_thread_op_info = "waiting for server activity";
os_event_wait(event);

View file

@ -628,7 +628,7 @@ open_or_create_log_file(
fil_node_create(name, srv_log_file_size,
2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
#ifdef notdefined
#ifdef UNIV_LOG_ARCHIVE
/* If this is the first log group, create the file space object
for archived logs.
Under MySQL, no archiving ever done. */
@ -636,12 +636,11 @@ open_or_create_log_file(
if (k == 0 && i == 0) {
arch_space_id = 2 * k + 1 + SRV_LOG_SPACE_FIRST_ID;
fil_space_create((char*) "arch_log_space", arch_space_id,
FIL_LOG);
fil_space_create("arch_log_space", arch_space_id, FIL_LOG);
} else {
arch_space_id = ULINT_UNDEFINED;
}
#endif
#endif /* UNIV_LOG_ARCHIVE */
if (i == 0) {
log_group_init(k, srv_n_log_files,
srv_log_file_size * UNIV_PAGE_SIZE,
@ -662,12 +661,14 @@ open_or_create_data_files(
/* out: DB_SUCCESS or error code */
ibool* create_new_db, /* out: TRUE if new database should be
created */
dulint* min_flushed_lsn,/* out: min of flushed lsn values in data
files */
#ifdef UNIV_LOG_ARCHIVE
ulint* min_arch_log_no,/* out: min of archived log numbers in data
files */
dulint* max_flushed_lsn,/* out: */
ulint* max_arch_log_no,/* out: */
#endif /* UNIV_LOG_ARCHIVE */
dulint* min_flushed_lsn,/* out: min of flushed lsn values in data
files */
dulint* max_flushed_lsn,/* out: */
ulint* sum_of_new_sizes)/* out: sum of sizes of the new files added */
{
ibool ret;
@ -820,8 +821,10 @@ open_or_create_data_files(
skip_size_check:
fil_read_flushed_lsn_and_arch_log_no(files[i],
one_opened,
min_flushed_lsn, min_arch_log_no,
max_flushed_lsn, max_arch_log_no);
#ifdef UNIV_LOG_ARCHIVE
min_arch_log_no, max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
min_flushed_lsn, max_flushed_lsn);
one_opened = TRUE;
} else {
/* We created the data file and now write it full of
@ -908,8 +911,10 @@ innobase_start_or_create_for_mysql(void)
ibool log_opened = FALSE;
dulint min_flushed_lsn;
dulint max_flushed_lsn;
#ifdef UNIV_LOG_ARCHIVE
ulint min_arch_log_no;
ulint max_arch_log_no;
#endif /* UNIV_LOG_ARCHIVE */
ulint sum_of_new_sizes;
ulint sum_of_data_file_sizes;
ulint tablespace_size_in_header;
@ -1017,28 +1022,22 @@ innobase_start_or_create_for_mysql(void)
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
#ifndef __WIN__
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"fdatasync")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str, "fdatasync")) {
srv_unix_file_flush_method = SRV_UNIX_FDATASYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"O_DSYNC")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DSYNC")) {
srv_unix_file_flush_method = SRV_UNIX_O_DSYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"O_DIRECT")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str, "O_DIRECT")) {
srv_unix_file_flush_method = SRV_UNIX_O_DIRECT;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"littlesync")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str, "littlesync")) {
srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"nosync")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str, "nosync")) {
srv_unix_file_flush_method = SRV_UNIX_NOSYNC;
#else
} else if (0 == ut_strcmp(srv_file_flush_method_str,
(char*)"normal")) {
} else if (0 == ut_strcmp(srv_file_flush_method_str, "normal")) {
srv_win_file_flush_method = SRV_WIN_IO_NORMAL;
os_aio_use_native_aio = FALSE;
@ -1181,6 +1180,7 @@ NetWare. */
os_thread_create(io_handler_thread, n + i, thread_ids + i);
}
#ifdef UNIV_LOG_ARCHIVE
if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) {
fprintf(stderr,
"InnoDB: Error: you must set the log group home dir in my.cnf the\n"
@ -1188,6 +1188,7 @@ NetWare. */
return(DB_ERROR);
}
#endif /* UNIV_LOG_ARCHIVE */
if (srv_n_log_files * srv_log_file_size >= 262144) {
fprintf(stderr,
@ -1219,8 +1220,10 @@ NetWare. */
}
err = open_or_create_data_files(&create_new_db,
&min_flushed_lsn, &min_arch_log_no,
&max_flushed_lsn, &max_arch_log_no,
#ifdef UNIV_LOG_ARCHIVE
&min_arch_log_no, &max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
&min_flushed_lsn, &max_flushed_lsn,
&sum_of_new_sizes);
if (err != DB_SUCCESS) {
fprintf(stderr,
@ -1235,8 +1238,10 @@ NetWare. */
return((int) err);
}
#ifdef UNIV_LOG_ARCHIVE
srv_normalize_path_for_win(srv_arch_dir);
srv_arch_dir = srv_add_path_separator_if_needed(srv_arch_dir);
#endif /* UNIV_LOG_ARCHIVE */
for (i = 0; i < srv_n_log_files; i++) {
err = open_or_create_log_file(create_new_db, &log_file_created,
@ -1270,9 +1275,16 @@ NetWare. */
fil_open_log_and_system_tablespace_files();
if (log_created && !create_new_db && !srv_archive_recovery) {
if (log_created && !create_new_db
#ifdef UNIV_LOG_ARCHIVE
&& !srv_archive_recovery
#endif /* UNIV_LOG_ARCHIVE */
) {
if (ut_dulint_cmp(max_flushed_lsn, min_flushed_lsn) != 0
|| max_arch_log_no != min_arch_log_no) {
#ifdef UNIV_LOG_ARCHIVE
|| max_arch_log_no != min_arch_log_no
#endif /* UNIV_LOG_ARCHIVE */
) {
fprintf(stderr,
"InnoDB: Cannot initialize created log files because\n"
"InnoDB: data files were not in sync with each other\n"
@ -1295,10 +1307,14 @@ NetWare. */
mutex_enter(&(log_sys->mutex));
#ifdef UNIV_LOG_ARCHIVE
/* Do not + 1 arch_log_no because we do not use log
archiving */
recv_reset_logs(max_flushed_lsn, max_arch_log_no, TRUE);
#else
recv_reset_logs(max_flushed_lsn, TRUE);
#endif /* UNIV_LOG_ARCHIVE */
mutex_exit(&(log_sys->mutex));
}
@ -1313,6 +1329,7 @@ NetWare. */
dict_create();
srv_startup_is_before_trx_rollback_phase = FALSE;
#ifdef UNIV_LOG_ARCHIVE
} else if (srv_archive_recovery) {
fprintf(stderr,
"InnoDB: Starting archive recovery from a backup...\n");
@ -1336,6 +1353,7 @@ NetWare. */
fsp_header_get_free_limit(0);
recv_recovery_from_archive_finish();
#endif /* UNIV_LOG_ARCHIVE */
} else {
/* We always try to do a recovery, even if the database had
been shut down normally: this is the normal startup path */
@ -1384,7 +1402,7 @@ NetWare. */
log_make_checkpoint_at(ut_dulint_max, TRUE);
#ifdef notdefined
#ifdef UNIV_LOG_ARCHIVE
/* Archiving is always off under MySQL */
if (!srv_log_archive_on) {
ut_a(DB_SUCCESS == log_archive_noarchivelog());
@ -1403,7 +1421,7 @@ NetWare. */
ut_a(DB_SUCCESS == log_archive_archivelog());
}
}
#endif
#endif /* UNIV_LOG_ARCHIVE */
if (!create_new_db && srv_force_recovery == 0) {
/* After a crash recovery we only check that the info in data
dictionary is consistent with what we already know about space

View file

@ -119,8 +119,8 @@ rw_lock_create_func(
lock->cfile_name = cfile_name;
lock->cline = cline;
lock->last_s_file_name = (char *) "not yet reserved";
lock->last_x_file_name = (char *) "not yet reserved";
lock->last_s_file_name = "not yet reserved";
lock->last_x_file_name = "not yet reserved";
lock->last_s_line = 0;
lock->last_x_line = 0;
@ -593,7 +593,7 @@ rw_lock_add_debug_info(
rw_lock_t* lock, /* in: rw-lock */
ulint pass, /* in: pass value */
ulint lock_type, /* in: lock type */
char* file_name, /* in: file where requested */
const char* file_name, /* in: file where requested */
ulint line) /* in: line where requested */
{
rw_lock_debug_t* info;

View file

@ -214,7 +214,7 @@ mutex_create_func(
mutex->magic_n = MUTEX_MAGIC_N;
#ifdef UNIV_SYNC_DEBUG
mutex->line = 0;
mutex->file_name = (char *) "not yet reserved";
mutex->file_name = "not yet reserved";
#endif /* UNIV_SYNC_DEBUG */
mutex->level = SYNC_LEVEL_NONE;
mutex->cfile_name = cfile_name;
@ -512,7 +512,7 @@ void
mutex_set_debug_info(
/*=================*/
mutex_t* mutex, /* in: mutex */
char* file_name, /* in: file where requested */
const char* file_name, /* in: file where requested */
ulint line) /* in: line where requested */
{
ut_ad(mutex);

View file

@ -116,11 +116,11 @@ trx_rollback_for_mysql(
return(DB_SUCCESS);
}
trx->op_info = (char *) "rollback";
trx->op_info = "rollback";
err = trx_general_rollback_for_mysql(trx, FALSE, NULL);
trx->op_info = (char *) "";
trx->op_info = "";
return(err);
}
@ -141,14 +141,14 @@ trx_rollback_last_sql_stat_for_mysql(
return(DB_SUCCESS);
}
trx->op_info = (char *) "rollback of SQL statement";
trx->op_info = "rollback of SQL statement";
err = trx_general_rollback_for_mysql(trx, TRUE,
&(trx->last_sql_stat_start));
/* The following call should not be needed, but we play safe: */
trx_mark_sql_stat_end(trx);
trx->op_info = (char *) "";
trx->op_info = "";
return(err);
}
@ -239,7 +239,7 @@ trx_rollback_to_savepoint_for_mysql(
*mysql_binlog_cache_pos = savep->mysql_binlog_cache_pos;
trx->op_info = (char *) "rollback to a savepoint";
trx->op_info = "rollback to a savepoint";
err = trx_general_rollback_for_mysql(trx, TRUE, &(savep->savept));
@ -248,7 +248,7 @@ trx_rollback_to_savepoint_for_mysql(
trx_mark_sql_stat_end(trx);
trx->op_info = (char *) "";
trx->op_info = "";
return(err);
}
@ -343,7 +343,7 @@ trx_rollback_or_clean_all_without_sess(void)
trx_t* trx;
dict_table_t* table;
ib_longlong rows_to_undo;
char* unit = (char*)"";
const char* unit = "";
int err;
mutex_enter(&kernel_mutex);
@ -421,7 +421,7 @@ loop:
rows_to_undo = trx_roll_max_undo_no;
if (rows_to_undo > 1000000000) {
rows_to_undo = rows_to_undo / 1000000;
unit = (char*)"M";
unit = "M";
}
fprintf(stderr,

View file

@ -832,7 +832,7 @@ trx_sys_init_at_db_start(void)
{
trx_sysf_t* sys_header;
ib_longlong rows_to_undo = 0;
char* unit = (char*)"";
const char* unit = "";
trx_t* trx;
mtr_t mtr;
@ -881,7 +881,7 @@ trx_sys_init_at_db_start(void)
}
if (rows_to_undo > 1000000000) {
unit = (char*)"M";
unit = "M";
rows_to_undo = rows_to_undo / 1000000;
}

View file

@ -81,7 +81,7 @@ trx_create(
trx->magic_n = TRX_MAGIC_N;
trx->op_info = (char *) "";
trx->op_info = "";
trx->type = TRX_USER;
trx->conc_state = TRX_NOT_STARTED;
@ -107,7 +107,7 @@ trx_create(
trx->mysql_log_file_name = NULL;
trx->mysql_log_offset = 0;
trx->mysql_master_log_file_name = (char*)"";
trx->mysql_master_log_file_name = "";
trx->mysql_master_log_pos = 0;
mutex_create(&(trx->undo_mutex));
@ -1394,7 +1394,7 @@ trx_commit_for_mysql(
ut_a(trx);
trx->op_info = (char *) "committing";
trx->op_info = "committing";
trx_start_if_not_started(trx);
@ -1404,7 +1404,7 @@ trx_commit_for_mysql(
mutex_exit(&kernel_mutex);
trx->op_info = (char *) "";
trx->op_info = "";
return(0);
}
@ -1423,7 +1423,7 @@ trx_commit_complete_for_mysql(
ut_a(trx);
trx->op_info = (char*)"flushing log";
trx->op_info = "flushing log";
if (srv_flush_log_at_trx_commit == 0) {
/* Do nothing */
@ -1447,7 +1447,7 @@ trx_commit_complete_for_mysql(
ut_error;
}
trx->op_info = (char*)"";
trx->op_info = "";
return(0);
}

View file

@ -1800,12 +1800,12 @@ my_string name;
if (buff[0] == ',')
strmov(buff,buff+2);
#endif
len=(uint) (int2str((long) share->rec[field].base.length,length,10) -
len=(uint) (int10_to_str((long) share->rec[field].base.length,length,10) -
length);
if (type == FIELD_BLOB)
{
length[len]='+';
VOID(int2str((long) sizeof(char*),length+len+1,10));
VOID(int10_to_str((long) sizeof(char*),length+len+1,10));
}
printf("%-6d%-6d%-7s%-35s",field+1,start,length,buff);
#ifndef NOT_PACKED_DATABASES

View file

@ -2,7 +2,8 @@ LIBRARY LIBMYSQL
DESCRIPTION 'MySQL 4.1 Client Library'
VERSION 6.0
EXPORTS
_dig_vec
_dig_vec_lower
_dig_vec_upper
bmove_upp
delete_dynamic
free_defaults

View file

@ -242,6 +242,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_length=pointer;
if (keydef->flag & HA_SPATIAL)
{
#ifdef HAVE_SPATIAL
/* BAR TODO to support 3D and more dimensions in the future */
uint sp_segs=SPDIMS*2;
keydef->flag=HA_SPATIAL;
@ -270,6 +271,10 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_length+=SPLEN*sp_segs;
length++; /* At least one length byte */
min_key_length_skip+=SPLEN*2*SPDIMS;
#else
my_errno= HA_ERR_UNSUPPORTED;
goto err;
#endif /*HAVE_SPATIAL*/
}
else
if (keydef->flag & HA_FULLTEXT)
@ -588,6 +593,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
for (j=0 ; j < keydefs[i].keysegs-sp_segs ; j++)
if (mi_keyseg_write(file, &keydefs[i].seg[j]))
goto err;
#ifdef HAVE_SPATIAL
for (j=0 ; j < sp_segs ; j++)
{
HA_KEYSEG sseg;
@ -603,6 +609,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if (mi_keyseg_write(file, &sseg))
goto err;
}
#endif
}
/* Create extra keys for unique definitions */
offset=reclength-uniques*MI_UNIQUE_HASH_LENGTH;

View file

@ -46,7 +46,11 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
/*
TODO: nulls processing
*/
#ifdef HAVE_SPATIAL
return sp_make_key(info,keynr,key,record,filepos);
#else
DBUG_ASSERT(0); /* mi_open should check that this never happens*/
#endif
}
start=key;

View file

@ -327,9 +327,14 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
if (share->keyinfo[i].flag & HA_SPATIAL)
{
#ifdef HAVE_SPATIAL
uint sp_segs=SPDIMS*2;
share->keyinfo[i].seg=pos-sp_segs;
share->keyinfo[i].keysegs--;
#else
my_errno=HA_ERR_UNSUPPORTED;
goto err;
#endif
}
else if (share->keyinfo[i].flag & HA_FULLTEXT)
{
@ -726,8 +731,12 @@ static void setup_key_functions(register MI_KEYDEF *keyinfo)
{
if (keyinfo->key_alg == HA_KEY_ALG_RTREE)
{
#ifdef HAVE_RTREE_KEYS
keyinfo->ck_insert = rtree_insert;
keyinfo->ck_delete = rtree_delete;
#else
DBUG_ASSERT(0); /* mi_open should check it never happens */
#endif
}
else
{

View file

@ -65,6 +65,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key,
rw_rdlock(&info->s->key_root_lock[inx]);
switch(info->s->keyinfo[inx].key_alg){
#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
{
uchar * key_buff;
@ -79,6 +80,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, key_range *min_key,
res= res ? res : 1; /* Don't return 0 */
break;
}
#endif
case HA_KEY_ALG_BTREE:
default:
start_pos= (min_key ?

View file

@ -74,6 +74,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
use_key_length=USE_WHOLE_KEY;
switch (info->s->keyinfo[inx].key_alg) {
#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
if (rtree_find_first(info,inx,key_buff,use_key_length,nextflag) < 0)
{
@ -81,6 +82,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
goto err;
}
break;
#endif
case HA_KEY_ALG_BTREE:
default:
if (!_mi_search(info, keyinfo, key_buff, use_key_length,

View file

@ -45,9 +45,11 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
if (!flag)
{
switch(info->s->keyinfo[inx].key_alg){
#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
error=rtree_get_first(info,inx,info->lastkey_length);
break;
#endif
case HA_KEY_ALG_BTREE:
default:
error=_mi_search_first(info,info->s->keyinfo+inx,
@ -58,6 +60,7 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
else
{
switch (info->s->keyinfo[inx].key_alg) {
#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
/*
Note that rtree doesn't support that the table
@ -66,7 +69,7 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
*/
error= rtree_get_next(info,inx,info->lastkey_length);
break;
#endif
case HA_KEY_ALG_BTREE:
default:
if (!changed)

View file

@ -43,6 +43,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
switch (keyinfo->key_alg)
{
#ifdef HAVE_RTREE_KEYS
case HA_KEY_ALG_RTREE:
if ((error=rtree_find_next(info,inx,
myisam_read_vec[info->last_key_func])))
@ -53,6 +54,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
break;
}
break;
#endif
case HA_KEY_ALG_BTREE:
default:
memcpy(info->lastkey2,info->lastkey,info->last_rkey_length);

View file

@ -1389,7 +1389,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
}
if (buff[0] == ',')
strmov(buff,buff+2);
int2str((long) share->rec[field].length,length,10);
int10_to_str((long) share->rec[field].length,length,10);
null_bit[0]=null_pos[0]=0;
if (share->rec[field].null_bit)
{

View file

@ -17,6 +17,8 @@
#include "myisamdef.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#include "rt_key.h"
#include "rt_mbr.h"
@ -991,3 +993,6 @@ err1:
my_afree((byte*)page_buf);
return HA_POS_ERROR;
}
#endif /*HAVE_RTREE_KEYS*/

View file

@ -18,6 +18,8 @@
#ifndef _rt_index_h
#define _rt_index_h
#ifdef HAVE_RTREE_KEYS
#define rt_PAGE_FIRST_KEY(page, nod_flag) (page + 2 + nod_flag)
#define rt_PAGE_NEXT_KEY(key, key_length, nod_flag) (key + key_length + \
(nod_flag ? nod_flag : info->s->base.rec_reflength))
@ -41,4 +43,5 @@ ha_rows rtree_estimate(MI_INFO *info, uint keynr, uchar *key,
int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
uint key_length, my_off_t *new_page_offs);
#endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_index_h */

View file

@ -16,6 +16,7 @@
#include "myisamdef.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#include "rt_key.h"
#include "rt_mbr.h"
@ -137,3 +138,5 @@ uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
}
return best_key;
}
#endif /*HAVE_RTREE_KEYS*/

View file

@ -20,6 +20,8 @@
#ifndef _rt_key_h
#define _rt_key_h
#ifdef HAVE_RTREE_KEYS
int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, my_off_t *new_page);
int rtree_delete_key(MI_INFO *info, uchar *page, uchar *key,
@ -28,4 +30,5 @@ int rtree_set_key_mbr(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, my_off_t child_page);
uchar *rtree_choose_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, uint nod_flag);
#endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_key_h */

View file

@ -17,6 +17,8 @@
#include "myisamdef.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#include "rt_mbr.h"
@ -757,3 +759,5 @@ int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
}
return 0;
}
#endif /*HAVE_RTREE_KEYS*/

View file

@ -18,6 +18,8 @@
#ifndef _rt_mbr_h
#define _rt_mbr_h
#ifdef HAVE_RTREE_KEYS
int rtree_key_cmp(HA_KEYSEG *keyseg, uchar *a, uchar *b, uint key_length,
uint nextflag);
int rtree_combine_rect(HA_KEYSEG *keyseg,uchar *, uchar *, uchar*,
@ -30,4 +32,5 @@ double rtree_area_increase(HA_KEYSEG *keyseg, uchar *a, uchar *b,
uint key_length, double *ab_area);
int rtree_page_mbr(MI_INFO *info, HA_KEYSEG *keyseg, uchar *page_buf,
uchar* c, uint key_length);
#endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_mbr_h */

View file

@ -17,6 +17,8 @@
#include "myisamdef.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#include "rt_key.h"
#include "rt_mbr.h"
@ -346,3 +348,5 @@ split_err:
my_free((gptr) coord_buf, MYF(0));
return err_code;
}
#endif /*HAVE_RTREE_KEYS*/

View file

@ -19,6 +19,9 @@
#include "myisam.h"
#ifdef HAVE_RTREE_KEYS
#include "rt_index.h"
#define MAX_REC_LENGTH 1024
@ -398,3 +401,10 @@ static void create_record(char *record,uint rownr)
pos+=sizeof(c);
}
}
#else
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
{
exit(0);
}
#endif /*HAVE_RTREE_KEYS*/

View file

@ -852,7 +852,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
uchar *strpos;
BUFFPEK *buffpek,**refpek;
QUEUE queue;
volatile bool *killed= killed_ptr(info->sort_info->param);
volatile my_bool *killed= killed_ptr(info->sort_info->param);
DBUG_ENTER("merge_buffers");
count=error=0;
@ -873,7 +873,8 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
count+= buffpek->count;
buffpek->base= strpos;
buffpek->max_keys=maxcount;
strpos+= (uint) (error=(int) info->read_to_buffer(from_file,buffpek,sort_length));
strpos+= (uint) (error=(int) info->read_to_buffer(from_file,buffpek,
sort_length));
if (error == -1)
goto err; /* purecov: inspected */
queue_insert(&queue,(char*) buffpek);
@ -890,7 +891,8 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file)
{
if (info->write_key(info,to_file,(byte*) buffpek->key,(uint) sort_length,1))
if (info->write_key(info,to_file,(byte*) buffpek->key,
(uint) sort_length,1))
{
error=1; goto err; /* purecov: inspected */
}

View file

@ -22,6 +22,8 @@
#define SPTYPE HA_KEYTYPE_DOUBLE
#define SPLEN 8
#ifdef HAVE_SPATIAL
enum wkbType
{
wkbPoint = 1,
@ -42,4 +44,5 @@ enum wkbByteOrder
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
const byte *record, my_off_t filepos);
#endif /*HAVE_SPATIAL*/
#endif /* _SP_DEFS_H */

View file

@ -15,6 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "myisamdef.h"
#ifdef HAVE_SPATIAL
#include "sp_defs.h"
static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
@ -284,3 +287,5 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
}
return res;
}
#endif /*HAVE_SPATIAL*/

View file

@ -18,6 +18,8 @@
/* Written by Alex Barkov, who has a shared copyright to this code */
#include "myisam.h"
#ifdef HAVE_SPATIAL
#include "sp_defs.h"
#define MAX_REC_LENGTH 1024
@ -553,3 +555,11 @@ static void rtree_PrintWKB(uchar *wkb, uint n_dims)
}
}
}
#else
int main(int argc __attribute__((unused)),char *argv[] __attribute__((unused)))
{
exit(0);
}
#endif /*HAVE_SPATIAL*/

View file

@ -181,7 +181,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
for (length=0 ; length < 8 && uniq ; length++)
{
*end_pos++= _dig_vec[(int) (uniq & 31)];
*end_pos++= _dig_vec_upper[(int) (uniq & 31)];
uniq >>= 5;
}
(void) strmov(end_pos,TMP_EXT);

View file

@ -90,9 +90,9 @@ int my_error(int nr,myf MyFlags, ...)
register int iarg;
iarg = va_arg(ap, int);
if (*tpos == 'd')
plen= (uint) (int2str((long) iarg,endpos, -10) - endpos);
plen= (uint) (int10_to_str((long) iarg, endpos, -10) - endpos);
else
plen= (uint) (int2str((long) (uint) iarg,endpos,10)- endpos);
plen= (uint) (int10_to_str((long) (uint) iarg, endpos, 10) - endpos);
if (olen + plen < ERRMSGSIZE+2) /* Replace parameter if possible */
{
endpos+=plen;

View file

@ -161,7 +161,7 @@ my_string my_tempnam(const char *dir, const char *pfx,
for (length=0 ; length < 8 && uniq ; length++)
{
*end_pos++= _dig_vec[(int) (uniq & 31)];
*end_pos++= _dig_vec_upper[(int) (uniq & 31)];
uniq >>= 5;
}
VOID(strmov(end_pos,TMP_EXT));

View file

@ -451,7 +451,7 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
/* Get number of connection */
connect_number = uint4korr(handle_connect_map);/*WAX2*/
p= int2str(connect_number, connect_number_char, 10);
p= int10_to_str(connect_number, connect_number_char, 10);
/*
The name of event and file-mapping events create agree next rule:

View file

@ -103,7 +103,7 @@ are determined in innobase_init below: */
char* innobase_data_home_dir = NULL;
char* innobase_data_file_path = NULL;
char* innobase_log_group_home_dir = NULL;
char* innobase_log_arch_dir = NULL;
char* innobase_log_arch_dir = NULL;/* unused */
/* The following has a misleading name: starting from 4.0.5, this also
affects Windows: */
char* innobase_unix_file_flush_method = NULL;
@ -112,7 +112,7 @@ char* innobase_unix_file_flush_method = NULL;
values */
uint innobase_flush_log_at_trx_commit = 1;
my_bool innobase_log_archive = FALSE;
my_bool innobase_log_archive = FALSE;/* unused */
my_bool innobase_use_native_aio = FALSE;
my_bool innobase_fast_shutdown = TRUE;
my_bool innobase_file_per_table = FALSE;
@ -839,7 +839,8 @@ innobase_init(void)
if (!innobase_log_group_home_dir) {
innobase_log_group_home_dir = default_path;
}
#ifdef UNIV_LOG_ARCHIVE
/* Since innodb_log_arch_dir has no relevance under MySQL,
starting from 4.0.6 we always set it the same as
innodb_log_group_home_dir: */
@ -847,6 +848,7 @@ innobase_init(void)
innobase_log_arch_dir = innobase_log_group_home_dir;
srv_arch_dir = innobase_log_arch_dir;
#endif /* UNIG_LOG_ARCHIVE */
ret = (bool)
srv_parse_log_group_home_dirs(innobase_log_group_home_dir,
@ -868,7 +870,9 @@ innobase_init(void)
srv_n_log_files = (ulint) innobase_log_files_in_group;
srv_log_file_size = (ulint) innobase_log_file_size;
#ifdef UNIV_LOG_ARCHIVE
srv_log_archive_on = (ulint) innobase_log_archive;
#endif /* UNIV_LOG_ARCHIVE */
srv_log_buffer_size = (ulint) innobase_log_buffer_size;
srv_flush_log_at_trx_commit = (ulint) innobase_flush_log_at_trx_commit;

View file

@ -2285,8 +2285,8 @@ String *Item_func_hex::val_str(String *str)
from++, to+=2)
{
uint tmp=(uint) (uchar) *from;
to[0]=_dig_vec[tmp >> 4];
to[1]=_dig_vec[tmp & 15];
to[0]=_dig_vec_upper[tmp >> 4];
to[1]=_dig_vec_upper[tmp & 15];
}
return &tmp_value;
}
@ -2746,9 +2746,6 @@ static uint nanoseq;
static ulonglong uuid_time=0;
static char clock_seq_and_node_str[]="-0000-000000000000";
/* we cannot use _dig_vec[] as letters should be lowercase */
static const char hex[] = "0123456789abcdef";
/* number of 100-nanosecond intervals between
1582-10-15 00:00:00.00 and 1970-01-01 00:00:00.00 */
#define UUID_TIME_OFFSET ((ulonglong) 141427 * 24 * 60 * 60 * 1000 * 10 )
@ -2761,7 +2758,7 @@ static void tohex(char *to, uint from, uint len)
to+= len;
while (len--)
{
*--to= hex[from & 15];
*--to= _dig_vec_lower[from & 15];
from >>= 4;
}
}
@ -2798,8 +2795,8 @@ String *Item_func_uuid::val_str(String *str)
s=clock_seq_and_node_str+sizeof(clock_seq_and_node_str)-1;
for (i=sizeof(mac)-1 ; i>=0 ; i--)
{
*--s=hex[mac[i] & 15];
*--s=hex[mac[i] >> 4];
*--s=_dig_vec_lower[mac[i] & 15];
*--s=_dig_vec_lower[mac[i] >> 4];
}
randominit(&uuid_rand, tmp + (ulong)start_time, tmp + bytes_sent);
set_clock_seq_str();

View file

@ -3015,7 +3015,7 @@ int main(int argc, char **argv)
need to have an unique named hEventShudown through the
application PID e.g.: MySQLShutdown1890; MySQLShutdown2342
*/
int2str((int) GetCurrentProcessId(),strmov(shutdown_event_name,
int10_to_str((int) GetCurrentProcessId(),strmov(shutdown_event_name,
"MySQLShutdown"), 10);
/* Must be initialized early for comparison of service name */
@ -3635,7 +3635,7 @@ pthread_handler_decl(handle_connections_shared_memory,arg)
HANDLE event_server_read= 0;
THD *thd= 0;
p= int2str(connect_number, connect_number_char, 10);
p= int10_to_str(connect_number, connect_number_char, 10);
/*
The name of event and file-mapping events create agree next rule:
shared_memory_base_name+unique_part+number_of_connection
@ -6224,7 +6224,7 @@ static void create_pid_file()
O_WRONLY | O_TRUNC, MYF(MY_WME))) >= 0)
{
char buff[21], *end;
end= int2str((long) getpid(), buff, 10);
end= int10_to_str((long) getpid(), buff, 10);
*end++= '\n';
(void) my_write(file, (byte*) buff, (uint) (end-buff),MYF(MY_WME));
(void) my_close(file, MYF(0));

View file

@ -321,8 +321,8 @@ octet2hex(char *to, const uint8 *str, uint len)
const uint8 *str_end= str + len;
for (; str != str_end; ++str)
{
*to++= _dig_vec[(*str & 0xF0) >> 4];
*to++= _dig_vec[*str & 0x0F];
*to++= _dig_vec_upper[(*str & 0xF0) >> 4];
*to++= _dig_vec_upper[*str & 0x0F];
}
*to= '\0';
}

View file

@ -15,6 +15,9 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mysql_priv.h"
#ifdef HAVE_SPATIAL
#define MAX_DIGITS_IN_DOUBLE 16
/***************************** Gis_class_info *******************************/
@ -1652,3 +1655,4 @@ const Geometry::Class_info *Gis_geometry_collection::get_class_info() const
return &geometrycollection_class;
}
#endif /*HAVE_SPATIAL*/

View file

@ -17,6 +17,8 @@
#ifndef _spatial_h
#define _spatial_h
#ifdef HAVE_SPATIAL
const uint SRID_SIZE= 4;
const uint SIZEOF_STORED_DOUBLE= 8;
const uint POINT_DATA_SIZE= SIZEOF_STORED_DOUBLE*2;
@ -459,4 +461,5 @@ struct Geometry_buffer
void *arr[(geometry_buffer_size - 1)/sizeof(void *) + 1];
};
#endif /*HAVE_SPATAIAL*/
#endif

View file

@ -64,15 +64,15 @@ public:
char *s=buf; int i;
for (i=sizeof(buffer)-1; i>=0 ; i--)
{
if ((*s=_dig_vec[buffer[i] >> 4]) != '0')
if ((*s=_dig_vec_upper[buffer[i] >> 4]) != '0')
break;
if ((*s=_dig_vec[buffer[i] & 15]) != '0')
if ((*s=_dig_vec_upper[buffer[i] & 15]) != '0')
break;
}
for (s++, i-- ; i>=0 ; i--)
{
*s++=_dig_vec[buffer[i] >> 4];
*s++=_dig_vec[buffer[i] & 15];
*s++=_dig_vec_upper[buffer[i] >> 4];
*s++=_dig_vec_upper[buffer[i] & 15];
}
*s=0;
return buf;

View file

@ -1312,7 +1312,6 @@ type:
$$=FIELD_TYPE_GEOMETRY;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
sym_group_geom.name,
sym_group_geom.needed_define);
YYABORT;
@ -1630,7 +1629,6 @@ key_type:
$$= Key::SPATIAL;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
@ -1664,7 +1662,6 @@ opt_unique_or_fulltext:
$$= Key::SPATIAL;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif
@ -2676,7 +2673,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
@ -2688,7 +2684,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
@ -2700,7 +2695,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
@ -2712,7 +2706,6 @@ simple_expr:
if (!$1.symbol->create_func)
{
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
$1.symbol->group->name,
$1.symbol->group->needed_define);
YYABORT;
@ -2809,7 +2802,6 @@ simple_expr:
$$= $1;
#else
net_printf(Lex->thd, ER_FEATURE_DISABLED,
ER(ER_FEATURE_DISABLED),
sym_group_geom.name, sym_group_geom.needed_define);
YYABORT;
#endif

View file

@ -14,42 +14,50 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Defines: int2str(), itoa(), ltoa()
int2str(dst, radix, val)
converts the (long) integer "val" to character form and moves it to
the destination string "dst" followed by a terminating NUL. The
result is normally a pointer to this NUL character, but if the radix
is dud the result will be NullS and nothing will be changed.
If radix is -2..-36, val is taken to be SIGNED.
If radix is 2.. 36, val is taken to be UNSIGNED.
That is, val is signed if and only if radix is. You will normally
use radix -10 only through itoa and ltoa, for radix 2, 8, or 16
unsigned is what you generally want.
_dig_vec is public just in case someone has a use for it.
The definitions of itoa and ltoa are actually macros in m_string.h,
but this is where the code is.
Note: The standard itoa() returns a pointer to the argument, when int2str
returns the pointer to the end-null.
itoa assumes that 10 -base numbers are allways signed and other arn't.
*/
#include <my_global.h>
#include "m_string.h"
char NEAR _dig_vec[] =
/*
_dig_vec arrays are public because they are used in several outer places.
*/
char NEAR _dig_vec_upper[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char NEAR _dig_vec_lower[] =
"0123456789abcdefghijklmnopqrstuvwxyz";
char *int2str(register long int val, register char *dst, register int radix)
/*
Convert integer to its string representation in given scale of notation.
SYNOPSIS
int2str()
val - value to convert
dst - points to buffer where string representation should be stored
radix - radix of scale of notation
upcase - flag indicating that whenever we should use upper-case digits
DESCRIPTION
Converts the (long) integer value to its character form and moves it to
the destination buffer followed by a terminating NUL.
If radix is -2..-36, val is taken to be SIGNED, if radix is 2..36, val is
taken to be UNSIGNED. That is, val is signed if and only if radix is.
All other radixes treated as bad and nothing will be changed in this case.
For conversion to decimal representation (radix is -10 or 10) one can use
optimized int10_to_str() function.
RETURN VALUE
Pointer to ending NUL character or NullS if radix is bad.
*/
char *
int2str(register long int val, register char *dst, register int radix,
char upcase)
{
char buffer[65];
register char *p;
long int new_val;
char *dig_vec= upcase ? _dig_vec_upper : _dig_vec_lower;
if (radix < 0) {
if (radix < -36 || radix > -2) return NullS;
@ -75,21 +83,21 @@ char *int2str(register long int val, register char *dst, register int radix)
p = &buffer[sizeof(buffer)-1];
*p = '\0';
new_val=(ulong) val / (ulong) radix;
*--p = _dig_vec[(uchar) ((ulong) val- (ulong) new_val*(ulong) radix)];
*--p = dig_vec[(uchar) ((ulong) val- (ulong) new_val*(ulong) radix)];
val = new_val;
#ifdef HAVE_LDIV
while (val != 0)
{
ldiv_t res;
res=ldiv(val,radix);
*--p = _dig_vec[res.rem];
*--p = dig_vec[res.rem];
val= res.quot;
}
#else
while (val != 0)
{
new_val=val/radix;
*--p = _dig_vec[(uchar) (val-new_val*radix)];
*--p = dig_vec[(uchar) (val-new_val*radix)];
val= new_val;
}
#endif
@ -99,8 +107,21 @@ char *int2str(register long int val, register char *dst, register int radix)
/*
This is a faster version of the above optimized for the normal case of
radix 10 / -10
Converts integer to its string representation in decimal notation.
SYNOPSIS
int10_to_str()
val - value to convert
dst - points to buffer where string representation should be stored
radix - flag that shows whenever val should be taken as signed or not
DESCRIPTION
This is version of int2str() function which is optimized for normal case
of radix 10/-10. It takes only sign of radix parameter into account and
not its absolute value.
RETURN VALUE
Pointer to ending NUL character.
*/
char *int10_to_str(long int val,char *dst,int radix)
@ -133,22 +154,3 @@ char *int10_to_str(long int val,char *dst,int radix)
while ((*dst++ = *p++) != 0) ;
return dst-1;
}
#ifdef USE_MY_ITOA
/* Change to less general itoa interface */
char *my_itoa(int val, char *dst, int radix)
{
VOID(int2str((long) val,dst,(radix == 10 ? -10 : radix)));
return dst;
}
char *my_ltoa(long int val, char *dst, int radix)
{
VOID(int2str((long) val,dst,(radix == 10 ? -10 : radix)));
return dst;
}
#endif

View file

@ -83,7 +83,7 @@ longlong2str:
divl %ebx
decl %ecx
movl %eax,%esi # quotent in ebp:esi
movb _dig_vec(%edx),%al # al is faster than dl
movb _dig_vec_upper(%edx),%al # al is faster than dl
movb %al,(%ecx) # store value in buff
.align 4
.L155:
@ -93,7 +93,7 @@ longlong2str:
jl .L153
je .L10_mov # Ready
movl %esi,%eax
movl $_dig_vec,%ebp
movl $_dig_vec_upper,%ebp
.align 4
.L154: # Do rest with integer precision

View file

@ -43,8 +43,6 @@
#if defined(HAVE_LONG_LONG) && !defined(longlong2str) && !defined(HAVE_LONGLONG2STR)
extern char NEAR _dig_vec[];
/*
This assumes that longlong multiplication is faster than longlong division.
*/
@ -81,14 +79,14 @@ char *longlong2str(longlong val,char *dst,int radix)
{
ulonglong quo=(ulonglong) val/(uint) radix;
uint rem= (uint) (val- quo* (uint) radix);
*--p = _dig_vec[rem];
*--p = _dig_vec_upper[rem];
val= quo;
}
long_val= (long) val;
while (long_val != 0)
{
long quo= long_val/radix;
*--p = _dig_vec[(uchar) (long_val - quo*radix)];
*--p = _dig_vec_upper[(uchar) (long_val - quo*radix)];
long_val= quo;
}
while ((*dst++ = *p++) != 0) ;
@ -126,14 +124,14 @@ char *longlong10_to_str(longlong val,char *dst,int radix)
{
ulonglong quo=(ulonglong) val/(uint) 10;
uint rem= (uint) (val- quo* (uint) 10);
*--p = _dig_vec[rem];
*--p = _dig_vec_upper[rem];
val= quo;
}
long_val= (long) val;
while (long_val != 0)
{
long quo= long_val/10;
*--p = _dig_vec[(uchar) (long_val - quo*10)];
*--p = _dig_vec_upper[(uchar) (long_val - quo*10)];
long_val= quo;
}
while ((*dst++ = *p++) != 0) ;

View file

@ -118,7 +118,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
if (*fmt== 'u')
store_end= int10_to_str(larg, store_start, 10);
else
store_end= int2str(larg, store_start, 16);
store_end= int2str(larg, store_start, 16, 0);
if ((res_length= (uint) (store_end - store_start)) > to_length)
break; /* num doesn't fit in output */
/* If %#d syntax was used, we have to pre-zero/pre-space the string */