Commit graph

55 commits

Author SHA1 Message Date
Davi Arnaut
c1545bec1e Bug#42733: Type-punning warnings when compiling MySQL
Post-merge fix: remove remaining casts which are now
unnecessary and are actually causing warnings.
2010-07-24 09:24:44 -03:00
Davi Arnaut
a10ae35328 Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.

Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.

Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost. 

The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.

Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
2010-07-08 18:20:08 -03:00
jonas@perch.ndb.mysql.com
47f379d2f1 Merge perch.ndb.mysql.com:/home/jonas/src/51-telco-gca
into  perch.ndb.mysql.com:/home/jonas/src/51-ndb
2008-01-23 10:28:30 +01:00
jonas@perch.ndb.mysql.com
94378f9189 Merge perch.ndb.mysql.com:/home/jonas/src/50-telco-gca
into  perch.ndb.mysql.com:/home/jonas/src/51-telco-gca
2008-01-23 10:11:40 +01:00
stewart@willster.(none)
5a67e7ebd6 ndb_rand.c:
Rename: ndb/src/common/util/ndb_rand.c -> storage/ndb/src/common/util/ndb_rand.c
ndb_rand.h:
  Rename: ndb/include/util/ndb_rand.h -> storage/ndb/include/util/ndb_rand.h
2007-09-25 12:16:39 +02:00
tomas@whalegate.ndb.mysql.com
fc50cd5ab2 Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new-ndb-merge
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-new-ndb-merge
2007-07-13 10:35:03 +02:00
tomas@whalegate.ndb.mysql.com
e22ba29c2b fix ndb_version.h so that it is usable and make some functions public to handle ndb version 2007-07-11 14:36:44 +02: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
tomas@whalegate.ndb.mysql.com
deec4449ac Bug#26176 NdbObjectIdMap::expand unable to expand!! mysqld got signal 11
- try to catch as many malloc failures as possible and give error messages
(more for 5.1)
2007-04-11 18:10:45 +02:00
tomas@whalegate.ndb.mysql.com
da1ebc7fce Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user
2007-04-11 15:51:09 +02:00
tomas@whalegate.ndb.mysql.com
d5f63f25c5 Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new-ndb
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user
2007-03-23 21:50:57 +01:00
stewart@mysql.com[stewart]
471469a674 [PATCH] WL#3704 mgmapi timeouts: For mgm server, have timeout per operation, not for entire connection (i.e. fix the bug)
for TransporterRegistry, keep connection to management server alive.


Index: ndb-work/storage/ndb/include/util/InputStream.hpp
===================================================================
2007-03-22 22:36:07 +11:00
stewart@mysql.com[stewart]
75cff8cd26 [PATCH] WL#3704 mgmapi timeouts: Correct cpc client usage of Socket Input/OutputStream for timeouts
Index: ndb-work/storage/ndb/include/util/InputStream.hpp
===================================================================
2007-03-22 22:35:55 +11:00
stewart@mysql.com[stewart]
c537c27796 [PATCH] WL#3704 mgmapi timeouts: Change to have total timeout for call, not per request
use portable method, getting milliseconds between calls - Linux would
let us do funky stuff by getting the timeout from select(2). Everywhere
else sucks and doesn't let us do that :(

