mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
76bf7d2224
Fixed compiler warnings (a lot of hidden variables detected by the Forte compiler) Added a lot of 'version_xxx' strings to 'show variables' Prevent copying of TMP_TABLE_PARAM (This caused core dump bug on Solaris) Fixed problem with printing sub selects to debug log Docs/mysqld_error.txt: Updated error messages Makefile.am: Added missing SSL library (Should be in source distribution) configure.in: Added missing SSL library include/sql_common.h: Move duplicated prototypes innobase/os/os0file.c: Added comment for line that could be removed innobase/srv/srv0srv.c: Added comment for line that could be removed innobase/srv/srv0start.c: Added comment for line that could be removed innobase/trx/trx0sys.c: Added cast to remove compiler warning isam/isamchk.c: Fixed compiler warning libmysql/conf_to_src.c: Include files in proper order myisam/mi_check.c: Removed else part that caused compiler warning myisam/mi_delete.c: Added cast myisam/mi_page.c: Added cast myisam/mi_preload.c: Added cast myisam/mi_write.c: Added cast myisam/myisampack.c: changed 'byte' to 'current_byte' to avoid compiler warnings mysql-test/mysql-test-run.sh: Removed start-from as test '<' is not portable and this can easily be done from command line mysys/hash.c: Added cast mysys/mf_wcomp.c: Removed not reached line mysys/my_append.c: Fixed include file order to get this more portable mysys/my_copy.c: Fixed include file order to get this more portable mysys/my_redel.c: Fixed include file order to get this more portable sql-common/client.c: More DBUG_PRINT sql-common/pack.c: Added casts becasue Fortre compiler apparently compares (ulonglong) < (longlong) as signed sql/ha_heap.cc: Changed variable names to not cause hidden variables sql/ha_innodb.cc: Changed variable names to not cause hidden variables sql/item.cc: Changed variable names to not cause hidden variables sql/item.h: Changed variable names to not cause hidden variables sql/item_cmpfunc.h: Changed variable names to not cause hidden variables sql/item_func.cc: Changed variable names to not cause hidden variables sql/item_subselect.cc: Changed variable names to not cause hidden variables sql/item_subselect.h: Changed variable names to not cause hidden variables sql/item_sum.cc: Changed variable names to not cause hidden variables sql/item_timefunc.cc: Changed variable names to not cause hidden variables sql/log.cc: Changed variable names to not cause hidden variables sql/protocol.cc: Changed variable names to not cause hidden variables sql/protocol.h: Changed variable names to not cause hidden variables Remove function not declared in protocol.cc sql/protocol_cursor.cc: Changed variable names to not cause hidden variables sql/set_var.cc: Added a lot of 'version_xxx' strings Changed 'bdb_version' to 'version_bdb' sql/sql_class.cc: Changed variable names to not cause hidden variables Add TMP_TABLE_PARAM::init() to allow one to initialize structure several times sql/sql_class.h: Prevent copying of TMP_TABLE_PARAM (This caused core dump bug on Solaris) sql/sql_derived.cc: Avoid copying TMP_TABLE_PARAM (Use class version instead) sql/sql_error.cc: More DBUG sql/sql_help.cc: Fixed compiler warning sql/sql_lex.cc: Changed variable names to not cause hidden variables sql/sql_list.h: Changed variable names to not cause hidden variables sql/sql_parse.cc: Changed variable names to not cause hidden variables sql/sql_select.cc: Changed variable names to not cause hidden variables Ensure that you don't send NULL to printf() for %s Fixed problem with printing sub selects to debug log sql/sql_select.h: Changed variable names to not cause hidden variables sql/sql_union.cc: Changed variable names to not cause hidden variables Don't use local copy of TMP_TABLE_PARAM (Caused core dump on Solaris) sql/sql_update.cc: Indentation cleanup sql/sql_yacc.yy: Remove warning strings/conf_to_src.c: Fixed include file order
118 lines
3.3 KiB
C
118 lines
3.3 KiB
C
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
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 */
|
|
|
|
/*
|
|
Preload indexes into key cache
|
|
*/
|
|
|
|
#include "myisamdef.h"
|
|
|
|
|
|
/*
|
|
Preload pages of the index file for a table into the key cache
|
|
|
|
SYNOPSIS
|
|
mi_preload()
|
|
info open table
|
|
map map of indexes to preload into key cache
|
|
ignore_leaves only non-leaves pages are to be preloaded
|
|
|
|
RETURN VALUE
|
|
0 if a success. error code - otherwise.
|
|
|
|
NOTES.
|
|
At present pages for all indexes are preloaded.
|
|
In future only pages for indexes specified in the key_map parameter
|
|
of the table will be preloaded.
|
|
*/
|
|
|
|
int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
|
|
{
|
|
uint i;
|
|
ulong length, block_length= 0;
|
|
uchar *buff= NULL;
|
|
MYISAM_SHARE* share= info->s;
|
|
uint keys= share->state.header.keys;
|
|
MI_KEYDEF *keyinfo= share->keyinfo;
|
|
my_off_t key_file_length= share->state.state.key_file_length;
|
|
my_off_t pos= share->base.keystart;
|
|
DBUG_ENTER("mi_preload");
|
|
|
|
if (!keys || !key_map || key_file_length == pos)
|
|
DBUG_RETURN(0);
|
|
|
|
block_length= keyinfo[0].block_length;
|
|
|
|
/* Check whether all indexes use the same block size */
|
|
for (i= 1 ; i < keys ; i++)
|
|
{
|
|
if (keyinfo[i].block_length != block_length)
|
|
DBUG_RETURN(my_errno= HA_ERR_NON_UNIQUE_BLOCK_SIZE);
|
|
}
|
|
|
|
length= info->preload_buff_size/block_length * block_length;
|
|
set_if_bigger(length, block_length);
|
|
|
|
if (!(buff= (uchar *) my_malloc(length, MYF(MY_WME))))
|
|
DBUG_RETURN(my_errno= HA_ERR_OUT_OF_MEM);
|
|
|
|
if (flush_key_blocks(share->key_cache,share->kfile, FLUSH_RELEASE))
|
|
goto err;
|
|
|
|
do
|
|
{
|
|
/* Read the next block of index file into the preload buffer */
|
|
if ((my_off_t) length > (key_file_length-pos))
|
|
length= (ulong) (key_file_length-pos);
|
|
if (my_pread(share->kfile, (byte*) buff, length, pos, MYF(MY_FAE)))
|
|
goto err;
|
|
|
|
if (ignore_leaves)
|
|
{
|
|
uchar *end= buff+length;
|
|
do
|
|
{
|
|
if (mi_test_if_nod(buff))
|
|
{
|
|
if (key_cache_insert(share->key_cache,
|
|
share->kfile, pos, DFLT_INIT_HITS,
|
|
(byte*) buff, block_length))
|
|
goto err;
|
|
}
|
|
pos+= block_length;
|
|
}
|
|
while ((buff+= block_length) != end);
|
|
buff= end-length;
|
|
}
|
|
else
|
|
{
|
|
if (key_cache_insert(share->key_cache,
|
|
share->kfile, pos, DFLT_INIT_HITS,
|
|
(byte*) buff, length))
|
|
goto err;
|
|
pos+= length;
|
|
}
|
|
}
|
|
while (pos != key_file_length);
|
|
|
|
my_free((char*) buff, MYF(0));
|
|
DBUG_RETURN(0);
|
|
|
|
err:
|
|
my_free((char*) buff, MYF(MY_ALLOW_ZERO_PTR));
|
|
DBUG_RETURN(my_errno= errno);
|
|
}
|
|
|