Commit graph

32 commits

Author SHA1 Message Date
unknown
b1e00b6be8 Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
2010-04-28 14:52:24 +02:00
Staale Smedseng
c7fad393fd Bug #49829 Many "hides virtual function" warnings with
SunStudio
      
SunStudio compilers of late warn about methods that might hide
methods in base classes due to the use of overloading combined
with overriding. SunStudio also warns about variables defined
in local socpe or method arguments that have the same name as
a member attribute of the class.
      
This patch renames methods that might hide base class methods,
to make it easier both for humans and compilers to see what is
actually called. It also renames variables in local scope.


sql/field.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/item_cmpfunc.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/item_create.cc:
  Renaming base class create() to create_func().
sql/item_create.h:
  Renaming base class create() to create_func().
sql/protocol.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/sql_profile.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/sql_select.cc:
  Local scope variable or method argument same as class 
  attribute.
sql/sql_yacc.yy:
  Renaming base class create() to create_func().
storage/federated/ha_federated.cc:
  Local scope variable or method argument same as class 
  attribute.
storage/myisammrg/ha_myisammrg.cc:
  Local scope variable or method argument same as class 
  attribute.
2010-03-14 17:01:45 +01:00
Michael Widenius
e9bce6c9d4 Patch set contributed by Alex Budovski (MCA)
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.
2010-01-29 20:42:22 +02:00
unknown
6aad537a6a Merge MySQL 5.1.39 into MariaDB 5.1. 2009-10-15 23:38:29 +02:00
Michael Widenius
e726e587ec Merged with mysql-5.1 tree.
client/mysqltest.cc:
  Manually merged
configure.in:
  Manually merged
mysql-test/r/variables.result:
  Manually merged
mysql-test/t/variables.test:
  Manually merged
mysys/my_pread.c:
  Manually merged
mysys/my_read.c:
  Manually merged
sql/mysqld.cc:
  Manually merged
storage/csv/ha_tina.h:
  Manually merged
storage/myisam/ha_myisam.cc:
  Manually merged
storage/myisam/mi_check.c:
  Manually merged
storage/myisam/mi_search.c:
  Manually merged
2009-04-25 13:05:32 +03:00
Michael Widenius
a8fdaa6f2c Merge with base MySQL 5.1
Contains fixes for test cases
Changed release tag to beta

configure.in:
  change release tag to beta
2009-02-15 12:58:34 +02:00
Ignacio Galarza
5b7347bda3 Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages.  This change focuses on the warnings 
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
2009-02-13 11:41:47 -05:00
Georgi Kodinov
b91bbba2df Fixed a warning in sql_profile.cc 2009-01-12 18:17:15 +02:00
Sergei Golubchik
ca23272e1e proc_info_hook, mysys access to thd->proc_info
include/my_global.h:
  move __func__ definition to my_global.h
include/my_sys.h:
  proc_info_hook
mysys/my_static.c:
  proc_info_hook
sql/mysqld.cc:
  proc_info_hook
sql/sql_class.cc:
  support thd==0 in set_thd_proc_info
sql/sql_profile.cc:
  move __func__ definition to my_global.h
sql/sql_profile.h:
  move __func__ definition to my_global.h
2008-08-27 14:15:06 +02:00
unknown
533d435463 Fix a compilation failure of the community tree. 2008-02-19 23:47:15 +03:00
unknown
7eb9aac77e Insert profiling instructions into s-p code to make each statement
be profiled separately.

Expand the time formats in i_s.profiling to wide enough for larger
numbers.


mysql-test/r/profiling.result:
  Show that each query inside a procedure is profiled separately.
mysql-test/t/profiling.test:
  Show that each query inside a procedure is profiled separately.
sql/sp_head.cc:
  Poke profiling into stored-procedure code.  For statement parts only
  of routines, process them as profilable discrete queries.
sql/sql_profile.cc:
  Encode decimal size correctly.
2007-11-13 09:46:17 -05:00
unknown
ac180f8272 Don't start profiling too soon. Begin timing when the packet is
read.

Do not store profiling information when there is no query text.  We
don't wish to capture non-COM_QUERY packets.


sql/sql_parse.cc:
  Start profiling immediately after a command packet is read from 
  the network.
sql/sql_profile.cc:
  Do not store items for which there is no query, i.e., protocol API 
  calls (non-COM_QUERY) and such.
