This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Test if write(2) blocks when an fsync() in the same file is in progress | |
* in another thread. | |
* | |
* Compile with: gcc fsync.c -Wall -W -O2 -lpthread -o fsynctest | |
* | |
* For feedbacks drop an email to antirez at gmail | |
*/ | |
#include <stdio.h> | |
#include <unistd.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==24670== 6,112 bytes in 764 blocks are definitely lost in loss record 150 of 171 | |
==24670== at 0x4C25153: malloc (vg_replace_malloc.c:195) | |
==24670== by 0x41DEB1: zmalloc (zmalloc.c:79) | |
==24670== by 0x407B5D: zslCreateNode (redis.c:5416) | |
==24670== by 0x40B49E: zslInsert (redis.c:5502) | |
==24670== by 0x410429: rdbLoadObject (redis.c:4004) | |
==24670== by 0x419D9B: rdbLoad (redis.c:4104) | |
==24670== by 0x41B7FA: debugCommand (redis.c:10538) | |
==24670== by 0x40E072: call (redis.c:2255) | |
==24670== by 0x417BDC: processCommand (redis.c:2439) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'redis' | |
def incr(r) | |
while true | |
r.watch('x') | |
val = r['x'] | |
retval = r.multi { | |
r.set('x',val.to_i+1) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MANDEL | |
$2430 | |
BBBBBBBBBBBBBBBBBBBRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR | |
BBBBBBBBBBBBBBBBRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR | |
BBBBBBBBBBBBBRRRRRRRRRRRRRRRRRRRR###############RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR | |
BBBBBBBBBBBRRRRRRRRRRRR###################################RRRRRRRRRRRRRRRRRRRRRR | |
BBBBBBBBBRRRRRRRRR######################$$$$$$PX.+PPP$$$$$#####RRRRRRRRRRRRRRRRR | |
BBBBBBBBRRRRRR######################$$$$$$$$PPPX0I:occX$$$$$$######RRRRRRRRRRRRR | |
BBBBBBRRRRR#####################$$$$$$$$$PPPPX0wo" "cw0XPP$$$$$$######RRRRRRRRRR | |
BBBBBRRR#####################$$$$$$$$$PPPXXX0wI c0XPPPPP$$$$#######RRRRRRR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source redis.tcl | |
proc dump r { | |
set o {} | |
foreach k [lsort [$r keys *]] { | |
set type [$r type $k] | |
append o [csvstring $k] , [csvstring $type] , | |
switch $type { | |
string { | |
append o [csvstring [$r get $k]] "\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<skm> what happens if you have more data then you do ram | |
<ronr_> your machine explodes! | |
<ronr_> you can use it for remote sabotage that way. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# compl1.rb - Redis autocomplete example | |
# download female-names.txt from http://antirez.com/misc/female-names.txt | |
require 'rubygems' | |
require 'redis' | |
r = Redis.new | |
# Create the completion sorted set | |
if !r.exists(:compl) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void addReply(redisClient *c, robj *obj) { | |
int decrrefcount = 0; | |
if (_installWriteEvent(c) != REDIS_OK) return; | |
redisAssert(!server.vm_enabled || obj->storage == REDIS_VM_MEMORY); | |
/* This is an important place where we can avoid copy-on-write | |
* when there is a saving child running, avoiding touching the | |
* refcount field of the object if it's not needed. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start_server { | |
tags {"list"} | |
overrides { | |
"list-max-ziplist-value" 512 | |
"list-max-ziplist-entries" 1024 | |
} | |
} { | |
test {ziplist implementation stress testing} { | |
for {set j 0} {$j < 100} {incr j} { | |
r del l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test {foobar} { | |
set mylist {49376042582 {BkG2o\pIC]4YYJa9cJ4GWZalG[4tin;1D2whSkCOW`mX;SFXGyS8sedcff3fQI^tgPCC@^Nu1J6o]meM@Lko]t_jRyo<xSJ1oObDYd`ppZuW6P@fS278YaOx=s6lvdFlMbP0[SbkI^Kr\HBXtuFaA^mDx:yzS4a[skiiPWhT<nNfAf=aQVfclcuwDrfe;iVuKdNvB9kbfq>tK?tH[\EvWqS]b`o2OCtjg:?nUTwdjpcUm]y:pg5q24q7LlCOwQE^}} | |
r del l | |
r rpush l [lindex $mylist 0] | |
r rpush l [lindex $mylist 1] | |
assert_equal [r lindex l 0] [lindex $mylist 0] | |
assert_equal [r lindex l 1] [lindex $mylist 1] | |
} |