Re: compute swap_file_sz before packing it

From: Henrik Nordstrom <henrik_at_henriknordstrom.net>
Date: Mon, 14 Sep 2009 23:26:52 +0200

mån 2009-09-14 klockan 02:04 -0600 skrev Alex Rousskov:

> Apparently, we are packing StoreEntry.swap_file_sz into the stored
> entry header before we compute its value. This happens because to
> compute swap_file_sz, we need to know swap_hdr_sz, the size of the
> stored entry header. To compute swap_hdr_sz, we need to pack the
> header, but we cannot pack the header because swap_file_sz field has
> not been computed yet. Chicken and egg, hidden behind a bunch of void*
> memcopies.

Hmm... are we really packing that one? I thougt we only packed the objet
size in STORE_META_OBJSIZE which is excluding the TLV header.

Right... it's in STORE_META_STD. Just ignore that one as a design error.
Use STORE_META_OBJSIZE instead, and calculate the "file size" as object
size + header size if needed.

> The attached patch is a "work in progress" hack to facilitate the
> discussion. The patch computes the future swap_hdr_sz without packing
> the header, sets swap_file_sz, and then packs the header. It is not
> very efficient but appears to work.

Do we need that? COSS rebuildig is quite content with using
STORE_META_OBJSIZE.

> If I am on the wrong path here, please shout.

Maybe. Or at least a redundant path.

Note: when the store progresses with separation of headers & data this
will get even fuzzier with "file size" changing over time for the same
object as headers gets updated. By that time we quite likely move HTTP
headers into the TLV header, but that's future.

Regards
Henrik
Received on Mon Sep 14 2009 - 21:26:56 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 15 2009 - 12:00:04 MDT