Commit graph

48 commits

Author SHA1 Message Date
kroki/tomash@moonlight.intranet
0f0ddc398a BUG#21051: RESET QUERY CACHE very slow when query_cache_type=0
There were two problems: RESET QUERY CACHE took a long time to complete
and other threads were blocked during this time.

The patch does three things:
  1 fixes a bug with improper use of test-lock-test_again technique.
      AKA Double-Checked Locking is applicable here only in few places.
  2 Somewhat improves performance of RESET QUERY CACHE.
      Do my_hash_reset() instead of deleting elements one by one.  Note
      however that the slowdown also happens when inserting into sorted
      list of free blocks, should be rewritten using balanced tree.
  3 Makes RESET QUERY CACHE non-blocking.
      The patch adjusts the locking protocol of the query cache in the
      following way: it introduces a flag flush_in_progress, which is
      set when Query_cache::flush_cache() is in progress.  This call
      sets the flag on enter, and then releases the lock.  Every other
      call is able to acquire the lock, but does nothing if
      flush_in_progress is set (as if the query cache is disabled).
      The only exception is the concurrent calls to
      Query_cache::flush_cache(), that are blocked until the flush is
      over.  When leaving Query_cache::flush_cache(), the lock is
      acquired and the flag is reset, and one thread waiting on
      Query_cache::flush_cache() (if any) is notified that it may
      proceed.
2006-08-22 11:47:52 +04:00
monty@mysql.com
54274976e7 Fixed compiler warnings from gcc 4.0.2:
- Added empty constructors and virtual destructors to many classes and structs
- Removed some usage of the offsetof() macro to instead use C++ class pointers
2006-02-25 17:46:30 +02:00
bell@sanja.is.com.ua
2bcd68973b Fix for BUG#13549 "Server crash with nested stored procedures
if inner routine has more local variables than outer one, and
one of its last variables was used as argument to NOT operator".

