projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Fix test case for weighted servers.
[m6w6/libmemcached]
/
libmemcached
/
memcached_storage.c
diff --git
a/libmemcached/memcached_storage.c
b/libmemcached/memcached_storage.c
index d42124d7a13b47905edd8a885ca23a379353d243..770b27d4006a2a46137f89501b642750bce4643e 100644
(file)
--- a/
libmemcached/memcached_storage.c
+++ b/
libmemcached/memcached_storage.c
@@
-106,10
+106,12
@@
static inline memcached_return memcached_send(memcached_st *ptr,
goto error;
}
goto error;
}
+ /* Send command header */
rc= memcached_do(&ptr->hosts[server_key], buffer, write_length, 0);
if (rc != MEMCACHED_SUCCESS)
goto error;
rc= memcached_do(&ptr->hosts[server_key], buffer, write_length, 0);
if (rc != MEMCACHED_SUCCESS)
goto error;
+ /* Send command body */
if ((sent_length= memcached_io_write(&ptr->hosts[server_key], value, value_length, 0)) == -1)
{
rc= MEMCACHED_WRITE_FAILURE;
if ((sent_length= memcached_io_write(&ptr->hosts[server_key], value, value_length, 0)) == -1)
{
rc= MEMCACHED_WRITE_FAILURE;
@@
-229,7
+231,8
@@
memcached_return memcached_cas(memcached_st *ptr,
}
memcached_return memcached_set_by_key(memcached_st *ptr,
}
memcached_return memcached_set_by_key(memcached_st *ptr,
- const char *master_key, size_t master_key_length,
+ const char *master_key __attribute__((unused)),
+ size_t master_key_length __attribute__((unused)),
const char *key, size_t key_length,
const char *value, size_t value_length,
time_t expiration,
const char *key, size_t key_length,
const char *value, size_t value_length,
time_t expiration,
@@
-237,7
+240,7
@@
memcached_return memcached_set_by_key(memcached_st *ptr,
{
memcached_return rc;
LIBMEMCACHED_MEMCACHED_SET_START();
{
memcached_return rc;
LIBMEMCACHED_MEMCACHED_SET_START();
- rc= memcached_send(ptr,
key,
key_length,
+ rc= memcached_send(ptr,
master_key, master_
key_length,
key, key_length, value, value_length,
expiration, flags, 0, SET_OP);
LIBMEMCACHED_MEMCACHED_SET_END();
key, key_length, value, value_length,
expiration, flags, 0, SET_OP);
LIBMEMCACHED_MEMCACHED_SET_END();
@@
-253,7
+256,7
@@
memcached_return memcached_add_by_key(memcached_st *ptr,
{
memcached_return rc;
LIBMEMCACHED_MEMCACHED_ADD_START();
{
memcached_return rc;
LIBMEMCACHED_MEMCACHED_ADD_START();
- rc= memcached_send(ptr,
key,
key_length,
+ rc= memcached_send(ptr,
master_key, master_
key_length,
key, key_length, value, value_length,
expiration, flags, 0, ADD_OP);
LIBMEMCACHED_MEMCACHED_ADD_END();
key, key_length, value, value_length,
expiration, flags, 0, ADD_OP);
LIBMEMCACHED_MEMCACHED_ADD_END();
@@
-269,7
+272,7
@@
memcached_return memcached_replace_by_key(memcached_st *ptr,
{
memcached_return rc;
LIBMEMCACHED_MEMCACHED_REPLACE_START();
{
memcached_return rc;
LIBMEMCACHED_MEMCACHED_REPLACE_START();
- rc= memcached_send(ptr,
key,
key_length,
+ rc= memcached_send(ptr,
master_key, master_
key_length,
key, key_length, value, value_length,
expiration, flags, 0, REPLACE_OP);
LIBMEMCACHED_MEMCACHED_REPLACE_END();
key, key_length, value, value_length,
expiration, flags, 0, REPLACE_OP);
LIBMEMCACHED_MEMCACHED_REPLACE_END();
@@
-284,7
+287,7
@@
memcached_return memcached_prepend_by_key(memcached_st *ptr,
uint32_t flags)
{
memcached_return rc;
uint32_t flags)
{
memcached_return rc;
- rc= memcached_send(ptr,
key,
key_length,
+ rc= memcached_send(ptr,
master_key, master_
key_length,
key, key_length, value, value_length,
expiration, flags, 0, PREPEND_OP);
return rc;
key, key_length, value, value_length,
expiration, flags, 0, PREPEND_OP);
return rc;
@@
-298,7
+301,7
@@
memcached_return memcached_append_by_key(memcached_st *ptr,
uint32_t flags)
{
memcached_return rc;
uint32_t flags)
{
memcached_return rc;
- rc= memcached_send(ptr,
key,
key_length,
+ rc= memcached_send(ptr,
master_key, master_
key_length,
key, key_length, value, value_length,
expiration, flags, 0, APPEND_OP);
return rc;
key, key_length, value, value_length,
expiration, flags, 0, APPEND_OP);
return rc;
@@
-329,6
+332,7
@@
static memcached_return memcached_send_binary(memcached_server_st* server,
uint64_t cas,
memcached_storage_action verb)
{
uint64_t cas,
memcached_storage_action verb)
{
+ char flush;
protocol_binary_request_set request= {.bytes= {0}};
size_t send_length= sizeof(request.bytes);
protocol_binary_request_set request= {.bytes= {0}};
size_t send_length= sizeof(request.bytes);
@@
-353,15
+357,14
@@
static memcached_return memcached_send_binary(memcached_server_st* server,
case CAS_OP:
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_REPLACE;
break;
case CAS_OP:
request.message.header.request.opcode= PROTOCOL_BINARY_CMD_REPLACE;
break;
- default:
- abort();
}
request.message.header.request.keylen= htons((uint16_t)key_length);
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
if (verb == APPEND_OP || verb == PREPEND_OP)
send_length -= 8; /* append & prepend does not contain extras! */
}
request.message.header.request.keylen= htons((uint16_t)key_length);
request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
if (verb == APPEND_OP || verb == PREPEND_OP)
send_length -= 8; /* append & prepend does not contain extras! */
- else {
+ else
+ {
request.message.header.request.extlen= 8;
request.message.body.flags= htonl(flags);
request.message.body.expiration= htonl((uint32_t)expiration);
request.message.header.request.extlen= 8;
request.message.body.flags= htonl(flags);
request.message.body.expiration= htonl((uint32_t)expiration);
@@
-373,7
+376,7
@@
static memcached_return memcached_send_binary(memcached_server_st* server,
if (cas)
request.message.header.request.cas= htonll(cas);
if (cas)
request.message.header.request.cas= htonll(cas);
-
char
flush= ((server->root->flags & MEM_BUFFER_REQUESTS) && verb == SET_OP) ? 0 : 1;
+ flush= ((server->root->flags & MEM_BUFFER_REQUESTS) && verb == SET_OP) ? 0 : 1;
/* write the header */
if ((memcached_do(server, (const char*)request.bytes, send_length, 0) != MEMCACHED_SUCCESS) ||
(memcached_io_write(server, key, key_length, 0) == -1) ||
/* write the header */
if ((memcached_do(server, (const char*)request.bytes, send_length, 0) != MEMCACHED_SUCCESS) ||
(memcached_io_write(server, key, key_length, 0) == -1) ||