Commit 4050e916 authored by unknown's avatar unknown
Browse files

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
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -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(
+0 −143
Original line number Diff line number Diff line
@@ -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. */

+0 −53
Original line number Diff line number Diff line
@@ -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);
}
+0 −37
Original line number Diff line number Diff line
@@ -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
+0 −31
Original line number Diff line number Diff line
@@ -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
Loading