2007-11-09 20:29:02 -05:00
unknown
69aee07373 Rewrite profiler code to be easier to maintain and less buggy.
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.
2007-11-09 14:45:44 -05:00
unknown
b01c89ed8c Fix several merge problems. There are many changes in 5.1 from 5.0
that affect profiling.


mysql-test/r/information_schema.result:
  Merge fixed.  This result moved to a new file.
sql/sql_parse.cc:
  Include profiling in statistics.
  
  Add hook for SHOW_PROFILE in execution.
sql/sql_profile.cc:
  Move/add the FEATURE_DISABLED warning to the I_S filling func.
  
  Fix merge, where a new member was added to ST_FIELD_INFO.
  
  orig_sql_command method was removed from Lex structure.
sql/sql_show.cc:
  Fix merge problem.
sql/sql_yacc.yy:
  orig_sql_command member removed from Lex structure in 5.1 .
2007-11-02 11:41:58 -04:00
unknown
cca4ea275b Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
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.
2007-10-31 17:24:32 -04:00
unknown
fc70ac4627 Sundry changes to fix merge problems. Most of these are duplicated
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.
2007-10-31 16:39:59 -04:00
unknown
4c0078853f Push history-limiting code until after the code that adds new
history entries.  Lazy deletion isn't smart or useful here.
2007-10-31 12:29:32 -04:00
unknown
5008a4e720 Track typedef'd struct. Name changed in Enterprise tree, but
community-exclusive file also referred to struct.


sql/sql_profile.cc:
  Track typedef'd struct.
sql/sql_profile.h:
  Track typedef'd struct.
2007-10-04 10:35:09 -04:00
unknown
fd70537309 In 5.0, Field_double::val_str uses "%g" to render floating point
numbers, which uses "X.YeZ" notation when the exponent Z would be
less than -4. That behavior at -4 is not exactly what we want, and
our Decimal type offers smarter number representation.  By changing
profiling to use Decimal types, we get more readable output.


sql/sql_profile.cc:
  Change the DOUBLE I_S types to DECIMAL, so we get a smarter
  floating-point number renderer.
sql/sql_show.cc:
  Add MYSQL_TYPE_DECIMAL as a string-ish type that INFORMATION_SCHEMA
  tables may use.
2007-07-03 12:20:19 -04:00
unknown
358b942b20 Unify profiling SHOW code and INFORMATION_SCHEMA code for
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.
2007-07-02 07:27:39 -04:00
unknown
0901dbc583 Fix up merge. Some macros are now functions. Some functions are
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''
2007-05-02 14:13:33 -04:00
unknown
2b4a895613 Wrap code specific to the comunity-server in additional CPP #ifdef .
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.
2007-04-24 18:11:55 -04:00
unknown
fcb52609e4 Changing the state of whether we're recording profiling information
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.
2007-04-06 09:15:18 -04:00
unknown
2879da7f84 Unreported minor bug: We start numbering query IDs at zero, which
is a special case in "SHOW PROFILE FOR QUERY n".  No one can get
the zero item (which is always the statement that turns on profiling),
because zero represents the final item, internally.

Now, order the queries starting at one.


mysql-test/r/profiling.result:
  Renumber the query IDs.
sql/sql_profile.cc:
  Start the profile_id_counter at 1, to overstep the special-case 
  value of zero.
  
  Unrelated, but looks similar: don't use -1 to initialize an unsigned 
  integer field.  That causes warnings in some environments.
2007-04-03 19:52:24 -04:00
unknown
46503d161e Backport:
B-g#27501: 5.0 significantly more sys ("kernel") time than 4.1 \
      due to getrusage() calls

Even if profiling is turned off, the parser makes calls to reset 
the state at the beginning of each query.  That would eventually 
instantiate a PROFILE_ENTRY, which does indeed capture resource 
usage.

Instead, now check that profiling is active before progressing
far into the storage/expiration of old entries in the history.
This has the pleasant side-effect that queries to toggle profiling
are not recorded in the history.


mysql-test/r/profiling.result:
  Now after we turn off profiling, the beginning of the next query 
  refuses to enter the profiling code and it discards the info.
sql/sql_profile.cc:
  Add the same condition twice:  Once to abort storing previous 
  query information and the other to abort initialization for this 
  query that is starting.
  
  We do this symmetrically, before and after expiring old history 
  entries, so that the counts are correct.
