Commit graph

85 commits

Author SHA1 Message Date
monty@mysql.com/narttu.mysql.fi
7887babe69 Moved a lot of old bug fixes and safe cleanups from Maria 5.1 tree to 5.1
- Reserver namespace and place in frm for TABLE_CHECKSUM and PAGE_CHECKSUM create options
- Added syncing of directory when creating .frm files
- Portability fixes
- Added missing cast that could cause bugs
- Code cleanups
- Made some bit functions inline
- Moved things out of myisam.h to my_handler.h to make them more accessable
- Renamed some myisam variables and defines to make them more globaly usable (as they are used outside of MyISAM)
- Fixed bugs in error conditions
- Use compiler time asserts instead of run time
- Fixed indentation
HA_EXTRA_PREPARE_FOR_DELETE -> HA_EXTRA_PREPARE_FOR_DROP as the old name was wrong
(Added a define for old value to ensure we don't break any old code)
Added HA_EXTRA_PREPARE_FOR_RENAME as a signal for rename (before we used a DROP signal which is wrong)
- Initialize error messages early to get better errors when mysqld or an engine fails to start
- Fix windows bug that query_performance_frequency was not initialized if registry code failed
- thread_stack -> my_thread_stack_size
2007-10-11 18:07:40 +03: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
msvensson@pilot.blaudden
0b5c41acc7 Bug#25807 LOAD DATA INFILE does not work with Pipes
- Additional fix for io_cache_init being called on a closed file
2007-02-20 12:06:04 +01:00
cmiller@zippy.cornsilk.net
9e9dd4327c Bug#25807: LOAD DATA INFILE does not work with Pipes
Showstopper and regression against 5.0.24.

Previously, we ignored seek() errors (see Bug#22828) and let seek()s
against pipes fail.  Now, since we check that a seek didn't fail,
and return without reading, this bug popped up.

This restores the behavior for file-ish objects that could never be 
seek()ed.
2007-02-13 16:35:29 -05:00
thek@kpdesk.mysql.com
36fc42cb10 Merge kpdesk.mysql.com:/home/thek/dev/mysql-4.1-maint
into  kpdesk.mysql.com:/home/thek/dev/mysql-5.0-maint
2007-01-11 15:23:34 +01:00
thek@kpdesk.mysql.com
965aa4c74f Merge kpettersson@bk-internal:/home/bk/mysql-5.0-maint
into  kpdesk.mysql.com:/home/thek/dev/mysql-5.0-maint
2007-01-11 15:21:06 +01:00
thek@kpdesk.mysql.com
75d91dedac Merge kpdesk.mysql.com:/home/thek/dev/mysql-4.0-maint
into  kpdesk.mysql.com:/home/thek/dev/mysql-4.1-maint
2007-01-11 15:16:33 +01:00
thek@kpdesk.mysql.com
1802d5aabb Merge kpettersson@bk-internal:/home/bk/mysql-4.1-maint
into  kpdesk.mysql.com:/home/thek/dev/mysql-4.1-maint
2007-01-11 14:11:58 +01:00
thek@kpdesk.mysql.com
f7688d5f10 Merge kpdesk.mysql.com:/home/thek/dev/mysql-4.1-maint
into  kpdesk.mysql.com:/home/thek/dev/mysql-5.0-maint
2007-01-11 14:08:12 +01:00
thek@kpdesk.mysql.com
0982a1d9b4 Merge kpdesk.mysql.com:/home/thek/dev/mysql-4.0-maint
into  kpdesk.mysql.com:/home/thek/dev/mysql-4.1-maint
2007-01-11 14:04:01 +01:00
Kristofer.Pettersson@naruto.
d9ad0cd0ba Merge naruto.:C:/cpp/bug24751/my50-bug24751
into  naruto.:C:/cpp/mysql-5.0-maint
2007-01-11 13:09:13 +01:00
Kristofer.Pettersson@naruto.
3adcf75e1d Merge naruto.:C:/cpp/bug24751/my41-bug24751
into  naruto.:C:/cpp/bug24751/my50-bug24751
2007-01-11 09:41:44 +01:00
Kristofer.Pettersson@naruto.
270752654e Bug#24751 - Possible infinit loop in init_io_cache() when insufficient memory
- When cache memory can't be allocated size is recaclulated using 3/4 of
  the requested memory. This number is rounded up to the nearest 
  min_cache step. 
  However with the previous implementation the new cache size might
  become bigger than requested because of this rounding and thus we get
  an infinit loop.
- This patch fixes this problem by ensuring that the new cache size
  always will be smaller on the second and subsequent iterations until
  we reach min_cache.
2007-01-11 09:40:17 +01:00
thek@kpdesk.mysql.com
0906993457 Cset exclude: thek@kpdesk.mysql.com|ChangeSet|20061106104152|07628 2007-01-09 12:28:46 +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/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
thek@kpdesk.mysql.com
689a32385a Bug#23010 _my_b_read() passing illegal file handles to my_seek()
- The io cache flag seek_not_done was not set properly in the 
  reinit_io_cache function call and this led my_seek to be called
  desipite an invalid file handle.
- Added a test in reinit_io_cache to ensure we have a valid file 
  handle before setting seek_not_done flag.
2006-11-06 11:41:52 +01:00
cmiller@zippy.cornsilk.net
e235c8c421 Fix merge collision. 2006-11-02 18:27:52 -05:00
cmiller@zippy.cornsilk.net
c34f3219b3 Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint
2006-11-02 17:27:42 -05:00
thek@kpdesk.mysql.com
35b833eb86 Merge kpdesk.mysql.com:/home/thek/dev/mysql-4.1-maint
into  kpdesk.mysql.com:/home/thek/dev/mysql-5.0-maint
2006-11-01 17:01:51 +01:00
thek@kpdesk.mysql.com
12d8f2bf31 Bug#22828 _my_b_read() ignores return values for my_seek() calls
- Because my_seek actually is capable of returning an error code we should
  exploit that in the best possible way.
- There might be kernel errors or other errors we can't predict and capturing
  the return value of all system calls gives us better understanding of
  possible errors.
2006-10-31 09:26:16 +01:00
tsmith/tim@siva.hindu.god
3af2089b13 Merge siva.hindu.god:/usr/home/tim/m/bk/g50
into  siva.hindu.god:/usr/home/tim/m/bk/50
2006-10-24 14:42:08 -06:00
Kristofer.Pettersson@naruto.
3b316569a7 Bug#23010 _my_b_read() passing illegal file handles to my_seek()
- The io cache flag seek_not_done was not set properly in the reinit_
io_chache function call and this led my_seek to be called despite an
invalid file handle.
- Added a test in reinit_io_cache to ensure we have a valid file handle
before setting seek_not_done flag.
2006-10-09 21:13:37 +02:00
istruewing@chilla.local
c299de14ee Merge chilla.local:/home/mydev/mysql-4.1-bug8283-one
into  chilla.local:/home/mydev/mysql-5.0-bug8283
2006-10-09 20:03:12 +02:00
istruewing@chilla.local
5f08a83186 Bug#8283 - OPTIMIZE TABLE causes data loss
OPTIMIZE TABLE with myisam_repair_threads > 1 performs a non-quick 
parallel repair. This means that it does not only rebuild all 
indexes, but also the data file.

Non-quick parallel repair works so that there is one thread per 
index. The first of the threads rebuilds also the new data file.

The problem was that all threads shared the read io cache on the
old data file. If there were holes (deleted records) in the table,
the first thread skipped them, writing only contiguous, non-deleted
records to the new data file. Then it built the new index so that
its entries pointed to the correct record positions. But the other
threads didn't know the new record positions, but put the positions
from the old data file into the index.

The new design is so that there is a shared io cache which is filled
by the first thread (the data file writer) with the new contiguous
records and read by the other threads. Now they know the new record
positions.

Another problem was that for the parallel repair of compressed
tables a common bit_buff and rec_buff was used. I changed it so
that thread specific buffers are used for parallel repair.

A similar problem existed for checksum calculation. I made this
multi-thread safe too.
2006-10-09 19:26:55 +02:00
ingo@mysql.com
c0fab8b7b2 Merge mysql.com:/home/mydev/mysql-4.1-bug11527
into  mysql.com:/home/mydev/mysql-5.0-bug11527
2006-02-16 19:51:09 +01:00
ingo@mysql.com
718ae78972 Bug#11527 - Setting myisam_repair_threads to >1 leads to corruption
A wrong cast led to numeric overflow for data files
greater than 4GB. The parallel repair assumed end of
file after reading the amount of data that the file
was bigger than 4GB. It truncated the data file and
noted the number of records it found so far in the
index file header as the number of rows in the table.
Removing the cast fixed the problem.
I added some cosmetic changes too.

The normal repair worked because it uses a different
function to read from the data file.
2006-02-16 19:45:57 +01:00
jani@a193-229-222-105.elisa-laajakaista.fi
acf218b708 Several fixes revelaled by Intel compiler. 2005-09-23 16:47:08 +03:00
georg@lmy002.wdf.sap.corp
b64e6db5a4 fixes for windows 64-bit compiler warnings 2005-06-13 12:41:15 +02:00
jimw@mysql.com
a33a283a49 Fix change to allow FIFO as log. (Bug #8271) 2005-05-19 14:43:10 -07:00
jimw@mysql.com
165f2abba5 Avoid doing a seek when first setting up the IO cache for a file,
which allows a FIFO to be used for the non-binary logs. (Bug #8271)
2005-05-13 07:18:41 -07:00
jani@ua141d10.elisa.omakaista.fi
8db4423b8c Fixed Bug#8922.
Reverted Jim's patch.
2005-03-08 18:12:12 +02:00
jimw@mysql.com
d22a4e70f9 Clean up merge 2005-03-07 13:26:27 -08:00
jimw@mysql.com
2ca5cec8c2 Avoid calls to my_seek() and my_tell() on log files so that
non-seekable files like FIFOs can be used for logs other
than the binlog. (Bug #8271)
2005-03-02 18:14:58 -08:00
monty@mysql.com
0a1076a25f Merge with 4.1 2005-01-15 14:09:45 +02:00
monty@mysql.com
a37e91e435 Changed interface for my_strntod() to make it more general and more portable 2005-01-15 12:28:38 +02:00
monty@mysql.com
7681e62422 Merge 2005-01-15 03:49:07 +02:00
monty@mysql.com
6d280ac161 Fixed possible access to unintialized memory in filesort when using many buffers 2005-01-15 03:47:06 +02:00
monty@mysql.com
309d691e65 Changed %lx -> 0x%lx (for easier comparison of debug files)
Cosmetic cleanups
Don't call 'delete_elements' on copy_funcs as this causes elements to be freed twice
2004-08-23 13:46:51 +03:00
konstantin@mysql.com
f08bbd1f12 assert.h needed for my_dbug.h now is included in my_dbug.h, where it for
some reason wasn't included before.
A lot of files cleaned up from #include <assert.h>
2004-06-10 23:58:39 +04:00
paul@kite-hub.kitebird.com
2f0ca1ce42 Fix skipp -> skip once and for all.
(Note: This affects only comments, not variable names.)
2004-06-03 11:52:54 -05:00
dlenev@jabberwock.localdomain
a80f46bfdf WL#775 "Add status variable identifying binlog_cache_size shortage"
Added two status variables: 
  binlog_cache_use - counts number of transactions that used somehow
    transaction temporary binary log.
  binlog_cache_disk_use - counts number of transactions that required
    disk I/O for storing info in this this binary log.
2004-04-02 00:47:20 +04:00
monty@mysql.com
e0e0314d60 Merge with 4.0 2004-03-25 23:29:45 +02:00
serg@serg.mylan
d8a9a8267b shared IO_CACHE: protection against remove_io_share in a wrong time
bug#3134
2004-03-25 11:22:01 +01:00
monty@mysql.com
350b433569 merge with 4.0 2004-03-16 22:41:30 +02:00
monty@mysql.com
4ee44751d9 Fixed memory leak in DROP DATABASE when using RAID tables (Bug #2882) 2004-03-10 13:46:11 +02:00
ram@gw.mysql.r18.ru
f231d9826b just tried to find all 'skipp' and replace it with 'skip'. 2004-02-02 20:25:39 +04:00
jani@rhols221.adsl.netsonic.fi
1cc08ed699 Fixed Bug#2123, mysqld segmentation faulted when it tried to
open a file that already existed. The problem was that end_io_cache()
was called even if init_io_cache() was not. This affected both
OUTFILE and DUMPFILE (both fixed). Sometimes wrongly aligned pointer was freed,
sometimes mysqld core dumped.

Other problem was that select_dump::send_error removed the dumpfile,
even if it was created by an earlier run, or by some other program, if
the file permissions just permitted it. Fixed it so that the file will
only be deleted, if an error occurred, but the file was created by mysqld
just a moment ago, in that thread.

On the other hand, select_export did not handle the corresponding garbage
file at all. Both fixed.

After these fixes, a big part of the select_export::prepare and select_dump::prepare
code became identical. Merged the code into a new function called create_file(),
which is now called by the two latter functions.

Regards,
Jani
2004-01-15 06:48:31 +02:00
monty@mysql.com
d08945498e Fixed memory leak with RAID tables
Fixed tests for RAID tables
Detect uninitialized mutexes on lock and destroy
2003-11-21 14:41:57 +02:00
guilhem@mysql.com
6e32e19047 Use my_b_append instead of my_b_write on a SEQ_READ_APPEND cache, when we write
the first 4 bytes of the relay log. Indeed comments in mysys/mf_iocache.c 
say we must always use my_b_append for such a cache.
This *could* avoid a very rare assertion failure which is: 
030524 19:32:38  Slave SQL thread initialized, starting replication in log 'FIRST' at position 0, relay log '/
users/gbichot/4.1.1/mysql-test/var/log/slave-relay-bin.000001' position: 4
030524 19:32:38  next log '/users/gbichot/4.1.1/mysql-test/var/log/slave-relay-bin.000002' is currently active
mysqld: mf_iocache.c:701: _my_b_seq_read: Assertion `pos_in_file == info->end_of_file' failed.
and which seemed to happen always when the SQL thread and/or the I/O thread
were at position 4 in a relay log.
2003-08-19 17:00:36 +02:00