Part of my COSS rewrite required a little 'help' from the store system
to hand over a little more metadata. This metadata is then used during
the COSS store rebuild.

I've added a new metadata type which records the object size if known.
Since its always known for COSS stores it means the object size is
written in as part of the metadata - and therefore allows COSS to 'know'
what the object size is when reading and rebuilding. The header isn't
required for swapin; nor is it checked at all in the other stores.
(It could be used as a further consistency check for aufs/ufs/diskd
during rebuild.)

I'd like to eventually add a small header to each COSS object to
include the total object size (data+metadata) and object "written"
time to help the rebuild process even further; but I've tried
to keep the actual storage layout unchanged in this first pass.

I've attached a patch for comment.

Thanks,



Adrian

Index: enums.h
===================================================================
RCS file: /server/cvs-server/squid/squid/src/enums.h,v
retrieving revision 1.226
diff -u -r1.226 enums.h
--- enums.h     18 May 2006 06:49:46 -0000      1.226
+++ enums.h     19 May 2006 00:32:19 -0000
@@ -644,6 +644,7 @@
     STORE_META_VALID,
     STORE_META_VARY_HEADERS,   /* Stores Vary request headers */
     STORE_META_STD_LFS,                /* standard metadata in lfs format */
+    STORE_META_OBJSIZE,                /* object size, if its known */
     STORE_META_END
 };
 
Index: store_swapmeta.c
===================================================================
RCS file: /server/cvs-server/squid/squid/src/store_swapmeta.c,v
retrieving revision 1.18
diff -u -r1.18 store_swapmeta.c
--- store_swapmeta.c    17 May 2005 16:56:38 -0000      1.18
+++ store_swapmeta.c    19 May 2006 00:32:19 -0000
@@ -68,6 +68,7 @@
     tlv **T = &TLV;
     const char *url;
     const char *vary;
+    const squid_off_t objsize = objectLen(e);
     assert(e->mem_obj != NULL);
     assert(e->swap_status == SWAPOUT_WRITING);
     url = storeUrl(e);
@@ -79,6 +80,9 @@
     T = storeSwapTLVAdd(STORE_META_STD_LFS, &e->timestamp, STORE_HDR_METASIZE, 
T);
 #endif
     T = storeSwapTLVAdd(STORE_META_URL, url, strlen(url) + 1, T);
+    if (objsize > -1) {
+        T = storeSwapTLVAdd(STORE_META_OBJSIZE, &objsize, sizeof(objsize), T);
+    }
     vary = e->mem_obj->vary_headers;
     if (vary)
        T = storeSwapTLVAdd(STORE_META_VARY_HEADERS, vary, strlen(vary) + 1, T);

Reply via email to