Skip to content

Commit

Permalink
Changelog update for 1.2.6 release and Patch originally from the Face…
Browse files Browse the repository at this point in the history
…book crew, cleaned up and split by dormando.
  • Loading branch information
dormando authored and dustin committed Jan 3, 2009
1 parent 6c6fb97 commit 869f186
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
19 changes: 19 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2008-07-24 [Version 1.2.6-rc1 released]

* Add support for newer automake (Facebook)

* DTrace support for Solaris/etc (Trond Norbye)

* LRU tests (Steve Yen)

* Handle negative length items properly (Dormando)

* Don't leave stale data after failed set attempts (Dormando)

* Fix refcount leaks, which would result in OOM's on all sets
(Dormando)

* Fix buffer overruns (Dustin Sallings, Tomash Brechko)

* Fix memory corruption with CAS (Dustin Sallings)

2008-06-11

* Fix -k to work with -d. (reported by Gary Zhu)
Expand Down
6 changes: 3 additions & 3 deletions memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static void settings_init(void) {
settings.managed = false;
settings.factor = 1.25;
settings.chunk_size = 48; /* space for a modest key and value */
settings.num_threads = 4; /* default number of worker threads */
settings.num_threads = 4 + 1; /* N workers + 1 dispatcher */
settings.prefix_delimiter = ':';
settings.detail_enabled = 0;
}
Expand Down Expand Up @@ -3476,7 +3476,7 @@ static int server_socket(const int port, enum protocol prot) {
if (IS_UDP(prot)) {
int c;

for (c = 0; c < settings.num_threads; c++) {
for (c = 1; c < settings.num_threads; c++) {
/* this is guaranteed to hit all threads because we round-robin */
dispatch_conn_new(sfd, conn_read, EV_READ | EV_PERSIST,
UDP_READ_BUFFER_SIZE, ascii_udp_prot);
Expand Down Expand Up @@ -3898,7 +3898,7 @@ int main (int argc, char **argv) {
}
break;
case 't':
settings.num_threads = atoi(optarg);
settings.num_threads = atoi(optarg) + 1; /* Extra dispatch thread */
if (settings.num_threads == 0) {
fprintf(stderr, "Number of threads must be greater than 0\n");
return 1;
Expand Down
15 changes: 10 additions & 5 deletions thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* $Id$
*/
#include "memcached.h"
#include <assert.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
Expand Down Expand Up @@ -359,7 +360,7 @@ static void thread_libevent_process(int fd, short which, void *arg) {
}

/* Which thread we assigned a connection to most recently. */
static int last_thread = -1;
static int last_thread = 0;

/*
* Dispatches a new connection to another thread. This is only ever called
Expand All @@ -369,20 +370,24 @@ static int last_thread = -1;
void dispatch_conn_new(int sfd, enum conn_states init_state, int event_flags,
int read_buffer_size, enum protocol prot) {
CQ_ITEM *item = cqi_new();
int thread = (last_thread + 1) % settings.num_threads;
int tid = last_thread % (settings.num_threads - 1);

last_thread = thread;
/* Skip the dispatch thread (0) */
tid++;
LIBEVENT_THREAD *thread = threads + tid;

last_thread = tid;

item->sfd = sfd;
item->init_state = init_state;
item->event_flags = event_flags;
item->read_buffer_size = read_buffer_size;
item->protocol = prot;

cq_push(&threads[thread].new_conn_queue, item);
cq_push(&thread->new_conn_queue, item);

MEMCACHED_CONN_DISPATCH(sfd, threads[thread].thread_id);
if (write(threads[thread].notify_send_fd, "", 1) != 1) {
if (write(thread->notify_send_fd, "", 1) != 1) {
perror("Writing to thread notify pipe");
}
}
Expand Down

0 comments on commit 869f186

Please sign in to comment.