summaryrefslogtreecommitdiff
path: root/libmysqld/lib_sql.cc
Commit message (Collapse)AuthorAgeFilesLines
* fix embedded startup with no command line argumentsSergei Golubchik2022-12-021-9/+6
| | | | | &fake_argv cannot be cast to char*** this causes a crash when resolving
* Merge branch '10.2' into 10.3mariadb-10.3.33Oleksandr Byelkin2022-01-291-1/+1
|\
| * Fixed wrong function call in embedded serverMonty2022-01-281-1/+1
| | | | | | | | | | | | This happens when compiled with HAVE_EMBEDDED_PRIVILEGE_CONTROL. There is a lot of other problems with the above option that should be fixed at some point
* | Merge branch '10.2' into 10.3Sergei Golubchik2021-02-011-1/+2
|\ \ | |/
| * cleanup: fix and generalize handle_manager threadSergei Golubchik2021-01-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * provide an argument to the callback * don't ignore a callback request if it's already present in the queue * initialize mutex/cond/in_use flag before starting the thread, in case the first callback queueing request arrives before handle_manager had time to initialize * set/check abort_manager under a mutex, otherwise handle_manager thread might destroy LOCK_manager before stop_handle_manager released it * signal COND on queueing a callback, stop cond_wait on callback request * always start the thread, even if flush_time is 0 * but keep the old behavior in embedded (no replication, no galera) * style cleanups (e.g. remove volatile for a variable protected by a mutex)
* | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-10-301-1/+2
|\ \ | |/
| * MDEV-19838: followup, fix for PS & embeddedOleksandr Byelkin2020-10-291-1/+2
| | | | | | | | Use 9 byte (min length packet)
* | Merge branch '10.2' into 10.3Monty2019-09-031-4/+14
|\ \ | |/
| * embedded client now writes errors to stderr during init_embedded_serverMonty2019-09-011-3/+14
| | | | | | | | | | This was done to be able to get any information why the embedded server doesn't start.
* | Mark embedded library as deinited.Oleksandr Byelkin2018-06-251-0/+1
| |
* | MDEV-16478: mysql_real_connect() from libmariadbd.so always crashOleksandr Byelkin2018-06-251-4/+13
| | | | | | | | | | | | | | Returned accidentally removed undefinition of MYSQL_SERVER in net_serv.cc inside embedded server (embedded server uses real_net_read/write only as a client) Prevented attempt to clean up embedded server if it was not initialized
* | Cleanup: renaming methods make_field(Send_field*) to make_send_field(..)Alexander Barkov2018-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Renaming methods: - Field::make_field(Send_field*) to make_send_field(..) - Item::make_field(THD *,Send_field *) to make_send_field(..) - Item::init_make_field(Send_field *, enum_field_type) to init_make_send_field(..) These names looked similar to other functions that are used for a very different purpose (creating Field instances): - Public function "Field * make_field(..)" - Method "Field *Column_defitinion::make_field(..)" The rename makes it's easier to search the code using "grep".
* | Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3Alexander Barkov2018-02-041-2/+2
|\ \
| * | Added name to MEM_ROOT for esier debuggingMonty2018-02-021-2/+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
* | | Changed database, tablename and alias to be LEX_CSTRINGMonty2018-01-301-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done in, among other things: - thd->db and thd->db_length - TABLE_LIST tablename, db, alias and schema_name - Audit plugin database name - lex->db - All db and table names in Alter_table_ctx - st_select_lex db Other things: - Changed a lot of functions to take const LEX_CSTRING* as argument for db, table_name and alias. See init_one_table() as an example. - Changed some function arguments from LEX_CSTRING to const LEX_CSTRING - Changed some lists from LEX_STRING to LEX_CSTRING - threads_mysql.result changed because process list_db wasn't always correctly updated - New append_identifier() function that takes LEX_CSTRING* as arguments - Added new element tmp_buff to Alter_table_ctx to separate temp name handling from temporary space - Ensure we store the length after my_casedn_str() of table/db names - Removed not used version of rename_table_in_stat_tables() - Changed Natural_join_column::table_name and db_name() to never return NULL (used for print) - thd->get_db() now returns db as a printable string (thd->db.str or "")
* | | remove ifdefs around PSI_THREAD_CALLSergei Golubchik2018-01-091-1/+1
|/ / | | | | | | same change as for PSI_TABLE_CALL
* | Merge branch '10.2' into bb-10.2-extSergei Golubchik2017-08-251-2/+1
|\ \ | |/
| * Merge branch '10.1' into 10.2Sergei Golubchik2017-08-171-2/+1
| |\
| | * MDEV-13179 main.errors fails with wrong errnoMonty2017-08-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that the introduction of max-thread-mem-used can cause an allocation error very early, even before mysql_parse() is called. As mysql_parse() calls thd->reset_for_next_command(), which called clear_error(), the error number was lost. Fixed by adding an option to have unique messages for each KILL signal and change max-thread-mem-used to use this new feature. This removes a lot of problems with the original approach, where one could get errors signaled silenty almost any time. ixed by moving clear_error() from reset_for_next_command() to do_command(), before any memory allocation for the thread. Related changes: - reset_for_next_command() now have an optional parameter if we should call clear_error() or not. By default it's called, but not anymore from dispatch_command() which was the original problem. - Added optional paramater to clear_error() to force calling of reset_diagnostics_area(). Before clear_error() only called reset_diagnostics_area() if there was no error, so we normally called reset_diagnostics_area() twice. - This change removed several duplicated calls to clear_error() when starting a query. - Reset max_mem_used on COM_QUIT, to protect against kill during quit. - Use fatal_error() instead of setting is_fatal_error (cleanup) - Set fatal_error if max_thead_mem_used is signaled. (Same logic we use for other places where we are out of resources)
| | * bugfix: mutex order violation in embeddedSergei Golubchik2017-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | safe_mutex: Found wrong usage of mutex 'LOCK_thread_count' and 'LOCK_status' Mutex currently locked (in reverse order): LOCK_status sql/sql_class.h line 3873 LOCK_thread_count libmysqld/lib_sql.cc line 432
* | | Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-5/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benefits of this patch: - Removed a lot of calls to strlen(), especially for field_string - Strings generated by parser are now const strings, less chance of accidently changing a string - Removed a lot of calls with LEX_STRING as parameter (changed to pointer) - More uniform code - Item::name_length was not kept up to date. Now fixed - Several bugs found and fixed (Access to null pointers, access of freed memory, wrong arguments to printf like functions) - Removed a lot of casts from (const char*) to (char*) Changes: - This caused some ABI changes - lex_string_set now uses LEX_CSTRING - Some fucntions are now taking const char* instead of char* - Create_field::change and after changed to LEX_CSTRING - handler::connect_string, comment and engine_name() changed to LEX_CSTRING - Checked printf() related calls to find bugs. Found and fixed several errors in old code. - A lot of changes from LEX_STRING to LEX_CSTRING, especially related to parsing and events. - Some changes from LEX_STRING and LEX_STRING & to LEX_CSTRING* - Some changes for char* to const char* - Added printf argument checking for my_snprintf() - Introduced null_clex_str, star_clex_string, temp_lex_str to simplify code - Added item_empty_name and item_used_name to be able to distingush between items that was given an empty name and items that was not given a name This is used in sql_yacc.yy to know when to give an item a name. - select table_name."*' is not anymore same as table_name.* - removed not used function Item::rename() - Added comparision of item->name_length before some calls to my_strcasecmp() to speed up comparison - Moved Item_sp_variable::make_field() from item.h to item.cc - Some minimal code changes to avoid copying to const char * - Fixed wrong error message in wsrep_mysql_parse() - Fixed wrong code in find_field_in_natural_join() where real_item() was set when it shouldn't - ER_ERROR_ON_RENAME was used with extra arguments. - Removed some (wrong) ER_OUTOFMEMORY, as alloc_root will already give the error. TODO: - Check possible unsafe casts in plugin/auth_examples/qa_auth_interface.c - Change code to not modify LEX_CSTRING for database name (as part of lower_case_table_names)
* | Merge branch '10.1' into 10.2Sergei Golubchik2016-09-091-0/+6
|\ \ | |/
| * MDEV-10318 : Fix crash in embedded, in case prepared statement has parameter ↵Vladislav Vaintroub2016-07-111-0/+6
| | | | | | | | placeholders, but does not bind parameters
* | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-2/+1
| | | | | | | | | | Postreview fixes. New MySQL tests fixes.
* | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-2/+2
| | | | | | | | Transaction tracker
* | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-1/+2
| | | | | | | | initial commit to test
* | Revert "MDEV-9293 Connector/C integration"Vladislav Vaintroub2016-08-191-9/+9
| | | | | | | | This reverts commit 7b89b9f5108c80f4f270da922d7e6c182a663719.
* | MDEV-9293 Connector/C integrationVladislav Vaintroub2016-08-191-9/+9
| |
* | MDEV-10138 Support for decimals up to 38 digitsMonty2016-06-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Decimals with float, double and decimal now works the following way: - DECIMAL_NOT_SPECIFIED is used when declaring DECIMALS without a firm number of decimals. It's only used in asserts and my_decimal_int_part. - FLOATING_POINT_DECIMALS (31) is used to mark that a FLOAT or DOUBLE was defined without decimals. This is regarded as a floating point value. - Max decimals allowed for FLOAT and DOUBLE is FLOATING_POINT_DECIMALS-1 - Clients assumes that float and double with decimals >= NOT_FIXED_DEC are floating point values (no decimals) - In the .frm decimals=FLOATING_POINT_DECIMALS are used to define floating point for float and double (31, like before) To ensure compatibility with old clients we do: - When storing float and double, we change NOT_FIXED_DEC to FLOATING_POINT_DECIMALS. - When creating fields from .frm we change for float and double FLOATING_POINT_DEC to NOT_FIXED_DEC - When sending definition for a float/decimal field without decimals to the client as part of a result set we convert NOT_FIXED_DEC to FLOATING_POINT_DECIMALS. - variance() and std() has changed to limit the decimals to FLOATING_POINT_DECIMALS -1 to not get the double converted floating point. (This was to preserve compatiblity) - FLOAT and DOUBLE still have 30 as max number of decimals. Bugs fixed: variance() printed more decimals than we support for double values. New behaviour: - Strings now have 38 decimals instead of 30 when converted to decimal - CREATE ... SELECT with a decimal with > 30 decimals will create a column with a smaller range than before as we are trying to preserve the number of decimals. Other changes - We are now using the obsolete bit FIELDFLAG_LEFT_FULLSCREEN to specify decimals > 31 - NOT_FIXED_DEC is now declared in one place - For clients, NOT_FIXED_DEC is always 31 (to ensure compatibility). On the server NOT_FIXED_DEC is DECIMAL_NOT_SPECIFIED (39) - AUTO_SEC_PART_DIGITS is taken from DECIMAL_NOT_SPECIFIED - DOUBLE conversion functions are now using DECIMAL_NOT_SPECIFIED instead of NOT_FIXED_DEC
* | cleanup: thread_countSergei Golubchik2016-06-041-2/+0
| | | | | | | | | | | | | | move thread_count handling into THD: * increment thread_count in THD constructor * decrement thread_count in THD destructor * never modify thread_count directly!
* | Reuse THD for new user connectionsMonty2016-06-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - To ensure that mallocs are marked for the correct THD, even if it's allocated in another thread, I added the thread_id to the THD constructor - Added st_my_thread_var to thr_lock_info_init() to avoid a call to my_thread_var - Moved things from THD::THD() to THD::init() - Moved some things to THD::cleanup() - Added THD::free_connection() and THD::reset_for_reuse() - Added THD to CONNECT::create_thd() - Added THD::thread_dbug_id and st_my_thread_var->dbug_id. These are needed to ensure that we have a constant thread_id used for debugging with a THD, even if it changes thread_id (=connection_id) - Set variables.pseudo_thread_id in constructor. Removed not needed sets.
* | MDEV-9947: COM_MULTI united responseOleksandr Byelkin2016-05-171-1/+2
| |
* | Merge commit 'd5822a3ad0657040114cdc185c6387b9eb3a12b2' into 10.2Monty2016-04-281-0/+3
|\ \ | |/
| * Fixed wrong counting of global Memory_usedMonty2016-04-281-0/+3
| |
* | Fixed compiler failures and warningsMonty2016-03-201-1/+2
| |
* | MDEV-9058: protocol: COM_MULTI command (part 2)Oleksandr Byelkin2016-03-181-1/+1
| | | | | | | | simple COM_MULTI support (no prepared statements chain yet).
* | Fixed main.null failure in embeddedSergey Vojtovich2016-02-261-1/+1
| | | | | | | | It is not permitted to "delete thd" under LOCK_thread_count anymore.
* | MDEV-6150 Speed up connection speed by moving creation of THD to new threadMonty2016-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Creating a CONNECT object on client connect and pass this to the working thread which creates the THD. Split LOCK_thread_count to different mutexes Added LOCK_thread_start to syncronize threads Moved most usage of LOCK_thread_count to dedicated functions Use next_thread_id() instead of thread_id++ Other things: - Thread id now starts from 1 instead of 2 - Added cast for thread_id as thread id is now of type my_thread_id - Made THD->host const (To ensure it's not changed) - Removed some DBUG_PRINT() about entering/exiting mutex as these was already logged by mutex code - Fixed that aborted_connects and connection_errors_internal are counted in all cases - Don't take locks for current_linfo when we set it (not needed as it was 0 before)
* | MDEV-8718 - Obsolete sql_strmake() in favor of THD::strmake() and thd_strmake()Sergey Vojtovich2015-11-261-1/+1
|/
* fix func_hybrid_type crash in --ps --embeddedSergei Golubchik2015-10-151-0/+1
| | | | | | create_embedded_thd() must reset current_thd before returning, otherwise client [de-]allocations will be happening in that stray THD context
* MDEV-7999 - PROFILING routines take 0.2% when profiling disabledsvoj-gittestSergey Vojtovich2015-05-141-8/+0
| | | | | | | | This is an addition to original patch. Embedded server does extra calls of PROFILING::start_new_query() and PROFILING::finish_current_query(), which cause DBUG_ASSERT(!current) failure. Removed these extra calls: dispatch_command() does all needed job.
* 5.5 mergeSergei Golubchik2015-01-211-0/+3
|\
| * mysql-5.5.41 mergeSergei Golubchik2014-12-191-0/+3
| |\
| | * Update copyright text.Alexander Nozdrin2014-08-281-0/+3
| | |
* | | 5.5 mergeSergei Golubchik2014-05-091-1/+13
|\ \ \ | |/ /
| * | MDEV-5138 Numerous test failures in "mtr --ps --embedded".Alexey Botchkov2014-04-151-0/+12
| | | | | | | | | | | | | | | | | | Thread can be disconnected internally for example after COMMIT statements. So we should check this for the statement execution.
| * | MDEV-5138 Numerous test failures in "mtr --ps --embedded".Alexey Botchkov2014-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The function Protocol::net_store_data(a, b, CHARSET_A, CHARSET_B) should be adapted to be working in the embedded server as it's done with the Protocol::net_store_data(a, b). That new function renamed as net_store_data_cs, so we can make it virtual.
* | | 10.0-base mergeSergei Golubchik2014-02-261-1/+1
|\ \ \
| * \ \ 5.5 mergeSergei Golubchik2014-02-251-1/+1
| |\ \ \ | | |/ /
| | * | MySQL-5.5.36 mergeSergei Golubchik2014-02-171-1/+1
| | |\ \ | | | |/ | | | | | | | | (without few incorrect bugfixes and with 1250 files where only a copyright year was changed)