Commit ebfad22d authored by Ingo Struewing's avatar Ingo Struewing

merge

parents 3ea68493 042b9c30
...@@ -17,7 +17,7 @@ EXPORTS ...@@ -17,7 +17,7 @@ EXPORTS
dynstr_append_mem dynstr_append_mem
init_dynamic_string init_dynamic_string
dynstr_free dynstr_free
hash_free my_hash_free
my_vsnprintf my_vsnprintf
dynstr_append dynstr_append
my_close my_close
...@@ -31,7 +31,7 @@ EXPORTS ...@@ -31,7 +31,7 @@ EXPORTS
fn_format fn_format
dirname_part dirname_part
my_hash_insert my_hash_insert
hash_search my_hash_search
test_if_hard_path test_if_hard_path
my_copy my_copy
my_mkdir my_mkdir
...@@ -54,7 +54,7 @@ EXPORTS ...@@ -54,7 +54,7 @@ EXPORTS
my_thread_stack_size my_thread_stack_size
my_safe_print_str my_safe_print_str
my_stat my_stat
_hash_init _my_hash_init
pthread_attr_setstacksize pthread_attr_setstacksize
pthread_attr_init pthread_attr_init
my_dirend my_dirend
......
...@@ -1848,3 +1848,35 @@ select hex(_utf8 B'001111111111'); ...@@ -1848,3 +1848,35 @@ select hex(_utf8 B'001111111111');
ERROR HY000: Invalid utf8 character string: 'FF' ERROR HY000: Invalid utf8 character string: 'FF'
select (_utf8 X'616263FF'); select (_utf8 X'616263FF');
ERROR HY000: Invalid utf8 character string: 'FF' ERROR HY000: Invalid utf8 character string: 'FF'
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70000 1092
70001 1085
70002 1065
ALTER TABLE t1 ADD UNIQUE (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
DROP INDEX b ON t1;
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
ALTER TABLE t1 ADD INDEX (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
CONVERT(a, CHAR) CONVERT(b, CHAR)
70002 1065
70001 1085
70000 1092
DROP TABLE t1;
End of 5.0 tests
drop table if exists t1; SET @start_value= @@global.wait_timeout;
## Creating new table t1 ##
CREATE TABLE t1
(
id INT NOT NULL auto_increment,
PRIMARY KEY (id),
name VARCHAR(30)
);
'#--------------------FN_DYNVARS_186_01-------------------------#' '#--------------------FN_DYNVARS_186_01-------------------------#'
## Creating new connection test_con1 ## SET @start_time= UNIX_TIMESTAMP();
## Setting value of variable to 5 ## connect (test_con1, localhost, root,,);
SET @@session.wait_timeout = 5; SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
## Inserting record in table t1 ## Expect 1
INSERT into t1(name) values('Record_1'); 1
## Using sleep to check timeout ## SET @@session.wait_timeout = <session_value>;
'#--------------------FN_DYNVARS_186_02-------------------------#' connect (test_con2, localhost, root,,);
## Setting value of variable ## SET @@session.wait_timeout = <session_value> - 1;
SET @@global.wait_timeout = 5; connection default;
## Creating new connection test_con2 ## wait until connections ready
INSERT into t1(name) values('Record_2'); SELECT info FROM information_schema.processlist;
## Using sleep to check timeout ## info
SELECT info FROM information_schema.processlist
'#--------------------FN_DYNVARS_186_03-------------------------#' '#--------------------FN_DYNVARS_186_03-------------------------#'
## Setting value of variable to 1 ## SET @@global.wait_timeout= <global_value>;
SET @@global.wait_timeout = 1; SELECT @@session.wait_timeout = @start_value AS 'Expect 1';
## Creating new connection ## Expect 1
INSERT into t1(name) values('Record_3'); 1
## Using sleep to check timeout ## connect (test_con3, localhost, root,,);
## We cannot test it further because the server stops due to wait_timeout ## SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
SELECT * from t1; Expect 1
ERROR HY000: MySQL server has gone away 1
connection default;
SELECT info FROM information_schema.processlist;
info
SELECT info FROM information_schema.processlist
SELECT UNIX_TIMESTAMP() - @start_time >= <global_value> + <session_value>;;
UNIX_TIMESTAMP() - @start_time >= <global_value> + <session_value>;
1
SET @@global.wait_timeout= @start_value;
...@@ -1439,3 +1439,20 @@ select hex(_utf8 X'616263FF'); ...@@ -1439,3 +1439,20 @@ select hex(_utf8 X'616263FF');
select hex(_utf8 B'001111111111'); select hex(_utf8 B'001111111111');
--error ER_INVALID_CHARACTER_STRING --error ER_INVALID_CHARACTER_STRING
select (_utf8 X'616263FF'); select (_utf8 X'616263FF');
#
# Bug #36772: When using UTF8, CONVERT with GROUP BY returns truncated results
#
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL);
INSERT INTO t1 VALUES (70000, 1092), (70001, 1085), (70002, 1065);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1;
ALTER TABLE t1 ADD UNIQUE (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
DROP INDEX b ON t1;
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) FROM t1 GROUP BY b;
ALTER TABLE t1 ADD INDEX (b);
SELECT CONVERT(a, CHAR), CONVERT(b, CHAR) from t1 GROUP BY b;
DROP TABLE t1;
--echo End of 5.0 tests
...@@ -11,93 +11,87 @@ ...@@ -11,93 +11,87 @@
# Creation Date: 2008-03-07 # # Creation Date: 2008-03-07 #
# Author: Salman Rawala # # Author: Salman Rawala #
# # # #
# Modified: HHunger 2008-08-27 Simplified the test and replaced the sleeps. #
# #
# Description: Test Cases of Dynamic System Variable wait_timeout # # Description: Test Cases of Dynamic System Variable wait_timeout #
# that checks the functionality of this variable # # that checks the functionality of this variable #
# # # #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # # Reference: #
# server-system-variables.html#option_mysqld_wait_timeouts # # http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# # # #
############################################################################### ###############################################################################
--source include/not_embedded.inc --source include/not_embedded.inc
--disable_warnings SET @start_value= @@global.wait_timeout;
drop table if exists t1;
--enable_warnings
##############################
# Creating two new tables #
##############################
--echo ## Creating new table t1 ##
CREATE TABLE t1
(
id INT NOT NULL auto_increment,
PRIMARY KEY (id),
name VARCHAR(30)
);
--echo '#--------------------FN_DYNVARS_186_01-------------------------#' --echo '#--------------------FN_DYNVARS_186_01-------------------------#'
####################################################################### #######################################################################
# Setting initial value of interactive_timeout greater than sleep and # 1. test of scope session
# verifying its behavior on session scope
####################################################################### #######################################################################
--echo ## Creating new connection test_con1 ## SET @start_time= UNIX_TIMESTAMP();
--echo connect (test_con1, localhost, root,,);
connect (test_con1, localhost, root,,); connect (test_con1, localhost, root,,);
connection test_con1; connection test_con1;
--echo ## Setting value of variable to 5 ## # If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
SET @@session.wait_timeout = 5; SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
--echo ## Inserting record in table t1 ##
INSERT into t1(name) values('Record_1');
--echo ## Using sleep to check timeout ##
sleep 4;
--echo '#--------------------FN_DYNVARS_186_02-------------------------#'
#######################################################################
# Setting initial value of interactive_timeout greater than sleep and
# verifying its behavior on global scope
#######################################################################
--echo ## Setting value of variable ## # Find a small value <> @@global.wait_timeout.
SET @@global.wait_timeout = 5; let $session_value =
`SELECT IF(@@global.wait_timeout <> 2 OR @@global.wait_timeout IS NULL, 2, 3)`;
--replace_result $session_value <session_value>
eval SET @@session.wait_timeout = $session_value;
--echo ## Creating new connection test_con2 ## --echo connect (test_con2, localhost, root,,);
connect (test_con2, localhost, root,,); connect (test_con2, localhost, root,,);
connection test_con2; connection test_con2;
INSERT into t1(name) values('Record_2'); --replace_result $session_value <session_value>
eval SET @@session.wait_timeout = $session_value - 1;
--echo ## Using sleep to check timeout ##
sleep 4;
--echo connection default;
connection default;
--echo wait until connections ready
let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
--source include/wait_condition.inc
SELECT info FROM information_schema.processlist;
--echo '#--------------------FN_DYNVARS_186_03-------------------------#' --echo '#--------------------FN_DYNVARS_186_03-------------------------#'
####################################################################### #######################################################################
# Setting initial value of interactive_timeout less than sleep and # 2. test of scope global
# verifying its behavior on global scope
####################################################################### #######################################################################
--echo ## Setting value of variable to 1 ## # Find a small value <> @@global.wait_timeout.
SET @@global.wait_timeout = 1; let $global_value = $session_value + 1;
--replace_result $global_value <global_value>
eval SET @@global.wait_timeout= $global_value;
--echo ## Creating new connection ## # Changing the @@global.wait_timeout has no influence on the
# @@session.wait_timeout of already established sessions.
SELECT @@session.wait_timeout = @start_value AS 'Expect 1';
--echo connect (test_con3, localhost, root,,);
connect (test_con3, localhost, root,,); connect (test_con3, localhost, root,,);
connection test_con3; connection test_con3;
INSERT into t1(name) values('Record_3'); # If not explicitly changed, @@session.wait_timeout equals @@global.wait_timeout.
SELECT @@session.wait_timeout = @@global.wait_timeout AS 'Expect 1';
--echo ## Using sleep to check timeout ##
sleep 5; --echo connection default;
connection default;
--echo ## We cannot test it further because the server stops due to wait_timeout ## # We can be sure that the connections test_con1 and test_con2 must be
--Error 2006 # established because both have already executed a SET @@session.wait_timeout.
SELECT * from t1; # This means they are or at least were visible within the processlist.
# Therefore we can now simply wait till both disappear from the processlist.
let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist;
--source include/wait_condition.inc
SELECT info FROM information_schema.processlist;
--replace_result $global_value <global_value> $session_value <session_value>;
eval SELECT UNIX_TIMESTAMP() - @start_time >= $global_value + $session_value;
SET @@global.wait_timeout= @start_value;
...@@ -3627,7 +3627,7 @@ int ha_init_key_cache(const char *name, KEY_CACHE *key_cache) ...@@ -3627,7 +3627,7 @@ int ha_init_key_cache(const char *name, KEY_CACHE *key_cache)
if (!key_cache->key_cache_inited) if (!key_cache->key_cache_inited)
{ {
pthread_mutex_lock(&LOCK_global_system_variables); pthread_mutex_lock(&LOCK_global_system_variables);
ulong tmp_buff_size= (ulong) key_cache->param_buff_size; size_t tmp_buff_size= (size_t) key_cache->param_buff_size;
uint tmp_block_size= (uint) key_cache->param_block_size; uint tmp_block_size= (uint) key_cache->param_block_size;
uint division_limit= key_cache->param_division_limit; uint division_limit= key_cache->param_division_limit;
uint age_threshold= key_cache->param_age_threshold; uint age_threshold= key_cache->param_age_threshold;
...@@ -3651,7 +3651,7 @@ int ha_resize_key_cache(KEY_CACHE *key_cache) ...@@ -3651,7 +3651,7 @@ int ha_resize_key_cache(KEY_CACHE *key_cache)
if (key_cache->key_cache_inited) if (key_cache->key_cache_inited)
{ {
pthread_mutex_lock(&LOCK_global_system_variables); pthread_mutex_lock(&LOCK_global_system_variables);
long tmp_buff_size= (long) key_cache->param_buff_size; size_t tmp_buff_size= (size_t) key_cache->param_buff_size;
long tmp_block_size= (long) key_cache->param_block_size; long tmp_block_size= (long) key_cache->param_block_size;
uint division_limit= key_cache->param_division_limit; uint division_limit= key_cache->param_division_limit;
uint age_threshold= key_cache->param_age_threshold; uint age_threshold= key_cache->param_age_threshold;
......
...@@ -2504,6 +2504,8 @@ void Item_char_typecast::fix_length_and_dec() ...@@ -2504,6 +2504,8 @@ void Item_char_typecast::fix_length_and_dec()
and thus avoid unnecessary character set conversion. and thus avoid unnecessary character set conversion.
- If the argument is not a number, then from_cs is set to - If the argument is not a number, then from_cs is set to
the argument's charset. the argument's charset.
Note (TODO): we could use repertoire technique here.
*/ */
from_cs= (args[0]->result_type() == INT_RESULT || from_cs= (args[0]->result_type() == INT_RESULT ||
args[0]->result_type() == DECIMAL_RESULT || args[0]->result_type() == DECIMAL_RESULT ||
...@@ -2511,12 +2513,13 @@ void Item_char_typecast::fix_length_and_dec() ...@@ -2511,12 +2513,13 @@ void Item_char_typecast::fix_length_and_dec()
(cast_cs->mbminlen == 1 ? cast_cs : &my_charset_latin1) : (cast_cs->mbminlen == 1 ? cast_cs : &my_charset_latin1) :
args[0]->collation.collation; args[0]->collation.collation;
charset_conversion= (cast_cs->mbmaxlen > 1) || charset_conversion= (cast_cs->mbmaxlen > 1) ||
!my_charset_same(from_cs, cast_cs) && (!my_charset_same(from_cs, cast_cs) &&
from_cs != &my_charset_bin && from_cs != &my_charset_bin &&
cast_cs != &my_charset_bin; cast_cs != &my_charset_bin);
collation.set(cast_cs, DERIVATION_IMPLICIT); collation.set(cast_cs, DERIVATION_IMPLICIT);
char_length= (cast_length >= 0) ? cast_length : char_length= (cast_length >= 0) ?
args[0]->max_length/from_cs->mbmaxlen; cast_length :
args[0]->max_length / args[0]->collation.collation->mbmaxlen;
max_length= char_length * cast_cs->mbmaxlen; max_length= char_length * cast_cs->mbmaxlen;
} }
......
...@@ -4371,6 +4371,9 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -4371,6 +4371,9 @@ we force server id to 2, but this MySQL server will not act as a slave.");
: mysqld_unix_port), : mysqld_unix_port),
mysqld_port, mysqld_port,
MYSQL_COMPILATION_COMMENT); MYSQL_COMPILATION_COMMENT);
#if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
Service.SetRunning();
#endif
/* Signal threads waiting for server to be started */ /* Signal threads waiting for server to be started */
...@@ -7351,6 +7354,7 @@ SHOW_VAR status_vars[]= { ...@@ -7351,6 +7354,7 @@ SHOW_VAR status_vars[]= {
{NullS, NullS, SHOW_LONG} {NullS, NullS, SHOW_LONG}
}; };
#ifndef EMBEDDED_LIBRARY
static void print_version(void) static void print_version(void)
{ {
set_server_version(); set_server_version();
...@@ -7362,7 +7366,6 @@ static void print_version(void) ...@@ -7362,7 +7366,6 @@ static void print_version(void)
server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT); server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
} }
#ifndef EMBEDDED_LIBRARY
static void usage(void) static void usage(void)
{ {
if (!(default_charset_info= get_charset_by_csname(default_character_set_name, if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
......
...@@ -255,10 +255,6 @@ void NTService::ServiceMain(DWORD argc, LPTSTR *argv) ...@@ -255,10 +255,6 @@ void NTService::ServiceMain(DWORD argc, LPTSTR *argv)
if (!pService->StartService()) if (!pService->StartService())
goto error; goto error;
// Check that the service is now running.
if (!pService->SetStatus(SERVICE_RUNNING,NO_ERROR, 0, 0, 0))
goto error;
// wait for exit event // wait for exit event
WaitForSingleObject (pService->hExitEvent, INFINITE); WaitForSingleObject (pService->hExitEvent, INFINITE);
...@@ -274,9 +270,18 @@ error: ...@@ -274,9 +270,18 @@ error:
return; return;
} }
/**
starts the appliaction thread.
*/ void NTService::SetRunning()
{
if (pService)
pService->SetStatus(SERVICE_RUNNING,NO_ERROR, 0, 0, 0);
}
/* ------------------------------------------------------------------------
StartService() - starts the application thread
-------------------------------------------------------------------------- */
BOOL NTService::StartService() BOOL NTService::StartService()
{ {
......
...@@ -60,7 +60,19 @@ class NTService ...@@ -60,7 +60,19 @@ class NTService
BOOL IsService(LPCSTR ServiceName); BOOL IsService(LPCSTR ServiceName);
BOOL got_service_option(char **argv, char *service_option); BOOL got_service_option(char **argv, char *service_option);
BOOL is_super_user(); BOOL is_super_user();
void Stop(void); //to be called from app. to stop service
/*
SetRunning() is to be called by the application
when initialization completes and it can accept
stop request
*/
void SetRunning(void);
/*
Stop() is to be called by the application to stop
the service
*/
void Stop(void);
protected: protected:
LPSTR ServiceName; LPSTR ServiceName;
......
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