Commit cdaa91f7 authored by unknown's avatar unknown

Merge siva.hindu.god:/usr/home/tim/m/bk/50

into  siva.hindu.god:/usr/home/tim/m/bk/51


client/mysqltest.c:
  Auto merged
include/config-win.h:
  Auto merged
include/my_global.h:
  Auto merged
mysql-test/r/type_ranges.result:
  Auto merged
mysql-test/r/type_timestamp.result:
  Auto merged
server-tools/instance-manager/guardian.cc:
  Auto merged
server-tools/instance-manager/instance.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
include/my_pthread.h:
  Manual merge.
mysql-test/r/archive.result:
  Manual merge.
mysql-test/t/archive.test:
  Manual merge.
parents 501f9247 931dcc8a
...@@ -2977,7 +2977,12 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host, ...@@ -2977,7 +2977,12 @@ void safe_connect(MYSQL* mysql, const char *name, const char *host,
if ((mysql_errno(mysql) == CR_CONN_HOST_ERROR || if ((mysql_errno(mysql) == CR_CONN_HOST_ERROR ||
mysql_errno(mysql) == CR_CONNECTION_ERROR) && mysql_errno(mysql) == CR_CONNECTION_ERROR) &&
failed_attempts < opt_max_connect_retries) failed_attempts < opt_max_connect_retries)
{
verbose_msg("Connect attempt %d/%d failed: %d: %s", failed_attempts,
opt_max_connect_retries, mysql_errno(mysql),
mysql_error(mysql));
my_sleep(connection_retry_sleep); my_sleep(connection_retry_sleep);
}
else else
{ {
if (failed_attempts > 0) if (failed_attempts > 0)
......
...@@ -249,7 +249,6 @@ inline double ulonglong2double(ulonglong value) ...@@ -249,7 +249,6 @@ inline double ulonglong2double(ulonglong value)
#define tell(A) _telli64(A) #define tell(A) _telli64(A)
#endif #endif
#define set_timespec(ABSTIME,SEC) { (ABSTIME).tv_sec=time((time_t*)0) + (time_t) (SEC); (ABSTIME).tv_nsec=0; }
#define STACK_DIRECTION -1 #define STACK_DIRECTION -1
......
...@@ -1106,41 +1106,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */ ...@@ -1106,41 +1106,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */ #define MY_HOW_OFTEN_TO_ALARM 2 /* How often we want info on screen */
#define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */ #define MY_HOW_OFTEN_TO_WRITE 1000 /* How often we want info on screen */
#ifdef HAVE_TIMESPEC_TS_SEC
#ifndef set_timespec
#define set_timespec(ABSTIME,SEC) \
{ \
(ABSTIME).ts_sec=time(0) + (time_t) (SEC); \
(ABSTIME).ts_nsec=0; \
}
#endif /* !set_timespec */
#ifndef set_timespec_nsec
#define set_timespec_nsec(ABSTIME,NSEC) \
{ \
ulonglong now= my_getsystime() + (NSEC/100); \
(ABSTIME).ts_sec= (now / ULL(10000000)); \
(ABSTIME).ts_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
}
#endif /* !set_timespec_nsec */
#else
#ifndef set_timespec
#define set_timespec(ABSTIME,SEC) \
{\
struct timeval tv;\
gettimeofday(&tv,0);\
(ABSTIME).tv_sec=tv.tv_sec+(time_t) (SEC);\
(ABSTIME).tv_nsec=tv.tv_usec*1000;\
}
#endif /* !set_timespec */
#ifndef set_timespec_nsec
#define set_timespec_nsec(ABSTIME,NSEC) \
{\
ulonglong now= my_getsystime() + (NSEC/100); \
(ABSTIME).tv_sec= (time_t) (now / ULL(10000000)); \
(ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
}
#endif /* !set_timespec_nsec */
#endif /* HAVE_TIMESPEC_TS_SEC */
/* /*
Define-funktions for reading and storing in machine independent format Define-funktions for reading and storing in machine independent format
......
...@@ -11120,7 +11120,13 @@ auto fld1 companynr fld3 fld4 fld5 fld6 ...@@ -11120,7 +11120,13 @@ auto fld1 companynr fld3 fld4 fld5 fld6
2 011401 37 breaking dreaded Steinberg W 2 011401 37 breaking dreaded Steinberg W
3 011402 37 Romans scholastics jarring 3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily 4 011403 37 intercepted audiology tinily
SELECT COUNT(auto) FROM t2;
COUNT(auto)
1213
INSERT DELAYED INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); INSERT DELAYED INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
SELECT COUNT(auto) FROM t2;
COUNT(auto)
1214
FLUSH TABLE t2; FLUSH TABLE t2;
SELECT * FROM t2; SELECT * FROM t2;
auto fld1 companynr fld3 fld4 fld5 fld6 auto fld1 companynr fld3 fld4 fld5 fld6
......
...@@ -1347,9 +1347,16 @@ CHECK TABLE t2; ...@@ -1347,9 +1347,16 @@ CHECK TABLE t2;
SELECT * FROM t2; SELECT * FROM t2;
# Test INSERT DELAYED and wait until the table has one more record
# We won't know exactly about what is going on internally, # We won't know exactly about what is going on internally,
# but we will see if the row makes it in!! # but we will see if the row makes it in!!
SELECT COUNT(auto) FROM t2;
INSERT DELAYED INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily',''); INSERT DELAYED INTO t2 VALUES (4,011403,37,'intercepted','audiology','tinily','');
while (`SELECT COUNT(auto)!=1214 FROM t2`)
{
sleep 0.1;
}
SELECT COUNT(auto) FROM t2;
FLUSH TABLE t2; FLUSH TABLE t2;
SELECT * FROM t2; SELECT * FROM t2;
......
...@@ -54,14 +54,30 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) ...@@ -54,14 +54,30 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
struct timespec *abstime) struct timespec *abstime)
{ {
struct _timeb curtime;
int result; int result;
long timeout; long timeout;
_ftime(&curtime); union ft64 now;
timeout= ((long) (abstime->tv_sec - curtime.time)*1000L +
(long)((abstime->tv_nsec/1000) - curtime.millitm)/1000L); GetSystemTimeAsFileTime(&now.ft);
if (timeout < 0) /* Some safety */
/*
- subtract start time from current time(values are in 100ns units
- convert to millisec by dividing with 10000
- subtract time since start from max timeout
*/
timeout= abstime->timeout_msec - (long)((now.i64 - abstime->start.i64) / 10000);
/* Don't allow the timeout to be negative */
if (timeout < 0)
timeout = 0L; timeout = 0L;
/*
Make sure the calucated time does not exceed original timeout
value which could cause "wait for ever" if system time changes
*/
if (timeout > abstime->timeout_msec)
timeout= abstime->timeout_msec;
InterlockedIncrement(&cond->waiting); InterlockedIncrement(&cond->waiting);
LeaveCriticalSection(mutex); LeaveCriticalSection(mutex);
result=WaitForSingleObject(cond->semaphore,timeout); result=WaitForSingleObject(cond->semaphore,timeout);
......
...@@ -254,8 +254,7 @@ void Guardian::run() ...@@ -254,8 +254,7 @@ void Guardian::run()
node= node->next; node= node->next;
} }
timeout.tv_sec= time(NULL) + monitoring_interval; set_timespec(timeout, monitoring_interval);
timeout.tv_nsec= 0;
/* check the loop predicate before sleeping */ /* check the loop predicate before sleeping */
if (!(shutdown_requested && (!(guarded_instances)))) if (!(shutdown_requested && (!(guarded_instances))))
......
...@@ -636,10 +636,9 @@ int Instance::stop() ...@@ -636,10 +636,9 @@ int Instance::stop()
waitchild= options.get_shutdown_delay(); waitchild= options.get_shutdown_delay();
kill_mysqld(SIGTERM); kill_mysqld(SIGTERM);
/* sleep on condition to wait for SIGCHLD */
timeout.tv_sec= time(NULL) + waitchild; /* sleep on condition to wait for SIGCHLD */
timeout.tv_nsec= 0; set_timespec(timeout, waitchild);
if (pthread_mutex_lock(&LOCK_instance)) if (pthread_mutex_lock(&LOCK_instance))
return ER_STOP_INSTANCE; return ER_STOP_INSTANCE;
......
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