Bounded_queue<> pretended to be a typesafe C++ wrapper
on top of pure C queues.h.
But it wasn't, it was tightly bounded to filesort and only useful there.
* implement Queue<> - a typesafe C++ wrapper on top of QUEUE
* move Bounded_queue to filesort.cc, remove pointless "generalizations"
change it to use Queue.
* remove bounded_queue.h
* change subselect_rowid_merge_engine to use Queue, not QUEUE
Make profiler to play a bit better with memory allocators. Test suite can not be included because it lead to non free memory on shutdown (IMHO OK for memory shortage emulation)
As alternetive all this should be rewritten and ability to return errors on upper level should be added.
This fixed the MySQL bug# 20338 about misuse of double underscore
prefix __WIN__, which was old MySQL's idea of identifying Windows
Replace it by _WIN32 standard symbol for targeting Windows OS
(both 32 and 64 bit)
Not that connect storage engine is not fixed in this patch (must be
fixed in "upstream" branch)
Handle string length as size_t, consistently (almost always:))
Change function prototypes to accept size_t, where in the past
ulong or uint were used. change local/member variables to size_t
when appropriate.
This fix excludes rocksdb, spider,spider, sphinx and connect for now.
This was done to get more information about where time is spent.
Now we can get proper timing for time spent in commit, rollback,
binlog write etc.
Following stages was added:
- Commit
- Commit_implicit
- Rollback
- Rollback implicit
- Binlog write
- Init for update
- This is used instead of "Init" for insert, update and delete.
- Staring cleanup
Following stages where changed:
- "Unlocking tables" stage reset stage to previous stage at end
- "binlog write" stage resets stage to previous stage at end
- "end" -> "end of update loop"
- "cleaning up" -> "Reset for next command"
- Added stage_searching_rows_for_update when searching for rows
to be deleted.
Other things:
- Renamed all stages to start with big letter (before there was no
consitency)
- Increased performance_schema_max_stage_classes from 150 to 160.
- Most of the test changes in performance schema comes from renaming of
stages.
- Removed duplicate output of variables and inital state in a lot of
performance schema tests.
This was done to make it easier to change a default value for a
performance variable without affecting all tests.
- Added start_server_variables.test to check configuration
- Removed some duplicate "closing tables" stages
- Updated position for "stage_init_update" and "stage_updating" for
delete, insert and update to be just before update loop (for more
exact timing).
- Don't set "Checking permissions" twice in a row.
- Remove stage_end stage from creating views (not done for create table
either).
- Updated default performance history size from 10 to 20 because of new
stages
- Ensure that ps_enabled is correct (to be used in a later patch)
- 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.
PROFILING::start_new_query() optimizations:
- no need to check "current": added assertion instead
- "enabled" now means "is enabled currently" instead of "was enabled at query
start". Old meaning was useless, new meaning echoes OPTION_PROFILING so
that start_new_query() can be defined in sql_profile.h.
- remnants of start_new_query() moved to sql_profile.h so it can be inlined
PROFILING::start_new_query() overhead dropped 0.08% -> out of radar.
PROFILING::set_query_source() optimizations:
- no need to check "enabled": !enabled && current is impossible
- remnants of set_query_source() moved to sql_profile.h so it can be inlined
PROFILING::set_query_source() overhead dropped 0.02% -> out of radar.
PROFILING::finish_current_query() optimizations:
- moved "current" check out to sql_profile.h so it can be inlined
PROFILING::finish_current_query() overhead dropped 0.10% -> out of radar.
THD::enter_stage() optimizations:
- stage backup code moved to THD::backup_stage(), saves one condition
- moved check for "new_stage" out to callers that actually need it
- remnants of enter_stage() moved to sql_class.h so it can be inlined
THD::enter_stage() overhead dropped 0.48% -> 0.07%.
PROFILING::status_change() optimizations:
- "status_arg" is now checked by QUERY_PROFILE::new_status()
- no need to check "enabled": !enabled && current is impossible
- remnants of status_change() moved to sql_profile.h so it can be inlined
PROFILING::status_change() overhead dropped 0.1% -> out of radar.
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.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
This patch:
- Moves all definitions from the mysql_priv.h file into
header files for the component where the variable is
defined
- Creates header files if the component lacks one
- Eliminates all include directives from mysql_priv.h
- Eliminates all circular include cycles
- Rename time.cc to sql_time.cc
- Rename mysql_priv.h to sql_priv.h
Fix for Bug#31173: mysqlslap.exe crashes if called without any parameters
.bzrignore:
Fixed .bzrignore rules. Many were simply not ignoring what they were meant to.
client/mysqlslap.c:
Fixed bug for Bug#31173: mysqlslap.exe crashes if called without any parameters
The original patch could cause memory leaks and odd problems depending on how connection was made.
This code ensures that all mysql_options() are set for each mysql_real_connect().
(This patch by Monty)
mysys/my_thr_init.c:
Fixed multiply-initialized critical section on Windows, due to code incorrectly
checking the wrong field in an attempt to prevent multiple-initialization.
sql-common/client.c:
Don't use shared memory if it's not set (for example after failed mysql_real_connect).
Ensure that mysql_close() resets all resources so that it's safe to call it twice.
(Patch by monty, related to Bug#31173: mysqlslap.exe crashes if called without any parameters)
sql/CMakeLists.txt:
Added page fault counters for SHOW PROFILE on Windows.
sql/mysqld.cc:
Fixed attempt to set a NULL event. The code now only sets the event if appropriate (i.e. shared memory is being used)
sql/sql_profile.cc:
Added page fault counters for SHOW PROFILE on Windows.
sql/sql_profile.h:
Added page fault counters for SHOW PROFILE on Windows.
sql/udf_example.def:
Some cleanup functions were not exported from udf_example.dll, causing them to
never be executed, and as a result multiple-initialization of kernel objects
occurred and resources were not being freed correctly.
storage/maria/ma_close.c:
Condition variable share->key_del_cond was never being destroyed, while its
containing heap block was being freed in maria_close(), leaking kernel
resources.
------------------------------------------------------------
revno: 2630.4.37
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-6.0-3726-w2
timestamp: Wed 2008-06-25 20:28:57 +0400
message:
Fix build failure of mysql-6.0-3726 tree on Windows.
The failure was caused by the fact that sql/mdl.cc was
using __func__ macro without including sql_profile.h
header which contained definition of this macro for
those platforms that miss it.
This patch solves this problem by moving this define to
include/my_global.h which makes it available in modules
which don't/can't include sql/mysql_priv.h.
This is a patch that is part of WL#3726.
include/my_global.h:
Moved definition of __func__ macro from sql/sql_profile.h to
include/my_global.h to make it accessible from those modules
of the server which don't include mysql_priv.h.
sql/sql_profile.cc:
Removed _unknown_func_ const variable since it is no longer used
by __func__ macro.
sql/sql_profile.h:
Moved definition of __func__ macro from sql/sql_profile.h to
include/my_global.h to make it accessible from those modules
of the server which don't include mysql_priv.h.
"have_profiling"
1) Renamed have_community_features server system variable to
have_profiling.
2) Removed eable-community-features configure option and
ENABLE_COMMUNITY_FEATURES macro.
3) Removed COMMUNITY_SERVER macro and replaced its usage by
ENABLED_PROFILING.
Only --enable-profiling is now needed to enable profiling.
It was the only existing "community feature", so there was
no need for both configure options.
Using --enable-community-features will give a warning message
since it no longer exists.
Remove custom DLL loader code from innodb plugin code, use
symbols exported from mysqld.
storage/innodb_plugin/handler/ha_innodb.cc:
Remove a Win32 workaround for current_thd.
The original problem that innodb plugin used
value of TLS variable across DLL boundaries is
solved in MySQL server (current_thd is a function
not TLS variable now)
storage/innodb_plugin/handler/handler0alter.cc:
Remove custom delay loader
storage/innodb_plugin/handler/handler0vars.h:
Remove custom delay loader
storage/innodb_plugin/handler/i_s.cc:
Remove custom delay loader
storage/innodb_plugin/handler/win_delay_loader.cc:
Remove custom delay loader
storage/innodb_plugin/plug.in:
Remove commented out MYSQL_PLUGIN_STATIC,
CMake would not parse that correctly
mysql-test/r/profiling.result:
Remove unnecessary verbosity.
Remove section of test that is impossible to test with PS protocol.
mysql-test/t/profiling.test:
Remove unnecessary verbosity.
Remove section of test that is impossible to test with PS protocol.
sql/sql_profile.h:
Make bit flags unsigned ints.
history entries. Lazy deletion isn't smart or useful here.
Backport from 5.1 .
include/my_sys.h:
Prepare for rename in 5.1.
mysql-test/r/profiling.result:
Backport tests from 5.1.
mysql-test/t/profiling.test:
Backport tests from 5.1.
sql/mysql_priv.h:
Backport changes from 5.1 .
sql/sp_head.cc:
Backport changes from 5.1 .
sql/sql_class.cc:
Backport changes from 5.1 .
sql/sql_parse.cc:
Backport changes from 5.1 .
sql/sql_profile.cc:
Push history-limiting code until after the code that adds new
history entries. Lazy deletion isn't smart or useful here.
Correct for 5.0 member existance and execution.
sql/sql_profile.h:
Backport changes from 5.1 .
sql/sql_show.cc:
Backport changes from 5.1 .
Between 5.0 and 5.1, the step of incrementing the global query id
changed, which broke how the profiler noticed when a new query had
started. That reset the state list and caused all but the last
five (or so) states to be thrown away.
Now, don't watch for query_id changes in the lower level.
Add a bogus state change at the end of profiling so that the last
real state change is timed.
Emit source reference for the start of the span of time instead of
the end of it.
mysql-test/r/profiling.result:
Add a test that shows continuation of execution with multi-statement
packets.
mysql-test/t/profiling.test:
Add a test that shows continuation of execution with multi-statement
packets.
sql/sql_parse.cc:
Insert profiling calls at beginnings and ends of each query.
Remove the old way of keeping or discarding profiles, and flipping
to new query profiles.
sql/sql_profile.cc:
No longer use the thread's query_id to determine when we flip
to a new statement.
Some status statements are set to be NULL in the server. We don't
log those, as it doesn't fit this style of profiling yet.
Rewrite the parser code to be more active and legible.
Relying on passive/lazy discovery of new queries was buggy.
Add a bogus status change before ending a profile, so that the
previous real status has a endpoint.
Emit source reference of the start of the span-of-time instead of
the end of it.
sql/sql_profile.h:
Store the server_query_id at instantiation time for a new query.
Rewrite the parser code to be more active. Relying on passive/lazy
discovery of new queries was buggy.
Name first state to more honestly describe the state. We don't
really know of initialization that will follow.
sql/sql_show.cc:
Update comment to note the decidedly weird field_length behavior
on Decimal types in information_schema.
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1
CMakeLists.txt:
Auto merged
BitKeeper/deleted/.del-Makefile.am~2:
Auto merged
BitKeeper/deleted/.del-README~1:
Auto merged
BitKeeper/deleted/.del-configure.js:
Auto merged
BitKeeper/deleted/.del-ha_berkeley.cc:
Auto merged
BitKeeper/triggers/post-commit:
Auto merged
client/CMakeLists.txt:
Auto merged
extra/CMakeLists.txt:
Auto merged
include/config-win.h:
Auto merged
libmysql/CMakeLists.txt:
Auto merged
libmysqld/Makefile.am:
Auto merged
mysql-test/r/func_in.result:
Auto merged
mysql-test/r/information_schema_db.result:
Auto merged
mysql-test/t/func_in.test:
Auto merged
mysql-test/t/information_schema.test:
Auto merged
server-tools/instance-manager/CMakeLists.txt:
Auto merged
sql/CMakeLists.txt:
Auto merged
sql/Makefile.am:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/lex.h:
Auto merged
sql/lock.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_repl.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/structs.h:
Auto merged
storage/archive/ha_archive.cc:
Auto merged
storage/myisam/CMakeLists.txt:
Auto merged
storage/myisam/ha_myisam.cc:
Auto merged
storage/myisam/mi_open.c:
Auto merged
storage/myisammrg/ha_myisammrg.cc:
Auto merged
storage/ndb/src/ndbapi/DictCache.cpp:
Auto merged
BitKeeper/deleted/.del-mysqld.vcproj~6aa7b3f9c3e28fcb:
Manual merge.
configure.in:
Manual merge.
mysql-test/r/information_schema.result:
Manual merge.
mysql-test/t/profiling.test:
Manual merge.
sql/set_var.cc:
Manual merge.
sql/sql_parse.cc:
Manual merge.
sql/sql_profile.cc:
Manual merge.
sql/sql_profile.h:
Manual merge.
sql/sql_select.cc:
Manual merge.
sql/sql_show.cc:
Manual merge.
sql/table.h:
Manual merge.
storage/ndb/src/common/util/File.cpp:
Manual merge.
support-files/mysql.spec.sh:
Manual merge.
in 5.0-community, but pulling to merge was very hard.
sql/mysql_priv.h:
Add new extern "C" qualification to set_thd_proc_info().
Fix typo in merge.
sql/mysqld.cc:
Replace obselete gptr with uchar* .
Add missing #endif from merge problem.
sql/set_var.cc:
Include new parameter to user variable contruction.
sql/sql_cache.cc:
Remove duplicate line from merge problem.
sql/sql_profile.cc:
struct st_table_list is now typedef'd to a new name.
ST_FIELD_INFO now includes a new member, a pointer to an open_table
function.
sql/sql_profile.h:
struct st_table_list is now typedef'd to a new name.
profiling. Also,
Bug#26938: profiling client hang if used before enabled
In the SHOW command, not sending header data because we had no
rows to send was a protocol violation. Porting the SHOW PROFILE
command to use the Information Schema table avoids that problem.
mysql-test/r/profiling.result:
Add headers of pre-profile SHOW test.
mysql-test/t/profiling.test:
Verify that the protocol isn't violated if we ask for profiling
info before profiling has recorded anything.
sql/sql_parse.cc:
Remove SQLCOM_SHOW_PROFILE and add a I_S schema table entry.
sql/sql_profile.cc:
Add SHOW column-names and a new function that takes profile options
set in the parser and packs a list of selected fields from the
I_S table implementation.
sql/sql_profile.h:
Remove unused functions and add a new function.
sql/sql_show.cc:
Add a pointer to the function that selects fields from I_S table
for SHOW command.
sql/sql_yacc.yy:
Prepare an I_S table for SHOW PROFILE.
sql/table.h:
Rename to match the intention.
renamed. Some new THD proc_info states are new. Directories must be
encountered in make in a specific order, to have symlinks already set.
Move community-server-specific tests into own tests, so that we can
exempt them from testing on enterprise servers.
BitKeeper/deleted/.del-profiling.inc:
Delete: mysql-test/include/profiling.inc
BitKeeper/deleted/.del-profiling.require:
Delete: mysql-test/r/profiling.require
configure.in:
Set a new order of sql_client_dirs, so that the make directory traversal
doesn't miss symlink dependencies.
mysql-test/r/not_embedded_server.result:
Account for new "executing" state.
mysql-test/t/information_schema.test:
Move community-feature test to another test file.
mysql-test/t/profiling.test:
Make test more generic to community features.
sql/lex.h:
Add symbol lost in manual merge.
sql/mysql_priv.h:
Insert a preprocessor layer between setting the caller and the function
that sets the thread state, so we can get caller information.
sql/mysqld.cc:
Add new server variable "have_community_features".
sql/set_var.cc:
Add new server variable "have_community_features".
sql/sql_class.cc:
Insert a preprocessor layer between setting the caller and the function
that sets the thread state, so we can get caller information.
sql/sql_profile.cc:
Function name change, my_strndup()
sql/sql_profile.h:
Insert a preprocessor layer between setting the caller and the function
that sets the thread state, so we can get caller information.
mysql-test/include/have_community_features.inc:
New BitKeeper file ``mysql-test/include/have_community_features.inc''
mysql-test/r/have_community_features.require:
New BitKeeper file ``mysql-test/r/have_community_features.require''
mysql-test/r/variables+c.result:
New BitKeeper file ``mysql-test/r/variables+c.result''
mysql-test/t/variables+c.test:
New BitKeeper file ``mysql-test/t/variables+c.test''
Add a new autoconf paremeter --{en,dis}able-community-features . The
default is disable for enterprise servers.
Though this is a 5.0 tree, it is only to be merged into the 5.0-community
tree and the global 5.1 tree, never to the 5.0-enterprise tree.
configure.in:
Add a new configure parameter, --enable-community-features for community
features.
mysql-test/t/profiling.test:
Add testing for whether profiling is enabled or not.
sql/mysqld.cc:
Add additional "COMMUNITY_SERVER" cpp definition test.
sql/set_var.cc:
Add additional "COMMUNITY_SERVER" cpp definition test.
sql/sql_class.cc:
Add additional "COMMUNITY_SERVER" cpp definition test.
sql/sql_class.h:
Add additional "COMMUNITY_SERVER" cpp definition test.
sql/sql_parse.cc:
Add additional "COMMUNITY_SERVER" cpp definition test.
sql/sql_prepare.cc:
Add additional "COMMUNITY_SERVER" cpp definition test.
sql/sql_profile.cc:
Add additional "COMMUNITY_SERVER" cpp definition test.
sql/sql_profile.h:
Add additional "COMMUNITY_SERVER" cpp definition test.
sql/sql_show.cc:
Add "COMMUNITY_SERVER" cpp definition test.
mysql-test/include/profiling.inc:
Add testing for whether profiling is enabled or not.
mysql-test/r/profiling.require:
Add testing for whether profiling is enabled or not.
halfway through a query (as happens in "SET SESSION PROFILING = ...")
has a few side-effects, the worst of which is a memory leak for
prepared statements, which poke directly from the parser into the
profiling code (we don't have the query text when we need it) and
that overwrites a pointer to heap-allocated memory when the previous
statement turns on profiling.
Instead, now set a flag when we begin a new statement that tracks
whether profiling is on _at the start_ of the query. Use that to
track whether we gather info.
Additionally, use that AND use the state of the profiling variable
after the end of a query to know whether to store information about
the query that just finished.
mysql-test/r/profiling.result:
Testing whether profiling is on at the beginning of a query and at
the end of a query makes "SET SESSION PROFILING = ..." statements
disappear from the profiling. They were never reliable before.
sql/sql_profile.cc:
Check to see if profiling was enabled at the beginning of this query
before trying to store query_source. This avoids a memory leak for
prepared statements, which get here by direct means.
If profiling was toggled in this query, then don't store this query
profile.
sql/sql_profile.h:
Keep track of whether profiling is on.
B-g#24795: SHOW PROFILE implementation
Don't use memory roots to store profiling information, because
memory roots make freeing the data a no-op, and thus long-running
processes with profiling turned on the whole time could eventually
use all available memory.
Instead, use regular heap allocation and deallocation calls to
manage profiling data. Replace the leaky List usage with a similar-
behaving structure named "Queue".
sql/sql_profile.cc:
Don't use C++ iterators on our simple Queue implementation. They're
not implemented and we don't really need them.
Rip out idea of swapping out the thd's mem_root.
sql/sql_profile.h:
Rip out idea of needing a mem_root.
Implement a Queue that looks and behaves very similarly to memroot-
using List.