2007-04-03 19:50:55 -04:00
unknown
4eb0a55340 Backport:
B-g#27060: SQL Profile utility may not be reporting right duration \
      for each step

Whenever the profiler is reset at the beginning of a query, there's
a "hidden" profiling entry that represents that point in time.  It 
has no status description, as those are set by state changes and no
such point has yet been encountered.  That profiling entry is not
in the list of entries generated when we change states.

The profiling code had the problem that each step of printing 
profiling data subtracted the previous "step"'s data, but gave the
label to that data of the current step, which is wrong.  The label/
state refers to the period beginning with that profiling data, not
ending with it.

Now, give a label to the first profiling pseudo-entry, so that we 
have a name to assign to the period that ends with the first state 
change.  Now also use the state name of the previous step in showing 
the delta values that end with this step.


sql/sql_profile.cc:
  Store a status of "initializing" whenever we construct the first
  profile entry -- the one that gets reset whenever we're starting 
  a new query, before the server sets a real status.
  
  Additionally, associate the previous status with the time period
  that ends with the current profile entry's stats.
  
  Since we need yet another piece of info from the previous profiling
  entry, take out the piecemeal ways we currently do it and make a
  general pointer to the whole thing.
2007-04-03 19:45:28 -04:00
unknown
698d98bea0 Backport:
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.
2007-04-03 17:59:52 -04:00
unknown
37dd1c9de4 Patch to release clone. Fixes two post-pushbuild discovered failures.
Expand float size to avoid assert()ion failures.

"_db_func_" isn't a known linked object on some platforms, possibly 
because it is occasionaly shadowed by DBUG variables.  Avoid that
confusion.


sql/sql_profile.cc:
  Expand float size to avoid assert()ion failures.
  
  "_db_func_" isn't a known linked object on some platforms, possibly 
  because it is occasionaly shadowed by DBUG variables.  Avoid that
  confusion.
sql/sql_profile.h:
  "_db_func_" isn't a known linked object on some platforms, possibly 
  because it is occasionaly shadowed by DBUG variables.  Avoid that
  confusion.
2007-03-02 09:14:33 -05:00
unknown
9e2fd8caad Some changes suggested Serg, from message <20070223210659.GA24202@janus.mylan>
configure.in:
  Use smarter autoconf help macro.
sql/set_var.cc:
  Make a local variable static.
sql/sql_lex.cc:
  Don't include CPP condition where it saves little time and decreases legibility.
sql/sql_parse.cc:
  Use the name of the query in the error, instead of describing the feature.
sql/sql_profile.cc:
  Update copyright.
  
  Make I_S schema table columns uppercase.
sql/sql_profile.h:
  Update copyright.
sql/sql_select.cc:
  Chagne tab indentation to spaces.
2007-02-26 13:11:36 -05:00
unknown
633fb481c9 Disambiguate method call. (Windows compiler error.) 2007-02-22 16:25:47 -05:00
unknown
607c224969 Prevent bugs by making DBUG_* expressions syntactically equivalent
to a single statement.
---
Bug#24795: SHOW PROFILE

Profiling is only partially functional on some architectures.  Where 
there is no getrusage() system call, presently Null values are 
returned where it would be required.  Notably, Windows needs some love 
applied to make it as useful.

  Syntax this adds:
  
  SHOW PROFILES
  
  SHOW PROFILE [types] [FOR QUERY n] [OFFSET n] [LIMIT n]
   where "n" is an integer
   and "types" is zero or many (comma-separated) of
      "CPU"
      "MEMORY" (not presently supported)
      "BLOCK IO"
      "CONTEXT SWITCHES"
      "PAGE FAULTS"
      "IPC"
      "SWAPS"
      "SOURCE"
      "ALL"

It also adds a session variable (boolean) "profiling", set to "no"
by default, and (integer) profiling_history_size, set to 15 by 
default.

This patch abstracts setting THDs' "proc_info" behind a macro that 
can be used as a hook into the profiling code when profiling 
support is compiled in.  All future code in this line should use
that mechanism for setting thd->proc_info.

---

Tests are now set to omit the statistics.

---

Adds an Information_schema table, "profiling" for access to 
"show profile" data.
---
Merge zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community-3--bug24795
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-community
---
Fix merge problems.
---
Fixed one bug in the query_source being NULL.  

Updated test results.
---
Include more thorough profiling tests.

Improve support for prepared statements.