THD::spcont was non-0 when we were parsing stored routine/trigger
definition during execution of another stored routine. This confused
methods of Item_splocal and forced them use wrong runtime context.
Fix ensures that we always have THD::spcont equal to zero during
routine/trigger body parsing. This also allows to avoid problems
with errors which occur during parsing and SQL exception handlers.
2005-11-23 00:50:37 +02:00
bell@sanja.is.com.ua
352c7b9cbc Merge sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
into  sanja.is.com.ua:/home/bell/mysql/bk/work-mrg-5.0
2005-09-06 20:51:15 +03:00
bell@sanja.is.com.ua
1bff548cb3 Merge sanja.is.com.ua:/home/bell/mysql/bk/work-4.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
2005-09-06 12:18:23 +03:00
bell@sanja.is.com.ua
10c0ef69e7 support of concurent query cache resizing (BUG#12848) 2005-09-06 11:16:53 +03:00
bell@sanja.is.com.ua
b196fa2cfa merge 2005-02-07 21:39:37 +02:00
msvensson@neptunus.homeip.net
3181f5d2b6 Merged "query cache for ndb" to 5.0 2005-02-03 09:33:48 +01:00
bell@sanja.is.com.ua
34b85449bb fixed QC invaluidation and processing with view (BUG#8050) (BUG#8054) 2005-01-27 14:21:37 +02:00
tomas@poseidon.ndb.mysql.com
e57726b98e removed special ndb query cache variable
ndb will always return query cache type ASKTRANSACT
2004-11-25 18:56:10 +00:00
tomas@poseidon.ndb.mysql.com
b53e083827 Merge 2004-11-24 12:04:17 +00:00
tomas@poseidon.ndb.mysql.com
ae471974ac sql/ha_innodb.cc
enabled query cache for ndb
    modified engine interface somewhat
sql/ha_innodb.h
    enabled query cache for ndb
    modified engine interface somewhat
sql/ha_ndbcluster.cc
    enabled query cache for ndb
    modified engine interface somewhat
    ndb will only allow caching and retrieval if running autocommit
      - return false, but do not invalidate
    commit count is used as engine data, i.e.
      - store commit count before store of cache
      - allow retrieval if commit count has not changed on a table
      - invalidate if commit count has changed
sql/ha_ndbcluster.h
    enabled query cache for ndb
    modified engine interface somewhat
sql/handler.cc
    enabled query cache for ndb
    modified engine interface somewhat
sql/handler.h
    enabled query cache for ndb
    modified engine interface somewhat
    new virtual handler method cached_table_registration called on each table before alowing store in query cache
      - return TRUE - ok to cache, FALSE - not allowed to cache, invalidate queries if engine_data below has changed
      - sets ulonglong (engine_data) that is stored in query cache for each table
      - sets callback to be called for each table before usage of cached query, callback = 0 -> no check later
sql/mysql_priv.h
    enabled query cache for ndb
    modified engine interface somewhat
    callcack prototype for callback to engine before query cache retrieval
sql/sql_cache.cc
    enabled query cache for ndb
    modified engine interface somewhat
    if callback is set on table in cache, do callback to check if allowed to use cache
    if not allowed to use cache, check if engine_data has changed, if so, invalidate all queries with that table
    + changes to store and pass callback and engine_data around
sql/sql_cache.h
    enabled query cache for ndb
    modified engine interface somewhat
    changes to store callback and engine_data
sql/table.h
    enabled query cache for ndb
    modified engine interface somewhat
    changes to store callback and engine_data
2004-11-24 11:56:51 +00:00
tomas@poseidon.ndb.mysql.com
ca61e54cd0 changed query cache type variable for ndb 2004-11-23 16:38:00 +00:00
monty@mysql.com
afbe601302 merge with 4.1 2004-10-29 19:26:52 +03:00
monty@mysql.com
3493f54a5e Merge with 4.0 2004-10-27 19:52:41 +03:00
bell@sanja.is.com.ua
ded12c828d Check of temporary tables hiding for query fetched from QC (BUG#6084) 2004-10-21 23:56:12 +03:00
pem@mysql.comhem.se
5b10e3e5b5 Fixed BUG#3583: query cache doesn't work for stored procedures. 2004-09-17 15:40:38 +02:00
bell@sanja.is.com.ua
24e1464d5a information about different variables agged to query cache (BUG#5515, BUG#5394) 2004-09-10 16:28:18 +03:00
monty@mysql.com
350b433569 merge with 4.0 2004-03-16 22:41:30 +02:00
bell@sanja.is.com.ua
d03034d306 invalidation of locking for write tables (BUG#2693)
fixed linking query_prealloc_size to query cache presence
2004-03-04 18:32:55 +02:00
hf@deer.(none)
afd0b37816 SCRUM
WL#1246 (Query cache in embedded library)
2003-12-01 17:19:10 +04:00
bell@laptop.sanja.is.com.ua
7a86c7df28 Merge laptop.sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into laptop.sanja.is.com.ua:/home/bell/mysql/bk/work-qc-4.1
2003-08-26 16:42:49 +03:00
bell@sanja.is.com.ua
57bb575d49 fixed query cache intercommunication with innodb engine 2003-08-12 23:45:04 +03:00
monty@mashka.mysql.fi
2263e3e51f Merge with 4.0.14 2003-08-11 22:44:43 +03:00
bell@sanja.is.com.ua
86e6cf399e support of more then 255 tables dependence in query cache (fixed BUG#930) 2003-07-30 14:59:56 +03:00
bell@sanja.is.com.ua
5ea922aab0 merging 2003-04-16 20:35:29 +03:00
bell@sanja.is.com.ua
b2f27a155c made variable query_cache_min_res_unit from QUERY_CACHE_MIN_RESULT_DATA_SIZE (SCRUM) 2003-03-02 21:39:03 +02:00
bell@sanja.is.com.ua
3103bca9b2 merging 2002-12-11 19:53:57 +02:00
bell@sanja.is.com.ua
64047ea9a7 new status variable (number of queries deleted because of low memory) 2002-11-17 20:41:25 +02:00
monty@butch.
a2bdf9265f Portability fixes for Fortre C++ 5.0 (on Sun) in 32 and 64 bit modes. 2002-11-07 03:54:00 +02:00
bell@sanja.is.com.ua
4307363079 new innodb query cache behaviour (recommit because of problem with 4.1 repository pushing)
fixed bug in quqry cache dbd transaction processing
2002-11-03 10:15:14 +02:00
monty@mashka.mysql.fi
efaaf0b4b8 Updated VC++ project files for 4.0.4
Only write short usage if one starts mysqldump without any options
Added query cache on windows
Added error message if one can't read privilege tables
2002-09-24 17:11:59 +03:00
bell@sanja.is.com.ua
96ebe3816f new function for innodb
windows case insensitive tables name work around
2002-09-19 10:36:19 +03:00
monty@mashka.mysql.fi
dddc20d9d1 New SET syntax & system variables.
Made a some new buffers thread specific and changeable.
Resize of key_buffer.
AUTO_COMMIT -> AUTOCOMMIT
Fixed mutex bug in DROP DATABASE
Fixed bug when using auto_increment as second part of a key where first part could include NULL.
Split handler->extra() to extra() and extra_opt() to be able to support thread specific buffers.
Don't write message to error log when slave reconnects becasue of timeout.
Fixed possible update problem when using DELETE/UPDATE on small tables
(In some cases we used index even if table scanning would be better)
A lot of minior code cleanups
2002-07-23 18:31:22 +03:00
bell@sanja.is.com.ua
2426972c5b semaphores replaced by rwlock 2002-06-30 12:08:58 +03:00
bell@sanja.is.com.ua
63b2a551bf processing trunsactional tables in query cache 2002-03-15 23:57:31 +02:00
bell@sanja.is.com.ua
11920dbbe7 New result block allocation strategy 2002-01-12 15:40:52 +02:00
monty@hundin.mysql.fi
ff17389116 Fix for FLUSH QUERY CACHE
Fix for new bug in CREATE TABLE when sorting keys.
2002-01-05 22:51:42 +02:00
monty@hundin.mysql.fi
a9de2c14a0 Some small fixes to the query cache. 2002-01-03 19:04:01 +02:00
monty@hundin.mysql.fi
4b877e0088 Added macros for nice TIMESPEC usage.
Fixes for building MySQL with gcc 3.0
Added SIGNED / UNSIGNED casts
Fixed core dump bug in net_clear() with libmysqld.
Back to using semaphores in query cache.
Added 'Null' and 'Index_type' to SHOW INDEX.
2002-01-02 21:29:41 +02:00
monty@hundin.mysql.fi
9e1ed2e4dc Fixed access privilege bug in query cache.
Change tests to use database 'mysqltest' instead of 'foo'
Add option to not print access denied messages to check_table_access()
2001-12-22 15:13:31 +02:00
monty@hundin.mysql.fi
4dbd9e061c Lots of portability fixes.
Fixed shutdown on HPUX.
Fixed bug in query cache.
2001-12-17 03:02:58 +02:00
monty@hundin.mysql.fi
61be9477ec Removed not used functions from sql_cache
Added new tests to testsuite.
2001-12-14 16:02:41 +02:00
monty@hundin.mysql.fi
87fd219d67 Fixed sleep time in mysql-test-run
Fixed bug in query cache.
Cleaned up des_crypt code.
2001-12-13 02:31:19 +02:00
monty@hundin.mysql.fi
6b02f13cf3 Removed compiler warnings.
Added new operators to be used with gcc 3.0.x
Update of query cache code.
Added semaphores for Windows (not yet in use)
Added pthread_mutex_trylock for windows.
2001-12-10 00:08:24 +02:00
monty@hundin.mysql.fi
4c17825acd Update of query cache code 2001-12-06 01:05:30 +02:00
monty@hundin.mysql.fi
1de4fff5ba Update of query cache code.
Changed some sql_alloc() -> thd->alloc()
Removed a lot of compiler warnings on Linux Alpha (64 bit)
Fixed some core dumps on 64 bit systems (wrong type for packet_len)
2001-12-05 13:03:00 +02:00
monty@hundin.mysql.fi
1d26537da5 Query cache.
Remove some warnings
2001-12-02 14:34:01 +02:00