Commit graph

220 commits

Author SHA1 Message Date
kaa@kaamos.(none)
36773c170d Merge kaamos.(none):/data/src/opt/mysql-5.0-opt
into  kaamos.(none):/data/src/opt/mysql-5.1-opt
2008-01-10 14:35:11 +03:00
evgen@moonbone.local
ce111a0d73 Bug#33675: Usage of an uninitialized memory by filesort in a subquery caused
server crash.

The filesort implementation has an optimization for subquery execution which
consists of reusing previously allocated buffers. In particular the call to
the read_buffpek_from_file function might be skipped when a big enough buffer
for buffer descriptors (buffpeks) is already allocated. Beside allocating
memory for buffpeks this function fills allocated buffer with data read from
disk. Skipping it might led to using an arbitrary memory as fields' data and
finally to a crash.

Now the read_buffpek_from_file function is always called. It allocates
new buffer only when necessary, but always fill it with correct data.
2008-01-09 00:40:41 +03:00
kostja@bodhi.(none)
e4b353c40c Use an inline getter method (thd->is_error()) to query if there is an error
in THD.
In future the error may be stored elsewhere (not in net.report_error) and 
it's important to start using an opaque getter to simplify merges.
2007-10-30 20:08:16 +03:00
kaa@polly.(none)
17a533e0d0 Merge polly.(none):/home/kaa/src/opt/bug31742/my50-bug28550
into  polly.(none):/home/kaa/src/opt/bug31742/my51-bug28550
2007-10-23 15:52:27 +04:00
kaa@polly.(none)
53a9e7f478 Fix for bug #31742: delete from ... order by function call that causes
an error, asserts server

In case of a fatal error during filesort in find_all_keys() the error
was returned without the necessary handler uninitialization.
Fixed by changing the code so that handler uninitialization is performed
before returning the error.
2007-10-22 16:10:08 +04:00
evgen@moonbone.local
fd1a43b080 Bug#15130: CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT.
When the SQL_BIG_RESULT flag is specified SELECT should store items from the
select list in the filesort data and use them when sending to a client.
The get_addon_fields function is responsible for creating necessary structures
for that. But this function was allowed to do so only for SELECT and
INSERT .. SELECT queries. This makes the SQL_BIG_RESULT useless for
the CREATE .. SELECT queries.

Now the get_addon_fields allows storing select list items in the filesort
data for the CREATE .. SELECT queries.
2007-07-24 18:15:44 +04:00
sergefp@mysql.com
d76af64aa3 BUG#29610: crash in func_group on 64bit platform:
- make merge_buffers():sort_length have type size_t as this type is 
  expected by, e.g. ptr_compare_1, which will receive pointer to 
  sort_length as comparison parameter.
2007-07-11 15:16:54 +04:00
gkodinov/kgeorge@magare.gmz
66bfc21362 Merge magare.gmz:/home/kgeorge/mysql/work/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.1-opt
2007-07-04 11:46:45 +03:00
igor@olga.mysql.com
f8683bfb44 Fixed bug #25798.
This bug may manifest itself not only with the queries for which
the index-merge access method is chosen. It also may display
itself for queries with DISTINCT.

The bug was in how the Unique::get method used the merge_buffers
function. To compare elements in the the queue employed by
merge_buffers() it must use the buffpek_compare function rather
than the function for binary comparison.
2007-07-01 15:33:28 -07:00
evgen@moonbone.local
76f4f23f54 Merge moonbone.local:/mnt/gentoo64/work/test-5.0-opt-mysql
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql
2007-06-11 14:20:52 +04:00
igor@olga.mysql.com
2d29a57f2b Fixed bug #28811: crash for a query containing a subquery with
ORDER BY and LIMIT 1. 
The bug was introduced by the patch for bug 21727. The patch
erroneously skipped initialization of the array of headers
for sorted records for non-first evaluations of the subquery.

