2001-02-17 14:19:19 +02:00
|
|
|
/******************************************************
|
|
|
|
Database object creation
|
|
|
|
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
|
|
|
|
Created 1/8/1996 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#include "dict0crea.h"
|
|
|
|
|
|
|
|
#ifdef UNIV_NONINL
|
|
|
|
#include "dict0crea.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "btr0pcur.h"
|
|
|
|
#include "btr0btr.h"
|
|
|
|
#include "page0page.h"
|
|
|
|
#include "mach0data.h"
|
|
|
|
#include "dict0boot.h"
|
2001-10-10 22:47:08 +03:00
|
|
|
#include "dict0dict.h"
|
2001-02-17 14:19:19 +02:00
|
|
|
#include "que0que.h"
|
|
|
|
#include "row0ins.h"
|
2001-10-10 22:47:08 +03:00
|
|
|
#include "row0mysql.h"
|
2001-02-17 14:19:19 +02:00
|
|
|
#include "pars0pars.h"
|
2001-10-10 22:47:08 +03:00
|
|
|
#include "trx0roll.h"
|
|
|
|
#include "usr0sess.h"
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
Based on a table object, this function builds the entry to be inserted
|
|
|
|
in the SYS_TABLES system table. */
|
|
|
|
static
|
|
|
|
dtuple_t*
|
|
|
|
dict_create_sys_tables_tuple(
|
|
|
|
/*=========================*/
|
2004-07-30 16:58:25 +03:00
|
|
|
/* out: the tuple which should be inserted */
|
2001-02-17 14:19:19 +02:00
|
|
|
dict_table_t* table, /* in: table */
|
|
|
|
mem_heap_t* heap) /* in: memory heap from which the memory for
|
|
|
|
the built tuple is allocated */
|
|
|
|
{
|
|
|
|
dict_table_t* sys_tables;
|
|
|
|
dtuple_t* entry;
|
|
|
|
dfield_t* dfield;
|
|
|
|
byte* ptr;
|
|
|
|
|
|
|
|
ut_ad(table && heap);
|
|
|
|
|
|
|
|
sys_tables = dict_sys->sys_tables;
|
|
|
|
|
|
|
|
entry = dtuple_create(heap, 8 + DATA_N_SYS_COLS);
|
|
|
|
|
|
|
|
/* 0: NAME -----------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 0);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, table->name, ut_strlen(table->name));
|
|
|
|
/* 3: ID -------------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 1);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 8);
|
|
|
|
mach_write_to_8(ptr, table->id);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 8);
|
|
|
|
/* 4: N_COLS ---------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 2);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, table->n_def);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 5: TYPE -----------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 3);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, table->type);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 6: MIX_ID ---------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 4);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 8);
|
|
|
|
mach_write_to_8(ptr, table->mix_id);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 8);
|
|
|
|
/* 7: MIX_LEN --------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 5);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, table->mix_len);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 8: CLUSTER_NAME ---------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 6);
|
|
|
|
|
|
|
|
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
|
|
|
dfield_set_data(dfield, table->cluster_name,
|
|
|
|
ut_strlen(table->cluster_name));
|
2004-03-13 22:48:00 +02:00
|
|
|
ut_error; /* Oracle-style clusters are not supported yet */
|
2001-02-17 14:19:19 +02:00
|
|
|
} else {
|
|
|
|
dfield_set_data(dfield, NULL, UNIV_SQL_NULL);
|
|
|
|
}
|
|
|
|
/* 9: SPACE ----------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 7);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, table->space);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/*----------------------------------*/
|
|
|
|
|
|
|
|
dict_table_copy_types(entry, sys_tables);
|
|
|
|
|
|
|
|
return(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
Based on a table object, this function builds the entry to be inserted
|
|
|
|
in the SYS_COLUMNS system table. */
|
|
|
|
static
|
|
|
|
dtuple_t*
|
|
|
|
dict_create_sys_columns_tuple(
|
|
|
|
/*==========================*/
|
|
|
|
/* out: the tuple which should be inserted */
|
|
|
|
dict_table_t* table, /* in: table */
|
|
|
|
ulint i, /* in: column number */
|
|
|
|
mem_heap_t* heap) /* in: memory heap from which the memory for
|
|
|
|
the built tuple is allocated */
|
|
|
|
{
|
|
|
|
dict_table_t* sys_columns;
|
|
|
|
dtuple_t* entry;
|
|
|
|
dict_col_t* column;
|
|
|
|
dfield_t* dfield;
|
|
|
|
byte* ptr;
|
|
|
|
|
|
|
|
ut_ad(table && heap);
|
|
|
|
|
|
|
|
column = dict_table_get_nth_col(table, i);
|
|
|
|
|
|
|
|
sys_columns = dict_sys->sys_columns;
|
|
|
|
|
|
|
|
entry = dtuple_create(heap, 7 + DATA_N_SYS_COLS);
|
|
|
|
|
|
|
|
/* 0: TABLE_ID -----------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 0);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 8);
|
|
|
|
mach_write_to_8(ptr, table->id);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 8);
|
|
|
|
/* 1: POS ----------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 1);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, i);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 4: NAME ---------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 2);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, column->name, ut_strlen(column->name));
|
|
|
|
/* 5: MTYPE --------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 3);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, (column->type).mtype);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 6: PRTYPE -------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 4);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, (column->type).prtype);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 7: LEN ----------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 5);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, (column->type).len);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 8: PREC ---------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 6);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, (column->type).prec);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/*---------------------------------*/
|
|
|
|
|
|
|
|
dict_table_copy_types(entry, sys_columns);
|
|
|
|
|
|
|
|
return(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
Builds a table definition to insert. */
|
|
|
|
static
|
|
|
|
ulint
|
|
|
|
dict_build_table_def_step(
|
|
|
|
/*======================*/
|
|
|
|
/* out: DB_SUCCESS or error code */
|
|
|
|
que_thr_t* thr, /* in: query thread */
|
|
|
|
tab_node_t* node) /* in: table create node */
|
|
|
|
{
|
|
|
|
dict_table_t* table;
|
|
|
|
dict_table_t* cluster_table;
|
|
|
|
dtuple_t* row;
|
2003-10-07 17:28:59 +03:00
|
|
|
ulint error;
|
|
|
|
mtr_t mtr;
|
2001-02-17 14:19:19 +02:00
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
table = node->table;
|
|
|
|
|
|
|
|
table->id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
|
|
|
|
|
|
|
|
thr_get_trx(thr)->table_id = table->id;
|
|
|
|
|
|
|
|
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
|
|
|
|
|
|
|
cluster_table = dict_table_get_low(table->cluster_name);
|
|
|
|
|
|
|
|
if (cluster_table == NULL) {
|
|
|
|
|
|
|
|
return(DB_CLUSTER_NOT_FOUND);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Inherit space and mix len from the cluster */
|
|
|
|
|
|
|
|
table->space = cluster_table->space;
|
|
|
|
table->mix_len = cluster_table->mix_len;
|
|
|
|
|
|
|
|
table->mix_id = dict_hdr_get_new_id(DICT_HDR_MIX_ID);
|
|
|
|
}
|
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
if (srv_file_per_table) {
|
|
|
|
/* We create a new single-table tablespace for the table.
|
|
|
|
We initially let it be 4 pages:
|
|
|
|
- page 0 is the fsp header and an extent descriptor page,
|
|
|
|
- page 1 is an ibuf bitmap page,
|
|
|
|
- page 2 is the first inode page,
|
|
|
|
- page 3 will contain the root of the clustered index of the
|
|
|
|
table we create here. */
|
2003-11-03 19:11:09 +02:00
|
|
|
|
|
|
|
table->space = 0; /* reset to zero for the call below */
|
2003-10-07 17:28:59 +03:00
|
|
|
|
|
|
|
error = fil_create_new_single_table_tablespace(
|
2003-11-03 19:11:09 +02:00
|
|
|
&(table->space), table->name,
|
|
|
|
FIL_IBD_FILE_INITIAL_SIZE);
|
2003-10-07 17:28:59 +03:00
|
|
|
if (error != DB_SUCCESS) {
|
|
|
|
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2003-11-03 19:11:09 +02:00
|
|
|
fsp_header_init(table->space, FIL_IBD_FILE_INITIAL_SIZE, &mtr);
|
2003-10-07 17:28:59 +03:00
|
|
|
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
}
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
row = dict_create_sys_tables_tuple(table, node->heap);
|
|
|
|
|
|
|
|
ins_node_set_new_row(node->tab_def, row);
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
Builds a column definition to insert. */
|
|
|
|
static
|
|
|
|
ulint
|
|
|
|
dict_build_col_def_step(
|
|
|
|
/*====================*/
|
|
|
|
/* out: DB_SUCCESS */
|
|
|
|
tab_node_t* node) /* in: table create node */
|
|
|
|
{
|
|
|
|
dtuple_t* row;
|
|
|
|
|
|
|
|
row = dict_create_sys_columns_tuple(node->table, node->col_no,
|
|
|
|
node->heap);
|
|
|
|
ins_node_set_new_row(node->col_def, row);
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
Based on an index object, this function builds the entry to be inserted
|
|
|
|
in the SYS_INDEXES system table. */
|
|
|
|
static
|
|
|
|
dtuple_t*
|
|
|
|
dict_create_sys_indexes_tuple(
|
|
|
|
/*==========================*/
|
|
|
|
/* out: the tuple which should be inserted */
|
|
|
|
dict_index_t* index, /* in: index */
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
mem_heap_t* heap) /* in: memory heap from which the memory for
|
2001-02-17 14:19:19 +02:00
|
|
|
the built tuple is allocated */
|
|
|
|
{
|
|
|
|
dict_table_t* sys_indexes;
|
|
|
|
dict_table_t* table;
|
|
|
|
dtuple_t* entry;
|
|
|
|
dfield_t* dfield;
|
|
|
|
byte* ptr;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(index && heap);
|
|
|
|
|
|
|
|
sys_indexes = dict_sys->sys_indexes;
|
|
|
|
|
|
|
|
table = dict_table_get_low(index->table_name);
|
|
|
|
|
|
|
|
entry = dtuple_create(heap, 7 + DATA_N_SYS_COLS);
|
|
|
|
|
|
|
|
/* 0: TABLE_ID -----------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 0);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 8);
|
|
|
|
mach_write_to_8(ptr, table->id);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 8);
|
|
|
|
/* 1: ID ----------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 1);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 8);
|
|
|
|
mach_write_to_8(ptr, index->id);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 8);
|
|
|
|
/* 4: NAME --------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 2);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, index->name, ut_strlen(index->name));
|
|
|
|
/* 5: N_FIELDS ----------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 3);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, index->n_fields);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 6: TYPE --------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 4);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, index->type);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 7: SPACE --------------------------*/
|
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
#if DICT_SYS_INDEXES_SPACE_NO_FIELD != 7
|
|
|
|
#error "DICT_SYS_INDEXES_SPACE_NO_FIELD != 7"
|
|
|
|
#endif
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
dfield = dtuple_get_nth_field(entry, 5);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, index->space);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 8: PAGE_NO --------------------------*/
|
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
#if DICT_SYS_INDEXES_PAGE_NO_FIELD != 8
|
|
|
|
#error "DICT_SYS_INDEXES_PAGE_NO_FIELD != 8"
|
|
|
|
#endif
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
dfield = dtuple_get_nth_field(entry, 6);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
|
|
|
mach_write_to_4(ptr, FIL_NULL);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/*--------------------------------*/
|
|
|
|
|
|
|
|
dict_table_copy_types(entry, sys_indexes);
|
|
|
|
|
|
|
|
return(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
Based on an index object, this function builds the entry to be inserted
|
|
|
|
in the SYS_FIELDS system table. */
|
|
|
|
static
|
|
|
|
dtuple_t*
|
|
|
|
dict_create_sys_fields_tuple(
|
|
|
|
/*=========================*/
|
|
|
|
/* out: the tuple which should be inserted */
|
|
|
|
dict_index_t* index, /* in: index */
|
|
|
|
ulint i, /* in: field number */
|
|
|
|
mem_heap_t* heap) /* in: memory heap from which the memory for
|
|
|
|
the built tuple is allocated */
|
|
|
|
{
|
|
|
|
dict_table_t* sys_fields;
|
|
|
|
dtuple_t* entry;
|
|
|
|
dict_field_t* field;
|
|
|
|
dfield_t* dfield;
|
|
|
|
byte* ptr;
|
2003-06-15 01:04:28 +03:00
|
|
|
ibool index_contains_column_prefix_field = FALSE;
|
|
|
|
ulint j;
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
ut_ad(index && heap);
|
|
|
|
|
2003-06-15 01:04:28 +03:00
|
|
|
for (j = 0; j < index->n_fields; j++) {
|
|
|
|
if (dict_index_get_nth_field(index, j)->prefix_len > 0) {
|
|
|
|
index_contains_column_prefix_field = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
field = dict_index_get_nth_field(index, i);
|
|
|
|
|
|
|
|
sys_fields = dict_sys->sys_fields;
|
|
|
|
|
|
|
|
entry = dtuple_create(heap, 3 + DATA_N_SYS_COLS);
|
|
|
|
|
|
|
|
/* 0: INDEX_ID -----------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 0);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 8);
|
|
|
|
mach_write_to_8(ptr, index->id);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 8);
|
2003-06-15 01:04:28 +03:00
|
|
|
/* 1: POS + PREFIX LENGTH ----------------------------*/
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
dfield = dtuple_get_nth_field(entry, 1);
|
|
|
|
|
|
|
|
ptr = mem_heap_alloc(heap, 4);
|
2003-06-15 01:04:28 +03:00
|
|
|
|
|
|
|
if (index_contains_column_prefix_field) {
|
|
|
|
/* If there are column prefix fields in the index, then
|
|
|
|
we store the number of the field to the 2 HIGH bytes
|
|
|
|
and the prefix length to the 2 low bytes, */
|
|
|
|
|
|
|
|
mach_write_to_4(ptr, (i << 16) + field->prefix_len);
|
|
|
|
} else {
|
|
|
|
/* Else we store the number of the field to the 2 LOW bytes.
|
|
|
|
This is to keep the storage format compatible with
|
|
|
|
InnoDB versions < 4.0.14. */
|
|
|
|
|
|
|
|
mach_write_to_4(ptr, i);
|
|
|
|
}
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
dfield_set_data(dfield, ptr, 4);
|
|
|
|
/* 4: COL_NAME -------------------------*/
|
|
|
|
dfield = dtuple_get_nth_field(entry, 2);
|
|
|
|
|
|
|
|
dfield_set_data(dfield, field->name,
|
|
|
|
ut_strlen(field->name));
|
|
|
|
/*---------------------------------*/
|
|
|
|
|
|
|
|
dict_table_copy_types(entry, sys_fields);
|
|
|
|
|
|
|
|
return(entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
2003-10-07 17:28:59 +03:00
|
|
|
Creates the tuple with which the index entry is searched for writing the index
|
|
|
|
tree root page number, if such a tree is created. */
|
2001-02-17 14:19:19 +02:00
|
|
|
static
|
|
|
|
dtuple_t*
|
|
|
|
dict_create_search_tuple(
|
|
|
|
/*=====================*/
|
|
|
|
/* out: the tuple for search */
|
|
|
|
dtuple_t* tuple, /* in: the tuple inserted in the SYS_INDEXES
|
|
|
|
table */
|
|
|
|
mem_heap_t* heap) /* in: memory heap from which the memory for
|
|
|
|
the built tuple is allocated */
|
|
|
|
{
|
|
|
|
dtuple_t* search_tuple;
|
|
|
|
dfield_t* field1;
|
|
|
|
dfield_t* field2;
|
|
|
|
|
|
|
|
ut_ad(tuple && heap);
|
|
|
|
|
|
|
|
search_tuple = dtuple_create(heap, 2);
|
|
|
|
|
|
|
|
field1 = dtuple_get_nth_field(tuple, 0);
|
|
|
|
field2 = dtuple_get_nth_field(search_tuple, 0);
|
|
|
|
|
|
|
|
dfield_copy(field2, field1);
|
|
|
|
|
|
|
|
field1 = dtuple_get_nth_field(tuple, 1);
|
|
|
|
field2 = dtuple_get_nth_field(search_tuple, 1);
|
|
|
|
|
|
|
|
dfield_copy(field2, field1);
|
|
|
|
|
|
|
|
ut_ad(dtuple_validate(search_tuple));
|
|
|
|
|
|
|
|
return(search_tuple);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
Builds an index definition row to insert. */
|
|
|
|
static
|
|
|
|
ulint
|
|
|
|
dict_build_index_def_step(
|
|
|
|
/*======================*/
|
|
|
|
/* out: DB_SUCCESS or error code */
|
|
|
|
que_thr_t* thr, /* in: query thread */
|
|
|
|
ind_node_t* node) /* in: index create node */
|
|
|
|
{
|
|
|
|
dict_table_t* table;
|
|
|
|
dict_index_t* index;
|
|
|
|
dtuple_t* row;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
index = node->index;
|
|
|
|
|
|
|
|
table = dict_table_get_low(index->table_name);
|
|
|
|
|
|
|
|
if (table == NULL) {
|
|
|
|
return(DB_TABLE_NOT_FOUND);
|
|
|
|
}
|
|
|
|
|
|
|
|
thr_get_trx(thr)->table_id = table->id;
|
|
|
|
|
|
|
|
node->table = table;
|
|
|
|
|
|
|
|
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
|
|
|
|
|| (index->type & DICT_CLUSTERED));
|
|
|
|
|
|
|
|
index->id = dict_hdr_get_new_id(DICT_HDR_INDEX_ID);
|
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
/* Inherit the space id from the table; we store all indexes of a
|
|
|
|
table in the same tablespace */
|
|
|
|
|
|
|
|
index->space = table->space;
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
index->page_no = FIL_NULL;
|
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
row = dict_create_sys_indexes_tuple(index, node->heap);
|
2001-02-17 14:19:19 +02:00
|
|
|
node->ind_row = row;
|
|
|
|
|
|
|
|
ins_node_set_new_row(node->ind_def, row);
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
Builds a field definition row to insert. */
|
|
|
|
static
|
|
|
|
ulint
|
|
|
|
dict_build_field_def_step(
|
|
|
|
/*======================*/
|
|
|
|
/* out: DB_SUCCESS */
|
|
|
|
ind_node_t* node) /* in: index create node */
|
|
|
|
{
|
|
|
|
dict_index_t* index;
|
|
|
|
dtuple_t* row;
|
|
|
|
|
|
|
|
index = node->index;
|
|
|
|
|
|
|
|
row = dict_create_sys_fields_tuple(index, node->field_no, node->heap);
|
|
|
|
|
|
|
|
ins_node_set_new_row(node->field_def, row);
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
Creates an index tree for the index if it is not a member of a cluster. */
|
|
|
|
static
|
|
|
|
ulint
|
|
|
|
dict_create_index_tree_step(
|
|
|
|
/*========================*/
|
|
|
|
/* out: DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
|
|
|
|
ind_node_t* node) /* in: index create node */
|
|
|
|
{
|
|
|
|
dict_index_t* index;
|
|
|
|
dict_table_t* sys_indexes;
|
|
|
|
dict_table_t* table;
|
|
|
|
dtuple_t* search_tuple;
|
|
|
|
btr_pcur_t pcur;
|
|
|
|
mtr_t mtr;
|
2004-03-12 17:14:51 +02:00
|
|
|
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
index = node->index;
|
|
|
|
table = node->table;
|
|
|
|
|
|
|
|
sys_indexes = dict_sys->sys_indexes;
|
|
|
|
|
|
|
|
if (index->type & DICT_CLUSTERED
|
|
|
|
&& table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
|
|
|
|
|
|
|
/* Do not create a new index tree: entries are put to the
|
|
|
|
cluster tree */
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Run a mini-transaction in which the index tree is allocated for
|
|
|
|
the index and its root address is written to the index entry in
|
|
|
|
sys_indexes */
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
|
|
|
search_tuple = dict_create_search_tuple(node->ind_row, node->heap);
|
|
|
|
|
|
|
|
btr_pcur_open(UT_LIST_GET_FIRST(sys_indexes->indexes),
|
|
|
|
search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF,
|
|
|
|
&pcur, &mtr);
|
|
|
|
|
|
|
|
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
|
|
|
|
|
|
|
|
index->page_no = btr_create(index->type, index->space, index->id,
|
|
|
|
&mtr);
|
2003-10-07 17:28:59 +03:00
|
|
|
/* printf("Created a new index tree in space %lu root page %lu\n",
|
|
|
|
index->space, index->page_no); */
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
page_rec_write_index_page_no(btr_pcur_get_rec(&pcur),
|
|
|
|
DICT_SYS_INDEXES_PAGE_NO_FIELD,
|
|
|
|
index->page_no, &mtr);
|
|
|
|
btr_pcur_close(&pcur);
|
|
|
|
mtr_commit(&mtr);
|
|
|
|
|
|
|
|
if (index->page_no == FIL_NULL) {
|
|
|
|
|
|
|
|
return(DB_OUT_OF_FILE_SPACE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Drops the index tree associated with a row in SYS_INDEXES table. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_drop_index_tree(
|
|
|
|
/*=================*/
|
|
|
|
rec_t* rec, /* in: record in the clustered index of SYS_INDEXES
|
|
|
|
table */
|
|
|
|
mtr_t* mtr) /* in: mtr having the latch on the record page */
|
|
|
|
{
|
|
|
|
ulint root_page_no;
|
|
|
|
ulint space;
|
|
|
|
byte* ptr;
|
|
|
|
ulint len;
|
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
ptr = rec_get_nth_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
|
|
|
|
|
|
|
|
ut_ad(len == 4);
|
|
|
|
|
|
|
|
root_page_no = mtr_read_ulint(ptr, MLOG_4BYTES, mtr);
|
|
|
|
|
|
|
|
if (root_page_no == FIL_NULL) {
|
|
|
|
/* The tree has already been freed */
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr = rec_get_nth_field(rec, DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
|
|
|
|
|
|
|
|
ut_ad(len == 4);
|
|
|
|
|
|
|
|
space = mtr_read_ulint(ptr, MLOG_4BYTES, mtr);
|
2003-10-07 17:28:59 +03:00
|
|
|
|
|
|
|
if (!fil_tablespace_exists_in_mem(space)) {
|
|
|
|
/* It is a single table tablespace and the .ibd file is
|
|
|
|
missing: do nothing */
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
/* We free all the pages but the root page first; this operation
|
|
|
|
may span several mini-transactions */
|
|
|
|
|
|
|
|
btr_free_but_not_root(space, root_page_no);
|
|
|
|
|
|
|
|
/* Then we free the root page in the same mini-transaction where
|
|
|
|
we write FIL_NULL to the appropriate field in the SYS_INDEXES
|
|
|
|
record: this mini-transaction marks the B-tree totally freed */
|
|
|
|
|
2003-10-07 17:28:59 +03:00
|
|
|
/* printf("Dropping index tree in space %lu root page %lu\n", space,
|
|
|
|
root_page_no); */
|
2001-02-17 14:19:19 +02:00
|
|
|
btr_free_root(space, root_page_no, mtr);
|
|
|
|
|
|
|
|
page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
|
|
|
|
FIL_NULL, mtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Creates a table create graph. */
|
|
|
|
|
|
|
|
tab_node_t*
|
|
|
|
tab_create_graph_create(
|
|
|
|
/*====================*/
|
|
|
|
/* out, own: table create node */
|
|
|
|
dict_table_t* table, /* in: table to create, built as a memory data
|
|
|
|
structure */
|
|
|
|
mem_heap_t* heap) /* in: heap where created */
|
|
|
|
{
|
|
|
|
tab_node_t* node;
|
|
|
|
|
|
|
|
node = mem_heap_alloc(heap, sizeof(tab_node_t));
|
|
|
|
|
|
|
|
node->common.type = QUE_NODE_CREATE_TABLE;
|
|
|
|
|
|
|
|
node->table = table;
|
|
|
|
|
|
|
|
node->state = TABLE_BUILD_TABLE_DEF;
|
|
|
|
node->heap = mem_heap_create(256);
|
|
|
|
|
|
|
|
node->tab_def = ins_node_create(INS_DIRECT, dict_sys->sys_tables,
|
|
|
|
heap);
|
|
|
|
node->tab_def->common.parent = node;
|
|
|
|
|
|
|
|
node->col_def = ins_node_create(INS_DIRECT, dict_sys->sys_columns,
|
|
|
|
heap);
|
|
|
|
node->col_def->common.parent = node;
|
|
|
|
|
|
|
|
node->commit_node = commit_node_create(heap);
|
|
|
|
node->commit_node->common.parent = node;
|
|
|
|
|
|
|
|
return(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Creates an index create graph. */
|
|
|
|
|
|
|
|
ind_node_t*
|
|
|
|
ind_create_graph_create(
|
|
|
|
/*====================*/
|
|
|
|
/* out, own: index create node */
|
|
|
|
dict_index_t* index, /* in: index to create, built as a memory data
|
|
|
|
structure */
|
|
|
|
mem_heap_t* heap) /* in: heap where created */
|
|
|
|
{
|
|
|
|
ind_node_t* node;
|
|
|
|
|
|
|
|
node = mem_heap_alloc(heap, sizeof(ind_node_t));
|
|
|
|
|
|
|
|
node->common.type = QUE_NODE_CREATE_INDEX;
|
|
|
|
|
|
|
|
node->index = index;
|
|
|
|
|
|
|
|
node->state = INDEX_BUILD_INDEX_DEF;
|
|
|
|
node->heap = mem_heap_create(256);
|
|
|
|
|
|
|
|
node->ind_def = ins_node_create(INS_DIRECT,
|
|
|
|
dict_sys->sys_indexes, heap);
|
|
|
|
node->ind_def->common.parent = node;
|
|
|
|
|
|
|
|
node->field_def = ins_node_create(INS_DIRECT,
|
|
|
|
dict_sys->sys_fields, heap);
|
|
|
|
node->field_def->common.parent = node;
|
|
|
|
|
|
|
|
node->commit_node = commit_node_create(heap);
|
|
|
|
node->commit_node->common.parent = node;
|
|
|
|
|
|
|
|
return(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************
|
|
|
|
Creates a table. This is a high-level function used in SQL execution graphs. */
|
|
|
|
|
|
|
|
que_thr_t*
|
|
|
|
dict_create_table_step(
|
|
|
|
/*===================*/
|
|
|
|
/* out: query thread to run next or NULL */
|
|
|
|
que_thr_t* thr) /* in: query thread */
|
|
|
|
{
|
|
|
|
tab_node_t* node;
|
ut0ut.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mem0pool.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0file.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0shm.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0sync.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0thread.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
page0page.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
que0que.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0ins.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0mysql.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0sel.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0upd.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0vers.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
srv0srv.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
srv0start.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0arr.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0rw.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0sync.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
trx0rec.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
trx0trx.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
srv0srv.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0rw.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0sync.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
ut0dbg.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
lock0lock.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
log0log.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
log0recv.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
ibuf0ibuf.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0buf.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0buf.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
hash0hash.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mach0data.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mem0mem.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mem0pool.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mtr0mtr.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0file.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0sync.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0sync.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0thread.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
univ.i Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0mysql.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
com0shm.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
data0data.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
data0type.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
dict0crea.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
dict0dict.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
fil0fil.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
fsp0fsp.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
fut0lst.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
btr0sea.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0buf.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0flu.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
btr0btr.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
btr0cur.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/btr/btr0btr.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/btr/btr0cur.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/btr/btr0sea.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/buf/buf0buf.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/buf/buf0flu.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/com/com0shm.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/data/data0data.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/data/data0type.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/dict/dict0crea.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/dict/dict0dict.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/fil/fil0fil.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/fsp/fsp0fsp.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/fut/fut0lst.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/ibuf/ibuf0ibuf.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/buf0buf.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/buf0buf.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/hash0hash.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mach0data.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mem0mem.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mem0pool.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mtr0mtr.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0file.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0sync.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0sync.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0thread.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/row0mysql.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/univ.i:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/srv0srv.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/sync0rw.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/sync0sync.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/ut0dbg.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/lock/lock0lock.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/log/log0log.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/log/log0recv.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/mem/mem0pool.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0file.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0shm.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0sync.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0thread.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/page/page0page.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/que/que0que.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0ins.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0mysql.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0sel.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0upd.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0vers.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/srv/srv0srv.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/srv/srv0start.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/sync/sync0arr.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/sync/sync0rw.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/sync/sync0sync.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/trx/trx0rec.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/trx/trx0trx.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/ut/ut0ut.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
2001-03-02 17:33:11 +02:00
|
|
|
ulint err = DB_ERROR;
|
2001-02-17 14:19:19 +02:00
|
|
|
trx_t* trx;
|
|
|
|
|
|
|
|
ut_ad(thr);
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
|
2001-02-17 14:19:19 +02:00
|
|
|
trx = thr_get_trx(thr);
|
|
|
|
|
|
|
|
node = thr->run_node;
|
|
|
|
|
|
|
|
ut_ad(que_node_get_type(node) == QUE_NODE_CREATE_TABLE);
|
|
|
|
|
|
|
|
if (thr->prev_node == que_node_get_parent(node)) {
|
|
|
|
node->state = TABLE_BUILD_TABLE_DEF;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == TABLE_BUILD_TABLE_DEF) {
|
|
|
|
|
|
|
|
/* DO THE CHECKS OF THE CONSISTENCY CONSTRAINTS HERE */
|
|
|
|
|
|
|
|
err = dict_build_table_def_step(thr, node);
|
|
|
|
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
|
|
|
|
goto function_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
node->state = TABLE_BUILD_COL_DEF;
|
|
|
|
node->col_no = 0;
|
|
|
|
|
|
|
|
thr->run_node = node->tab_def;
|
|
|
|
|
|
|
|
return(thr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == TABLE_BUILD_COL_DEF) {
|
|
|
|
|
|
|
|
if (node->col_no < (node->table)->n_def) {
|
|
|
|
|
|
|
|
err = dict_build_col_def_step(node);
|
|
|
|
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
|
|
|
|
goto function_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
node->col_no++;
|
|
|
|
|
|
|
|
thr->run_node = node->col_def;
|
|
|
|
|
|
|
|
return(thr);
|
|
|
|
} else {
|
|
|
|
node->state = TABLE_COMMIT_WORK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == TABLE_COMMIT_WORK) {
|
|
|
|
|
|
|
|
/* Table was correctly defined: do NOT commit the transaction
|
|
|
|
(CREATE TABLE does NOT do an implicit commit of the current
|
|
|
|
transaction) */
|
|
|
|
|
|
|
|
node->state = TABLE_ADD_TO_CACHE;
|
|
|
|
|
|
|
|
/* thr->run_node = node->commit_node;
|
|
|
|
|
|
|
|
return(thr); */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == TABLE_ADD_TO_CACHE) {
|
|
|
|
|
|
|
|
dict_table_add_to_cache(node->table);
|
|
|
|
|
|
|
|
err = DB_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
function_exit:
|
|
|
|
trx->error_state = err;
|
|
|
|
|
|
|
|
if (err == DB_SUCCESS) {
|
|
|
|
/* Ok: do nothing */
|
|
|
|
|
|
|
|
} else if (err == DB_LOCK_WAIT) {
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
} else {
|
|
|
|
/* SQL error detected */
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
thr->run_node = que_node_get_parent(node);
|
|
|
|
|
|
|
|
return(thr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************
|
|
|
|
Creates an index. This is a high-level function used in SQL execution
|
|
|
|
graphs. */
|
|
|
|
|
|
|
|
que_thr_t*
|
|
|
|
dict_create_index_step(
|
|
|
|
/*===================*/
|
|
|
|
/* out: query thread to run next or NULL */
|
|
|
|
que_thr_t* thr) /* in: query thread */
|
|
|
|
{
|
|
|
|
ind_node_t* node;
|
|
|
|
ibool success;
|
ut0ut.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mem0pool.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0file.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0shm.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0sync.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0thread.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
page0page.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
que0que.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0ins.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0mysql.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0sel.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0upd.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0vers.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
srv0srv.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
srv0start.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0arr.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0rw.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0sync.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
trx0rec.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
trx0trx.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
srv0srv.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0rw.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
sync0sync.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
ut0dbg.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
lock0lock.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
log0log.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
log0recv.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
ibuf0ibuf.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0buf.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0buf.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
hash0hash.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mach0data.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mem0mem.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mem0pool.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
mtr0mtr.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0file.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0sync.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0sync.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
os0thread.h Fixes for 64-bit Linux, bug fixes, compiler warning fixes
univ.i Fixes for 64-bit Linux, bug fixes, compiler warning fixes
row0mysql.ic Fixes for 64-bit Linux, bug fixes, compiler warning fixes
com0shm.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
data0data.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
data0type.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
dict0crea.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
dict0dict.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
fil0fil.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
fsp0fsp.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
fut0lst.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
btr0sea.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0buf.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
buf0flu.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
btr0btr.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
btr0cur.c Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/btr/btr0btr.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/btr/btr0cur.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/btr/btr0sea.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/buf/buf0buf.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/buf/buf0flu.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/com/com0shm.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/data/data0data.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/data/data0type.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/dict/dict0crea.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/dict/dict0dict.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/fil/fil0fil.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/fsp/fsp0fsp.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/fut/fut0lst.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/ibuf/ibuf0ibuf.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/buf0buf.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/buf0buf.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/hash0hash.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mach0data.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mem0mem.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mem0pool.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/mtr0mtr.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0file.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0sync.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0sync.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/os0thread.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/row0mysql.ic:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/univ.i:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/srv0srv.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/sync0rw.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/sync0sync.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/include/ut0dbg.h:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/lock/lock0lock.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/log/log0log.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/log/log0recv.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/mem/mem0pool.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0file.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0shm.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0sync.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/os/os0thread.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/page/page0page.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/que/que0que.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0ins.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0mysql.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0sel.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0upd.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/row/row0vers.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/srv/srv0srv.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/srv/srv0start.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/sync/sync0arr.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/sync/sync0rw.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/sync/sync0sync.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/trx/trx0rec.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/trx/trx0trx.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
innobase/ut/ut0ut.c:
Fixes for 64-bit Linux, bug fixes, compiler warning fixes
2001-03-02 17:33:11 +02:00
|
|
|
ulint err = DB_ERROR;
|
2001-02-17 14:19:19 +02:00
|
|
|
trx_t* trx;
|
|
|
|
|
|
|
|
ut_ad(thr);
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2001-02-17 14:19:19 +02:00
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
2004-03-12 17:14:51 +02:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
trx = thr_get_trx(thr);
|
|
|
|
|
|
|
|
node = thr->run_node;
|
|
|
|
|
|
|
|
ut_ad(que_node_get_type(node) == QUE_NODE_CREATE_INDEX);
|
|
|
|
|
|
|
|
if (thr->prev_node == que_node_get_parent(node)) {
|
|
|
|
node->state = INDEX_BUILD_INDEX_DEF;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == INDEX_BUILD_INDEX_DEF) {
|
|
|
|
/* DO THE CHECKS OF THE CONSISTENCY CONSTRAINTS HERE */
|
|
|
|
err = dict_build_index_def_step(thr, node);
|
|
|
|
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
|
|
|
|
goto function_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
node->state = INDEX_BUILD_FIELD_DEF;
|
|
|
|
node->field_no = 0;
|
|
|
|
|
|
|
|
thr->run_node = node->ind_def;
|
|
|
|
|
|
|
|
return(thr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == INDEX_BUILD_FIELD_DEF) {
|
|
|
|
|
|
|
|
if (node->field_no < (node->index)->n_fields) {
|
|
|
|
|
|
|
|
err = dict_build_field_def_step(node);
|
|
|
|
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
|
|
|
|
goto function_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
node->field_no++;
|
|
|
|
|
|
|
|
thr->run_node = node->field_def;
|
|
|
|
|
|
|
|
return(thr);
|
|
|
|
} else {
|
|
|
|
node->state = INDEX_CREATE_INDEX_TREE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == INDEX_CREATE_INDEX_TREE) {
|
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
err = dict_create_index_tree_step(node);
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
|
|
|
|
goto function_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
node->state = INDEX_COMMIT_WORK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == INDEX_COMMIT_WORK) {
|
|
|
|
|
|
|
|
/* Index was correctly defined: do NOT commit the transaction
|
|
|
|
(CREATE INDEX does NOT currently do an implicit commit of
|
|
|
|
the current transaction) */
|
|
|
|
|
|
|
|
node->state = INDEX_ADD_TO_CACHE;
|
|
|
|
|
|
|
|
/* thr->run_node = node->commit_node;
|
|
|
|
|
|
|
|
return(thr); */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (node->state == INDEX_ADD_TO_CACHE) {
|
|
|
|
|
|
|
|
success = dict_index_add_to_cache(node->table, node->index);
|
|
|
|
|
|
|
|
ut_a(success);
|
|
|
|
|
|
|
|
err = DB_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
function_exit:
|
|
|
|
trx->error_state = err;
|
|
|
|
|
|
|
|
if (err == DB_SUCCESS) {
|
|
|
|
/* Ok: do nothing */
|
|
|
|
|
|
|
|
} else if (err == DB_LOCK_WAIT) {
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
} else {
|
|
|
|
/* SQL error detected */
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
thr->run_node = que_node_get_parent(node);
|
|
|
|
|
|
|
|
return(thr);
|
|
|
|
}
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
/********************************************************************
|
|
|
|
Creates the foreign key constraints system tables inside InnoDB
|
|
|
|
at database creation or database start if they are not found or are
|
|
|
|
not of the right form. */
|
|
|
|
|
|
|
|
ulint
|
|
|
|
dict_create_or_check_foreign_constraint_tables(void)
|
|
|
|
/*================================================*/
|
|
|
|
/* out: DB_SUCCESS or error code */
|
|
|
|
{
|
|
|
|
dict_table_t* table1;
|
|
|
|
dict_table_t* table2;
|
|
|
|
que_thr_t* thr;
|
|
|
|
que_t* graph;
|
|
|
|
ulint error;
|
|
|
|
trx_t* trx;
|
2004-05-27 15:27:43 +03:00
|
|
|
const char* str;
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
mutex_enter(&(dict_sys->mutex));
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
table1 = dict_table_get_low("SYS_FOREIGN");
|
|
|
|
table2 = dict_table_get_low("SYS_FOREIGN_COLS");
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
if (table1 && table2
|
|
|
|
&& UT_LIST_GET_LEN(table1->indexes) == 3
|
|
|
|
&& UT_LIST_GET_LEN(table2->indexes) == 1) {
|
|
|
|
|
|
|
|
/* Foreign constraint system tables have already been
|
|
|
|
created, and they are ok */
|
|
|
|
|
|
|
|
mutex_exit(&(dict_sys->mutex));
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
Many files:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
sql/ha_innodb.cc:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/dict/dict0crea.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/dict/dict0dict.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/log0recv.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/row0mysql.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/srv0srv.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/trx0trx.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/log/log0recv.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/os/os0sync.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/os/os0thread.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0ins.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0mysql.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0purge.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0undo.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0upd.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/srv/srv0srv.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/srv/srv0start.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/trx/trx0roll.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/trx/trx0trx.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
2002-11-06 00:41:27 +02:00
|
|
|
mutex_exit(&(dict_sys->mutex));
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
trx = trx_allocate_for_mysql();
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
trx->op_info = "creating foreign key sys tables";
|
2001-10-10 22:47:08 +03:00
|
|
|
|
Many files:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
sql/ha_innodb.cc:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/dict/dict0crea.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/dict/dict0dict.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/log0recv.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/row0mysql.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/srv0srv.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/trx0trx.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/log/log0recv.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/os/os0sync.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/os/os0thread.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0ins.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0mysql.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0purge.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0undo.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0upd.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/srv/srv0srv.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/srv/srv0start.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/trx/trx0roll.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/trx/trx0trx.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
2002-11-06 00:41:27 +02:00
|
|
|
row_mysql_lock_data_dictionary(trx);
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
if (table1) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: dropping incompletely created SYS_FOREIGN table\n");
|
2004-05-27 15:27:43 +03:00
|
|
|
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
|
2001-10-10 22:47:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (table2) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: dropping incompletely created SYS_FOREIGN_COLS table\n");
|
2004-05-27 15:27:43 +03:00
|
|
|
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
|
2001-10-10 22:47:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(stderr,
|
2001-10-30 17:38:44 +02:00
|
|
|
"InnoDB: Creating foreign key constraint system tables\n");
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
/* NOTE: in dict_load_foreigns we use the fact that
|
|
|
|
there are 2 secondary indexes on SYS_FOREIGN, and they
|
|
|
|
are defined just like below */
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
str =
|
2001-10-10 22:47:08 +03:00
|
|
|
"PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
|
|
|
|
"BEGIN\n"
|
|
|
|
"CREATE TABLE\n"
|
|
|
|
"SYS_FOREIGN(ID CHAR, FOR_NAME CHAR, REF_NAME CHAR, N_COLS INT);\n"
|
|
|
|
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN (ID);\n"
|
|
|
|
"CREATE INDEX FOR_IND ON SYS_FOREIGN (FOR_NAME);\n"
|
|
|
|
"CREATE INDEX REF_IND ON SYS_FOREIGN (REF_NAME);\n"
|
|
|
|
"CREATE TABLE\n"
|
|
|
|
"SYS_FOREIGN_COLS(ID CHAR, POS INT, FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n"
|
|
|
|
"CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN_COLS (ID, POS);\n"
|
|
|
|
"COMMIT WORK;\n"
|
|
|
|
"END;\n";
|
|
|
|
|
|
|
|
graph = pars_sql(str);
|
|
|
|
|
|
|
|
ut_a(graph);
|
|
|
|
|
|
|
|
graph->trx = trx;
|
|
|
|
trx->graph = NULL;
|
|
|
|
|
|
|
|
graph->fork_type = QUE_FORK_MYSQL_INTERFACE;
|
|
|
|
|
2004-03-11 12:55:28 +02:00
|
|
|
ut_a(thr = que_fork_start_command(graph));
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
que_run_threads(thr);
|
|
|
|
|
|
|
|
error = trx->error_state;
|
|
|
|
|
|
|
|
if (error != DB_SUCCESS) {
|
2003-12-20 03:41:04 +02:00
|
|
|
fprintf(stderr, "InnoDB: error %lu in creation\n",
|
|
|
|
(ulong) error);
|
2001-10-30 17:38:44 +02:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
ut_a(error == DB_OUT_OF_FILE_SPACE);
|
|
|
|
|
|
|
|
fprintf(stderr, "InnoDB: creation failed\n");
|
|
|
|
fprintf(stderr, "InnoDB: tablespace is full\n");
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: dropping incompletely created SYS_FOREIGN tables\n");
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
|
|
|
|
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
error = DB_MUST_GET_MORE_FILE_SPACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
que_graph_free(graph);
|
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
trx->op_info = "";
|
2001-10-10 22:47:08 +03:00
|
|
|
|
Many files:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
sql/ha_innodb.cc:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/dict/dict0crea.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/dict/dict0dict.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/log0recv.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/row0mysql.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/srv0srv.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/include/trx0trx.h:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/log/log0recv.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/os/os0sync.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/os/os0thread.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0ins.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0mysql.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0purge.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0undo.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/row/row0upd.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/srv/srv0srv.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/srv/srv0start.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/trx/trx0roll.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
innobase/trx/trx0trx.c:
Merge InnoDB-4.0.5b: minor improvements to foreign keys, more logical data dictionary lock
2002-11-06 00:41:27 +02:00
|
|
|
row_mysql_unlock_data_dictionary(trx);
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
trx_free_for_mysql(trx);
|
|
|
|
|
|
|
|
if (error == DB_SUCCESS) {
|
|
|
|
fprintf(stderr,
|
2001-10-30 17:38:44 +02:00
|
|
|
"InnoDB: Foreign key constraint system tables created\n");
|
2001-10-10 22:47:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
Many files:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/dict/dict0crea.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/dict/dict0dict.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0crea.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0dict.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/ut0mem.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/row/row0mysql.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/sync/sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/ut/ut0mem.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
2004-02-09 01:32:00 +02:00
|
|
|
Adds foreign key definitions to data dictionary tables in the database. We
|
|
|
|
look at table->foreign_list, and also generate names to constraints that were
|
|
|
|
not named by the user. A generated constraint has a name of the format
|
|
|
|
databasename/tablename_ibfk_<number>, where the numbers start from 1, and are
|
|
|
|
given locally for this table, that is, the number is not global, as in the
|
|
|
|
old format constraints < 4.0.18 it used to be. */
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
ulint
|
|
|
|
dict_create_add_foreigns_to_dictionary(
|
|
|
|
/*===================================*/
|
|
|
|
/* out: error code or DB_SUCCESS */
|
Many files:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/dict/dict0crea.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/dict/dict0dict.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0crea.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0dict.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/ut0mem.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/row/row0mysql.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/sync/sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/ut/ut0mem.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
2004-02-09 01:32:00 +02:00
|
|
|
ulint start_id,/* in: if we are actually doing ALTER TABLE
|
|
|
|
ADD CONSTRAINT, we want to generate constraint
|
|
|
|
numbers which are bigger than in the table so
|
|
|
|
far; we number the constraints from
|
|
|
|
start_id + 1 up; start_id should be set to 0 if
|
|
|
|
we are creating a new table, or if the table
|
|
|
|
so far has no constraints for which the name
|
|
|
|
was generated here */
|
2001-10-10 22:47:08 +03:00
|
|
|
dict_table_t* table, /* in: table */
|
|
|
|
trx_t* trx) /* in: transaction */
|
|
|
|
{
|
|
|
|
dict_foreign_t* foreign;
|
|
|
|
que_thr_t* thr;
|
|
|
|
que_t* graph;
|
Many files:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/dict/dict0crea.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/dict/dict0dict.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0crea.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0dict.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/ut0mem.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/row/row0mysql.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/sync/sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/ut/ut0mem.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
2004-02-09 01:32:00 +02:00
|
|
|
ulint number = start_id + 1;
|
2001-10-10 22:47:08 +03:00
|
|
|
ulint len;
|
|
|
|
ulint error;
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
FILE* ef = dict_foreign_err_file;
|
2001-10-10 22:47:08 +03:00
|
|
|
ulint i;
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
char* sql;
|
|
|
|
char* sqlend;
|
|
|
|
/* This procedure builds an InnoDB stored procedure which will insert
|
|
|
|
the necessary rows into SYS_FOREIGN and SYS_FOREIGN_COLS. */
|
|
|
|
static const char str1[] = "PROCEDURE ADD_FOREIGN_DEFS_PROC () IS\n"
|
|
|
|
"BEGIN\n"
|
|
|
|
"INSERT INTO SYS_FOREIGN VALUES(";
|
|
|
|
static const char str2[] = ");\n";
|
|
|
|
static const char str3[] =
|
|
|
|
"INSERT INTO SYS_FOREIGN_COLS VALUES(";
|
|
|
|
static const char str4[] =
|
|
|
|
"COMMIT WORK;\n"
|
|
|
|
"END;\n";
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2004-03-12 17:14:51 +02:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2001-10-10 22:47:08 +03:00
|
|
|
|
2004-05-27 15:27:43 +03:00
|
|
|
if (NULL == dict_table_get_low("SYS_FOREIGN")) {
|
2001-10-10 22:47:08 +03:00
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: table SYS_FOREIGN not found from internal data dictionary\n");
|
2003-04-16 16:45:01 +03:00
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
return(DB_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreign = UT_LIST_GET_FIRST(table->foreign_list);
|
|
|
|
loop:
|
|
|
|
if (foreign == NULL) {
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
Many files:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/dict/dict0crea.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/dict/dict0dict.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0crea.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0dict.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/ut0mem.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/row/row0mysql.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/sync/sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/ut/ut0mem.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
2004-02-09 01:32:00 +02:00
|
|
|
if (foreign->id == NULL) {
|
|
|
|
/* Generate a new constraint id */
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
ulint namelen = strlen(table->name);
|
|
|
|
char* id = mem_heap_alloc(foreign->heap, namelen + 20);
|
2004-02-20 16:34:09 +02:00
|
|
|
/* no overflow if number < 1e13 */
|
2004-04-26 15:53:31 +03:00
|
|
|
sprintf(id, "%s_ibfk_%lu", table->name, (ulong) number++);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
foreign->id = id;
|
Many files:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/dict/dict0crea.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/dict/dict0dict.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0crea.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0dict.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/ut0mem.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/row/row0mysql.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/sync/sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/ut/ut0mem.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
2004-02-09 01:32:00 +02:00
|
|
|
}
|
2001-10-10 22:47:08 +03:00
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
len = (sizeof str1) + (sizeof str2) + (sizeof str4) - 3
|
|
|
|
+ 9/* ' and , chars */ + 10/* 32-bit integer */
|
|
|
|
+ ut_strlenq(foreign->id, '\'') * (foreign->n_fields + 1)
|
|
|
|
+ ut_strlenq(table->name, '\'')
|
|
|
|
+ ut_strlenq(foreign->referenced_table_name, '\'');
|
|
|
|
|
|
|
|
for (i = 0; i < foreign->n_fields; i++) {
|
|
|
|
len += 9/* ' and , chars */ + 10/* 32-bit integer */
|
|
|
|
+ (sizeof str3) + (sizeof str2) - 2
|
|
|
|
+ ut_strlenq(foreign->foreign_col_names[i], '\'')
|
|
|
|
+ ut_strlenq(foreign->referenced_col_names[i], '\'');
|
|
|
|
}
|
2004-02-20 16:34:09 +02:00
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
sql = sqlend = mem_alloc(len + 1);
|
|
|
|
|
|
|
|
/* INSERT INTO SYS_FOREIGN VALUES(...); */
|
|
|
|
memcpy(sqlend, str1, (sizeof str1) - 1);
|
|
|
|
sqlend += (sizeof str1) - 1;
|
|
|
|
*sqlend++ = '\'';
|
|
|
|
sqlend = ut_strcpyq(sqlend, '\'', foreign->id);
|
|
|
|
*sqlend++ = '\'', *sqlend++ = ',', *sqlend++ = '\'';
|
|
|
|
sqlend = ut_strcpyq(sqlend, '\'', table->name);
|
|
|
|
*sqlend++ = '\'', *sqlend++ = ',', *sqlend++ = '\'';
|
|
|
|
sqlend = ut_strcpyq(sqlend, '\'', foreign->referenced_table_name);
|
|
|
|
*sqlend++ = '\'', *sqlend++ = ',';
|
|
|
|
sqlend += sprintf(sqlend, "%010lu",
|
|
|
|
foreign->n_fields + (foreign->type << 24));
|
|
|
|
memcpy(sqlend, str2, (sizeof str2) - 1);
|
|
|
|
sqlend += (sizeof str2) - 1;
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
for (i = 0; i < foreign->n_fields; i++) {
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
/* INSERT INTO SYS_FOREIGN_COLS VALUES(...); */
|
|
|
|
memcpy(sqlend, str3, (sizeof str3) - 1);
|
|
|
|
sqlend += (sizeof str3) - 1;
|
|
|
|
*sqlend++ = '\'';
|
|
|
|
sqlend = ut_strcpyq(sqlend, '\'', foreign->id);
|
|
|
|
*sqlend++ = '\''; *sqlend++ = ',';
|
2004-04-26 15:53:31 +03:00
|
|
|
sqlend += sprintf(sqlend, "%010lu", (ulong) i);
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
*sqlend++ = ','; *sqlend++ = '\'';
|
|
|
|
sqlend = ut_strcpyq(sqlend, '\'',
|
|
|
|
foreign->foreign_col_names[i]);
|
|
|
|
*sqlend++ = '\''; *sqlend++ = ','; *sqlend++ = '\'';
|
|
|
|
sqlend = ut_strcpyq(sqlend, '\'',
|
|
|
|
foreign->referenced_col_names[i]);
|
|
|
|
*sqlend++ = '\'';
|
|
|
|
memcpy(sqlend, str2, (sizeof str2) - 1);
|
|
|
|
sqlend += (sizeof str2) - 1;
|
2001-10-10 22:47:08 +03:00
|
|
|
}
|
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
memcpy(sqlend, str4, sizeof str4);
|
|
|
|
sqlend += sizeof str4;
|
2001-10-10 22:47:08 +03:00
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
ut_a(sqlend == sql + len + 1);
|
|
|
|
|
|
|
|
graph = pars_sql(sql);
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
ut_a(graph);
|
|
|
|
|
InnoDB cleanup: fixing buffer overflows and quoting of quotes
innobase/dict/dict0crea.c:
Remove unneeded prototypes for static functions
Remove unused parameters from some functions
Replace some assertions with compile-time checks
dict_create_add_foreigns_to_dictionary():
allocate space dynamically for the SQL, and quote quotes
innobase/dict/dict0dict.c:
Remove unnecessary prototypes for static functions
dict_tables_have_same_db(): Remove length limitation
dict_remove_db_name(): Use strchr()
dict_get_db_name_len(): Use strchr()
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
Remove unnecessary strlen() calls
Allocate space dynamically for generated strings
dict_scan_id(): allow quotes within quoted strings
innobase/dict/dict0load.c:
Remove unnecessary strlen() calls
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/dict/dict0mem.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/eval/eval0eval.c:
Make TO_CHAR() work with any machine word width
innobase/fil/fil0fil.c:
Replace mem_alloc()+strlen()+strcpy() with mem_strdup()
innobase/ibuf/ibuf0ibuf.c:
Make some global variables static
Add #ifdef UNIV_IBUF_DEBUG around debug statements
innobase/include/data0data.h:
Add #ifdef UNIV_DEBUG around dtuple_validate()
innobase/include/data0data.ic:
Replace = with == in ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N)
innobase/include/dict0dict.h:
Add const qualifiers
innobase/include/lock0lock.h:
Add UL suffixes to unsigned long masks
innobase/include/log0log.h:
Remove unused parameter "type" of log_group_write_buf()
innobase/include/mem0mem.h:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/mem0mem.ic:
Add mem_strdup(), mem_strdupl(), mem_strdupq(), mem_heap_strdup(),
and mem_heap_strdupl()
innobase/include/row0uins.h:
Remove unused parameter "thr" of row_undo_ins()
innobase/include/row0undo.h:
Remvoe unused parameter "thr" of row_undo_search_clust_to_pcur()
innobase/include/ut0byte.h:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/include/ut0mem.h:
Add ut_strlenq(), ut_strcpyq() and ut_memcpyq()
innobase/include/ut0mem.ic:
Add ut_strlenq()
innobase/include/ut0ut.h:
Declare ut_sprintf() as a printf-style function
innobase/lock/lock0lock.c:
lock_clust_rec_modify_check_and_lock(): Remove unused variable "trx"
innobase/log/log0log.c:
Remove unused parameters
innobase/log/log0recv.c:
Remove parameter "type" from log_group_write_buf()
innobase/mem/mem0mem.c:
Simplify the initialization of block->init_block
innobase/mtr/mtr0log.c:
Add a debug assertion to mlog_parse_initial_log_record()
innobase/page/page0cur.c:
Add debug assertion to page_cur_insert_rec_write_log()
Remove hard-coded buffer size in page_cur_parse_insert_rec()
innobase/page/page0page.c:
Remove unneeded variable rec
innobase/pars/pars0opt.c:
Correct a potential buffer overflow
innobase/pars/pars0pars.c:
Replace mem_heap_alloc()+strlen()+memcpy() with mem_heap_strdup()
innobase/row/row0ins.c:
Replace parameter "thr" with "trx" in row_ins_foreign_report_add_err()
Remove unnecessary strlen() call
Use strchr()
innobase/row/row0mysql.c:
Add row_mysql_is_recovered_tmp_table()
Add row_mysql_is_system_table()
Compare reserved table names with exact match
Use strstr() and strchr() and mem_strdupl()
Compute space needed for generated SQL, and allocate it dynamically
innobase/row/row0purge.c:
Remove unused parameters "thr"
innobase/row/row0row.c:
Simplify row_get_clust_rec()
innobase/row/row0uins.c:
Remove unused parameters "thr"
innobase/row/row0umod.c:
Remove unused variable "index"
row_undo_mod_del_unmark_sec_and_undo_update():
Remove parameter "node" and variable "rec"
Remove unused parameters "thr"
innobase/row/row0undo.c:
Remove unused parameters "thr"
innobase/srv/srv0srv.c:
Replace UT_NOT_USED() with __attribute__((unused))
innobase/srv/srv0start.c:
Remove unnecessary strlen() calls
Remove unused parameter "create_new_db" of open_or_create_log_file()
innobase/trx/trx0roll.c:
Replace mem_alloc()+strlen()+memcpy() with mem_strdup()
innobase/trx/trx0sys.c:
Remove unnecessary strlen() call
innobase/ut/ut0byte.c:
Add const qualifier to ut_cpy_in_lower_case()
Remove parameter "len" of ut_cmp_in_lower_case()
innobase/ut/ut0mem.c:
Add ut_strlenq() and ut_memcpyq()
sql/ha_innodb.cc:
Remove parameter "len" of ut_cmp_in_lower_case()
2004-04-01 16:51:34 +03:00
|
|
|
mem_free(sql);
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
graph->trx = trx;
|
|
|
|
trx->graph = NULL;
|
|
|
|
|
|
|
|
graph->fork_type = QUE_FORK_MYSQL_INTERFACE;
|
|
|
|
|
2004-03-11 12:55:28 +02:00
|
|
|
ut_a(thr = que_fork_start_command(graph));
|
2001-10-10 22:47:08 +03:00
|
|
|
|
|
|
|
que_run_threads(thr);
|
|
|
|
|
|
|
|
error = trx->error_state;
|
|
|
|
|
|
|
|
que_graph_free(graph);
|
|
|
|
|
Many files:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/dict/dict0crea.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/dict/dict0dict.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0crea.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0dict.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/ut0mem.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/row/row0mysql.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/sync/sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/ut/ut0mem.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
2004-02-09 01:32:00 +02:00
|
|
|
if (error == DB_DUPLICATE_KEY) {
|
|
|
|
mutex_enter(&dict_foreign_err_mutex);
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
rewind(ef);
|
|
|
|
ut_print_timestamp(ef);
|
|
|
|
fputs(" Error in foreign key constraint creation for table ",
|
|
|
|
ef);
|
|
|
|
ut_print_name(ef, table->name);
|
|
|
|
fputs(".\nA foreign key constraint of name ", ef);
|
|
|
|
ut_print_name(ef, foreign->id);
|
|
|
|
fputs("\nalready exists."
|
|
|
|
" (Note that internally InnoDB adds 'databasename/'\n"
|
|
|
|
"in front of the user-defined constraint name).\n",
|
|
|
|
ef);
|
Many files:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/dict/dict0crea.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/dict/dict0dict.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0crea.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/dict0dict.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/include/ut0mem.h:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/row/row0mysql.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
innobase/sync/sync0sync.c:
UNIV_SYNC_DEBUG caused assertion in the creation of the doublewrite buffer, if we do not allow thousands of latches per thread
innobase/ut/ut0mem.c:
Fix bug #2167: generate foreign key id's locally for each table, in the form databasename/tablename_ibfk_number; if the user gives the constraint name explicitly remember it; these changes should ensure that foreign key id's in a slave are the same as in the master, and DROP FOREIGN KEY does not break replication
2004-02-09 01:32:00 +02:00
|
|
|
|
|
|
|
mutex_exit(&dict_foreign_err_mutex);
|
|
|
|
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
if (error != DB_SUCCESS) {
|
2001-12-14 19:35:31 +02:00
|
|
|
fprintf(stderr,
|
2002-02-08 23:24:36 +02:00
|
|
|
"InnoDB: Foreign key constraint creation failed:\n"
|
2003-12-20 03:41:04 +02:00
|
|
|
"InnoDB: internal error number %lu\n", (ulong) error);
|
2001-12-14 19:35:31 +02:00
|
|
|
|
2003-04-16 16:45:01 +03:00
|
|
|
mutex_enter(&dict_foreign_err_mutex);
|
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
2004-04-06 16:14:43 +03:00
|
|
|
ut_print_timestamp(ef);
|
|
|
|
fputs(" Internal error in foreign key constraint creation"
|
|
|
|
" for table ", ef);
|
|
|
|
ut_print_name(ef, table->name);
|
|
|
|
fputs(".\n"
|
|
|
|
"See the MySQL .err log in the datadir for more information.\n", ef);
|
2003-04-16 16:45:01 +03:00
|
|
|
mutex_exit(&dict_foreign_err_mutex);
|
|
|
|
|
2001-10-10 22:47:08 +03:00
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
|
|
|
|
|
|
|
|
goto loop;
|
|
|
|
}
|