summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--memcached.c30
-rwxr-xr-xscripts/memcached-tool38
-rw-r--r--slabs.c85
-rw-r--r--slabs.h6
-rwxr-xr-xt/slab-reassign.t11
5 files changed, 0 insertions, 170 deletions
diff --git a/memcached.c b/memcached.c
index dcc0e74..7d4206e 100644
--- a/memcached.c
+++ b/memcached.c
@@ -2801,36 +2801,6 @@ static void process_command(conn *c, char *command) {
conn_set_state(c, conn_closing);
- } else if (ntokens == 5 && (strcmp(tokens[COMMAND_TOKEN].value, "slabs") == 0 &&
- strcmp(tokens[COMMAND_TOKEN + 1].value, "reassign") == 0)) {
-#ifdef ALLOW_SLABS_REASSIGN
-
- int src, dst, rv;
-
- src = strtol(tokens[2].value, NULL, 10);
- dst = strtol(tokens[3].value, NULL, 10);
-
- if(errno == ERANGE) {
- out_string(c, "CLIENT_ERROR bad command line format");
- return;
- }
-
- rv = slabs_reassign(src, dst);
- if (rv == 1) {
- out_string(c, "DONE");
- return;
- }
- if (rv == 0) {
- out_string(c, "CANT");
- return;
- }
- if (rv == -1) {
- out_string(c, "BUSY");
- return;
- }
-#else
- out_string(c, "CLIENT_ERROR Slab reassignment not supported");
-#endif
} else if ((ntokens == 3 || ntokens == 4) && (strcmp(tokens[COMMAND_TOKEN].value, "verbosity") == 0)) {
process_verbosity_command(c, tokens, ntokens);
} else {
diff --git a/scripts/memcached-tool b/scripts/memcached-tool
index c18f242..b8a1b06 100755
--- a/scripts/memcached-tool
+++ b/scripts/memcached-tool
@@ -42,14 +42,6 @@ die
memcached-tool 10.0.0.5:11211 # same. (default is display)
memcached-tool 10.0.0.5:11211 stats # shows general stats
memcached-tool 10.0.0.5:11211 dump # dumps keys and values
- memcached-tool 10.0.0.5:11211 move 7 9 # takes 1MB slab from class #7
- # to class #9.
-
-You can only move slabs around on a server that supports 'slabs reassign'
-messages and only once slab memory is totally allocated, and only
-once the target class is full. (So you can't move from #6 to #9 and #7
-to #9 at the same itme, since you'd have to wait for #9 to fill from
-the first reassigned page)
" unless $host && $mode;
$host .= ":11211" unless $host =~ /:\d+/;
@@ -58,36 +50,6 @@ my $sock = IO::Socket::INET->new(PeerAddr => $host,
Proto => 'tcp');
die "Couldn't connect to $host\n" unless $sock;
-
-if ($mode eq "move") {
- my $tries = 0;
- while (1) {
- print $sock "slabs reassign $from $to\r\n";
- my $res = <$sock>;
- $res =~ s/\s+//;
- if ($res eq "DONE") {
- print "Success.\n";
- exit 0;
- } elsif ($res eq "CANT") {
- print "Error: can't move from $from to $to. Destination not yet full? See usage docs.\n";
- exit;
- } elsif ($res eq "BUSY") {
- if (++$tries == 3) {
- print "Failed to move after 3 tries. Try again later.\n";
- exit;
- }
-
- print "Page busy, retrying...\n";
- sleep 1;
- } elsif ($res =~ "CLIENT_ERROR") {
- print "Error: CLIENT_ERROR; perhaps slab reassignment is not enabled.\n";
- exit;
- }
- }
-
- exit;
-}
-
if ($mode eq 'dump') {
my %items;
my $totalitems;
diff --git a/slabs.c b/slabs.c
index 7d16001..d0c75bb 100644
--- a/slabs.c
+++ b/slabs.c
@@ -196,11 +196,7 @@ static int grow_slab_list (const unsigned int id) {
static int do_slabs_newslab(const unsigned int id) {
slabclass_t *p = &slabclass[id];
-#ifdef ALLOW_SLABS_REASSIGN
- int len = settings.item_size_max;
-#else
int len = p->size * p->perslab;
-#endif
char *ptr;
if ((mem_limit && mem_malloced + len > mem_limit && p->slabs > 0) ||
@@ -393,87 +389,6 @@ static void do_slabs_stats(ADD_STAT add_stats, void *c) {
add_stats(NULL, 0, NULL, 0, c);
}
-#ifdef ALLOW_SLABS_REASSIGN
-/* Blows away all the items in a slab class and moves its slabs to another
- class. This is only used by the "slabs reassign" command, for manual tweaking
- of memory allocation. It's disabled by default since it requires that all
- slabs be the same size (which can waste space for chunk size mantissas of
- other than 2.0).
- 1 = success
- 0 = fail
- -1 = tried. busy. send again shortly. */
-int do_slabs_reassign(unsigned char srcid, unsigned char dstid) {
- void *slab, *slab_end;
- slabclass_t *p, *dp;
- void *iter;
- bool was_busy = false;
-
- if (srcid < POWER_SMALLEST || srcid > power_largest ||
- dstid < POWER_SMALLEST || dstid > power_largest)
- return 0;
-
- p = &slabclass[srcid];
- dp = &slabclass[dstid];
-
- /* fail if src still populating, or no slab to give up in src */
- if (p->end_page_ptr || ! p->slabs)
- return 0;
-
- /* fail if dst is still growing or we can't make room to hold its new one */
- if (dp->end_page_ptr || ! grow_slab_list(dstid))
- return 0;
-
- if (p->killing == 0) p->killing = 1;
-
- slab = p->slab_list[p->killing - 1];
- slab_end = (char*)slab + settings.item_size_max;
-
- for (iter = slab; iter < slab_end; (char*)iter += p->size) {
- item *it = (item *)iter;
- if (it->slabs_clsid) {
- if (it->refcount) was_busy = true;
- item_unlink(it);
- }
- }
-
- /* go through free list and discard items that are no longer part of this slab */
- {
- int fi;
- for (fi = p->sl_curr - 1; fi >= 0; fi--) {
- if (p->slots[fi] >= slab && p->slots[fi] < slab_end) {
- p->sl_curr--;
- if (p->sl_curr > fi) p->slots[fi] = p->slots[p->sl_curr];
- }
- }
- }
-
- if (was_busy) return -1;
-
- /* if good, now move it to the dst slab class */
- p->slab_list[p->killing - 1] = p->slab_list[p->slabs - 1];
- p->slabs--;
- p->killing = 0;
- dp->slab_list[dp->slabs++] = slab;
- dp->end_page_ptr = slab;
- dp->end_page_free = dp->perslab;
- /* this isn't too critical, but other parts of the code do asserts to
- make sure this field is always 0. */
- for (iter = slab; iter < slab_end; (char*)iter += dp->size) {
- ((item *)iter)->slabs_clsid = 0;
- }
- return 1;
-}
-
-int slabs_reassign(unsigned char srcid, unsigned char dstid) {
- int ret;
-
- pthread_mutex_lock(&slabs_lock);
- ret = do_slabs_reassign(srcid, dstid);
- pthread_mutex_unlock(&slabs_lock);
- return ret;
-}
-#endif
-
static void *memory_allocate(size_t size) {
void *ret;
diff --git a/slabs.h b/slabs.h
index 685ca88..ec14455 100644
--- a/slabs.h
+++ b/slabs.h
@@ -30,10 +30,4 @@ bool get_stats(const char *stat_type, int nkey, ADD_STAT add_stats, void *c);
/** Fill buffer with stats */ /*@null@*/
void slabs_stats(ADD_STAT add_stats, void *c);
-/* Request some slab be moved between classes
- 1 = success
- 0 = fail
- -1 = tried. busy. send again shortly. */
-int slabs_reassign(unsigned char srcid, unsigned char dstid);
-
#endif
diff --git a/t/slab-reassign.t b/t/slab-reassign.t
deleted file mode 100755
index 99e07d5..0000000
--- a/t/slab-reassign.t
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use Test::More skip_all => "Tests not written."; # tests => 1
-use FindBin qw($Bin);
-use lib "$Bin/lib";
-use MemcachedTest;
-
-my $server = new_memcached();
-my $sock = $server->sock;
-