Commit 59294fb5 authored by Michael Widenius's avatar Michael Widenius

Fixed failing trnman-t unit test

mysql-test/valgrind.supp:
  Fixed suppression rule
storage/maria/unittest/trnman-t.c:
  Test failed becasue it accessed reused structures.
  I fixed this by creating a separate array to hold trids for the transactions
parent dee33675
...@@ -384,7 +384,7 @@ ...@@ -384,7 +384,7 @@
fun:calloc fun:calloc
fun:_dlerror_run fun:_dlerror_run
fun:dlclose fun:dlclose
fun:plugin_dl_del fun:plugin_dl_del(st_mysql_lex_string const*)
} }
{ {
......
...@@ -111,10 +111,11 @@ void run_test(const char *test, pthread_handler handler, int n, int m) ...@@ -111,10 +111,11 @@ void run_test(const char *test, pthread_handler handler, int n, int m)
} }
#define ok_read_from(T1, T2, RES) \ #define ok_read_from(T1, T2, RES) \
i= trnman_can_read_from(trn[T1], trn[T2]->trid); \ i= trnman_can_read_from(trn[T1], trid[T2]); \
ok(i == RES, "trn" #T1 " %s read from trn" #T2, i ? "can" : "cannot") ok(i == RES, "trn" #T1 " %s read from trn" #T2, i ? "can" : "cannot")
#define start_transaction(T) \ #define start_transaction(T) \
trn[T]= trnman_new_trn(&mutexes[T], &conds[T], &i + STACK_SIZE) trn[T]= trnman_new_trn(&mutexes[T], &conds[T], &i + STACK_SIZE); \
trid[T]= trn[T]->trid
#define commit(T) trnman_commit_trn(trn[T]) #define commit(T) trnman_commit_trn(trn[T])
#define abort(T) trnman_abort_trn(trn[T]) #define abort(T) trnman_abort_trn(trn[T])
...@@ -122,6 +123,7 @@ void run_test(const char *test, pthread_handler handler, int n, int m) ...@@ -122,6 +123,7 @@ void run_test(const char *test, pthread_handler handler, int n, int m)
void test_trnman_read_from() void test_trnman_read_from()
{ {
TRN *trn[Ntrns]; TRN *trn[Ntrns];
TrID trid[Ntrns];
pthread_mutex_t mutexes[Ntrns]; pthread_mutex_t mutexes[Ntrns];
pthread_cond_t conds[Ntrns]; pthread_cond_t conds[Ntrns];
int i; int i;
...@@ -142,6 +144,7 @@ void test_trnman_read_from() ...@@ -142,6 +144,7 @@ void test_trnman_read_from()
ok_read_from(3, 0, 1); ok_read_from(3, 0, 1);
ok_read_from(3, 1, 0); ok_read_from(3, 1, 0);
ok_read_from(3, 2, 0); ok_read_from(3, 2, 0);
ok_read_from(3, 3, 1);
commit(1); /* commit trn2 */ commit(1); /* commit trn2 */
ok_read_from(3, 1, 0); ok_read_from(3, 1, 0);
commit(3); /* commit trn5 */ commit(3); /* commit trn5 */
...@@ -158,7 +161,7 @@ int main(int argc __attribute__((unused)), char **argv) ...@@ -158,7 +161,7 @@ int main(int argc __attribute__((unused)), char **argv)
MY_INIT(argv[0]); MY_INIT(argv[0]);
my_init(); my_init();
plan(6); plan(7);
if (my_atomic_initialize()) if (my_atomic_initialize())
return exit_status(); return exit_status();
......
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