Skip to content

Commit 48eb885

Browse files
committed
Merged in 1.4.1
1 parent a4d56e8 commit 48eb885

29 files changed

+935
-222
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ doc/protocol-binary.txt
4141
/version.m4
4242
/version.num
4343
/testapp
44+
/timedrun
4445
/doc/doxy
4546
/check_util
4647
/check_moxi
@@ -53,4 +54,4 @@ libmemcached-*/libmemcached/*.lo
5354
libmemcached-*/libmemcached/*.la
5455
libmemcached-*/libmemcached/libmemcached_config.h
5556
.buildbot/*
56-
57+
/memcached.spec

Makefile.am

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = foreign
22

33
bin_PROGRAMS = moxi
44
##pkginclude_HEADERS = protocol_binary.h
5-
noinst_PROGRAMS = moxi-debug sizes testapp
5+
noinst_PROGRAMS = moxi-debug sizes testapp timedrun
66

77
BUILT_SOURCES =
88

@@ -29,6 +29,8 @@ moxi_SOURCES = memcached.c memcached.h \
2929
cproxy_front.c \
3030
matcher.c matcher.h
3131

32+
timedrun_SOURCES = timedrun.c
33+
3234
TESTS = check_util check_moxi check_moxi_agent check_work
3335

3436
check_PROGRAMS = check_util \

configure.ac

+5-4
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,11 @@ AC_ARG_ENABLE(coverage,
140140
if test "x$enable_coverage" != "xno"; then
141141
if test "$ICC" = "yes"
142142
then
143-
:
144143
dnl ICC trying to be gcc, but not well
144+
CFLAGS="$CFLAGS -pthread"
145145
elif test "$GCC" = "yes"
146146
then
147+
CFLAGS="$CFLAGS -pthread"
147148
AC_PATH_PROG([PROFILER], [gcov], "no", [$PATH])
148149
if test "x$PROFILER" != "xno"; then
149150
PROFILER_FLAGS="-fprofile-arcs -ftest-coverage"
@@ -383,10 +384,10 @@ AC_DEFUN([AC_C_ALIGNMENT],
383384
],[
384385
ac_cv_c_alignment=none
385386
],[
386-
ac_cv_c_endian=need
387+
ac_cv_c_alignment=need
387388
])
388389
])
389-
if test $ac_cv_c_endian = need; then
390+
if test $ac_cv_c_alignment = need; then
390391
AC_DEFINE(NEED_ALIGN, 1, [Machine need alignment])
391392
fi
392393
])
@@ -438,7 +439,7 @@ then
438439
AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
439440
elif test "$GCC" = "yes"
440441
then
441-
GCC_VERSION=`gcc -dumpversion`
442+
GCC_VERSION=`$CC -dumpversion`
442443
CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
443444
case $GCC_VERSION in
444445
4.4.*)

cproxy.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ int cproxy_listen_port(int port,
274274
int listening = 0;
275275
conn *listen_conn_orig = listen_conn;
276276

277-
if (server_socket(port, protocol, transport) == 0) {
277+
if (server_socket(port, transport, NULL) == 0) {
278278
assert(listen_conn != NULL);
279279

280280
// The listen_conn global list is changed by server_socket(),
@@ -301,6 +301,7 @@ int cproxy_listen_port(int port,
301301
//
302302
c->extra = conn_extra;
303303
c->funcs = conn_funcs;
304+
c->protocol = protocol;
304305
c = c->next;
305306
}
306307
}
@@ -985,11 +986,11 @@ conn *cproxy_connect_downstream_conn(downstream *d,
985986

986987
conn *c = conn_new(fd, conn_pause, 0,
987988
DATA_BUFFER_SIZE,
988-
behavior->downstream_protocol,
989989
tcp_transport,
990990
thread->base,
991991
&cproxy_downstream_funcs, d);
992992
if (c != NULL) {
993+
c->protocol = behavior->downstream_protocol;
993994
c->thread = thread;
994995

995996
return c;

cproxy_protocol_a2b.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ void a2b_process_downstream_response(conn *c) {
737737
case 0: {
738738
char *s = add_conn_suffix(uc);
739739
if (s != NULL) {
740-
uint64_t v = swap64(response_incr->message.body.value);
740+
uint64_t v = mc_swap64(response_incr->message.body.value);
741741
sprintf(s, "%llu", (unsigned long long) v);
742742
out_string(uc, s);
743743
} else {
@@ -1270,7 +1270,7 @@ bool cproxy_forward_a2b_item_downstream(downstream *d, short cmd,
12701270
break;
12711271
case NREAD_CAS: {
12721272
uint64_t cas = ITEM_get_cas(it);
1273-
req->request.cas = swap64(cas);
1273+
req->request.cas = mc_swap64(cas);
12741274
req->request.opcode =
12751275
uc->noreply ?
12761276
PROTOCOL_BINARY_CMD_SETQ :

doc/moxi.1

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ is included below.
2323
Unix socket path to listen on (disables network support).
2424
.TP
2525
.B \-a <perms>
26-
Permissions (in octal format) for Unix socket created with -s option.
26+
Permissions (in octal format) for Unix socket created with \-s option.
2727
.TP
2828
.B \-l <ip_addr>
2929
Listen on <ip_addr>; default to INADDR_ANY. This is an important option to
@@ -77,7 +77,7 @@ The default is 1.25.
7777
Allocate a minimum of <size> bytes for the item key, value, and flags. The
7878
default is 48. If you have a lot of small keys and values, you can get a
7979
significant memory efficiency gain with a lower value. If you use a high
80-
chunk growth factor (-f option), on the other hand, you may want to increase
80+
chunk growth factor (\-f option), on the other hand, you may want to increase
8181
the size to allow a bigger percentage of your items to fit in the most densely
8282
packed (smallest) chunks.
8383
.TP
@@ -98,7 +98,7 @@ responses.
9898
Print moxi and libevent licenses.
9999
.TP
100100
.B \-P <filename>
101-
Print pidfile to <filename>, only used under -d option.
101+
Print pidfile to <filename>, only used under \-d option.
102102
.TP
103103
.B \-t <threads>
104104
Number of threads to use to process incoming requests. This option is only

doc/protocol-binary.xml

+17-6
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,16 @@
250250
<t hangText="0x1A">PrependQ</t>
251251
</list>
252252
</t>
253-
<t>
254-
As a convention all of the commands ending with "Q" for Quiet.
255-
A quiet version of a command will not send back a response, except
256-
for GetQ and GetKQ. See the description of the
257-
<xref target="command-get">Get commands</xref> for a full description.
258-
</t>
253+
<t>
254+
As a convention all of the commands ending with "Q" for
255+
Quiet. A quiet version of a command will omit responses
256+
that are considered uninteresting. Whether a given response
257+
is interesting is dependent upon the command. See the
258+
descriptions of the
259+
<xref target="command-get">set commands</xref>
260+
and <xref target="command-set">set commands</xref> for
261+
examples of commands that include quiet variants.
262+
</t>
259263
</section>
260264

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

608+
<t>
609+
Quiet mutations only return responses on failure. Success
610+
is considered the general case and is suppressed when in
611+
quiet mode, but errors should not be allowed to go
612+
unnoticed.
613+
</t>
614+
604615
<section anchor="command-set-example" title="Example">
605616
<t>The following figure shows an add-command for
606617
<list style="empty">

doc/protocol.txt

+7
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,17 @@ END\r\n
555555
| free_chunks | Chunks not yet allocated to items, or freed via delete. |
556556
| free_chunks_end | Number of free chunks at the end of the last allocated |
557557
| | page. |
558+
| mem_requested | Number of bytes requested to be stored in this slab[*]. |
558559
| active_slabs | Total number of slab classes allocated. |
559560
| total_malloced | Total amount of memory allocated to slab pages. |
560561
|-----------------+----------------------------------------------------------|
561562

563+
* Items are stored in a slab that is the same size or larger than the
564+
item. mem_requested shows the size of all items within a
565+
slab. (total_pages * 1MB) - mem_requested shows memory wasted in a
566+
slab class. If you see a lot of waste, consider tuning the slab
567+
factor.
568+
562569
Other commands
563570
--------------
564571

items.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ char *do_item_cachedump(const unsigned int slabs_clsid, const unsigned int limit
379379
(unsigned long)it->exptime + process_started);
380380
if (bufcurr + len + 6 > memlimit) /* 6 is END\r\n\0 */
381381
break;
382-
strcpy(buffer + bufcurr, temp);
382+
memcpy(buffer + bufcurr, temp, len);
383383
bufcurr += len;
384384
shown++;
385385
it = it->next;
@@ -397,8 +397,8 @@ void do_item_stats(ADD_STAT add_stats, void *c) {
397397
for (i = 0; i < LARGEST_ID; i++) {
398398
if (tails[i] != NULL) {
399399
const char *fmt = "items:%d:%s";
400-
char key_str[128];
401-
char val_str[256];
400+
char key_str[STAT_KEY_LEN];
401+
char val_str[STAT_VAL_LEN];
402402
int klen = 0, vlen = 0;
403403

404404
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) {
446446
if (histogram[i] != 0) {
447447
char key[8];
448448
int klen = 0;
449-
klen = sprintf(key, "%d", i * 32);
449+
klen = snprintf(key, sizeof(key), "%d", i * 32);
450450
assert(klen < sizeof(key));
451451
APPEND_STAT(key, "%u", histogram[i]);
452452
}

0 commit comments

Comments
 (0)