Skip to content

Instantly share code, notes, and snippets.

View antirez's full-sized avatar

Salvatore Sanfilippo antirez

View GitHub Profile
8297745 Sentinel: redirect-to-master is not ok with new algorithm.
76a88f5 Sentinel: safer slave reconfig, master reported role should match.
ddaad9f Sentinel: role reporting fixed and added in SENTINEL output.
a0afa66 Sentinel: being a master and reporting as slave is considered SDOWN.
17718fd Sentinel: make sure role_reported is always updated.
46a053d Sentinel: track role change time. Wait before reconfigurations.
9e40c46 Sentinel: fix no-down check in master->slave conversion code.
ae35b7e Sentinel: readd slaves back after a master reset.
6bd4f6b Sentinel: sentinelResetMaster() new flag to avoid removing set of sentinel
1569af1 Sentinel: receive Pub/Sub messages from slaves.
# shape = [2,5,1,3,1,2,1,7,7,6]
shape = [3,1,3,1,2,0,1]
volume = 0 # Total water
[true,false].each{|second_pass|
acc = 0 # Accumulate water in current sub-pool
max = 0 # Max wall height seen so far.
shape.each{|h|
if (!second_pass && h >= max) || (second_pass && h > max) then
redis 127.0.0.1:6379> flushall
OK
redis 127.0.0.1:6379> debug populate 33
OK
redis 127.0.0.1:6379> scan 0
1) "52"
2) 1) "key:29"
2) "key:13"
3) "key:9"
4) "key:12"
require 'rubygems'
require 'redis'
ValuesDistribution= [
[0.020957439173186,0..135],
[0.021100983277112,137..175],
[0.021280413407019,177..223],
[0.024079523433575,225..439],
[0.092191200746429,441..551],
[0.14623555587454,553..695],
=== REDIS BUG REPORT START: Cut & paste starting from here ===
[38538] 21 Aug 15:46:58.567 # === ASSERTION FAILED ===
[38538] 21 Aug 15:46:58.567 # ==> dict.c:607 'iter->fingerprint == dictFingerprint(iter->d)' is not true
[38538] 21 Aug 15:46:58.567 # (forcing SIGSEGV to print the bug report.)
[38538] 21 Aug 15:46:58.567 # Redis 2.9.11 crashed by signal: 11
[38538] 21 Aug 15:46:58.567 # Failed assertion: iter->fingerprint == dictFingerprint(iter->d) (dict.c:607)
[38538] 21 Aug 15:46:58.567 # --- STACK TRACE
0 redis-server 0x0000000104855377 logStackTrace + 103
1 redis-server 0x000000010485469f _redisAssert + 159
2 libsystem_c.dylib 0x00007fff942454ea _sigtramp + 26
After EMBSTR patch:
src ➤ redis-benchmark -q -P 32 -n 1000000 -t set,get -r 1000000
SET: 402738.62 requests per second
GET: 606796.12 requests per second
Before:
src ➤ redis-benchmark -q -P 32 -n 1000000 -t set,get -r 1000000
SET: 358294.53 requests per second
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
int main(){
double f = 1e-309;
printf("%.17g\n", f);
f = strtod("1e-309", NULL);
redis 127.0.0.1:6379> eval "\n\n\nredis.call('lpush','foo','bar')" 0
Now it prints:
(error) ERR Error running script
(call to f_f8387efe7c56c29070e99e7ab0a6d2f686c64c30):
WRONGTYPE Operation against a key holding the wrong
kind of value: @user_script: 4
It used to print:
15:35:32.182025 IP 192.168.1.36.55109 > 173.194.40.16.443: Flags [.], seq 0:1188, ack 1, win 8192, options [nop,nop,TS val 1497079724 ecr 1420282176], length 1188
15:35:39.928316 IP 192.168.1.36.55109 > 173.194.40.16.443: Flags [.], seq 0:1188, ack 1, win 8192, options [nop,nop,TS val 1497087411 ecr 1420282176], length 1188
15:35:55.206879 IP 192.168.1.36.55109 > 173.194.40.16.443: Flags [.], seq 0:1188, ack 1, win 8192, options [nop,nop,TS val 1497102554 ecr 1420282176], length 1188
@antirez
antirez / gist:5244532
Last active December 15, 2015 10:19
Redis as a replacement for Google Reader
$ redis-cli -p 9999
redis 127.0.0.1:9999> set foo bar
OK
redis 127.0.0.1:9999> read https://news.ycombinator.com/rss
1. Introduction to Go 1.1 (googlecode.com)
2. Ad industry threatens Firefox users with more ads if Mozilla moves on tracking (computerworld.com)
3. Don't specify X years of experience required - You're breaking the law (hackerjobs.co.uk)
4. DIY cellphone (mit.edu)
5. Silk - Interactive Generative Art (weavesilk.com)
redis 127.0.0.1:9999> fetch 4