To fix the problem a new parameter has been added to the
function make_char_array that performs the initialization.
Now this function is called for any invocation of the 
filesort procedure. Yet it allocates the buffer for sorted
records only if this parameter is NULL.
2007-06-07 22:35:31 -07:00
kostja@bodhi.(none)
16633169e4 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.(none):/opt/local/work/mysql-5.1-runtime
2007-06-01 12:12:06 +04:00
kostja@vajra.(none)
0162745cff Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  vajra.(none):/opt/local/work/mysql-5.1-runtime
2007-05-24 19:34:14 +04:00
jani@a88-113-38-195.elisa-laajakaista.fi
fc3b3a0a86 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-marvel
2007-05-24 13:24:36 +03:00
malff/marcsql@weblab.(none)
782096dbcc Bug#21554 (sp_cache.cc: violates C++ aliasing rules)
The problem reported is a compile bug,
reported by the development GCC team with GCC 4.2.

The original issue can no longer be reproduced in MySQL 5.1,
since the configure script no longer define HAVE_ATOMIC_ADD,
which caused the Linux atomic functions to be used (and cause a problem
with an invalid cast).

This patch implements some code cleanup for 5.1 only, which was identified
during the investigation of this issue.

With this patch, statistics maintained in THD::status_var are by definition
owned by the running thread, and do not need to be protected against race
conditions. These statistics are maintained by the status_var_* helpers,
which do not require any lock.
2007-05-22 13:41:40 -06:00
dkatz@damien-katzs-computer.local
e7977bab61 Merge damien-katzs-computer.local:/Users/dkatz/mysql50
into  damien-katzs-computer.local:/Users/dkatz/mysql51
2007-05-17 20:50:29 -04:00
dkatz@damien-katzs-computer.local
89e28d00b0 Bug #27119 server crash with integer division by zero during filesort on huge result
Fixed a problem and compiler warning on 64bit platforms so that they only allocated UINT_MAX number of BUFFPEKS.
2007-05-17 20:45:33 -04:00
dkatz@damien-katzs-computer.local
b1304050e1 Merge damien-katzs-computer.local:/Users/dkatz/mysql50
into  damien-katzs-computer.local:/Users/dkatz/mysql51
2007-05-17 18:11:50 -04:00
dkatz@damien-katzs-computer.local
971d8d0077 Bug #27119 server crash with integer division by zero during filesort on huge result
Fixed a compiler warning on platforms where uint != ulong from the first pushed fix.
2007-05-17 17:54:31 -04:00
dkatz@damien-katzs-computer.local
da10c5dd0b Merge damien-katzs-computer.local:/Users/dkatz/mysql50
into  damien-katzs-computer.local:/Users/dkatz/mysql51
2007-05-17 16:18:35 -04:00
dkatz@damien-katzs-computer.local
41dac22271 Bug #27119 server crash with integer division by zero during filesort on huge result
Added checks to detect integer overflow and fixed other bugs on the error path.
2007-05-16 16:14:13 -04:00
monty@mysql.com/narttu.mysql.fi
088e2395f1 WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:

- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t

Removed declaration of byte, gptr, my_string, my_size_t and size_s. 

Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
  instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
  as this requires fewer casts in the code and is more in line with how the
  standard functions work.
- Added extra length argument to dirname_part() to return the length of the
  created string.
