-0.43
+0.43 Wed Jul 28 16:29:47 PDT 2010
+ * Added --args to memstat so that a greater range of values can be returned.
+ * Prelimanary support for Windows.
* memcached_stat_execute() merged.
0.42 Tue Jul 6 12:29:50 PDT 2010
OPT_UDP,
OPT_USERNAME,
OPT_PASSWD,
+ OPT_STAT_ARGS,
OPT_FILE= 'f'
} memcached_options;
static int opt_displayflag= 0;
static int opt_analyze= 0;
static char *opt_servers= NULL;
+static char *stat_args= NULL;
static char *analyze_mode= NULL;
static struct option long_options[]=
{
+ {(OPTIONSTRING)"args", required_argument, NULL, OPT_STAT_ARGS},
{(OPTIONSTRING)"version", no_argument, NULL, OPT_VERSION},
{(OPTIONSTRING)"help", no_argument, NULL, OPT_HELP},
{(OPTIONSTRING)"verbose", no_argument, &opt_verbose, OPT_VERBOSE},
}
else
{
- rc= memcached_stat_execute(memc, NULL, stat_printer, NULL);
+ rc= memcached_stat_execute(memc, stat_args, stat_printer, NULL);
}
free(opt_servers);
case OPT_SERVERS: /* --servers or -s */
opt_servers= strdup(optarg);
break;
+ case OPT_STAT_ARGS:
+ stat_args= strdup(optarg);
+ break;
case OPT_ANALYZE: /* --analyze or -a */
opt_analyze= OPT_ANALYZE;
analyze_mode= (optarg) ? strdup(optarg) : NULL;
#ifdef AI_ADDRCONFIG
hints.ai_flags= AI_PASSIVE | AI_ADDRCONFIG;
#else
-+ hints.ai_flags= AI_PASSIVE;
+ hints.ai_flags= AI_PASSIVE;
#endif /* AI_ADDRCONFIG */
if (is_udp)
{
case OPT_USERNAME: return "Username to use for SASL authentication";
case OPT_PASSWD: return "Password to use for SASL authentication";
case OPT_FILE: return "Path to file in which to save result";
+ case OPT_STAT_ARGS: return "Argument for statistics";
default: WATCHPOINT_ASSERT(0);
};
# the COPYING file in this directory for full text.
AC_PREREQ(2.59)
-AC_INIT([libmemcached],[0.42],[http://libmemcached.org/])
+AC_INIT([libmemcached],[0.43],[http://libmemcached.org/])
AC_CONFIG_SRCDIR([libmemcached/memcached.c])
AC_CONFIG_AUX_DIR(config)
#shared library versioning
MEMCACHED_UTIL_LIBRARY_VERSION=1:0:0
MEMCACHED_PROTOCAL_LIBRARY_VERSION=0:0:0
-MEMCACHED_LIBRARY_VERSION=5:1:0
+MEMCACHED_LIBRARY_VERSION=5:2:0
# | | |
# +------+ | +---+
# | | |
STATS_PAGES= \
memcached_stat.pop \
- memcached_stat_get_keys.pop .pop\
+ memcached_stat_execute.pop\
+ memcached_stat_get_keys.pop\
memcached_stat_get_value.pop \
memcached_stat_servername.pop
BUILT_SOURCES += ${STATS_PAGES}
memcached_set_memory_allocators.html \
memcached_set.html \
memcached_set_user_data.html \
+ memcached_stat_execute.html \
memcached_stat_get_keys.html \
memcached_stat_get_value.html \
memcached_stat.html \
memcached_set_memory_allocators.3 \
memcached_set_user_data.3 \
memcached_stat.3 \
+ memcached_stat_execute.3 \
memcached_stat_get_keys.3 \
memcached_stat_get_value.3 \
memcached_stat_servername.3 \
memcached_stat_st *stat,
memcached_return_t *error);
+ memcached_return_t
+ memcached_stat_execute (memcached_st *memc,
+ const char *args,
+ memcached_stat_fn func,
+ void *context);
+
=head1 DESCRIPTION
libmemcached(3) has the ability to query a memcached server (or collection
While it is possible to access the structure directly it is not advisable.
<memcached_stat_get_value() has been provided to query the structure.
+memcached_stat_execute() uses the servers found in C<memcached_stat_st> and
+executes a "stat" command on each server. args is an optional argument that
+can be passed in to modify the behavior of "stats". You will need to supply
+a callback function that will be supplied each pair of values returned by
+the memcached server.
+
memcached_stat() fetches an array of C<memcached_stat_st> structures containing
the state of all available memcached servers. The return value must be freed
by the calling application. If called with the C<MEMCACHED_BEHAVIOR_USE_UDP>
It displays all data to stdout.
You can specify servers via the B<--servers> option or via the
-environment variable C<MEMCACHED_SERVERS>.
+environment variable C<MEMCACHED_SERVERS>. B<--args> can be used
+to specify the "argument" sent to the stats command (ie slab, size, items,
+etc..).
For a full list of operations run the tool with the B<--help> option.
%exclude %{_libdir}/libmemcachedutil.la
%exclude %{_libdir}/libmemcachedprotocol.la
%{_libdir}/libhashkit.so.0.0.0
-%{_libdir}/libmemcached.so.5.0.1
+%{_libdir}/libmemcached.so.5.0.2
%{_libdir}/libmemcachedutil.so.1.0.0
%{_libdir}/libmemcachedprotocol.so.0.0.0
%{_libdir}/libhashkit.so.0
%{_includedir}/libmemcached/memcached.hpp
%{_includedir}/libmemcached/memcached_util.h
%{_includedir}/libmemcached/parse.h
+%{_includedir}/libmemcached/platform.h
%{_includedir}/libmemcached/protocol/cache.h
%{_includedir}/libmemcached/protocol/callback.h
%{_includedir}/libmemcached/protocol_handler.h
%{_mandir}/man3/memcached_set_sasl_callbacks.3.gz
%{_mandir}/man3/memcached_set_user_data.3.gz
%{_mandir}/man3/memcached_stat.3.gz
+%{_mandir}/man3/memcached_stat_execute.3.gz
%{_mandir}/man3/memcached_stat_get_keys.3.gz
%{_mandir}/man3/memcached_stat_get_value.3.gz
%{_mandir}/man3/memcached_stat_servername.3.gz
test: check
check-local: $(TEST_DOCS) test-mem test-hash memcapable
- echo "Tests completed"
+ @echo "Tests completed"
test-x: check-local test-plus test-memcat test-memcp test-memrm test-memerror test-memdump test-memflush test-memstat
- echo "Tests completed"
+ @echo "Tests completed"
memcapable: clients/memcapable
- @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcapable -p 12555 || echo "Your memcached server does not support all commands"
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
test-memcat: clients/memcat clients/memcp
@echo "Testing memcat"
- @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" `pwd`/clients/memcp
@clients/memcat --servers="localhost:12555" memcp > `pwd`/tests/scratch
@clients/memcat --servers="localhost:12555" --file=`pwd`/tests/scratch2 memcp
valgrind-memcat: clients/memcat clients/memcp
@echo "Testing memcat"
- @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcp
@$(VALGRIND_COMMAND) clients/memcat --servers="localhost:12555" memcp > tests/scratch
# @diff clients/memcp tests/scratch
test-memcp: clients/memcp
@echo "Testing memcp"
- @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
valgrind-memcp: clients/memcat clients/memcp
@echo "Testing memcp"
- @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
test-memrm: clients/memrm clients/memcp
@echo "Testing memrm"
- @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcat
@clients/memrm --servers="localhost:12555" memcat
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
valgrind-memrm: clients/memcat clients/memcp
@echo "Testing memrm"
- @@MEMC_BINARY@ -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcat
@$(VALGRIND_COMMAND) clients/memrm --servers="localhost:12555" memcat
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
test-memflush: clients/memflush
@echo "Testing memflush"
- @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memflush --servers="localhost:12555"
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
valgrind-memflush: clients/memflush
@echo "Testing memflush"
- @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
test-memdump: clients/memdump clients/memcp
@echo "Testing memdump"
- @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcat
@clients/memdump --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
valgrind-memdump: clients/memcat clients/memcp
@echo "Testing memdump"
- @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memcp --servers="localhost:12555" clients/memcat
@$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
test-memstat: clients/memstat
@echo "Testing memstat"
- @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@clients/memstat --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
valgrind-memstat: clients/memstat
@echo "Testing memstat"
- @$(MEMC_BINARY) -d -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
@$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
@cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
@rm tests/Xumemc.pid
return TEST_SUCCESS;
}
-#ifndef __sun
+#if !defined(__sun) && !defined(__OpenBSD__)
/* Check the validity of chinese key*/
static test_return_t user_supplied_bug17(memcached_st *memc)
{
{"user_supplied_bug14", 1, (test_callback_fn)user_supplied_bug14 },
{"user_supplied_bug15", 1, (test_callback_fn)user_supplied_bug15 },
{"user_supplied_bug16", 1, (test_callback_fn)user_supplied_bug16 },
-#ifndef __sun
+#if !defined(__sun) && !defined(__OpenBSD__)
/*
** It seems to be something weird with the character sets..
** value_fetch is unable to parse the value line (iscntrl "fails"), so I
char buffer[1024]; /* Nothing special for number */
int count;
int status;
+ in_port_t port;
+
+ {
+ char *var;
+ char variable_buffer[1024];
+
+ snprintf(variable_buffer, sizeof(variable_buffer), "LIBMEMCACHED_PORT_%u", x);
+
+ if ((var= getenv(variable_buffer)))
+ {
+ port= (in_port_t)atoi(var);
+ }
+ else
+ {
+ port= (in_port_t)(x + TEST_PORT_BASE);
+ }
+ }
sprintf(buffer, "/tmp/%umemc.pid", x);
if (access(buffer, F_OK) == 0)
if (x == 0)
{
- sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u -U %u -m 128",
- MEMCACHED_BINARY, x, x + TEST_PORT_BASE, x + TEST_PORT_BASE);
+ sprintf(buffer, "%s -d -u root -P /tmp/%umemc.pid -t 1 -p %u -U %u -m 128",
+ MEMCACHED_BINARY, x, port, port);
}
else
{
- sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u -U %u",
- MEMCACHED_BINARY, x, x + TEST_PORT_BASE, x + TEST_PORT_BASE);
+ sprintf(buffer, "%s -d -u root -P /tmp/%umemc.pid -t 1 -p %u -U %u",
+ MEMCACHED_BINARY, x, port, port);
}
- if (libmemcached_util_ping("localhost", (in_port_t)(x + TEST_PORT_BASE), NULL))
+ if (libmemcached_util_ping("localhost", port, NULL))
{
- fprintf(stderr, "Server on port %u already exists\n", x + TEST_PORT_BASE);
+ fprintf(stderr, "Server on port %u already exists\n", port);
}
else
{
status= system(buffer);
fprintf(stderr, "STARTING SERVER: %s status:%d\n", buffer, status);
}
- count= sprintf(end_ptr, "localhost:%u,", x + TEST_PORT_BASE);
+ count= sprintf(end_ptr, "localhost:%u,", port);
end_ptr+= count;
}
*end_ptr= 0;