Use session-specific query IDs, starting at zero.
---
Selecting from I_S.profiling is no longer quashed in profiling, as
requested by Giuseppe.

Limit the size of captured query text.

No longer log queries that are zero length.


BitKeeper/deleted/.del-profile.result:
  Rename: mysql-test/r/profile.result -> BitKeeper/deleted/.del-profile.result
BitKeeper/deleted/.del-profile.test:
  Rename: mysql-test/t/profile.test -> BitKeeper/deleted/.del-profile.test
BitKeeper/deleted/.del-sql_profile.cc:
  Rename: sql/sql_profile.cc -> BitKeeper/deleted/.del-sql_profile.cc
BitKeeper/deleted/.del-sql_profile.h:
  Rename: sql/sql_profile.h -> BitKeeper/deleted/.del-sql_profile.h
configure.in:
  Add a configure-time option to enable/disable query profiling.  The
  default is enabled.
include/my_dbug.h:
  
  
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
myisam/mi_open.c:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
mysql-test/r/information_schema.result:
  Updated (re-recorded) tests that I missed somehow.  I verified these
  for correctness.
mysql-test/r/information_schema_db.result:
  Updated test results I missed.
mysql-test/r/mysqlshow.result:
  Fix merge problems.
ndb/src/ndbapi/DictCache.cpp:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
sql/ha_archive.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/ha_berkeley.cc:
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/ha_myisam.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/ha_myisammrg.cc:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
sql/ha_ndbcluster.cc:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
sql/item_cmpfunc.cc:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
sql/item_func.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/lock.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/log_event.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/mysql_priv.h:
  Use 64-bit constants for the 64-bit bit field.
  
  Add a new option bit for whether profiling is active or not.
sql/mysqld.cc:
  Add semicolon to DBUG statement.
  
  Add a new system variable and set it.
  ---
  Set the minimum, which is zero and not 50.
sql/repl_failsafe.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/set_var.cc:
  Make a new system global variable and session variable, to determine
  behavior of profiling.	
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/set_var.h:
  The THD::options bit field is ulonglong, not ulong.
sql/slave.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/sp_head.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_base.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/sql_cache.cc:
  DBUG_* statements should be syntactically equivalent to a single 
  statement.
  ---
  Fix merge problems.
sql/sql_class.cc:
  Insert a pointer to the current thread in the profiling code.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
sql/sql_class.h:
  Create a new system variable, profiling_history_size, and add a 
  member to THD to hold profiling information about this thread's 
  execution.
  ---
  Manual merge, undoing first patch.
sql/sql_delete.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/sql_insert.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
sql/sql_lex.cc:
  Initialize profiling options to empty.
  ---
  Manual merge, undoing first patch.
sql/sql_lex.h:
  Add info to the lexer object so that we can hold data that comes from
  parsing statements.
  
  Reuse memory addresses of uints that can't occur in the same state-
  ment.
  
  This is dangerous because it involves knowledge of what symbols are 
  never used together, which is information stored obliquely in another
  file.
  ---
  Manual merge, undoing first patch.
sql/sql_parse.cc:
  Add hooks to the parser to jump to profiling code.
  
  If profiling is not present, then return an error message upon being
  used.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
  ---
  Include patch backported to 5.0-global.
  
  THD::options is a ulonglong, not ulong.
sql/sql_prepare.cc:
  From prepared statement execution, set the query source in the 
  profiler, as we can't get it from  thd .
  ---
  Make it less expensive to limit the size of the queries.
sql/sql_repl.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_select.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
sql/sql_show.cc:
  Abstract setting thread-info into a function or macro.
  
  Also, remove "static" qualification on schema_table_store_record()
  so that external functions may use it.
  ---
  Manual merge, undoing first patch.
sql/sql_table.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_update.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_view.cc:
  Abstract setting thread-info into a function or macro.
  ---
  Manual merge, undoing first patch.
sql/sql_yacc.yy:
  Add new lexer symbols and insert new grammatical rules necessary to 
  retreive profiling information.
  ---
  Manual merge, undoing first patch.
  ---
  Fix merge problems.
sql/table.h:
  Add enum item for query profiling.
BitKeeper/deleted/.del-profiling-master.opt:
  New BitKeeper file ``mysql-test/t/profiling-master.opt''