- Changed (at least) following functions to take uchar* as argument:
  - db_dump()
  - my_net_write()
  - net_write_command()
  - net_store_data()
  - DBUG_DUMP()
  - decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
  argument to my_uncompress() from a pointer to a value as we only return
  one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
  the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
  casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.

Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
  needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
  explicitely as this conflict was often hided by casting the function to
  hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
  get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
  size_t. This was needed to properly detect errors (which are
  returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
  (portability fix)
- Removed windows specific code to restore cursor position as this
  causes slowdown on windows and we should not mix read() and pread()
  calls anyway as this is not thread safe. Updated function comment to
  reflect this. Changed function that depended on original behavior of
  my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
  m_size is the number of elements in the array, not a string/memory
  length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
  Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
  - Replaced some calls to alloc_root + memcpy to use
    strmake_root()/strdup_root().
  - Changed some calls from memdup() to strmake() (Safety fix)
  - Simpler loops in client-simple.c
2007-05-10 12:59:39 +03:00
gkodinov/kgeorge@magare.gmz
2fd1bd92a3 Merge magare.gmz:/home/kgeorge/mysql/autopush/B26794-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26794-merge-5.1-opt
2007-03-14 17:04:45 +02:00
gkodinov/kgeorge@macbook.gmz
d2c977a935 Bug #26672:
DATE/DATETIME values are out of the currently supported
 4 basic value types (INT,STRING,REAL and DECIMAL).
 So expressions (not fields) of compile type DATE/DATETIME are 
 generally considered as STRING values. This is not so
 when they are compared : then they are compared as 
 INTEGER values.
 But the rule for comparison as INTEGERS must be checked
 explicitly each time when a comparison is to be performed.
 filesort is one such place. However there the check was 
 not done and hence the expressions (not fields) of type 
 DATE/DATETIME were sorted by their string representation.
 Fixed to compare them as INTEGER values for filesort.
2007-03-07 14:51:45 +02:00
monty@mysql.com/narttu.mysql.fi
e5cc397f33 Fixed compiler warnings (for linux and win32 and win64)
Fixed a couple of usage of not initialized warnings (unlikely cases)
2007-02-22 16:59:57 +02:00
monty@mysql.com/narttu.mysql.fi
26aa385bc5 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2007-02-21 14:07:08 +02:00
jani@a88-113-38-195.elisa-laajakaista.fi
cd75806b61 Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.1
into  a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1
2007-02-03 00:58:09 +02:00
gluh@eagle.(none)
7849d31923 Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-02-02 10:25:45 +04:00
monty@mysql.com/narttu.mysql.fi
410fc81a72 After merge fixes
Removed a lot of compiler warnings
Removed not used variables, functions and labels
Initialize some variables that could be used unitialized (fatal bugs)
%ll -> %l
2007-01-29 01:47:35 +02:00
monty@narttu.mysql.fi
8a80e36ac3 Merge mysql.com:/home/my/mysql-5.0
into  mysql.com:/home/my/mysql-5.1
Merge of 'remove compiler warnings when using -Wshadow'
2007-01-27 03:46:45 +02:00
igor@olga.mysql.com
19f4fb2b4f Merge olga.mysql.com:/home/igor/dev-opt/mysql-4.1-opt-bug24653
into  olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug24653
2007-01-25 21:01:28 -08:00
igor@olga.mysql.com
36df33d80a Fixed bug #24653.
The bug report has demonstrated the following two problems.
1. If an ORDER/GROUP BY list includes a constant expression being 
optimized away and, at the same time, containing single-row
subselects that return more that one row, no error is reported.
Strictly speaking the standard allows to ignore error in this case.
Yet, now a corresponding fatal error is reported in this case.
2. If a query requires sorting by expressions containing single-row
subselects that, however, return more than one row, then the execution
of the query may cause a server crash. 
To fix this some code has been added that blocks execution of a subselect
item in case of a fatal error in the method Item_subselect::exec.
2007-01-25 18:44:35 -08:00
monty@mysql.com/narttu.mysql.fi
a04157fbb3 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/my/mysql-5.0
2007-01-22 14:04:40 +02:00
kent@kent-amd64.(none)
58763e383e Merge mysql.com:/home/kent/bk/main/mysql-5.0
into  mysql.com:/home/kent/bk/main/mysql-5.1
2006-12-31 01:32:21 +01:00
kent@mysql.com/kent-amd64.(none)
6523aca729 my_strtoll10-x86.s:
Corrected spelling in copyright text
Makefile.am:
  Don't update the files from BitKeeper
Many files:
  Removed "MySQL Finland AB & TCX DataKonsult AB" from copyright header
  Adjusted year(s) in copyright header 
Many files:
  Added GPL copyright text
Removed files:
  Docs/Support/colspec-fix.pl
  Docs/Support/docbook-fixup.pl
  Docs/Support/docbook-prefix.pl
  Docs/Support/docbook-split
  Docs/Support/make-docbook
  Docs/Support/make-makefile
  Docs/Support/test-make-manual
  Docs/Support/test-make-manual-de
  Docs/Support/xwf
2006-12-31 01:02:27 +01:00
kent@kent-amd64.(none)
be15e3bc15 Merge mysql.com:/home/kent/bk/main/mysql-5.0
into  mysql.com:/home/kent/bk/main/mysql-5.1
2006-12-23 20:20:40 +01:00
kent@mysql.com/kent-amd64.(none)
226a5c833f Many files:
Changed header to GPL version 2 only
2006-12-23 20:17:15 +01:00
monty@mysql.com/narttu.mysql.fi
88dd873de0 Fixed compiler warnings detected by option -Wshadow and -Wunused:
- Removed not used variables and functions
- Added #ifdef around code that is not used
- Renamed variables and functions to avoid conflicts
- Removed some not used arguments

Fixed some class/struct warnings in ndb
Added define IS_LONGDATA() to simplify code in libmysql.c

I did run gcov on the changes and added 'purecov' comments on almost all lines that was not just variable name changes
2006-12-15 00:51:37 +02:00
gkodinov@dl145s.mysql.com
32c9e11df9 Merge bk-internal:/home/bk/mysql-5.1
into  dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE/mysql-5.1-opt
2006-11-28 17:14:16 +01:00
gkodinov@dl145s.mysql.com
e74c9add47 Merge bk-internal:/home/bk/mysql-5.0
into  dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE/mysql-5.0-opt
2006-11-27 16:25:52 +01:00
monty@nosik.monty.fi
89570bf966 Merge mysql.com:/home/my/mysql-5.0
into  mysql.com:/home/my/mysql-5.1
2006-11-22 14:11:36 +02:00
gkodinov/kgeorge@macbook.gmz
ed94ac23ce Merge macbook.gmz:/Users/kgeorge/mysql/work/mysql-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/merge-5.1-opt
2006-11-22 12:50:58 +02:00
sergefp@mysql.com
0421d489fb Fix typo in comment 2006-11-21 21:52:39 +03:00
monty@mysql.com/nosik.monty.fi
e825879800 Remove compiler warnings
(Mostly in DBUG_PRINT() and unused arguments)
Fixed bug in query cache when used with traceing (--with-debug)
Fixed memory leak in mysqldump
Removed warnings from mysqltest scripts (replaced -- with #)
2006-11-20 22:42:06 +02:00
holyfoot/hf@deer.(none)
938ba3e11e Merge mysql.com:/home/hf/work/mysql-5.0.clean
into  mysql.com:/home/hf/work/mysql-5.1.clean
2006-11-08 19:09:39 +04:00
igor@rurik.mysql.com
79abdb38f8 Merge rurik.mysql.com:/home/igor/mysql-5.0-opt
into  rurik.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug21727
2006-11-01 14:50:14 -08:00
igor@rurik.mysql.com
2a7acba7e1 Fixed bug #21727.
This is a performance issue for queries with subqueries evaluation
of which requires filesort.
Allocation of memory for the sort buffer at each evaluation of a
subquery may take a significant amount of time if the buffer is rather big.
With the fix we allocate the buffer at the first evaluation of the
subquery and reuse it at each subsequent evaluation.
2006-10-31 17:31:56 -08:00
jani@ua141d10.elisa.omakaista.fi
446d2c9960 Added a missing breakpoint. This could cause
wrong results in order by in some rare cases.
2006-10-03 12:44:59 +03:00
gkodinov@dl145s.mysql.com
3abb604333 Merge dl145s.mysql.com:/data/bk/team_tree_merge/mysql-5.1
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1-opt
2006-09-28 10:41:42 +02:00
gkodinov/kgeorge@macbook.gmz
a01e7b12ce Merge macbook.gmz:/Users/kgeorge/mysql/work/B21174-5.0-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B21174-5.1-opt
2006-09-27 13:03:41 +03:00