Skip to content

Instantly share code, notes, and snippets.

@agladysh
Created April 3, 2011 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agladysh/900845 to your computer and use it in GitHub Desktop.
Save agladysh/900845 to your computer and use it in GitHub Desktop.
SELECT does not^H^H^H work while LOADING in Redis 2.2.2 (it does!)
-- get LuaRocks here: http://luarocks.org
require 'lua-nucleo.module' -- sudo luarocks install lua-nucleo
require 'lua-nucleo.strict'
require = import 'lua-nucleo/require_and_declare.lua' { 'require_and_declare' }
require 'hiredis' -- sudo luarocks install lua-hiredis
local tstr = import 'lua-nucleo/tstr.lua' { 'tstr' } -- Lua value to string
local wait = function(msg)
print(msg)
print("=== press return ===")
io.read("*l")
end
print("semi-automatic test")
wait("restart redis with huge db 15 now")
print("connecting")
local conn = assert(hiredis.connect("localhost", 6379))
print("select 15")
print(tstr(assert(conn:command("SELECT", "15"))))
wait("wait until redis is loaded")
print("keys 1.6*")
print(tstr(assert(conn:command("KEYS", "1.6*"))))
print("done")
conn:close()
$ redis-cli info
redis_version:2.2.2
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:32
multiplexing_api:epoll
process_id:3989
uptime_in_seconds:586
uptime_in_days:0
lru_clock:161962
used_cpu_sys:3.44
used_cpu_user:8.04
used_cpu_sys_childrens:0.00
used_cpu_user_childrens:0.00
connected_clients:3
connected_slaves:0
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:1
used_memory:574571328
used_memory_human:547.95M
used_memory_rss:647053312
mem_fragmentation_ratio:1.13
use_tcmalloc:0
loading:0
aof_enabled:0
changes_since_last_save:0
bgsave_in_progress:0
last_save_time:1301853275
bgrewriteaof_in_progress:0
total_connections_received:827
total_commands_processed:2146
expired_keys:0
evicted_keys:0
keyspace_hits:525
keyspace_misses:192
hash_max_zipmap_entries:512
hash_max_zipmap_value:64
pubsub_channels:0
pubsub_patterns:0
vm_enabled:0
role:master
allocation_stats:0=525,2=1,4=902,6=1,8=2184,9=2013,10=646,11=1053,12=6258605,13=605,14=645,15=576,16=26224,17=11,18=6,19=29,20=4113,21=3673,22=32936,23=299467,24=2639526,25=1545108,26=153918,27=15618,28=1408,29=545,31=2,32=1649,33=1,34=1,35=2,36=5,37=288,38=12,39=30,40=63,41=139,42=266,48=893,49=96,57=1,58=1,59=1,64=812,69=131,71=1,74=1267,79=12203,84=122385,89=1228033,93=1,94=122173,97=2,99=12269,101=7,103=13,104=1333,105=30,107=63,109=139,111=266,119=5,120=6,123=2,125=5,127=7,128=283,129=143,130=141,131=30,133=63,135=139,137=266,139=1267,140=1373,149=12203,150=13571,159=122385,160=135295,169=1228038,170=1359615,179=122167,180=135262,189=12265,190=13531,199=1333,200=1472,>=256=1972
db4:keys=2,expires=0
db7:keys=1,expires=0
db15:keys=2080181,expires=0
$ lua hiredis_check_select.lua
semi-automatic test
restart redis with huge db 15 now
=== press return ===
connecting
select 15
{name="LOADING Redis is loading the dataset in memory",type=6}
wait until redis is loaded
=== press return ===
keys 1.6*
{}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment