liangdabiao / redis

Automatically exported from code.google.com/p/redis
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Slave blocks on requests even when stale-data is enabled #555

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
We are experiencing errors when GET'ing to a slave that is currently under sync 
with the master, despite the stale data serving being enabled in the 
configuration file.  We are using redis-2.2.2-1 on Ubuntu Server LTS 10.04, 
kernel 2.6.32-31, arch x86_64, through the 1.904 redis perl bindings.

We experience the following error:
--
[get] LOADING Redis is loading the dataset in memory, at 
/usr/local/share/perl/5.10.1/Redis.pm line 
364\n\tRedis::__read_response_r('Redis=HASH(0x7fef9bb95f60)', 'get') called at 
/usr/local/share/perl/5.10.1/Redis.pm line 
344\n\tRedis::__read_response('Redis=HASH(0x7fef9bb95f60)', 'get') called at 
/usr/local/share/perl/5.10.1/Redis.pm line 
147\n\tRedis::AUTOLOAD('Redis=HASH(0x7fef9bb95f60)', 'f:key') called at 
RedisDB.pm line 88\n\tRedisDB::get('f:key') called at Query.pm line 
280\n\tPackage('Package::Query=HASH(0x7fef9f9782b8)') called at Query.pm line 
320\n\tQuery::log('Package::Query=HASH(0x7fef9f9782b8)') called at Handler.pm 
line 322\n\tPackage::handler('Apache2::RequestRec=SCALAR(0x7fef9a88a7a8)') 
called at -e line 0\n\teval {...} called at -e line 0\n
--

A copy of the info is attached.

Original issue reported on code.google.com by hlieberm...@chitika.com on 20 May 2011 at 2:50

Attachments:

GoogleCodeExporter commented 8 years ago
AFAIK this is not a bug - when redis is loading the data into memory, you 
cannot query it. the "serve stale data" refers to the process where the slave 
starts the SYNC with the master, and receives the data, up until it has to 
actually load it into memory.
the SYNC process can be seen as having 4 stages:

1. slave tries to connect and sends a SYNC
2. master acknowledges and dumps its current data to be sent.
3. the data is sent over the wire to the slave.
4. when it finishes getting the data, the slave  loads the data into its own 
memory.

"serve stale data" saves you from blocking on stages 1-3. but currently there 
is no way around rejecting queries when at stage 4.

Original comment by dvir...@gmail.com on 21 May 2011 at 9:15

GoogleCodeExporter commented 8 years ago
s there any wa to change that behavior? I am using redis in a realtimr system 
which can probably tolerate very short delays but really cant handle "sorry try 
again later".

Has this behavios changed since the 2.0 series? My company didnt experience 
this behavior before. we are currently looking to upgrade but this issue is 
preventing us.

Original comment by elreydet...@gmail.com on 21 May 2011 at 6:30