Ignore:
Timestamp:
2008-01-28 11:28:24 (6 years ago)
Author:
Poul-Henning Kamp <phk@…>
Branches:
master, 3.0, 4.0, experimental-ims
Children:
21933b
Parents:
51b069
git-author:
Poul-Henning Kamp <phk@…> (2008-01-28 11:28:24)
git-committer:
Poul-Henning Kamp <phk@…> (2008-01-28 11:28:24)
Message:

Finish (the "easy") part of degraded mode:

Add req.grace timer: We only serve degraded mode objects if both the
request and the object's grace timers are satisfied.

Sort expiry list on obj.ttl + obj.grace and fiddle list if either changes.

In the hash lookup: record if any objects still in grace by obj.grace which
match our Vary: criteria (if any).

If no in-ttl object was found AND we have a graced object AND it is also
graced by req.grace AND it is being fetched: serve the graced object.

Otherwise, mark us as successor to the graced object while we fetch to
give others the chance.

When we unbusy the object, clean the magic pointers between the two
objects again.

To play with this you need at least:

sub vcl_recv {

set req.grace = 2m;

}
sub vcl_fetch {

set obj.grace = 2m;

}

git-svn-id:  http://www.varnish-cache.org/svn/trunk/varnish-cache@2392 d4fa192b-c00b-0410-8231-f00ffab90ce4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bin/varnishd/cache_vrt.c

    r51b069 rb7839e  
    318318                a = 0; 
    319319        sp->obj->grace = a; 
     320        if (sp->obj->timer_idx != 0) 
     321                EXP_TTLchange(sp->obj); 
    320322} 
    321323 
     
    426428        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); 
    427429        return (sp->restarts); 
     430} 
     431 
     432/*-------------------------------------------------------------------- 
     433 * req.grace 
     434 */ 
     435 
     436void 
     437VRT_l_req_grace(struct sess *sp, double a) 
     438{ 
     439 
     440        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); 
     441        if (a < 0) 
     442                a = 0; 
     443        sp->grace = a; 
     444} 
     445 
     446double 
     447VRT_r_req_grace(struct sess *sp) 
     448{ 
     449        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); 
     450        return (sp->grace); 
    428451} 
    429452 
Note: See TracChangeset for help on using the changeset viewer.