Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memcached: fix stuck on processing GET request #94

Merged
merged 1 commit into from
Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions memcached/internal/memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ memcached_loop(struct memcached_connection *con)
memcached_flush(con);
fiber_reschedule();
batch_count = 0;
if (ibuf_used(con->in) > 0) {
goto next;
}
continue;
}
memcached_flush(con);
Expand Down
1 change: 1 addition & 0 deletions test/binary/binary-gh-73.result
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test_val_20
28 changes: 28 additions & 0 deletions test/binary/binary-gh-73.test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os
import sys
import inspect

saved_path = sys.path[:]
sys.path.append(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))))

from internal.memcached_connection import MemcachedBinaryConnection
from internal.memcached_connection import STATUS, COMMANDS

mc = MemcachedBinaryConnection("127.0.0.1", iproto.py_con.port)

batch_count = 20 # Default batch_count value used in memcached.

# Put (batch_count + 1) keys at once, pay attention to "nosend" flag.
for i in range(1, batch_count + 1):
val = "test_val_%d" % i
key = "test_key_%d" % i
mc.setq(key, val, flags = 82, nosend=True)

data = "".join(mc.commands)
mc.socket.sendall(data)

# Get any key right after setting.
res = mc.get("test_key_20")
print(res[0]['val'])

sys.path = saved_path
1 change: 0 additions & 1 deletion test/binary/suite.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
core = tarantool
script = binary.lua
description = memcached binary tests
disabled = binary-boundary.test.py