summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorDavi Arnaut <davi.arnaut@oracle.com>2010-07-23 17:14:35 -0300
committerDavi Arnaut <davi.arnaut@oracle.com>2010-07-23 17:14:35 -0300
commit7a221fc9a30888fc30bd0ef79445829896572d97 (patch)
tree34993c1eeb34970e4c3ffef7f0a41b6e14095d89 /sql
parente7dd11f0bef0e31fad7063ac8b2c6df3bb575436 (diff)
downloadmariadb-git-7a221fc9a30888fc30bd0ef79445829896572d97.tar.gz
WL#5498: Remove dead and unused source code
Remove unused source code and associated paraphernalia.
Diffstat (limited to 'sql')
-rw-r--r--sql/CMakeLists.txt2
-rw-r--r--sql/Makefile.am7
-rw-r--r--sql/mysqld.cc7
-rw-r--r--sql/mysqld.h4
-rw-r--r--sql/sql_map.cc144
-rw-r--r--sql/sql_map.h70
-rw-r--r--sql/sql_olap.cc188
7 files changed, 8 insertions, 414 deletions
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 7107a68ee84..b3ac22aca01 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -60,7 +60,7 @@ SET (SQL_SOURCE
sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h
sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc
sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc
- sql_list.cc sql_load.cc sql_manager.cc sql_map.cc sql_parse.cc
+ sql_list.cc sql_load.cc sql_manager.cc sql_parse.cc
sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
debug_sync.cc debug_sync.h
sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 4b1ecbbc8da..7fed55f3cd6 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -90,7 +90,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
item_create.h item_subselect.h item_row.h \
sql_priv.h item_geofunc.h sql_bitmap.h \
procedure.h sql_class.h sql_lex.h sql_list.h \
- sql_map.h sql_string.h unireg.h \
+ sql_string.h unireg.h \
sql_error.h field.h handler.h mysqld_suffix.h \
sql_profile.h mysqld.h sql_help.h frm_crypt.h \
ha_ndbcluster.h ha_ndbcluster_cond.h \
@@ -135,7 +135,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
item_row.cc item_geofunc.cc item_xmlfunc.cc \
field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \
net_serv.cc protocol.cc sql_state.c \
- lock.cc sql_string.cc sql_manager.cc sql_map.cc \
+ lock.cc sql_string.cc sql_manager.cc \
main.cc mysqld.cc password.c hash_filo.cc hostname.cc \
sql_connect.cc scheduler.cc sql_parse.cc \
keycaches.cc set_var.cc sql_yacc.yy sys_vars.cc \
@@ -160,8 +160,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
rpl_reporting.cc \
sql_union.cc sql_derived.cc \
sql_client.cc \
- repl_failsafe.h repl_failsafe.cc \
- sql_olap.cc sql_view.cc \
+ repl_failsafe.h repl_failsafe.cc sql_view.cc \
gstream.cc spatial.cc sql_help.cc sql_cursor.cc \
tztime.cc my_decimal.cc\
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 7ce27f4ba4f..4c0d290f2cc 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -602,7 +602,7 @@ pthread_key(MEM_ROOT**,THR_MALLOC);
pthread_key(THD*, THR_THD);
mysql_mutex_t LOCK_thread_count;
mysql_mutex_t LOCK_mysql_create_db, LOCK_open,
- LOCK_mapped_file, LOCK_status, LOCK_global_read_lock,
+ LOCK_status, LOCK_global_read_lock,
LOCK_error_log, LOCK_uuid_generator,
LOCK_delayed_insert, LOCK_delayed_status, LOCK_delayed_create,
LOCK_crypt,
@@ -1532,7 +1532,6 @@ static void clean_up_mutexes()
mysql_rwlock_destroy(&LOCK_grant);
mysql_mutex_destroy(&LOCK_open);
mysql_mutex_destroy(&LOCK_thread_count);
- mysql_mutex_destroy(&LOCK_mapped_file);
mysql_mutex_destroy(&LOCK_status);
mysql_mutex_destroy(&LOCK_delayed_insert);
mysql_mutex_destroy(&LOCK_delayed_status);
@@ -3512,7 +3511,6 @@ static int init_thread_environment()
mysql_mutex_init(key_LOCK_lock_db, &LOCK_lock_db, MY_MUTEX_INIT_SLOW);
mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_thread_count, &LOCK_thread_count, MY_MUTEX_INIT_FAST);
- mysql_mutex_init(key_LOCK_mapped_file, &LOCK_mapped_file, MY_MUTEX_INIT_SLOW);
mysql_mutex_init(key_LOCK_status, &LOCK_status, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_delayed_insert,
&LOCK_delayed_insert, MY_MUTEX_INIT_FAST);
@@ -7691,7 +7689,7 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables,
- key_LOCK_lock_db, key_LOCK_manager, key_LOCK_mapped_file,
+ key_LOCK_lock_db, key_LOCK_manager,
key_LOCK_mysql_create_db, key_LOCK_open, key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status,
key_LOCK_system_variables_hash, key_LOCK_table_share, key_LOCK_thd_data,
@@ -7732,7 +7730,6 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_global_system_variables, "LOCK_global_system_variables", PSI_FLAG_GLOBAL},
{ &key_LOCK_lock_db, "LOCK_lock_db", PSI_FLAG_GLOBAL},
{ &key_LOCK_manager, "LOCK_manager", PSI_FLAG_GLOBAL},
- { &key_LOCK_mapped_file, "LOCK_mapped_file", PSI_FLAG_GLOBAL},
{ &key_LOCK_mysql_create_db, "LOCK_mysql_create_db", PSI_FLAG_GLOBAL},
{ &key_LOCK_open, "LOCK_open", PSI_FLAG_GLOBAL},
{ &key_LOCK_prepared_stmt_count, "LOCK_prepared_stmt_count", PSI_FLAG_GLOBAL},
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 626c2d116f5..91bdc600cda 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -228,7 +228,7 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_LOCK_connection_count, key_LOCK_crypt, key_LOCK_delayed_create,
key_LOCK_delayed_insert, key_LOCK_delayed_status, key_LOCK_error_log,
key_LOCK_gdl, key_LOCK_global_read_lock, key_LOCK_global_system_variables,
- key_LOCK_lock_db, key_LOCK_logger, key_LOCK_manager, key_LOCK_mapped_file,
+ key_LOCK_lock_db, key_LOCK_logger, key_LOCK_manager,
key_LOCK_mysql_create_db, key_LOCK_open, key_LOCK_prepared_stmt_count,
key_LOCK_rpl_status, key_LOCK_server_started, key_LOCK_status,
key_LOCK_table_share, key_LOCK_thd_data,
@@ -317,7 +317,7 @@ extern MYSQL_PLUGIN_IMPORT key_map key_map_full; /* Should be threaded
Server mutex locks and condition variables.
*/
extern mysql_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_lock_db,
- LOCK_mapped_file, LOCK_user_locks, LOCK_status,
+ LOCK_user_locks, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager, LOCK_global_read_lock,
diff --git a/sql/sql_map.cc b/sql/sql_map.cc
deleted file mode 100644
index ca8a88bcbf8..00000000000
--- a/sql/sql_map.cc
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Copyright (C) 2000-2001, 2004-2005 MySQL AB, 2008-2009 Sun Microsystems, Inc
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
-#include "sql_priv.h"
-#include "unireg.h" // REQUIRED: for other includes
-#include "sql_map.h" // mapped_files
-#include "sql_class.h" // THD
-
-#include <sys/stat.h>
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-mapped_files::mapped_files(const char * filename,uchar *magic,uint magic_length)
-{
-#ifdef HAVE_MMAP
- name=my_strdup(filename,MYF(0));
- use_count=1;
- error=0;
- map=0;
- size=0;
- if ((file= mysql_file_open(key_file_map, name, O_RDONLY, MYF(MY_WME))) >= 0)
- {
- struct stat stat_buf;
- if (!fstat(file, &stat_buf))
- {
- if (!(map=(uchar*) my_mmap(0,(size_t)(size= stat_buf.st_size),PROT_READ,
- MAP_SHARED | MAP_NORESERVE,file,
- 0L)))
- {
- error=errno;
- my_error(ER_NO_FILE_MAPPING, MYF(0), (char *) name, error);
- }
- }
- if (map && memcmp(map,magic,magic_length))
- {
- my_error(ER_WRONG_MAGIC, MYF(0), name);
- (void) my_munmap((char*) map,(size_t)size);
- map=0;
- }
- if (!map)
- {
- (void) mysql_file_close(file, MYF(0));
- file= -1;
- }
- }
-#endif
-}
-
-
-mapped_files::~mapped_files()
-{
-#ifdef HAVE_MMAP
- if (file >= 0)
- {
- (void) my_munmap((char*) map,(size_t)size);
- (void) mysql_file_close(file, MYF(0));
- file= -1; map=0;
- }
- my_free(name);
-#endif
-}
-
-
-static I_List<mapped_files> maps_in_use;
-
-/*
-** Check if a file is mapped. If it is, then return pointer to old map,
-** else alloc new object
-*/
-
-mapped_files *map_file(const char * name,uchar *magic,uint magic_length)
-{
-#ifdef HAVE_MMAP
- mysql_mutex_lock(&LOCK_mapped_file);
- I_List_iterator<mapped_files> list(maps_in_use);
- mapped_files *map;
- char path[FN_REFLEN];
- sprintf(path,"%s/%s/%s.uniq",mysql_data_home,current_thd->db,name);
- (void) unpack_filename(path,path);
-
- while ((map=list++))
- {
- if (!strcmp(path,map->name))
- break;
- }
- if (!map)
- {
- map=new mapped_files(path,magic,magic_length);
- maps_in_use.append(map);
- }
- else
- {
- map->use_count++;
- if (!map->map)
- my_error(ER_NO_FILE_MAPPING, MYF(0), path, map->error);
- }
- mysql_mutex_unlock(&LOCK_mapped_file);
- return map;
-#else
- return NULL;
-#endif
-}
-
-/*
-** free the map if there are no more users for it
-*/
-
-void unmap_file(mapped_files *map)
-{
-#ifdef HAVE_MMAP
- mysql_mutex_lock(&LOCK_mapped_file);
- if (!map->use_count--)
- delete map;
- mysql_mutex_unlock(&LOCK_mapped_file);
-#endif
-}
-
-/*****************************************************************************
-** Instansiate templates
-*****************************************************************************/
-
-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
-/* Used templates */
-template class I_List<mapped_files>;
-template class I_List_iterator<mapped_files>;
-#endif
diff --git a/sql/sql_map.h b/sql/sql_map.h
deleted file mode 100644
index be1c145df3f..00000000000
--- a/sql/sql_map.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef SQL_MAP_INCLUDED
-#define SQL_MAP_INCLUDED
-
-/* Copyright (C) 2000-2001, 2005 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-
-/* interface for memory mapped files */
-
-#ifdef USE_PRAGMA_INTERFACE
-#pragma interface /* gcc class implementation */
-#endif
-
-#include "my_base.h" /* ha_rows */
-#include "sql_list.h" /* ilink */
-
-class mapped_files;
-mapped_files *map_file(const char * name,uchar *magic,uint magic_length);
-void unmap_file(mapped_files *map);
-
-class mapped_files :public ilink {
- uchar *map;
- ha_rows size;
- char *name; // name of mapped file
- File file; // >= 0 if open
- int error; // If not mapped
- uint use_count;
-
-public:
- mapped_files(const char * name,uchar *magic,uint magic_length);
- ~mapped_files();
-
- friend class mapped_file;
- friend mapped_files *map_file(const char * name,uchar *magic,
- uint magic_length);
- friend void unmap_file(mapped_files *map);
-};
-
-
-class mapped_file
-{
- mapped_files *file;
-public:
- mapped_file(const char * name,uchar *magic,uint magic_length)
- {
- file=map_file(name,magic,magic_length); /* old or new map */
- }
- ~mapped_file()
- {
- unmap_file(file); /* free map */
- }
- uchar *map()
- {
- return file->map;
- }
-};
-
-#endif /* SQL_MAP_INCLUDED */
diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc
deleted file mode 100644
index b957d1e9be4..00000000000
--- a/sql/sql_olap.cc
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright (C) 2000-2006 MySQL AB
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-
-/*
- OLAP implementation by Sinisa Milivojevic <sinisa@mysql.com>
- Inspired by code submitted by Srilakshmi <lakshmi@gdit.iiit.net>
-
- The ROLLUP code in this file has to be complitely rewritten as it's
- not good enough to satisfy the goals of MySQL.
-
- In 4.1 we will replace this with a working, superior implementation
- of ROLLUP.
-*/
-
-#ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1
-
-#ifdef USE_PRAGMA_IMPLEMENTATION
-#pragma implementation // gcc: Class implementation
-#endif
-
-#include "sql_priv.h"
-#include "unireg.h"
-#include "sql_select.h"
-
-
-/****************************************************************************
- Functions that recursively actually creates new SELECT's
- Returns 0 if OK, 1 if error, -1 if error already printed to client
-****************************************************************************/
-
-
-static int make_new_olap_select(LEX *lex, SELECT_LEX *select_lex, List<Item> new_fields)
-{
- THD *thd=current_thd;
- Item *item, *new_item;
- Item_null *constant= new Item_null("ALL");
-
- SELECT_LEX *new_select = (SELECT_LEX *) thd->memdup((char*) select_lex, sizeof(*select_lex));
- if (!new_select)
- return 1;
- lex->last_selects->next=new_select;
- new_select->linkage=OLAP_TYPE;
- new_select->olap=NON_EXISTING_ONE;
- new_select->group_list.elements=0;
- new_select->group_list.first=(uchar *)0;
- new_select->group_list.next=(uchar **)&new_select->group_list.first;
- List<Item> privlist;
-
- List_iterator<Item> list_it(select_lex->item_list);
- List_iterator<Item> new_it(new_fields);
-
- while ((item=list_it++))
- {
- bool not_found= TRUE;
- if (item->type()==Item::FIELD_ITEM)
- {
- Item_field *iif = (Item_field *)item;
- new_it.rewind();
- while ((new_item=new_it++))
- {
- if (new_item->type()==Item::FIELD_ITEM &&
- !strcmp(((Item_field*)new_item)->table_name,iif->table_name) &&
- !strcmp(((Item_field*)new_item)->field_name,iif->field_name))
- {
- not_found= 0;
- ((Item_field*)new_item)->db_name=iif->db_name;
- Item_field *new_one=new Item_field(&select_lex->context,
- iif->db_name, iif->table_name, iif->field_name);
- privlist.push_back(new_one);
- if (add_to_list(new_select->group_list,new_one,1))
- return 1;
- break;
- }
- }
- }
- if (not_found)
- {
- if (item->type() == Item::FIELD_ITEM)
- privlist.push_back(constant);
- else
- privlist.push_back((Item*)thd->memdup((char *)item,item->size_of()));
- }
- }
- new_select->item_list=privlist;
-
- lex->last_selects = new_select;
- return 0;
-}
-
-/****************************************************************************
- Functions that recursively creates combinations of queries for OLAP
- Returns 0 if OK, 1 if error, -1 if error already printed to client
-****************************************************************************/
-
-static int olap_combos(List<Item> old_fields, List<Item> new_fields, Item *item, LEX *lex,
- SELECT_LEX *select_lex, int position, int selection, int num_fields,
- int num_new_fields)
-{
- int sl_return = 0;
- if (position == num_new_fields)
- {
- if (item)
- new_fields.push_front(item);
- sl_return = make_new_olap_select(lex, select_lex, new_fields);
- }
- else
- {
- if (item)
- new_fields.push_front(item);
- while ((num_fields - num_new_fields >= selection - position) && !sl_return)
- {
- item = old_fields.pop();
- sl_return = olap_combos(old_fields, new_fields, item, lex, select_lex, position+1, ++selection, num_fields, num_new_fields);
- }
- }
- return sl_return;
-}
-
-
-/****************************************************************************
- Top level function for converting OLAP clauses to multiple selects
- This is also a place where clauses treatment depends on OLAP type
- Returns 0 if OK, 1 if error, -1 if error already printed to client
-****************************************************************************/
-
-int handle_olaps(LEX *lex, SELECT_LEX *select_lex)
-{
- List<Item> item_list_copy, new_item_list;
- item_list_copy.empty();
- new_item_list.empty();
- int count=select_lex->group_list.elements;
- int sl_return=0;
-
-
- lex->last_selects=select_lex;
-
- for (ORDER *order= select_lex->group_list.first ; order ; order=order->next)
- item_list_copy.push_back(*(order->item));
-
- List<Item> all_fields(select_lex->item_list);
-
-
- if (setup_tables(lex->thd, &select_lex->context, &select_lex->top_join_list,
- select_lex->table_list.first
- &select_lex->leaf_tables, FALSE) ||
- setup_fields(lex->thd, 0, select_lex->item_list, MARK_COLUMNS_READ,
- &all_fields,1) ||
- setup_fields(lex->thd, 0, item_list_copy, MARK_COLUMNS_READ,
- &all_fields, 1))
- return -1;
-
- if (select_lex->olap == CUBE_TYPE)
- {
- for ( int i=count-1; i>=0 && !sl_return; i--)
- sl_return=olap_combos(item_list_copy, new_item_list, (Item *)0, lex, select_lex, 0, 0, count, i);
- }
- else if (select_lex->olap == ROLLUP_TYPE)
- {
- for ( int i=count-1; i>=0 && !sl_return; i--)
- {
- Item *item;
- item_list_copy.pop();
- List_iterator<Item> it(item_list_copy);
- new_item_list.empty();
- while ((item = it++))
- new_item_list.push_front(item);
- sl_return=make_new_olap_select(lex, select_lex, new_item_list);
- }
- }
- else
- sl_return=1; // impossible
- return sl_return;
-}
-
-#endif /* DISABLED_UNTIL_REWRITTEN_IN_4_1 */