Permalink
Browse files

Merged in 1.4.1

  • Loading branch information...
dustin committed Sep 10, 2009
1 parent a4d56e8 commit 48eb88572d260bb6041edb66766833cec0206bb8
Showing with 935 additions and 222 deletions.
  1. +2 −1 .gitignore
  2. +3 −1 Makefile.am
  3. +5 −4 configure.ac
  4. +3 −2 cproxy.c
  5. +2 −2 cproxy_protocol_a2b.c
  6. +3 −3 doc/moxi.1
  7. +17 −6 doc/protocol-binary.xml
  8. +7 −0 doc/protocol.txt
  9. +4 −4 items.c
  10. +192 −79 memcached.c
  11. +18 −10 memcached.h
  12. +5 −2 memcached.spec → memcached.spec.in
  13. +59 −54 memcached_dtrace.d
  14. +7 −2 slabs.c
  15. +2 −1 solaris_priv.c
  16. +7 −6 stats.c
  17. +65 −4 t/binary.t
  18. +1 −1 t/cas.t
  19. +21 −0 t/issue_42.t
  20. +22 −0 t/issue_70.t
  21. +1 −1 t/lib/MemcachedTest.pm
  22. +1 −1 t/stats.t
  23. +3 −2 t/whitespace.t
  24. +348 −29 testapp.c
  25. +1 −5 thread.c
  26. +101 −0 timedrun.c
  27. +16 −1 util.c
  28. +17 −0 util.h
  29. +2 −1 version.sh
View
@@ -41,6 +41,7 @@ doc/protocol-binary.txt
/version.m4
/version.num
/testapp
+/timedrun
/doc/doxy
/check_util
/check_moxi
@@ -53,4 +54,4 @@ libmemcached-*/libmemcached/*.lo
libmemcached-*/libmemcached/*.la
libmemcached-*/libmemcached/libmemcached_config.h
.buildbot/*
-
+/memcached.spec
View
@@ -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 =
@@ -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 \
View
@@ -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"
@@ -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
])
@@ -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.*)
View
@@ -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(),
@@ -301,6 +301,7 @@ int cproxy_listen_port(int port,
//
c->extra = conn_extra;
c->funcs = conn_funcs;
+ c->protocol = protocol;
c = c->next;
}
}
@@ -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;
View
@@ -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 {
@@ -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 :
View
@@ -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
@@ -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
@@ -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
View
@@ -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">
@@ -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">
View
@@ -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
--------------
View
@@ -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;
@@ -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]);
@@ -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]);
}
Oops, something went wrong.

0 comments on commit 48eb885

Please sign in to comment.