Skip to content

Commit

Permalink
Merged in 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Sep 10, 2009
1 parent a4d56e8 commit 48eb885
Show file tree
Hide file tree
Showing 29 changed files with 935 additions and 222 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -41,6 +41,7 @@ doc/protocol-binary.txt
/version.m4
/version.num
/testapp
/timedrun
/doc/doxy
/check_util
/check_moxi
Expand All @@ -53,4 +54,4 @@ libmemcached-*/libmemcached/*.lo
libmemcached-*/libmemcached/*.la
libmemcached-*/libmemcached/libmemcached_config.h
.buildbot/*

/memcached.spec
4 changes: 3 additions & 1 deletion Makefile.am
Expand Up @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = foreign

bin_PROGRAMS = moxi
##pkginclude_HEADERS = protocol_binary.h
noinst_PROGRAMS = moxi-debug sizes testapp
noinst_PROGRAMS = moxi-debug sizes testapp timedrun

BUILT_SOURCES =

Expand All @@ -29,6 +29,8 @@ moxi_SOURCES = memcached.c memcached.h \
cproxy_front.c \
matcher.c matcher.h

timedrun_SOURCES = timedrun.c

TESTS = check_util check_moxi check_moxi_agent check_work

check_PROGRAMS = check_util \
Expand Down
9 changes: 5 additions & 4 deletions configure.ac
Expand Up @@ -140,10 +140,11 @@ AC_ARG_ENABLE(coverage,
if test "x$enable_coverage" != "xno"; then
if test "$ICC" = "yes"
then
:
dnl ICC trying to be gcc, but not well
CFLAGS="$CFLAGS -pthread"
elif test "$GCC" = "yes"
then
CFLAGS="$CFLAGS -pthread"
AC_PATH_PROG([PROFILER], [gcov], "no", [$PATH])
if test "x$PROFILER" != "xno"; then
PROFILER_FLAGS="-fprofile-arcs -ftest-coverage"
Expand Down Expand Up @@ -383,10 +384,10 @@ AC_DEFUN([AC_C_ALIGNMENT],
],[
ac_cv_c_alignment=none
],[
ac_cv_c_endian=need
ac_cv_c_alignment=need
])
])
if test $ac_cv_c_endian = need; then
if test $ac_cv_c_alignment = need; then
AC_DEFINE(NEED_ALIGN, 1, [Machine need alignment])
fi
])
Expand Down Expand Up @@ -438,7 +439,7 @@ then
AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
elif test "$GCC" = "yes"
then
GCC_VERSION=`gcc -dumpversion`
GCC_VERSION=`$CC -dumpversion`
CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
case $GCC_VERSION in
4.4.*)
Expand Down
5 changes: 3 additions & 2 deletions cproxy.c
Expand Up @@ -274,7 +274,7 @@ int cproxy_listen_port(int port,
int listening = 0;
conn *listen_conn_orig = listen_conn;

if (server_socket(port, protocol, transport) == 0) {
if (server_socket(port, transport, NULL) == 0) {
assert(listen_conn != NULL);

// The listen_conn global list is changed by server_socket(),
Expand All @@ -301,6 +301,7 @@ int cproxy_listen_port(int port,
//
c->extra = conn_extra;
c->funcs = conn_funcs;
c->protocol = protocol;
c = c->next;
}
}
Expand Down Expand Up @@ -985,11 +986,11 @@ conn *cproxy_connect_downstream_conn(downstream *d,

conn *c = conn_new(fd, conn_pause, 0,
DATA_BUFFER_SIZE,
behavior->downstream_protocol,
tcp_transport,
thread->base,
&cproxy_downstream_funcs, d);
if (c != NULL) {
c->protocol = behavior->downstream_protocol;
c->thread = thread;

return c;
Expand Down
4 changes: 2 additions & 2 deletions cproxy_protocol_a2b.c
Expand Up @@ -737,7 +737,7 @@ void a2b_process_downstream_response(conn *c) {
case 0: {
char *s = add_conn_suffix(uc);
if (s != NULL) {
uint64_t v = swap64(response_incr->message.body.value);
uint64_t v = mc_swap64(response_incr->message.body.value);
sprintf(s, "%llu", (unsigned long long) v);
out_string(uc, s);
} else {
Expand Down Expand Up @@ -1270,7 +1270,7 @@ bool cproxy_forward_a2b_item_downstream(downstream *d, short cmd,
break;
case NREAD_CAS: {
uint64_t cas = ITEM_get_cas(it);
req->request.cas = swap64(cas);
req->request.cas = mc_swap64(cas);
req->request.opcode =
uc->noreply ?
PROTOCOL_BINARY_CMD_SETQ :
Expand Down
6 changes: 3 additions & 3 deletions doc/moxi.1
Expand Up @@ -23,7 +23,7 @@ is included below.
Unix socket path to listen on (disables network support).
.TP
.B \-a <perms>
Permissions (in octal format) for Unix socket created with -s option.
Permissions (in octal format) for Unix socket created with \-s option.
.TP
.B \-l <ip_addr>
Listen on <ip_addr>; default to INADDR_ANY. This is an important option to
Expand Down Expand Up @@ -77,7 +77,7 @@ The default is 1.25.
Allocate a minimum of <size> bytes for the item key, value, and flags. The
default is 48. If you have a lot of small keys and values, you can get a
significant memory efficiency gain with a lower value. If you use a high
chunk growth factor (-f option), on the other hand, you may want to increase
chunk growth factor (\-f option), on the other hand, you may want to increase
the size to allow a bigger percentage of your items to fit in the most densely
packed (smallest) chunks.
.TP
Expand All @@ -98,7 +98,7 @@ responses.
Print moxi and libevent licenses.
.TP
.B \-P <filename>
Print pidfile to <filename>, only used under -d option.
Print pidfile to <filename>, only used under \-d option.
.TP
.B \-t <threads>
Number of threads to use to process incoming requests. This option is only
Expand Down
23 changes: 17 additions & 6 deletions doc/protocol-binary.xml
Expand Up @@ -250,12 +250,16 @@
<t hangText="0x1A">PrependQ</t>
</list>
</t>
<t>
As a convention all of the commands ending with "Q" for Quiet.
A quiet version of a command will not send back a response, except
for GetQ and GetKQ. See the description of the
<xref target="command-get">Get commands</xref> for a full description.
</t>
<t>
As a convention all of the commands ending with "Q" for
Quiet. A quiet version of a command will omit responses
that are considered uninteresting. Whether a given response
is interesting is dependent upon the command. See the
descriptions of the
<xref target="command-get">set commands</xref>
and <xref target="command-set">set commands</xref> for
examples of commands that include quiet variants.
</t>
</section>

<section anchor="value-types" title="Data Types">
Expand Down Expand Up @@ -601,6 +605,13 @@ Value (33-37): The textual string: "World"
or not.
</t>

<t>
Quiet mutations only return responses on failure. Success
is considered the general case and is suppressed when in
quiet mode, but errors should not be allowed to go
unnoticed.
</t>

<section anchor="command-set-example" title="Example">
<t>The following figure shows an add-command for
<list style="empty">
Expand Down
7 changes: 7 additions & 0 deletions doc/protocol.txt
Expand Up @@ -555,10 +555,17 @@ END\r\n
| free_chunks | Chunks not yet allocated to items, or freed via delete. |
| free_chunks_end | Number of free chunks at the end of the last allocated |
| | page. |
| mem_requested | Number of bytes requested to be stored in this slab[*]. |
| active_slabs | Total number of slab classes allocated. |
| total_malloced | Total amount of memory allocated to slab pages. |
|-----------------+----------------------------------------------------------|

* Items are stored in a slab that is the same size or larger than the
item. mem_requested shows the size of all items within a
slab. (total_pages * 1MB) - mem_requested shows memory wasted in a
slab class. If you see a lot of waste, consider tuning the slab
factor.

Other commands
--------------

Expand Down
8 changes: 4 additions & 4 deletions items.c
Expand Up @@ -379,7 +379,7 @@ char *do_item_cachedump(const unsigned int slabs_clsid, const unsigned int limit
(unsigned long)it->exptime + process_started);
if (bufcurr + len + 6 > memlimit) /* 6 is END\r\n\0 */
break;
strcpy(buffer + bufcurr, temp);
memcpy(buffer + bufcurr, temp, len);
bufcurr += len;
shown++;
it = it->next;
Expand All @@ -397,8 +397,8 @@ void do_item_stats(ADD_STAT add_stats, void *c) {
for (i = 0; i < LARGEST_ID; i++) {
if (tails[i] != NULL) {
const char *fmt = "items:%d:%s";
char key_str[128];
char val_str[256];
char key_str[STAT_KEY_LEN];
char val_str[STAT_VAL_LEN];
int klen = 0, vlen = 0;

APPEND_NUM_FMT_STAT(fmt, i, "number", "%u", sizes[i]);
Expand Down Expand Up @@ -446,7 +446,7 @@ void do_item_stats_sizes(ADD_STAT add_stats, void *c) {
if (histogram[i] != 0) {
char key[8];
int klen = 0;
klen = sprintf(key, "%d", i * 32);
klen = snprintf(key, sizeof(key), "%d", i * 32);
assert(klen < sizeof(key));
APPEND_STAT(key, "%u", histogram[i]);
}
Expand Down

0 comments on commit 48eb885

Please sign in to comment.