Commit 47d3337e authored by unknown's avatar unknown

Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-4.1

into rurik.mysql.com:/home/igor/mysql-4.1
parents aec7248c bf99e546
...@@ -45,6 +45,8 @@ typedef struct st_keycache_wqueue ...@@ -45,6 +45,8 @@ typedef struct st_keycache_wqueue
typedef struct st_key_cache typedef struct st_key_cache
{ {
my_bool key_cache_inited; my_bool key_cache_inited;
my_bool resize_in_flush; /* true during flush of resize operation */
my_bool can_be_used; /* usage of cache for read/write is allowed */
uint key_cache_shift; uint key_cache_shift;
ulong key_cache_mem_size; /* specified size of the cache memory */ ulong key_cache_mem_size; /* specified size of the cache memory */
uint key_cache_block_size; /* size of the page buffer of a cache block */ uint key_cache_block_size; /* size of the page buffer of a cache block */
...@@ -58,6 +60,7 @@ typedef struct st_key_cache ...@@ -58,6 +60,7 @@ typedef struct st_key_cache
ulong blocks_used; /* number of currently used blocks */ ulong blocks_used; /* number of currently used blocks */
ulong blocks_changed; /* number of currently dirty blocks */ ulong blocks_changed; /* number of currently dirty blocks */
ulong warm_blocks; /* number of blocks in warm sub-chain */ ulong warm_blocks; /* number of blocks in warm sub-chain */
ulong cnt_for_resize_op; /* counter to block resize operation */
long blocks_available; /* number of blocks available in the LRU chain */ long blocks_available; /* number of blocks available in the LRU chain */
HASH_LINK **hash_root; /* arr. of entries into hash table buckets */ HASH_LINK **hash_root; /* arr. of entries into hash table buckets */
HASH_LINK *hash_link_root; /* memory for hash table links */ HASH_LINK *hash_link_root; /* memory for hash table links */
...@@ -67,6 +70,7 @@ typedef struct st_key_cache ...@@ -67,6 +70,7 @@ typedef struct st_key_cache
BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */ BLOCK_LINK *used_last; /* ptr to the last block of the LRU chain */
BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */ BLOCK_LINK *used_ins; /* ptr to the insertion block in LRU chain */
pthread_mutex_t cache_lock; /* to lock access to the cache structure */ pthread_mutex_t cache_lock; /* to lock access to the cache structure */
KEYCACHE_WQUEUE resize_queue; /* threads waiting during resize operation */
KEYCACHE_WQUEUE waiting_for_hash_link; /* waiting for a free hash link */ KEYCACHE_WQUEUE waiting_for_hash_link; /* waiting for a free hash link */
KEYCACHE_WQUEUE waiting_for_block; /* requests waiting for a free block */ KEYCACHE_WQUEUE waiting_for_block; /* requests waiting for a free block */
BLOCK_LINK *changed_blocks[CHANGED_BLOCKS_HASH]; /* hash for dirty file bl.*/ BLOCK_LINK *changed_blocks[CHANGED_BLOCKS_HASH]; /* hash for dirty file bl.*/
......
This diff is collapsed.
...@@ -23,14 +23,15 @@ $opt_select_count=$opt_join_count=0; ...@@ -23,14 +23,15 @@ $opt_select_count=$opt_join_count=0;
$opt_update=1;$opt_delete=0; $opt_update=1;$opt_delete=0;
$opt_flush=$opt_check=$opt_repair=$opt_alter=0; $opt_flush=$opt_check=$opt_repair=$opt_alter=0;
$opt_join_range=100; $opt_join_range=100;
$opt_resize_interval=0;
$opt_time=0; $opt_time=0;
$opt_host=$opt_user=$opt_password=""; $opt_db="test"; $opt_host=$opt_user=$opt_password=""; $opt_db="test";
$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$opt_force=undef; # Ignore warnings from these
GetOptions("host=s","db=s","user=s","password=s","loop-count=i","skip-create","skip-in","skip-drop", GetOptions("host=s","db=s","user=s","password=s","loop-count=i","skip-create","skip-in","skip-drop",
"verbose","fast-insert","lock-tables","debug","fast","force","thread-factor=i", "verbose","fast-insert","lock-tables","debug","fast","force","thread-factor=i",
"insert=i", "select=i", "join=i", "select-count=i", "join-count=i", "update=i", "delete=i", "insert=i", "select=i", "join=i", "select-count=i", "join-count=i", "update=i", "delete=i",
"flush=i", "check=i", "repair=i", "alter=i", "max-join_range=i", "time=i") || die "Aborted"; "flush=i", "check=i", "repair=i", "alter=i", "resize-interval=i", "max-join_range=i", "time=i") || die "Aborted";
$opt_verbose=$opt_debug=$opt_lock_tables=$opt_fast_insert=$opt_fast=$opt_skip_in=$opt_force=undef; # Ignore warnings from these
print "Test of multiple connections that test the following things:\n"; print "Test of multiple connections that test the following things:\n";
print "insert, select, delete, update, alter, check, repair and flush\n"; print "insert, select, delete, update, alter, check, repair and flush\n";
...@@ -158,6 +159,11 @@ for ($i=0 ; $i < $opt_alter ; $i ++) ...@@ -158,6 +159,11 @@ for ($i=0 ; $i < $opt_alter ; $i ++)
test_alter() if (($pid=fork()) == 0); $work{$pid}="alter"; test_alter() if (($pid=fork()) == 0); $work{$pid}="alter";
} }
$threads+=$i; $threads+=$i;
if ($opt_resize_interval != 0)
{
test_resize() if (($pid=fork()) == 0); $work{$pid}="resize";
$threads+=1;
}
print "Started $threads threads\n"; print "Started $threads threads\n";
...@@ -590,6 +596,32 @@ sub test_flush ...@@ -590,6 +596,32 @@ sub test_flush
exit(0); exit(0);
} }
#
# Do a resize key cache every periodically
#
sub test_resize
{
my ($dbh, $key_buffer_size);
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host",
$opt_user, $opt_password,
{ PrintError => 0}) || die $DBI::errstr;
$count=0;
$key_buffer_size=1024*64;
while (!test_if_abort($dbh))
{
sleep($opt_resize_interval);
$dbh->do("set global key_buffer_size=$key_buffer_size") ||
die "Got error on resize key cache $DBI::errstr\n";
$key_buffer_size+=1024*16;
$count++;
}
$dbh->disconnect; $dbh=0;
print "Test_resize: Executed $count times resize key cache\n";
exit(0);
}
# #
# Test all tables in a database # Test all tables in a database
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment