Decide against extending the log at this point - no oa_present yet

With the previous commit, we restore the objcore's oa_present field
when we first read the object.

On top of that, it would be nice if we could restore the field or at
least the bit for OA_VARY when we read the log, because a cache lookup
checks it and could avoid reading objects if the OA_VARY bit is not
set.

On the other hand, if vary is used, the object needs to be read
anyway, so restoring oa_present during log read only payed off for no
vary.

The straight forward solution would be to add 2 bytes to struct
fellow_dle_obj. This would

- require a DLE version bump and compatibility code
- bump the dle size from 72 to 80 bytes (because alignment)
- consequently, reduce FELLOW_DISK_LOG_BLOCK_ENTRIES from 56 to 4032 /
  80 = 50

All this is possible and part of the fellow design, but at
this point I conclude that it is not worth the effort.

Another option would be to cram two bits into the existing
fellow_dle_obj, for example by exploiting the fact that the sign bit
of ban and t_origin is always zero. This could break backwards
compatibility, so we prepare for the option, but do not implement it.

All in all, we just add a TODO to add this when we need to extend the
DLE anyway.

Closes #17
parent c40f8bcd
......@@ -96,6 +96,8 @@ struct fellow_dle_reg {
// aligned(4) assumes that this will only be used
// at a position 4, otherwise alignment of the other
// data types will not match
//
// TODO #17 IF EXTENDING, ADD oa_present field
struct fellow_dle_obj {
// 4
float keep;
......
......@@ -1778,6 +1778,8 @@ sfe_objnew(struct sfe_resurrect_priv *sfer, struct worker *wrk,
oc->stobj->priv2 = e->u.obj.start.fdb;
stvfe_oc_log_submitted(oc);
EXP_COPY(oc, &e->u.obj);
// #17 clear sign bit of t_origin, see sfe_resurrect()
oc->t_origin = copysign(oc->t_origin, 1.0);
oc->refcnt++;
HSH_Insert(wrk, e->u.obj.hash, oc, ban);
AN(oc->ban);
......@@ -1835,7 +1837,7 @@ sfe_resurrect(void *priv, const struct fellow_dle *e)
struct sfe_resurrect_priv *sfer;
struct objcore *oc;
struct ban *ban;
vtim_real t;
vtim_real t, ban_t;
unsigned n;
CAST_OBJ_NOTNULL(sfer, priv, SFE_RESURRECT_PRIV_MAGIC);
......@@ -1853,6 +1855,12 @@ sfe_resurrect(void *priv, const struct fellow_dle *e)
if (! sfe_check(sfer, e))
return (0);
/*
* #17: clear sign bit of ban and t_origin to _possibly_ use these in
* the future and retain backwards compatibility from this point onwards
*/
ban_t = copysign(e->u.obj.ban, 1.0);
/*
* note on earliest ban export time: There are plenty of oppurtunities
* in varnish-cache for an export to happen before all objects have been
......@@ -1867,7 +1875,7 @@ sfe_resurrect(void *priv, const struct fellow_dle *e)
* are not logged and wrongly get revived through this mechanism.
*/
t = e->u.obj.ban;
t = ban_t;
if (t < sfer->ban_exp_t.earliest)
t = sfer->ban_exp_t.earliest;
......@@ -1881,7 +1889,7 @@ sfe_resurrect(void *priv, const struct fellow_dle *e)
oc = sfe_objnew(sfer, sfer->wrk, e, ban);
if (ban == sfer->dummy_ban)
festash_insert(sfer->fet, oc, e->u.obj.ban);
festash_insert(sfer->fet, oc, ban_t);
else
sfe_deref_post(&sfer->deref, oc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment