summaryrefslogtreecommitdiff
path: root/assoc.c
Commit message (Collapse)AuthorAgeFilesLines
* fix build with musl libcNatanael Copa2016-05-281-1/+1
| | | | | | | | | | musl libc will warn if you include sys/signal.h instead of signal.h as specified by posix. Build will fail due to -Werror explicitly beeing set. Fix it by use the posix location. fixes #138
* basic lock around hash_items counterdormando2015-02-061-0/+5
| | | | | | could/should be an atomic. Previously all write mutations were wrapped with cache_lock, but that's not the case anymore. Just enforce consistency around the hash_items counter, which is used for hash table expansion.
* Pause all threads while swapping hash table.dormando2014-12-271-18/+17
| | | | | | | | | | | | | | | | | | | | | | | We used to hold a global lock around all modifications to the hash table. Then it was switched to wrapping hash table accesses in a global lock during hash table expansion, set by notifying each worker thread to change lock styles. There was a bug here which causes trylocks to clobber, due to the specific item locks not being held during the global lock: https://code.google.com/p/memcached/issues/detail?id=370 The patch previous to this one uses item locks during hash table expansion. Since the item lock table is always smaller than the hash table, an item lock will always cover both its new and old buckets. However, we still need to pause all threads during the pointer swap and setup. This patch pauses all background threads and worker threads, swaps the hash table, then unpauses them. This trades the (possibly significant) slowdown during the hash table copy, with a short total hang at the beginning of each expansion. As previously; those worried about consistent performance can presize the hash table with `-o hashpower=n`
* use item lock instead of global lock when hash expanding.Jason CHAN2014-12-261-35/+44
|
* Make hash table algorithm selectabledormando2014-04-161-1/+1
| | | | | jenkins hash is old. Lets try murmur3 to start! Default is the old one, so people aren't surprised.
* don't wait on condition without holding the lockdormando2012-09-031-1/+2
| | | | freebsd9 is the only platform that apparently cares about this.
* item locks now lock hash table bucketsdormando2012-09-031-5/+25
| | | | | | | | | | expansion requires switching to a global lock temporarily, so all buckets have a covered read lock. slab rebalancer is paused during hash table expansion. internal item "trylocks" are always issued, and tracked as the hash power variable can change out from under it.
* call mutex_unlock() when we use mutex_lock()1.4.14dormando2012-07-301-2/+2
| | | | | use both #define's when using the spinlock version of our locks. not all locks are designed to be that way, so this doesn't touch the whole thing.
* move hash calls outside of cache_lockdormando2011-11-091-10/+6
| | | | | been hard to measure while using the intel hash (since it's very fast), but should help with the software hash.
* Use spinlocks for main cache lockdormando2011-11-091-2/+2
| | | | | | | Partly by Ripduman Sohan Appears to significantly help prevent performance dropoff from additional threads, but only when the locks are frequently contested and are short.
* Allow setting initial size of the hash tabledormando2011-09-281-2/+5
| | | | | | Instances which run many millions of items can now have its hash table presized. This can avoid some minor memory churn during the warmup period.
* expose stats for the internal hash tabledormando2011-09-281-0/+13
| | | | | | Now users can tell how much memory is being used for the hash table structure. It also exposes the current hash power level, which is useful for presizing the structure.
* "stats reset" should reset eviction counters as wellTrond Norbye2009-03-241-1/+0
| | | | See: http://code.google.com/p/memcached/issues/detail?id=22
* Remove some cvs/svn junk from files.Dustin Sallings2009-03-061-2/+0
|
* Refactor: moved the hash function from assoc.c to hash.cTrond Norbye2009-03-021-419/+0
|
* Get build working under ICC.Dustin Sallings2009-02-021-1/+2
| | | | | | | | | | | ICC pretends to be GCC as far as autoconf is concerned, but is incompatible in a few ways. ICC C99 mode fails to define u_char, so I made a small change to modify that required c99 to work with ICC's C99 mode off. Nobody wants to put effort into working around compilers that don't speak C99 in the long-term, but a one line change has already revealed quite a few potential bugs.
* Do hash expansion in it's own threadTrond Norbye2009-01-271-27/+84
| | | | | | | Previously we tried to migrate one bucket over to the new hash table before we started a new command for a client, and we tried to lock the cache in order to determine if we should move an item or not. This resulted in extra contention on an already hot mutex...
* Add DTrace probes to the binary protocolTrond Norbye2009-01-031-3/+3
|
* Add DTrace probes for Solaris/etc.Trond Norbye2009-01-021-6/+16
|
* Use calloc for allocating the hash table vs. malloc+memset.Dustin Sallings2008-06-181-3/+1
| | | | | calloc is already used to resize the hash table, so it's good to be consistent here.
* conn_add_to_freelist returns boolPaul Lindner2007-07-101-2/+2
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@595 b0b603af-a30f-0410-a34e-baf09ae79d0b
* gcc -pedantic changes, comments, signed/unsigned changes. also convert ↵Paul Lindner2007-07-091-11/+11
| | | | | | expanded to bool git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@591 b0b603af-a30f-0410-a34e-baf09ae79d0b
* cleanup unistd.h, better spec file, remove warnings from threads.cPaul Lindner2007-05-071-1/+0
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@551 b0b603af-a30f-0410-a34e-baf09ae79d0b
* Part 1 of the Windows compatibility patchPaul Lindner2007-04-161-2/+3
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@510 b0b603af-a30f-0410-a34e-baf09ae79d0b
* Merge multithreaded into trunk, commit #2 (first commit only did theSteven Grimm2007-04-161-23/+20
| | | | | | | new files, not the modified ones.) git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@509 b0b603af-a30f-0410-a34e-baf09ae79d0b
* use EXIT_* constantsPaul Lindner2007-04-121-1/+1
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@500 b0b603af-a30f-0410-a34e-baf09ae79d0b
* Add patch for changable verbosity levelsPaul Lindner2007-04-121-6/+6
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@496 b0b603af-a30f-0410-a34e-baf09ae79d0b
* update clean-whitespace, add automated whitespace test, and clean whitespacePaul Lindner2007-04-101-24/+24
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@492 b0b603af-a30f-0410-a34e-baf09ae79d0b
* multiple cleanups/refactoring, see ChangeLogPaul Lindner2007-03-061-7/+7
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@468 b0b603af-a30f-0410-a34e-baf09ae79d0b
* Incorporate changes from "performance" branch (revisions 414-419).Steven Grimm2006-11-261-31/+130
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@450 b0b603af-a30f-0410-a34e-baf09ae79d0b
* Update hash function to Jenkins2006.Steven Grimm2006-10-131-76/+410
| | | | | | | Add byte-order check to the configure script (required for Jenkins2006). git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@412 b0b603af-a30f-0410-a34e-baf09ae79d0b
* fix some long-standing psuedo-bugs with regard to the delete-lockedBrad Fitzpatrick2006-09-041-1/+3
| | | | | | | | | | | | | | | | | | | | | | window (when you specify a time parameter to the delete command, which prevents adds/replaces for that many seconds) in particular, if you had a small timeout, less than 5 seconds, then a future add/replace which should've worked wouldn't because the delete_timer wouldn't have run yet. this has caused a lot of people just evalutating memcached and playing around as they read the protocol docs to go crazy, as they couldn't see the delete timer happening, and it all just appeared random to them this also unifies some duplicated code, and adds some assertions, in particular in assoc_insert to make sure that key isn't already in the hashtable. git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@337 b0b603af-a30f-0410-a34e-baf09ae79d0b
* restore blank lines I over-zealously destroyed earlier.Brad Fitzpatrick2006-09-041-0/+23
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@335 b0b603af-a30f-0410-a34e-baf09ae79d0b
* but we do want trailing newline at end of fileBrad Fitzpatrick2006-09-041-1/+1
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@330 b0b603af-a30f-0410-a34e-baf09ae79d0b
* remove all trailing whitespace, not just first occurrence. :)Brad Fitzpatrick2006-09-041-28/+3
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@329 b0b603af-a30f-0410-a34e-baf09ae79d0b
* whitespace changes onlyBrad Fitzpatrick2006-09-041-1/+1
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@328 b0b603af-a30f-0410-a34e-baf09ae79d0b
* Evan Martin: portability work to build on OS X (and other BSDs)Evan Martin2003-08-111-2/+0
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk@95 b0b603af-a30f-0410-a34e-baf09ae79d0b
* version 1.1.6Brad Fitzpatrick2003-06-271-0/+1
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk@56 b0b603af-a30f-0410-a34e-baf09ae79d0b
* more debug assertsBrad Fitzpatrick2003-06-271-1/+2
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk@53 b0b603af-a30f-0410-a34e-baf09ae79d0b
* misc fixes as suggested by avva. lot of comment updates, mostly.Brad Fitzpatrick2003-06-221-8/+7
| | | | git-svn-id: http://code.sixapart.com/svn/memcached/trunk@35 b0b603af-a30f-0410-a34e-baf09ae79d0b
* 2003-06-10Brad Fitzpatrick2003-06-201-38/+23
| | | | | | | | | | * removing use of Judy; use a hash. (judy caused memory fragmentation) * shrink some structures * security improvements * version 1.1.0 git-svn-id: http://code.sixapart.com/svn/memcached/trunk@34 b0b603af-a30f-0410-a34e-baf09ae79d0b
* stop using Judy for string mappings and use a hash table instead, whichBrad Fitzpatrick2003-06-201-0/+202
uses our slab allocator. git-svn-id: http://code.sixapart.com/svn/memcached/trunk@33 b0b603af-a30f-0410-a34e-baf09ae79d0b