Commit 4050e916 authored by unknown's avatar unknown

InnoDB: Remove unnecessary code, mostly related to stored procedures


innobase/data/data0data.c:
  Remove unused global variables
innobase/dict/dict0dict.c:
  Remove unused code
innobase/dict/dict0mem.c:
  Remove unnecessary function dict_mem_procedure_create()
innobase/include/dict0dict.h:
  Remove unused code related to stored procedures
innobase/include/dict0dict.ic:
  Remove unnecessary function dict_procedure_get()
innobase/include/dict0mem.h:
  Remove unnecessary code related to stored procedures
innobase/include/dict0types.h:
  Remove dict_proc_t, as procedures are not stored into database
innobase/include/pars0pars.h:
  Remove call_node_struct and references to dict_proc_t,
  as procedures are not stored into database or called by name
innobase/include/pars0sym.h:
  Remove procedure_def, as procedures are not stored into database
innobase/include/pars0types.h:
  Remove call_node_t, as procedures are not called by name
parent 7945ea24
......@@ -25,10 +25,6 @@ byte data_error; /* data pointers of tuple fields are initialized
ulint data_dummy; /* this is used to fool the compiler in
dtuple_validate */
byte data_buf[8192]; /* used in generating test tuples */
ulint data_rnd = 756511;
/* Some non-inlined functions used in the MySQL interface: */
void
dfield_set_data_noninline(
......
......@@ -43,9 +43,6 @@ rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve
#define DICT_HEAP_SIZE 100 /* initial memory heap size when
creating a table or index object */
#define DICT_POOL_PER_PROCEDURE_HASH 512 /* buffer pool max size per stored
procedure hash table fixed size in
bytes */
#define DICT_POOL_PER_TABLE_HASH 512 /* buffer pool max size per table
hash table fixed size in bytes */
#define DICT_POOL_PER_COL_HASH 128 /* buffer pool max size per column
......@@ -667,9 +664,6 @@ dict_init(void)
dict_sys->col_hash = hash_create(buf_pool_get_max_size() /
(DICT_POOL_PER_COL_HASH *
UNIV_WORD_SIZE));
dict_sys->procedure_hash = hash_create(buf_pool_get_max_size() /
(DICT_POOL_PER_PROCEDURE_HASH *
UNIV_WORD_SIZE));
dict_sys->size = 0;
UT_LIST_INIT(dict_sys->table_LRU);
......@@ -2499,35 +2493,6 @@ dict_skip_word(
return(ptr);
}
#ifdef currentlynotused
/*************************************************************************
Returns the number of opening brackets '(' subtracted by the number
of closing brackets ')' between string and ptr. */
static
int
dict_bracket_count(
/*===============*/
/* out: bracket count */
char* string, /* in: start of string */
char* ptr) /* in: end of string */
{
int count = 0;
while (string != ptr) {
if (*string == '(') {
count++;
}
if (*string == ')') {
count--;
}
string++;
}
return(count);
}
#endif
/*************************************************************************
Removes MySQL comments from an SQL string. A comment is either
(a) '#' to the end of the line,
......@@ -3409,114 +3374,6 @@ dict_foreign_parse_drop_constraints(
/*==================== END OF FOREIGN KEY PROCESSING ====================*/
/**************************************************************************
Adds a stored procedure object to the dictionary cache. */
void
dict_procedure_add_to_cache(
/*========================*/
dict_proc_t* proc) /* in: procedure */
{
ulint fold;
mutex_enter(&(dict_sys->mutex));
fold = ut_fold_string(proc->name);
/* Look for a procedure with the same name: error if such exists */
{
dict_proc_t* proc2;
HASH_SEARCH(name_hash, dict_sys->procedure_hash, fold, proc2,
(ut_strcmp(proc2->name, proc->name) == 0));
ut_a(proc2 == NULL);
}
/* Add the procedure to the hash table */
HASH_INSERT(dict_proc_t, name_hash, dict_sys->procedure_hash, fold,
proc);
mutex_exit(&(dict_sys->mutex));
}
/**************************************************************************
Reserves a parsed copy of a stored procedure to execute. If there are no
free parsed copies left at the moment, parses a new copy. Takes the copy off
the list of copies: the copy must be returned there with
dict_procedure_release_parsed_copy. */
que_t*
dict_procedure_reserve_parsed_copy(
/*===============================*/
/* out: the query graph */
dict_proc_t* proc) /* in: dictionary procedure node */
{
que_t* graph;
proc_node_t* proc_node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(dict_sys->mutex));
#ifdef UNIV_DEBUG
UT_LIST_VALIDATE(graphs, que_t, proc->graphs);
#endif
graph = UT_LIST_GET_FIRST(proc->graphs);
if (graph) {
UT_LIST_REMOVE(graphs, proc->graphs, graph);
/* printf("Graph removed, list length %lu\n",
UT_LIST_GET_LEN(proc->graphs)); */
#ifdef UNIV_DEBUG
UT_LIST_VALIDATE(graphs, que_t, proc->graphs);
#endif
}
mutex_exit(&(dict_sys->mutex));
if (graph == NULL) {
graph = pars_sql(proc->sql_string);
proc_node = que_fork_get_child(graph);
proc_node->dict_proc = proc;
printf("Parsed a new copy of graph %s\n",
proc_node->proc_id->name);
}
/* printf("Returning graph %lu\n", (ulint)graph); */
return(graph);
}
/**************************************************************************
Releases a parsed copy of an executed stored procedure. Puts the copy to the
list of copies. */
void
dict_procedure_release_parsed_copy(
/*===============================*/
que_t* graph) /* in: query graph of a stored procedure */
{
proc_node_t* proc_node;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(dict_sys->mutex));
proc_node = que_fork_get_child(graph);
UT_LIST_ADD_FIRST(graphs, (proc_node->dict_proc)->graphs, graph);
mutex_exit(&(dict_sys->mutex));
}
/**************************************************************************
Returns an index object if it is found in the dictionary cache. */
......
......@@ -301,56 +301,3 @@ dict_mem_index_free(
{
mem_heap_free(index->heap);
}
/**************************************************************************
Creates a procedure memory object. */
dict_proc_t*
dict_mem_procedure_create(
/*======================*/
/* out, own: procedure object */
char* name, /* in: procedure name */
char* sql_string, /* in: procedure definition as an SQL
string */
que_fork_t* graph) /* in: parsed procedure graph */
{
dict_proc_t* proc;
proc_node_t* proc_node;
mem_heap_t* heap;
char* str;
ut_ad(name);
heap = mem_heap_create(128);
proc = mem_heap_alloc(heap, sizeof(dict_proc_t));
proc->heap = heap;
str = mem_heap_alloc(heap, 1 + ut_strlen(name));
ut_strcpy(str, name);
proc->name = str;
str = mem_heap_alloc(heap, 1 + ut_strlen(sql_string));
ut_strcpy(str, sql_string);
proc->sql_string = str;
UT_LIST_INIT(proc->graphs);
/* UT_LIST_ADD_LAST(graphs, proc->graphs, graph); */
#ifdef UNIV_DEBUG
UT_LIST_VALIDATE(graphs, que_t, proc->graphs);
#endif
proc->mem_fix = 0;
proc_node = que_fork_get_child(graph);
proc_node->dict_proc = proc;
return(proc);
}
......@@ -59,41 +59,6 @@ Inits the data dictionary module. */
void
dict_init(void);
/*===========*/
/**************************************************************************
Returns a stored procedure object and memoryfixes it. */
UNIV_INLINE
dict_proc_t*
dict_procedure_get(
/*===============*/
/* out: procedure, NULL if does not exist */
char* proc_name, /* in: table name */
trx_t* trx); /* in: transaction handle or NULL */
/**************************************************************************
Adds a stored procedure object to the dictionary cache. */
void
dict_procedure_add_to_cache(
/*========================*/
dict_proc_t* proc); /* in: procedure */
/**************************************************************************
Reserves a parsed copy of a stored procedure to execute. If there are no
free parsed copies left at the moment, parses a new copy. Takes the copy off
the list of copies: the copy must be returned there with
dict_procedure_release_parsed_copy. */
que_t*
dict_procedure_reserve_parsed_copy(
/*===============================*/
/* out: the query graph */
dict_proc_t* proc); /* in: dictionary procedure node */
/**************************************************************************
Releases a parsed copy of an executed stored procedure. Puts the copy to the
list of copies. */
void
dict_procedure_release_parsed_copy(
/*===============================*/
que_t* graph); /* in: query graph of a stored procedure */
/*************************************************************************
Gets the column data type. */
UNIV_INLINE
......@@ -901,8 +866,6 @@ struct dict_sys_struct{
hash_table_t* table_id_hash; /* hash table of the tables, based
on id */
hash_table_t* col_hash; /* hash table of the columns */
hash_table_t* procedure_hash; /* hash table of the stored
procedures */
UT_LIST_BASE_NODE_T(dict_table_t)
table_LRU; /* LRU list of tables */
ulint size; /* varying space in bytes occupied
......
......@@ -581,37 +581,6 @@ dict_table_get_low(
return(table);
}
/**************************************************************************
Returns a stored procedure object and memoryfixes it. */
UNIV_INLINE
dict_proc_t*
dict_procedure_get(
/*===============*/
/* out: procedure, NULL if does not exist */
char* proc_name, /* in: table name */
trx_t* trx) /* in: transaction handle or NULL */
{
dict_proc_t* proc;
ulint name_fold;
UT_NOT_USED(trx);
mutex_enter(&(dict_sys->mutex));
/* Look for the table name in the hash table */
name_fold = ut_fold_string(proc_name);
HASH_SEARCH(name_hash, dict_sys->procedure_hash, name_fold, proc,
ut_strcmp(proc->name, proc_name) == 0);
if (proc != NULL) {
proc->mem_fix++;
}
mutex_exit(&(dict_sys->mutex));
return(proc);
}
/**************************************************************************
Returns a table object, based on table id, and memoryfixes it. */
UNIV_INLINE
......
......@@ -132,18 +132,6 @@ dict_foreign_t*
dict_mem_foreign_create(void);
/*=========================*/
/* out, own: foreign constraint struct */
/**************************************************************************
Creates a procedure memory object. */
dict_proc_t*
dict_mem_procedure_create(
/*======================*/
/* out, own: procedure object */
char* name, /* in: procedure name */
char* sql_string, /* in: procedure definition as an SQL
string */
que_fork_t* graph); /* in: parsed procedure graph */
/* Data structure for a column in a table */
struct dict_col_struct{
......@@ -420,24 +408,6 @@ struct dict_table_struct{
#endif /* UNIV_DEBUG */
};
/* Data structure for a stored procedure */
struct dict_proc_struct{
mem_heap_t* heap; /* memory heap */
char* name; /* procedure name */
char* sql_string;
/* procedure definition as an SQL string:
we can produce more parsed instances of the
procedure by parsing this string */
hash_node_t name_hash;
/* hash chain node */
UT_LIST_BASE_NODE_T(que_fork_t) graphs;
/* list of parsed instances of the procedure:
there may be many of them, and they are
recycled */
ulint mem_fix;/* count of how many times this struct
has been fixed in memory */
};
#ifndef UNIV_NONINL
#include "dict0mem.ic"
#endif
......
......@@ -15,7 +15,6 @@ typedef struct dict_field_struct dict_field_t;
typedef struct dict_index_struct dict_index_t;
typedef struct dict_tree_struct dict_tree_t;
typedef struct dict_table_struct dict_table_t;
typedef struct dict_proc_struct dict_proc_t;
typedef struct dict_foreign_struct dict_foreign_t;
/* A cluster object is a table object with the type field set to
......
......@@ -456,18 +456,6 @@ struct proc_node_struct{
sym_node_t* param_list; /* input and output parameters */
que_node_t* stat_list; /* statement list */
sym_tab_t* sym_tab; /* symbol table of this procedure */
dict_proc_t* dict_proc; /* stored procedure node in the
dictionary cache, if defined */
};
/* Stored procedure call node */
struct call_node_struct{
que_common_t common; /* type: QUE_NODE_CALL */
sym_node_t* proc_name; /* stored procedure name */
dict_proc_t* procedure_def; /* pointer to a stored procedure graph
in the dictionary stored procedure
cache */
sym_tab_t* sym_tab; /* symbol table of this query */
};
/* elsif-element node */
......
......@@ -127,9 +127,6 @@ struct sym_node_struct{
dict_table_t* table; /* table definition
if a table id or a
column id */
dict_proc_t* procedure_def; /* stored procedure
definition, if a
stored procedure name */
ulint col_no; /* column number if a
column */
sel_buf_t* prefetch_buf; /* NULL, or a buffer
......
......@@ -15,7 +15,6 @@ typedef struct pars_res_word_struct pars_res_word_t;
typedef struct func_node_struct func_node_t;
typedef struct order_node_struct order_node_t;
typedef struct proc_node_struct proc_node_t;
typedef struct call_node_struct call_node_t;
typedef struct elsif_node_struct elsif_node_t;
typedef struct if_node_struct if_node_t;
typedef struct while_node_struct while_node_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment