summaryrefslogtreecommitdiff
path: root/mysys/tree.c
Commit message (Collapse)AuthorAgeFilesLines
* perfschema memory related instrumentation changesSergei Golubchik2020-03-101-2/+2
|
* Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
|\
| * Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| |\
| | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | |\
| | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | * Update wrong zip-code
* | | | Merge branch '10.2' into 10.3Oleksandr Byelkin2019-05-121-25/+23
|\ \ \ \ | |/ / /
| * | | Merge branch '10.1' into 10.2Oleksandr Byelkin2019-05-041-25/+23
| |\ \ \ | | |/ /
| | * | cleanup: cosmetic fixesSergei Golubchik2019-04-241-1/+1
| | | |
| | * | cleanup: make TREE copyableSergei Golubchik2019-04-241-24/+22
| | | | | | | | | | | | | | | | | | | | move per-object TREE::null_element to be one global static null_element.
* | | | Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3Alexander Barkov2018-02-041-1/+2
|\ \ \ \
| * | | | Added name to MEM_ROOT for esier debuggingMonty2018-02-021-1/+2
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will make it easier to how memory allocation is done when debugging with either DBUG or gdb. Will especially help when debugging stored procedures Main change is a name argument as second argument to init_alloc_root() init_sql_alloc() Other things: - Added DBUG_ENTER/EXIT to some Virtual_tmp_table functions
* | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-10-041-2/+2
|\ \ \ \ | |/ / /
| * | | MDEV-13844 : Fix Windows warnings. Fix DBUG_PRINT.Vladislav Vaintroub2017-09-281-2/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix win64 pointer truncation warnings (usually coming from misusing 0x%lx and long cast in DBUG) - Also fix printf-format warnings Make the above mentioned warnings fatal. - fix pthread_join on Windows to set return value.
* | | Fix that end_bulk_insert() doesn't write to to-be-deleted filesMonty2017-05-171-14/+51
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | This affected mainly MyISAM and Aria engines. Also fixed that end_bulk_insert() detects errors from internal mi_end_bulk_insert() and ma_end_bulk_insert() - delete_tree() and delete_tree_element() now has an extra argument that marks if future calls to tree->free should be ignored. - tree->free changed to function returning int, to be able to signal errors. - Restored deleting flag in MyISAM that was accidently disabled in mi_extra(PREPARE_FOR_DROP)
* | spelling fixesklemens2017-03-071-2/+2
| |
* | Merge branch '5.5' into bb-10.0Sergei Golubchik2016-06-211-1/+2
|\ \ | |/
| * Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2016-06-141-1/+2
| |\
| | * BUG#22594514: HANDLE_FATAL_SIGNAL (SIG=11) INNisha Gopalakrishnan2016-03-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UNIQUE::~UNIQUE | SQL/UNIQUES.CC:355 Analysis ======== Enabling the sort_buffer_size with a large value can cause operations utilizing the sort buffer like DELETE as mentioned in the bug report to fail. 5.5 and 5.6 versions reports OOM error while in 5.7+, the server crashes. While initializing the mem_root for the sort buffer tree, the block size for the mem_root is determined from the 'sort_buffer_size' value. This unsigned long value is typecasted to unsigned int, hence it becomes zero. Further block_size computation while initializing the mem_root results in a very large block_size value. Hence while trying to allocate a block during the DELETE operation, an OOM error is reported. In case of 5.7+, the PFS instrumentation for memory allocation, overshoots the unsigned value and allocates a block of just one byte. While trying to free the block of the mem_root, the original block_size is used. This triggers the crash since the server tries to free unallocated memory. Fix: ==== In order to restrict usage of such unreasonable sort_buffer_size, the typecast of block size to 'unsigned int' is removed and hence reports OOM error across all versions for sizes exceeding unsigned int range.
| | * Updated/added copyright headersKent Boortz2011-06-301-2/+2
| | |\
| | * | Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabledDavi Arnaut2010-07-081-2/+2
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| | * WL#3817: Simplify string / memory area types and make things more consistent ↵monty@mysql.com/narttu.mysql.fi2007-05-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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
| | * Many files:kent@mysql.com/kent-amd64.(none)2006-12-231-2/+1
| | | | | | | | | | | | Changed header to GPL version 2 only
| | * Fixed portability issue in my_thr_init.c (was added in my last push)monty@mysql.com/narttu.mysql.fi2006-11-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed compiler warnings (detected by VC++): - Removed not used variables - Added casts - Fixed wrong assignments to bool - Fixed wrong calls with bool arguments - Added missing argument to store(longlong), which caused wrong store method to be called.
| | * Remove compiler warningsmonty@mysql.com/nosik.monty.fi2006-11-201-2/+2
| | | | | | | | | | | | | | | | | | | | | (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 #)
| | * BUG#18160 - Memory-/HEAP Table endless growing indexessvoj@april.(none)2006-04-191-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updating data in HEAP table with BTREE index results in wrong index_length counter value, which keeps growing after each update. When inserting new record into tree counter is incremented by: sizeof(TREE_ELEMENT) + key_size + tree->size_of_element But when deleting element from tree it doesn't decrement counter by key_size: sizeof(TREE_ELEMENT) + tree->size_of_element This fix makes accurate allocated memory counter for tree. That is decrease counter by key_size when deleting tree element.
| | * Bug#8321 - myisampack bug in compression algorithmingo@mysql.com2005-06-241-0/+3
| | | | | | | | | | | | | | | Added 64-bit extensions, comments, extended statistics and trace prints.
| | * Changed %lx -> 0x%lx (for easier comparison of debug files)monty@mysql.com2004-08-231-2/+2
| | | | | | | | | | | | | | | Cosmetic cleanups Don't call 'delete_elements' on copy_funcs as this causes elements to be freed twice
| | * BTREE-indexes in HEAP tables can now be used to optimize ORDER BYmonty@mysql.com2004-03-251-5/+0
| | | | | | | | | | | | | | | | | | Don't read character set files if we are using only the default charset. In most cases the user will not anymore get a warning about missing character set files Compare strings with space extend instead of space strip. Now the following comparisons holds: "a" == "a " and "a\t" < "a". (Bug #3152). Note: Because of the above fix, one has to do a REPAIR on any table that has an ascii character < 32 last in a CHAR/VARCHAR/TEXT columns.
| | * Optimized GIS functionsmonty@mashka.mysql.fi2004-03-041-8/+13
| | |
| | * Merge with 4.0.14monty@mashka.mysql.fi2003-08-111-0/+5
| | |\
| | | * Fixed memory allocation in Unique to not allocate too much memorymonty@mashka.mysql.fi2003-06-261-0/+5
| | | |
| | * | comment addedserg@serg.mylan2003-06-161-0/+10
| | | |
| | * | Portability fixes (for windows)monty@mashka.mysql.fi2003-01-211-4/+4
| | | | | | | | | | | | | | | | Some changes to the prepared statement protocol to make it easier to use and faster.
| | * | support for HA_READ_PREFIX_LAST_OR_PREV, HA_READ_PREFIX_LAST and ↵ram@mysql.r18.ru2002-11-281-20/+33
| | | | | | | | | | | | | | | | HA_READ_BEFORE_KEY
| | * | Merge with 4.0monty@mashka.mysql.fi2002-11-211-3/+5
| | |\ \ | | | |/
| | | * Try to optimize the cache buffer size needed for bulk_insertmonty@mashka.mysql.fi2002-11-201-3/+5
| | | | | | | | | | | | | | | | Fix for shutdown on Mac OS X
| | * | fix for HEAP rb-tree indexes and BIG_TABLES problem (serg: thanks for discovery)ram@mysql.r18.ru2002-11-111-2/+2
| | | |
| | * | Fixes and code cleanups after merge with 4.0.3monty@mashka.mysql.fi2002-10-021-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Warning handling and initial prepared statement handling (last not complete yet) Changed a lot of functions that returned 0/1 to my_bool type. GRANT handling now uses read/write locks instead of mutex Change basic net functions to use THD instead of NET (needed for 4.1 protocol) Use my_sprintf instead of sprintf() + strlen() Added alloc_query() to be able to chare query initialization code with prepared statements. Cleanup handling of SHOW COUNT(*) WARNINGS and SELECT LAST_INSERT_ID() Note that the following test fails (will be fixed ASAP): sub_select, union, rpl_rotate_logs and rpl_mystery22
| | * | Removed unnecessary key search in the hp_rb_write_key() functionram@gw.udmsearch.izhnet.ru2002-05-281-0/+5
| | | |
| | * | BTREE heap key structure is now the same as MyISAMram@gw.udmsearch.izhnet.ru2002-05-211-34/+30
| | | | | | | | | | | | | | | | | | | | _mi_compare_text -> mi_compate_text Changes according Monty's suggestions
| | * | RB-Tree indexes support in HEAP tablesbar@gw.udmsearch.izhnet.ru2002-04-251-11/+178
| | |/ | | | | | | | | | | | | | | | Renamed _hp_func -> hp_func mi_key_cmp moved to /mysys/my_handler.c New tests for HEAP tables
| | * Update copyrightmonty@hundin.mysql.fi2001-12-061-17/+16
| | | | | | | | | | | | Fixed memory leak on shutdown (Affects the embedded version & MyODBC)
| | * merge with 3.23.42monty@work.mysql.com2001-09-021-1/+1
| | |\
| | | * Fixes for OS2.monty@hundin.mysql.fi2001-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | Fix bug in isamlog Add argument types to function declarations.
| | * | cleanupsserg@serg.mysql.com2001-07-101-25/+29
| | | |
| | * | Redefinition of myisam_bulk_insert_tree_sizemonty@tik.mysql.fi2001-07-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed new error message Fixed test case for varbinary Threads are again killable in "merge_buffers" Cleanup of sql_repl.cc SHOW OPEN TABLES now works when no tables are opened
| | * | bulk insert optimization documentedserg@serg.mysql.com2001-07-041-1/+1
| | | |
| | * | mergedserg@serg.mysql.com2001-07-021-0/+2
| | |\ \
| | | * \ Merge mysql.sashanet.com:/home/sasha/src/bk/mysqlsasha@mysql.sashanet.com2001-06-041-0/+2
| | | |\ \ | | | | |/ | | | | | | | | | | into mysql.sashanet.com:/home/sasha/src/bk/mysql-4.0
| | | | * Added ABS() to make tests more portable.monty@hundin.mysql.fi2001-06-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | New postgresql crash-me file. Increased blob size in benchmarks from 65K to 1M.