Commit b3ea683c authored by Guilhem Bichot's avatar Guilhem Bichot

merge from latest 5.1-maria

parents 998b4ae5 ce8f55fe
...@@ -814,7 +814,7 @@ AC_HEADER_DIRENT ...@@ -814,7 +814,7 @@ AC_HEADER_DIRENT
AC_HEADER_STDC AC_HEADER_STDC
AC_HEADER_SYS_WAIT AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
memory.h pwd.h select.h \ memory.h pwd.h select.h fnmatch.h \
stdlib.h stddef.h sys/stat.h \ stdlib.h stddef.h sys/stat.h \
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \ strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \ sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
* (the logic is - think of a call stack as of a path. * (the logic is - think of a call stack as of a path.
* "function" means only this function, "function/" means the hierarchy. * "function" means only this function, "function/" means the hierarchy.
* in the future, filters like function1/function2 could be supported. * in the future, filters like function1/function2 could be supported.
* wildcards are a natural extension too: * and ?) * following this logic glob(7) wildcards are supported.)
* *
*/ */
...@@ -88,6 +88,13 @@ ...@@ -88,6 +88,13 @@
#include <my_global.h> #include <my_global.h>
#include <m_string.h> #include <m_string.h>
#include <errno.h> #include <errno.h>
#ifdef HAVE_FNMATCH_H
#include <fnmatch.h>
#else
#define fnmatch(A,B,C) strcmp(A,B)
#endif
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
#include <process.h> #include <process.h>
#endif #endif
...@@ -1547,7 +1554,7 @@ static int InList(struct link *linkp, const char *cp) ...@@ -1547,7 +1554,7 @@ static int InList(struct link *linkp, const char *cp)
for (result=MATCHED; linkp != NULL; linkp= linkp->next_link) for (result=MATCHED; linkp != NULL; linkp= linkp->next_link)
{ {
if (!strcmp(linkp->str, cp)) if (!fnmatch(linkp->str, cp, 0))
return linkp->flags; return linkp->flags;
if (!(linkp->flags & EXCLUDE)) if (!(linkp->flags & EXCLUDE))
result=NOT_MATCHED; result=NOT_MATCHED;
......
...@@ -941,6 +941,9 @@ a complete log file in case of crashes. This mode is implicit in ...@@ -941,6 +941,9 @@ a complete log file in case of crashes. This mode is implicit in
multi-threaded environment. multi-threaded environment.
.LI d[,keywords] .LI d[,keywords]
Enable output from macros with specified keywords. Enable output from macros with specified keywords.
Every keyword can be a
.I glob(7)
pattern.
An empty list of keywords implies that all keywords are selected. An empty list of keywords implies that all keywords are selected.
.LI D[,time] .LI D[,time]
Delay for specified time after each output line, to let output drain. Delay for specified time after each output line, to let output drain.
...@@ -948,6 +951,9 @@ Time is given in tenths of a second (value of 10 is one second). ...@@ -948,6 +951,9 @@ Time is given in tenths of a second (value of 10 is one second).
Default is zero. Default is zero.
.LI f[,functions] .LI f[,functions]
Limit debugger actions to the specified list of functions. Limit debugger actions to the specified list of functions.
Every function can be a
.I glob(7)
pattern.
An empty list of functions implies that all functions are selected. An empty list of functions implies that all functions are selected.
Every function in the list may optionally be followed by a '/' - Every function in the list may optionally be followed by a '/' -
this will implicitly select all the functions down the call stack. this will implicitly select all the functions down the call stack.
...@@ -966,6 +972,9 @@ Mark each debugger output line with the PID (or thread ID) of the ...@@ -966,6 +972,9 @@ Mark each debugger output line with the PID (or thread ID) of the
current process. current process.
.LI g,[functions] .LI g,[functions]
Enable profiling for the specified list of functions. Enable profiling for the specified list of functions.
Every function can be a
.I glob(7)
pattern.
An empty list of functions enables profiling for all functions. An empty list of functions enables profiling for all functions.
See See
.B PROFILING\ WITH\ DBUG .B PROFILING\ WITH\ DBUG
...@@ -984,7 +993,11 @@ Like 'a[,file]' but overwrite old file, do not append. ...@@ -984,7 +993,11 @@ Like 'a[,file]' but overwrite old file, do not append.
.LI O[,file] .LI O[,file]
Like 'A[,file]' but overwrite old file, do not append. Like 'A[,file]' but overwrite old file, do not append.
.LI p[,processes] .LI p[,processes]
Limit debugger actions to the specified processes. An empty list Limit debugger actions to the specified processes.
Every name can be a
.I glob(7)
pattern.
An empty list
implies all processes. This is useful for processes which run child implies all processes. This is useful for processes which run child
processes. Note that each debugger output line can be marked with the processes. Note that each debugger output line can be marked with the
name of the current process via the 'P' flag. The process name must name of the current process via the 'P' flag. The process name must
......
...@@ -24,6 +24,7 @@ struct test_wt_thd { ...@@ -24,6 +24,7 @@ struct test_wt_thd {
uint i, cnt; uint i, cnt;
pthread_mutex_t lock; pthread_mutex_t lock;
pthread_cond_t thread_sync;
ulong wt_timeout_short=100, wt_deadlock_search_depth_short=4; ulong wt_timeout_short=100, wt_deadlock_search_depth_short=4;
ulong wt_timeout_long=10000, wt_deadlock_search_depth_long=15; ulong wt_timeout_long=10000, wt_deadlock_search_depth_long=15;
...@@ -48,9 +49,19 @@ pthread_handler_t test_wt(void *arg) ...@@ -48,9 +49,19 @@ pthread_handler_t test_wt(void *arg)
my_thread_init(); my_thread_init();
pthread_mutex_lock(&lock); pthread_mutex_lock(&mutex);
id= cnt++; id= cnt++;
pthread_mutex_unlock(&lock); wt_thd_lazy_init(& thds[id].thd,
& wt_deadlock_search_depth_short, & wt_timeout_short,
& wt_deadlock_search_depth_long, & wt_timeout_long);
/* now, wait for everybody to be ready to run */
if (cnt >= THREADS)
pthread_cond_broadcast(&thread_sync);
else
while (cnt < THREADS)
pthread_cond_wait(&thread_sync, &mutex);
pthread_mutex_unlock(&mutex);
my_rnd_init(&rand, (ulong)(intptr)&m, id); my_rnd_init(&rand, (ulong)(intptr)&m, id);
if (kill_strategy == YOUNGEST) if (kill_strategy == YOUNGEST)
...@@ -111,23 +122,23 @@ pthread_handler_t test_wt(void *arg) ...@@ -111,23 +122,23 @@ pthread_handler_t test_wt(void *arg)
thds[id].thd.weight++; thds[id].thd.weight++;
} }
pthread_mutex_lock(&mutex);
/* wait for everybody to finish */
if (!--cnt)
pthread_cond_broadcast(&thread_sync);
else
while (cnt)
pthread_cond_wait(&thread_sync, &mutex);
pthread_mutex_lock(& thds[id].lock); pthread_mutex_lock(& thds[id].lock);
pthread_mutex_lock(&lock); pthread_mutex_lock(&lock);
wt_thd_release_all(& thds[id].thd); wt_thd_release_all(& thds[id].thd);
pthread_mutex_unlock(&lock); pthread_mutex_unlock(&lock);
pthread_mutex_unlock(& thds[id].lock); pthread_mutex_unlock(& thds[id].lock);
wt_thd_destroy(& thds[id].thd);
#ifndef DBUG_OFF if (!--running_threads) /* now, signal when everybody is done with deinit */
{ pthread_cond_signal(&cond);
#define DEL "(deleted)"
char *x=malloc(strlen(thds[id].thd.name)+sizeof(DEL)+1);
strxmov(x, thds[id].thd.name, DEL, 0);
thds[id].thd.name=x;
}
#endif
pthread_mutex_lock(&mutex);
if (!--running_threads) pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
DBUG_PRINT("wt", ("exiting")); DBUG_PRINT("wt", ("exiting"));
my_thread_end(); my_thread_end();
...@@ -137,6 +148,7 @@ pthread_handler_t test_wt(void *arg) ...@@ -137,6 +148,7 @@ pthread_handler_t test_wt(void *arg)
void do_one_test() void do_one_test()
{ {
double sum, sum0; double sum, sum0;
DBUG_ENTER("do_one_test");
reset(wt_cycle_stats); reset(wt_cycle_stats);
reset(wt_wait_stats); reset(wt_wait_stats);
...@@ -162,10 +174,13 @@ void do_one_test() ...@@ -162,10 +174,13 @@ void do_one_test()
wt_wait_table[cnt], wt_wait_stats[cnt]); wt_wait_table[cnt], wt_wait_stats[cnt]);
diag("timed out: %u", wt_wait_stats[cnt]); diag("timed out: %u", wt_wait_stats[cnt]);
diag("successes: %u", wt_success_stats); diag("successes: %u", wt_success_stats);
DBUG_VOID_RETURN;
} }
void do_tests() void do_tests()
{ {
DBUG_ENTER("do_tests");
plan(14); plan(14);
compile_time_assert(THREADS >= 4); compile_time_assert(THREADS >= 4);
...@@ -174,19 +189,18 @@ void do_tests() ...@@ -174,19 +189,18 @@ void do_tests()
bad= my_atomic_initialize(); bad= my_atomic_initialize();
ok(!bad, "my_atomic_initialize() returned %d", bad); ok(!bad, "my_atomic_initialize() returned %d", bad);
pthread_cond_init(&thread_sync, 0);
pthread_mutex_init(&lock, 0); pthread_mutex_init(&lock, 0);
wt_init(); wt_init();
for (cnt=0; cnt < THREADS; cnt++) for (cnt=0; cnt < THREADS; cnt++)
{
wt_thd_lazy_init(& thds[cnt].thd,
& wt_deadlock_search_depth_short, & wt_timeout_short,
& wt_deadlock_search_depth_long, & wt_timeout_long);
pthread_mutex_init(& thds[cnt].lock, 0); pthread_mutex_init(& thds[cnt].lock, 0);
}
{ {
WT_RESOURCE_ID resid[3]; WT_RESOURCE_ID resid[4];
for (i=0; i < 3; i++) for (i=0; i < array_elements(resid); i++)
{ {
wt_thd_lazy_init(& thds[i].thd,
& wt_deadlock_search_depth_short, & wt_timeout_short,
& wt_deadlock_search_depth_long, & wt_timeout_long);
resid[i].value= i+1; resid[i].value= i+1;
resid[i].type= &restype; resid[i].type= &restype;
} }
...@@ -220,15 +234,13 @@ void do_tests() ...@@ -220,15 +234,13 @@ void do_tests()
wt_thd_release_all(& thds[1].thd); wt_thd_release_all(& thds[1].thd);
wt_thd_release_all(& thds[2].thd); wt_thd_release_all(& thds[2].thd);
wt_thd_release_all(& thds[3].thd); wt_thd_release_all(& thds[3].thd);
pthread_mutex_unlock(&lock);
for (cnt=0; cnt < 4; cnt++) for (i=0; i < array_elements(resid); i++)
{ {
wt_thd_destroy(& thds[cnt].thd); wt_thd_release_all(& thds[i].thd);
wt_thd_lazy_init(& thds[cnt].thd, wt_thd_destroy(& thds[i].thd);
& wt_deadlock_search_depth_short, & wt_timeout_short,
& wt_deadlock_search_depth_long, & wt_timeout_long);
} }
pthread_mutex_unlock(&lock);
} }
wt_deadlock_search_depth_short=6; wt_deadlock_search_depth_short=6;
...@@ -244,30 +256,23 @@ void do_tests() ...@@ -244,30 +256,23 @@ void do_tests()
#define test_kill_strategy(X) \ #define test_kill_strategy(X) \
diag("kill strategy: " #X); \ diag("kill strategy: " #X); \
DBUG_EXECUTE("reset_file", \
{ rewind(DBUG_FILE); ftruncate(fileno(DBUG_FILE), 0); }); \
DBUG_PRINT("info", ("kill strategy: " #X)); \
kill_strategy=X; \ kill_strategy=X; \
do_one_test(); do_one_test();
test_kill_strategy(LATEST); test_kill_strategy(LATEST);
SKIP_BIG_TESTS(1) test_kill_strategy(RANDOM);
{
test_kill_strategy(RANDOM);
}
test_kill_strategy(YOUNGEST); test_kill_strategy(YOUNGEST);
test_kill_strategy(LOCKS); test_kill_strategy(LOCKS);
DBUG_PRINT("wt", ("================= cleanup ===================")); DBUG_PRINT("wt", ("================= cleanup ==================="));
pthread_mutex_lock(&lock);
for (cnt=0; cnt < THREADS; cnt++) for (cnt=0; cnt < THREADS; cnt++)
{
wt_thd_release_all(& thds[cnt].thd);
wt_thd_destroy(& thds[cnt].thd);
pthread_mutex_destroy(& thds[cnt].lock); pthread_mutex_destroy(& thds[cnt].lock);
#ifndef DBUG_OFF
free(thds[cnt].thd.name);
#endif
}
pthread_mutex_unlock(&lock);
wt_end(); wt_end();
pthread_mutex_destroy(&lock); pthread_mutex_destroy(&lock);
pthread_cond_destroy(&thread_sync);
DBUG_VOID_RETURN;
} }
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