Index: ndb-work/storage/ndb/include/util/InputStream.hpp
===================================================================
2007-03-22 22:35:07 +11:00
stewart@mysql.com[stewart]
64361ee36f [PATCH] WL#3704 mgmapi timeouts: Add bool timeout flag to Streams
Index: ndb-work/storage/ndb/include/util/InputStream.hpp
===================================================================
2007-03-22 22:33:43 +11:00
stewart@mysql.com[stewart]
c2f0a25dc4 [PATCH] WL#3704 mgmapi timeouts: Rename inputstream timeout
Index: ndb-work/storage/ndb/include/util/InputStream.hpp
===================================================================
2007-03-22 22:33:31 +11:00
tomas@poseidon.mysql.com
f4e0bc78dd Merge poseidon.mysql.com:/home/tomas/mysql-5.1-telco-gca-ndb_restore
into  poseidon.mysql.com:/home/tomas/mysql-5.1-new-ndb
2007-03-09 01:01:20 +07:00
tomas@poseidon.mysql.com
bd49cdd273 Merge poseidon.mysql.com:/home/tomas/mysql-5.0-telco-gca-ndb_restore
into  poseidon.mysql.com:/home/tomas/mysql-5.1-telco-gca-ndb_restore
2007-03-07 13:44:54 +07:00
stewart@willster.(none)
6358a0f48c Merge willster.(none):/home/stewart/Documents/MySQL/5.0/ndb-work
into  willster.(none):/home/stewart/Documents/MySQL/5.1/ndb-work
2007-02-14 16:37:40 +11:00
stewart@willster.(none)
dbaab7f474 Merge willster.(none):/home/stewart/Documents/MySQL/5.0/bug25487
into  willster.(none):/home/stewart/Documents/MySQL/5.1/bug25567
2007-01-24 00:34:12 +11: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@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
mskold/marty@linux.site
6f0e7a2631 Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.1
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1-new-ndb
2006-12-01 21:12:13 +01:00
mskold/marty@linux.site
d7e375680a Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.1
into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1-new-ndb
2006-11-30 15:31:20 +01:00
monty@mysql.com/narttu.mysql.fi
3a35c30027 Fixed compiler warnings (Mostly VC++):
- Removed not used variables
- Changed some ulong parameters/variables to ulonglong (possible serious bug)
- Added casts to get rid of safe assignment from longlong to long (and similar)
- Added casts to function parameters
- Fixed signed/unsigned compares
- Added some constructores to structures
- Removed some not portable constructs

Better fix for bug Bug #21428 "skipped 9 bytes from file: socket (3)" on "mysqladmin shutdown"
(Added new parameter to net_clear() to define when we want the communication buffer to be emptied)
2006-11-30 03:40:42 +02:00
monty@mysql.com/nosik.monty.fi
fa81a82e7f Fixed a LOT of compiler warnings
Added missing DBUG_RETURN statements (in mysqldump.c)
Added missing enums
Fixed a lot of wrong DBUG_PRINT() statements, some of which could cause crashes
Removed usage of %lld and %p in printf strings as these are not portable or produces different results on different systems.
2006-11-27 01:47:38 +02: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
stewart@willster.(none)
e07d563a4d Merge willster.(none):/home/stewart/Documents/MySQL/5.0/ndb-mgm-work
into  willster.(none):/home/stewart/Documents/MySQL/5.1/ndb-mgm-work
2006-11-08 15:23:46 +11:00
stewart@willster.(none)
dd2cea1698 remove OSE 2006-11-03 02:18:45 +11:00
stewart@willster.(none)
d345a1fdf7 Merge willster.(none):/home/stewart/Documents/MySQL/5.0/ndb-mgm-work
into  willster.(none):/home/stewart/Documents/MySQL/5.1/ndb-mgm-work
2006-11-02 23:46:59 +11:00
knielsen@ymer.(none)
e43c5fca48 Merge ymer.(none):/usr/local/mysql/mysql-4.1-ndb.tmp
into  ymer.(none):/usr/local/mysql/mysql-5.1-new-ndb
2006-10-25 10:44:22 +02:00
stewart@willster.(none)
3551165c90 Merge willster.(none):/home/stewart/Documents/MySQL/5.0/bug21154
into  willster.(none):/home/stewart/Documents/MySQL/5.1/bug13987

