Skip to content

Commit

Permalink
tests: memcached: workaround a possible race between flush_all and read
Browse files Browse the repository at this point in the history
Currently memcached will return "OK" for flush_all after it
scheduled a timer that is going to evict all elements from the cache.
However if this operation came in the middle of the timer period
(e.g. timer's granularity is 1ms and the operation came 50us after the last
timer event) it allows read operation to arrive and to be handled before
the next timer event and thereby cause a flush_in_the_past test to fail.

There is an issue with our flush_all implementation in general
(see scylladb#101 for more details).

This workaround would allow the test to pass before we get to fixing
the issue above.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Message-Id: <1452012791-4410-3-git-send-email-vladz@cloudius-systems.com>
  • Loading branch information
Vlad Zolotarov authored and avikivity committed Jan 5, 2016
1 parent dff4d2c commit d1c3324
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/memcached/test_memcached.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def test_flushing_in_the_past(self):
self.setKey('key2')
key2_time = int(time.time())
self.assertEqual(call('flush_all %d\r\n' % (key2_time - 1)), b'OK\r\n')
time.sleep(1)
self.assertNoKey("key1")
self.assertNoKey("key2")

Expand Down

0 comments on commit d1c3324

Please sign in to comment.