diff options
author | dormando <dormando@rydia.net> | 2017-09-26 14:43:17 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2017-11-28 14:18:05 -0800 |
commit | f593a59bce69f917514ef6213cf565c71bddcf8c (patch) | |
tree | 4a5dc07433e97b089f46a913b5367aa5d52c059a /items.c | |
parent | e6239a905d072e837baa8aa425ca0ccee2fc3e01 (diff) | |
download | memcached-f593a59bce69f917514ef6213cf565c71bddcf8c.tar.gz |
external storage base commit
been squashing reorganizing, and pulling code off to go upstream ahead
of merging the whole branch.
Diffstat (limited to 'items.c')
-rw-r--r-- | items.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -2,6 +2,9 @@ #include "memcached.h" #include "bipbuffer.h" #include "slab_automove.h" +#ifdef EXTSTORE +#include "storage.h" +#endif #include <sys/stat.h> #include <sys/socket.h> #include <sys/resource.h> @@ -960,6 +963,7 @@ item *do_item_get(const char *key, const size_t nkey, const uint32_t hv, conn *c was_found = 1; if (item_is_flushed(it)) { do_item_unlink(it, hv); + STORAGE_delete(c->thread->storage, it); do_item_remove(it); it = NULL; pthread_mutex_lock(&c->thread->stats.mutex); @@ -971,6 +975,7 @@ item *do_item_get(const char *key, const size_t nkey, const uint32_t hv, conn *c was_found = 2; } else if (it->exptime != 0 && it->exptime <= current_time) { do_item_unlink(it, hv); + STORAGE_delete(c->thread->storage, it); do_item_remove(it); it = NULL; pthread_mutex_lock(&c->thread->stats.mutex); @@ -1489,6 +1494,10 @@ static pthread_t lru_maintainer_tid; #define MIN_LRU_MAINTAINER_SLEEP 1000 static void *lru_maintainer_thread(void *arg) { +#ifdef EXTSTORE + void *storage = arg; + int x; +#endif int i; useconds_t to_sleep = MIN_LRU_MAINTAINER_SLEEP; useconds_t last_sleep = MIN_LRU_MAINTAINER_SLEEP; @@ -1542,6 +1551,18 @@ static void *lru_maintainer_thread(void *arg) { } int did_moves = lru_maintainer_juggle(i); +#ifdef EXTSTORE + // Deeper loop to speed up pushing to storage. + for (x = 0; x < 500; x++) { + int found; + found = lru_maintainer_store(storage, i); + if (found) { + did_moves += found; + } else { + break; + } + } +#endif if (did_moves == 0) { if (backoff_juggles[i] != 0) { backoff_juggles[i] += backoff_juggles[i] / 8; |