Merge 5.0-ndb into 5.1-ndb
2006-10-05 23:13:29 +10:00
jonas@perch.ndb.mysql.com
c3e20d907e Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-new-ndb
into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb
2006-10-04 11:42:50 +02:00
gni/root@dev3-127.(none)
c26952192b BUG@21585 The --help option shows a screen of command options for the ndbd, ndb_mgmd, ndb_mgm
and other commands related to ndb. For all of these, the help screen contains 
           "Ndb.cfg" string. Now i change the "Ndb.cfg" to "my.cnf" because "Ndb.cfg" is obsolete.
2006-09-22 20:22:50 +08:00
jonas@perch.ndb.mysql.com
64bf33836e Merge perch.ndb.mysql.com:/home/jonas/src/50-work
into  perch.ndb.mysql.com:/home/jonas/src/51-work
2006-09-15 11:43:49 +02:00
dli@dev3-76.dev.cn.tlan
ac481a3206 Merge dev3-76.dev.cn.tlan:/home/dli/mysql/mysql-5.0/mysql-5.0-bug-21345
into  dev3-76.dev.cn.tlan:/home/dli/mysql/mysql-5.1/mysql-5.1-bug-21345
2006-09-01 10:36:32 +08:00
stewart@mysql.com
9edd7b3766 Merge mysql.com:/home/stewart/Documents/MySQL/5.0/bugsmerge
into  mysql.com:/home/stewart/Documents/MySQL/5.1/main
2006-06-20 17:33:14 +10:00
jonas@perch.ndb.mysql.com
98e8749ef3 Merge perch.ndb.mysql.com:/home/jonas/src/50-work
into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb
2006-05-19 10:36:19 +02:00
jani@ua141d10.elisa.omakaista.fi
083f8455c7 Merge ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0
into  ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.1-new
2006-05-09 20:50:29 +03:00
jonas@perch.ndb.mysql.com
59bced7f8a Merge perch.ndb.mysql.com:/home/jonas/src/50-work
into  perch.ndb.mysql.com:/home/jonas/src/51-work
2006-04-26 15:16:21 +02:00
tomas@poseidon.ndb.mysql.com
fe67d648fc Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0
into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new
2006-04-21 14:00:44 +02:00
mskold@mysql.com
27a2d1b68b Merge mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
into  mysql.com:/usr/local/home/marty/MySQL/mysql-5.1-new
2006-04-20 12:10:09 +02:00
monty@mysql.com
cbd420a0c1 Remove compiler warnings
Add missing DBUG_RETURN
Fixed stack overflow in NdbBlob (found by ndb_gis.test)
Fixed access to freed memory in ndb_cluster_real_free_share()
2006-03-29 17:04:00 +03:00
jonas@perch.ndb.mysql.com
4a22082b66 ndb -
more compiler warnings...
2006-03-24 10:23:50 +01:00
jonas@perch.ndb.mysql.com
31efa863dd ndb -
still some compiler warnings
2006-03-24 10:19:10 +01:00
stewart@mysql.com
05696de46f Merge mysql.com:/home/stewart/Documents/MySQL/5.0/bug17411-thisisaverylongnamethatshouldbewaylongerthanthe128limitthatweprivouslyhadbutireallywantotestitandseethatitdoesreallywork.nowitshouldbeabout160charslongnonow.iwonderifanythingwillchokeornotwiththisoutrageouslylongpathname
into  mysql.com:/home/stewart/Documents/MySQL/5.1/new
2006-02-16 15:51:37 +11:00
jonas@perch.ndb.mysql.com
d033448fa1 Merge perch.ndb.mysql.com:/home/jonas/src/50-work
into  perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new
2006-01-13 09:22:02 +01:00
jonas@perch.ndb.mysql.com
161645c81e wl2723 - ndb opt. nr 2006-01-11 11:35:25 +01:00
jonas@perch.ndb.mysql.com
88fbfc489d Import ndb varsize 2005-11-07 12:19:28 +01:00
monty@mysql.com
a6f5375cb0 Merge mysql.com:/home/my/mysql-5.0
into  mysql.com:/home/my/mysql-5.1
2005-11-05 01:32:55 +02:00