Commit 8cc19d27 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Fix #5369 (partitioned counter asserts because it expects the counter to go...

Fix #5369 (partitioned counter asserts because it expects the counter to go monotonically up, but part of the test decrements).  Change it so that it only increments in the test.

git-svn-id: file:///svn/toku/tokudb@46778 c7de825b-a66e-492c-adef-691d508d4ae1
parent cdebca29
...@@ -290,12 +290,12 @@ static void *reader_test_fun (void *ta_v) { ...@@ -290,12 +290,12 @@ static void *reader_test_fun (void *ta_v) {
while (ta->unfinished_count>0) { while (ta->unfinished_count>0) {
uint64_t thisval = read_partitioned_counter(ta->pc); uint64_t thisval = read_partitioned_counter(ta->pc);
assert(lastval <= thisval); assert(lastval <= thisval);
assert(thisval <= ta->limit); assert(thisval <= ta->limit+2);
lastval = thisval; lastval = thisval;
if (verboseness_cmdarg && (0==(thisval & (thisval-1)))) printf("ufc=%ld Thisval=%ld\n", ta->unfinished_count,thisval); if (verboseness_cmdarg && (0==(thisval & (thisval-1)))) printf("ufc=%ld Thisval=%ld\n", ta->unfinished_count,thisval);
} }
uint64_t thisval = read_partitioned_counter(ta->pc); uint64_t thisval = read_partitioned_counter(ta->pc);
assert(thisval==ta->limit); assert(thisval==ta->limit+2); // we incremented two extra times in the test
return ta_v; return ta_v;
} }
...@@ -333,7 +333,7 @@ static void do_testit (void) { ...@@ -333,7 +333,7 @@ static void do_testit (void) {
for (uint64_t j=0; j<n_writers[i] ; j++) { for (uint64_t j=0; j<n_writers[i] ; j++) {
pt_create(&writer_threads[i][j], writer_test_fun, &tas[i]); pt_create(&writer_threads[i][j], writer_test_fun, &tas[i]);
} }
increment_partitioned_counter(tas[i].pc, -1); // make sure that the long-lived thread also increments the partitioned counter, to test for #5321. increment_partitioned_counter(tas[i].pc, 1); // make sure that the long-lived thread also increments the partitioned counter, to test for #5321.
} }
for (int i=0; i<NGROUPS; i++) { for (int i=0; i<NGROUPS; i++) {
pt_join(reader_threads[i], &tas[i]); pt_join(reader_threads[i], &tas[i]);
......
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