mysql-test/r/profiling.result:
  New BitKeeper file ``mysql-test/r/profiling.result''
  ---
  Include more verbose that describes the queries so far.
  
  Include Giuseppe's tests.
  ---
  Selecting from I_S.profiling is no longer quashed in profiling, as
  requested by Giuseppe.
mysql-test/t/profiling.test:
  New BitKeeper file ``mysql-test/t/profiling.test''
  ---
  Include more verbose that describes the queries so far.
  
  Include Giuseppe's tests.
  ---
  Selecting from I_S.profiling is no longer quashed in profiling, as
  requested by Giuseppe.
sql/sql_profile.cc:
  New BitKeeper file ``sql/sql_profile.cc''
  ---
  If query_source is NULL, as can sometimes happen, then don't try
  to copy that memory.
  ---
  Make each new session use its own numbering of query_ids, and not
  show the global-pool numbers to the user.
  
  Provide a way for prepared statements to set the query_source.
  ---
  Selecting from I_S.profiling is no longer quashed in profiling, as
  requested by Giuseppe.
  
  Limit the size of captured query text.
  
  No longer log queries that are zero length.
sql/sql_profile.h:
  New BitKeeper file ``sql/sql_profile.h''
  ---
  Make each new session use its own numbering of query_ids, and not
  show the global-pool numbers to the user.
  
  Provide a way for prepared statements to set the query_source.
  ---
  Make it less expensive to limit the size of the queries.
2007-02-22 10:03:08 -05:00
unknown
66dfd85cf4 Bug#24795: Add SHOW PROFILE
Patch contributed by Jeremy Cole.  CLA received Oct 2006 by Kaj Arnö

Add rudimentary query profiling support.


libmysqld/Makefile.am:
  Add profile file to source list.
sql/Makefile.am:
  Add profiling files to source and header lists.
sql/ha_archive.cc:
  Macro-ized other discovered instances of setting proc_info.
sql/ha_myisam.cc:
  Macroize setting thread-state info
sql/item_func.cc:
  Macro-ized other discovered instances of setting proc_info.
sql/lex.h:
  Add lexer info for profiling.
sql/lock.cc:
  Macroize setting thread-state info
sql/log_event.cc:
  Macro-ized other discovered instances of setting proc_info.
sql/mysql_priv.h:
  Set constants for profiling.
sql/repl_failsafe.cc:
  Macro-ized other discovered instances of setting proc_info.
sql/slave.cc:
  Macro-ized other discovered instances of setting proc_info.
sql/sp_head.cc:
  Macro-ized other discovered instances of setting proc_info.
sql/sql_base.cc:
  Macroize setting thread-state info
  ---
  Macro-ized other discovered instances of setting proc_info.
sql/sql_cache.cc:
  Macroize setting thread-state info
sql/sql_class.cc:
  Integrate profiling.
sql/sql_class.h:
  Instantiate profiling object.
sql/sql_delete.cc:
  Macroize setting thread-state info
sql/sql_insert.cc:
  Macroize setting thread-state info
  ---
  Macro-ized other discovered instances of setting proc_info.
sql/sql_lex.cc:
  Initialize profiling.
sql/sql_lex.h:
  Define lex tokens and allocate space for profiling options.
sql/sql_parse.cc:
  Integrate profiling.
  ---
  Macro-ized other discovered instances of setting proc_info.
sql/sql_repl.cc:
  Macro-ized other discovered instances of setting proc_info.
sql/sql_select.cc:
  Macroize setting thread-state info.
  
  Clean up some lines.
sql/sql_show.cc:
  Macro-ized other discovered instances of setting proc_info.
  ---
  Revert bad use of macro.
sql/sql_table.cc:
  Macroize setting thread-state info
sql/sql_update.cc:
  Macroize setting thread-state info
sql/sql_view.cc:
  Macro-ized other discovered instances of setting proc_info.
sql/sql_yacc.yy:
  Add parser info for profiling.
  ---
  Fix new YACC shift/reduce conflict.  (Now at 249.)
mysql-test/r/profile.result:
  Test profiling code.
  ---
  A not-very-useful result.
mysql-test/t/profile.test:
  Test profiling code.
  ---
  Test syntax, but not values of profiles code.
sql/sql_profile.cc:
  Add profiling code.
  ---
  Add wishlist comment.
sql/sql_profile.h:
  Add profiling code.
  ---
  Changed the value of the macro so that it's syntactically equivalent to a
  single statement.
2007-01-03 17:15:10 -05:00