Fix to bug #513, http://bugs.skysql.com/show_bug.cgi?id=513
This commit is contained in:
@ -382,7 +382,12 @@ static bool file_write_header(
|
||||
const char* header_buf3;
|
||||
time_t* t = NULL;
|
||||
struct tm* tm = NULL;
|
||||
|
||||
#if defined(LAPTOP_TEST)
|
||||
struct timespec ts1;
|
||||
ts1.tv_sec = 0;
|
||||
ts1.tv_nsec = DISKWRITE_LATENCY*1000000;
|
||||
#endif
|
||||
|
||||
if ((t = (time_t *)malloc(sizeof(time_t))) == NULL) {
|
||||
goto return_succp;
|
||||
}
|
||||
@ -406,7 +411,7 @@ static bool file_write_header(
|
||||
len2 = strlen(header_buf2);
|
||||
len3 = strlen(header_buf3);
|
||||
#if defined(LAPTOP_TEST)
|
||||
usleep(DISKWRITE_LATENCY);
|
||||
nanosleep(&ts1, NULL);
|
||||
#else
|
||||
wbytes1=fwrite((void*)header_buf1, len1, 1, outfile);
|
||||
wbytes2=fwrite((void*)header_buf2, len2, 1, outfile);
|
||||
|
||||
@ -820,6 +820,8 @@ void route_buffers()
|
||||
while(instance.buff_ind < instance.buffer_count){
|
||||
pthread_mutex_unlock(&instance.work_mtx);
|
||||
while(instance.last_ind < instance.session_count){
|
||||
struct timespec ts1;
|
||||
ts1.tv_sec = 0;
|
||||
|
||||
tprg = ((bprg + (float)instance.last_ind)/fin);
|
||||
if(!instance.verbose){
|
||||
@ -828,7 +830,8 @@ void route_buffers()
|
||||
trig += step;
|
||||
}
|
||||
}
|
||||
usleep(100);
|
||||
ts1.tv_nsec = 100*1000000;
|
||||
nanosleep(&ts1, NULL);
|
||||
}
|
||||
pthread_mutex_lock(&instance.work_mtx);
|
||||
instance.buff_ind++;
|
||||
@ -863,6 +866,9 @@ void work_buffer(void* thr_num)
|
||||
index < instance.session_count &&
|
||||
instance.buff_ind < instance.buffer_count)
|
||||
{
|
||||
struct timespec ts1;
|
||||
ts1.tv_sec = 0;
|
||||
|
||||
instance.head->instance->routeQuery(instance.head->filter,
|
||||
instance.head->session[index],
|
||||
instance.buffer[instance.buff_ind]);
|
||||
@ -872,7 +878,8 @@ void work_buffer(void* thr_num)
|
||||
fake_ok);
|
||||
}
|
||||
atomic_add(&instance.last_ind,1);
|
||||
usleep(1000*instance.rt_delay);
|
||||
ts1.tv_nsec = 1000*instance.rt_delay*1000000;
|
||||
nanosleep(&ts1, NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1111,7 +1111,7 @@ int gw_MySQLAccept(DCB *listener)
|
||||
int sendbuf = GW_BACKEND_SO_SNDBUF;
|
||||
socklen_t optlen = sizeof(sendbuf);
|
||||
int eno = 0;
|
||||
int syseno = 0;
|
||||
int syseno = 0;
|
||||
int i = 0;
|
||||
|
||||
CHK_DCB(listener);
|
||||
@ -1151,6 +1151,8 @@ int gw_MySQLAccept(DCB *listener)
|
||||
}
|
||||
else if (eno == ENFILE || eno == EMFILE)
|
||||
{
|
||||
struct timespec ts1;
|
||||
ts1.tv_sec = 0;
|
||||
/**
|
||||
* Exceeded system's (ENFILE) or processes
|
||||
* (EMFILE) max. number of files limit.
|
||||
@ -1173,8 +1175,9 @@ int gw_MySQLAccept(DCB *listener)
|
||||
strerror(eno))));
|
||||
}
|
||||
i++;
|
||||
usleep(100*i*i);
|
||||
|
||||
ts1.tv_nsec = 100*i*i*1000000;
|
||||
nanosleep(&ts1, NULL);
|
||||
|
||||
if (i<10) {
|
||||
goto retry_accept;
|
||||
}
|
||||
|
||||
@ -1847,7 +1847,7 @@ void protocol_add_srv_command(
|
||||
MySQLProtocol* p,
|
||||
mysql_server_cmd_t cmd)
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
#if defined(EXTRA_SS_DEBUG)
|
||||
server_command_t* c;
|
||||
#endif
|
||||
spinlock_acquire(&p->protocol_lock);
|
||||
|
||||
Reference in New Issue
Block a user