Lachim / redis

Automatically exported from code.google.com/p/redis
2 stars 0 forks source link

dbsize wrong return #537

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of Redis you are using, in what kind of Operating System?
redis_version:2.1.12

What is the problem you are experiencing?
dbsize return (integer) 38359 instead of 40145 element.

What steps will reproduce the problem?
I put 40145 hset in my redis Master, and after that, dbsize command give to me 
a wrong number

Do you have an INFO output? Please past it here.
this is the laster one, i have also early 40 slave machine

redis_version:2.2.4
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:32
multiplexing_api:epoll
process_id:4274
uptime_in_seconds:543328
uptime_in_days:6
lru_clock:359330
used_cpu_sys:15.27
used_cpu_user:37.01
used_cpu_sys_childrens:134.37
used_cpu_user_childrens:16.73
connected_clients:1
connected_slaves:39
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
used_memory:6431844
used_memory_human:6.13M
used_memory_rss:9744384
mem_fragmentation_ratio:1.52
use_tcmalloc:0
loading:0
aof_enabled:1
changes_since_last_save:4
bgsave_in_progress:0
last_save_time:1303827313
bgrewriteaof_in_progress:0
total_connections_received:14801
total_commands_processed:96339
expired_keys:0
evicted_keys:0
keyspace_hits:83275
keyspace_misses:41948
hash_max_zipmap_entries:64
hash_max_zipmap_value:512
pubsub_channels:0
pubsub_patterns:0
vm_enabled:0
role:master
allocation_stats:2=40037,4=1735,6=1,7=2,8=16816,9=650333,10=1526,11=111,12=10770
27,13=127108,14=70,15=2181241,16=1362371,17=391962,18=6158,19=181302,20=25684,21
=12910,22=17219,23=16236,24=78269,25=22941,26=16742,27=13486,28=11591,29=12992,3
0=8947,31=7596,32=9694,33=96040,34=4860,35=4212,36=3458,37=3070,38=2448,39=2338,
40=11285,41=2127,42=1921,43=2306,44=3793,45=3232,46=3656,47=4066,48=19337,49=475
7,50=4675,51=4691,52=4414,53=3993,54=3573,55=4645,56=2689,57=2378,58=2079,59=271
0,60=1931,61=7880,62=10236,63=4680,64=6116,65=7849,66=4539,67=8538,68=7387,69=10
300,70=3848,71=9084,72=4854,73=9802,74=4168,75=9402,76=4123,77=9062,78=3145,79=8
261,80=2562,81=7460,82=1548,83=6467,84=1012,85=5269,86=656,87=4801,88=490,89=400
4,90=331,91=3346,92=271,93=2968,94=242,95=2605,96=176,97=2323,98=125,99=2120,100
=110,101=1793,102=73,103=1620,104=76,105=1349,106=87,107=1322,108=97,109=6225,11
0=129,111=1193,112=158,113=1619,114=120,115=786,116=91,117=2312,118=77,119=602,1
20=78,121=2376,122=42,123=398,124=34,125=434,126=27,127=409,128=1523,129=3037,13
0=55,131=877,132=55,133=3559,134=80,135=699,136=69,137=4290,138=113,139=712,140=
120,141=4953,142=97,143=805,144=101,145=4674,146=86,147=803,148=53,149=4789,150=
45,151=874,152=36,153=4697,154=31,155=778,156=6,157=4312,158=8,159=611,160=6,161
=4423,162=1,163=742,164=6,165=3685,166=11,167=586,168=4,169=3846,170=4,171=492,1
72=13,173=3074,174=2,175=1227,176=4,177=4214,178=18,179=2212,180=6,181=1702,183=
2440,184=4,185=1657,187=2776,189=1082,190=6,191=2874,192=2,193=933,194=6,195=293
3,196=2,197=769,198=2,199=3069,200=4,201=698,202=5,203=3074,204=4,205=692,207=29
52,208=3,209=1080,210=4,211=2559,212=2,213=1839,214=2,215=2407,217=2400,219=2294
,220=2,221=2588,223=2641,225=2159,227=3096,229=2090,231=3088,233=2111,235=3230,2
37=1996,239=3172,241=1976,243=2914,245=1791,247=4332,249=1591,251=4509,253=2265,
255=2653,>=256=46602
db0:keys=38361,expires=0

Original issue reported on code.google.com by michaelp...@gmail.com on 26 Apr 2011 at 2:20

GoogleCodeExporter commented 8 years ago
# /usr/local/redis/redis-cli sync > r
# wc -l r
1493 r
# cat r | sed -e "s/\\x04.../\n/g" > r2
# wc -l r2
38396 r2
# /usr/local/redis/redis-cli dbsize
(integer) 38363
# wc -l red44.txt 
40145 red44.txt

red44.txt is the file with hset data

Original comment by michaelp...@gmail.com on 26 Apr 2011 at 2:32

GoogleCodeExporter commented 8 years ago
Could you please check you do not have any key
duplicates in your red44.txt file?

Otherwise, 40 slaves directly connected to one master looks high to me.
Perhaps you should consider using some cascading (i.e. master connected
to 5 slaves, each of them connected to 8 other slaves ...).

Regards,
Didier.

Original comment by didier...@gmail.com on 26 Apr 2011 at 3:37

GoogleCodeExporter commented 8 years ago
(Thanks for your help)

Of course, red44.txt had not duplicate entry :)

i'm a little confuse, why an X number of slave machine can cause this problem ?

Original comment by michaelp...@gmail.com on 26 Apr 2011 at 3:43

GoogleCodeExporter commented 8 years ago
No duplicate entry
  => ok, we had to ask ;-)

Regarding the number of slave machines, it was an off topic remark.
I don't think there is a link between the number of items and
the number of slaves.

For your investigation, the next step is probably to use a keys *
command to dump all the keys and check their number.

1- if you have the expected number (i.e. same number than in red44.txt)
then there is definitely something strange in Redis.

2- if you have the same number than the result of dbsize and info,
then it means Redis is consistent, and some of your keys have not
been created while you think they have.

By comparing the result of keys * to your input file red44.txt,
(use shell commands to extract the keys), you can try to
identify the missing keys. Perhaps it will give you a new clue.

Regards,
Didier.

Original comment by didier...@gmail.com on 26 Apr 2011 at 8:30