Redis returns OK when removing a non-existent set entry (#4434)

This commit is contained in:
Kai Yang
2019-03-22 02:59:15 +08:00
committed by Robert Nishihara
parent 57c1aeb427
commit c36d03874b
4 changed files with 65 additions and 37 deletions
+20
View File
@@ -2840,3 +2840,23 @@ def test_shutdown_disconnect_global_state():
with pytest.raises(Exception) as e:
ray.global_state.object_table()
assert str(e.value).endswith("ray.init has been called.")
@pytest.mark.parametrize(
"ray_start_object_store_memory", [10**8], indirect=True)
def test_redis_lru_with_set(ray_start_object_store_memory):
x = np.zeros(8 * 10**7, dtype=np.uint8)
x_id = ray.put(x)
# Remove the object from the object table to simulate Redis LRU eviction.
removed = False
start_time = time.time()
while time.time() < start_time + 10:
if ray.global_state.redis_clients[0].delete(b"OBJECT" +
x_id.binary()) == 1:
removed = True
break
assert removed
# Now evict the object from the object store.
ray.put(x) # This should not crash.