Update of /cvsroot/monetdb/MonetDB/src/gdk
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11932/src/gdk

Modified Files:
      Tag: GDK-2
        gdk.mx gdk_align.mx gdk_bat.mx gdk_batop.mx gdk_bbp.mx 
        gdk_delta.mx gdk_storage.mx 
Log Message:
more cleanup. Moved dirty flag into heap struct


Index: gdk.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk.mx,v
retrieving revision 1.237.2.13
retrieving revision 1.237.2.14
diff -u -d -r1.237.2.13 -r1.237.2.14
--- gdk.mx      17 Aug 2007 08:49:54 -0000      1.237.2.13
+++ gdk.mx      19 Sep 2007 13:46:02 -0000      1.237.2.14
@@ -668,10 +668,12 @@
        size_t free;            /* index where free area starts. */
        size_t size;            /* size of the heap (bytes) */
        char *base;             /* base pointer in memory. */
+       str filename;           /* file containing image of the heap */
+
        char storage;           /* storage mode (mmap/malloc). */
        bit copied;             /* a copy of an existing map. */
        chr newstorage;         /* new desired storage mode at re-allocation. */
-       str filename;           /* file containing image of the heap */
+       chr dirty;              /* specific heap dirty marker */
 } Heap;
 
 typedef struct {
@@ -801,7 +803,6 @@
           int    batHeat;          /* heat of BAT in the BBP */
           sht    batDirty;         /* BAT modified after last commit? */
           bit    batDirtydesc;     /* BAT descriptor specific dirty flag */
-          bit    batDirtybuns;     /* BUN heap specific dirty flag */
           Heap*  batBuns;          /* Heap where the buns are stored */
           /* DELTA status */
           BUN    batDeleted;       /* first deleted BUN */
@@ -815,7 +816,6 @@
           bit    hsorted;          /* are head values currently ordered? */
           bit    hvarsized;        /* for speed: head type is varsized? */
          oid    halign;           /* alignment OID for head. */
-          bit    hheapdirty;       /* head heap specific dirty flag */
           /* Head storage */
           int    hloc;             /* byte-offset in BUN for head elements */
           Heap   *hheap;           /* heap for varsized head values */
@@ -827,7 +827,6 @@
           bit    tsorted;          /* are tail values currently ordered? */
           bit    tvarsized;        /* for speed: tail type is varsized? */
          oid    talign;           /* alignment OID for head. */
-          bit    theapdirty;       /* tail heap specific dirty flag */
           /* Tail storage */
           int    tloc;             /* byte-offset in BUN for tail elements */
           Heap   theap;            /* heap for varsized tail values */
@@ -864,9 +863,8 @@
         dirty:2,               /* dirty wrt disk? */
         dirtyflushed:1,        /* was dirty before commt started? */
         descdirty:1,           /* bat descriptor dirty marker */
-        bunsdirty:1,           /* bun heap dirty marker */
         lview:1,               /* bat is a *logical* view on parentid */
-        unused:25;             /* value=0 for now */
+        unused:26;             /* value=0 for now */
        chr set;                /* real set semantics */
        chr restricted;         /* access priviliges */
        sht persistence;        /* should the BAT persist on disk? */
@@ -908,14 +906,13 @@
        size_t nosorted;        /* position that proves sorted==FALSE */
        size_t nodense;         /* position that proves dense==FALSE */
        oid seq;                /* start of dense head sequence */
-       bat parentid;           /* cache id of VIEW parent bat */
 
-       chr heapdirty;          /* specific heap dirty marker */
        Heap heap;              /* space for the column. */
        Heap *vheap;            /* space for the varsized data. */
        Hash *hash;             /* hash table */
 
        PROPrec *props;         /* list of dynamic properties stored in the bat 
descriptor */
+       bat parentid;           /* cache id of VIEW parent bat */
 } COLrec;
 
 #define GDKLIBRARY      061021 /* 64-bits BAT */
@@ -962,9 +959,6 @@
 #define batConvert     P->convert
 #define batDirtyflushed P->dirtyflushed
 #define batDirtydesc   P->descdirty
-#define batDirtybuns   P->bunsdirty
-#define hheapdirty     H->heapdirty
-#define theapdirty     T->heapdirty
 #define batFirst       U->first
 #define batInserted    U->inserted
 #define batDeleted     U->deleted
@@ -1461,9 +1455,11 @@
 gdk_export int BATcheckmodes(BAT *b, int persistent, int unloadable);
 
 
-#define BATdirty(b)    ((b)->batCopiedtodisk == 0 || (b)->batDirty ||  \
-                       (b)->batDirtydesc || (b)->batDirtybuns ||       \
-                       (b)->hheapdirty || (b)->theapdirty)
+#define BATdirty(b)    ((b)->batCopiedtodisk == 0 || (b)->batDirty || \
+                       (b)->batDirtydesc || \
+                       (b)->H->heap.dirty || (b)->T->heap.dirty || \
+                       ((b)->H->vheap?(b)->H->vheap->dirty:0) || \
+                       ((b)->T->vheap?(b)->T->vheap->dirty:0))
 
 #define PERSISTENT     4096
 #define SESSION                2048

Index: gdk_bbp.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_bbp.mx,v
retrieving revision 1.201.2.7
retrieving revision 1.201.2.8
diff -u -d -r1.201.2.7 -r1.201.2.8
--- gdk_bbp.mx  17 Aug 2007 08:49:58 -0000      1.201.2.7
+++ gdk_bbp.mx  19 Sep 2007 13:46:03 -0000      1.201.2.8
@@ -2848,10 +2848,10 @@
                        return -1;
        }
 @c
-       @:backup(head,(&b->H->heap), b->batDirty || b->batDirtybuns)@
-       @:backup(tail,(&b->T->heap), b->batDirty || b->batDirtybuns)@
-       @:backup(hheap,b->H->vheap, (b->batDirty || b->hheapdirty) && b->htype 
&& b->hvarsized)@
-       @:backup(theap,b->T->vheap, (b->batDirty || b->theapdirty) && b->ttype 
&& b->tvarsized)@
+       @:backup(head,(&b->H->heap), b->batDirty || b->H->heap.dirty)@
+       @:backup(tail,(&b->T->heap), b->batDirty || b->T->heap.dirty)@
+       @:backup(hheap,b->H->vheap, (b->batDirty || (b->H->vheap && 
b->H->vheap->dirty)) && b->htype && b->hvarsized)@
+       @:backup(theap,b->T->vheap, (b->batDirty || (b->T->vheap && 
b->T->vheap->dirty)) && b->ttype && b->tvarsized)@
        return 0;
 }
 

Index: gdk_batop.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_batop.mx,v
retrieving revision 1.138.4.11
retrieving revision 1.138.4.12
diff -u -d -r1.138.4.11 -r1.138.4.12
--- gdk_batop.mx        17 Aug 2007 08:49:57 -0000      1.138.4.11
+++ gdk_batop.mx        19 Sep 2007 13:46:03 -0000      1.138.4.12
@@ -1637,7 +1637,7 @@
        b->tsorted = FALSE;
        b->hdense = FALSE;
        b->tdense = FALSE;
-       b->batDirtydesc = b->batDirtybuns = TRUE;
+       b->batDirtydesc = b->H->heap.dirty = b->T->heap.dirty = TRUE;
 
        return b;
 }

Index: gdk_align.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_align.mx,v
retrieving revision 1.83.4.11
retrieving revision 1.83.4.12
diff -u -d -r1.83.4.11 -r1.83.4.12
--- gdk_align.mx        17 Aug 2007 08:49:56 -0000      1.83.4.11
+++ gdk_align.mx        19 Sep 2007 13:46:02 -0000      1.83.4.12
@@ -428,7 +428,7 @@
        BATsetdims(b);
        b->batDirty = TRUE;
        b->batDirtydesc = TRUE;
-       b->batDirtybuns = TRUE;
+       b->H->heap.dirty = TRUE;
 
        /* set the correct dense info */
        b->hdense = TRUE;

Index: gdk_delta.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_delta.mx,v
retrieving revision 1.44.4.7
retrieving revision 1.44.4.8
diff -u -d -r1.44.4.7 -r1.44.4.8
--- gdk_delta.mx        15 Aug 2007 09:37:19 -0000      1.44.4.7
+++ gdk_delta.mx        19 Sep 2007 13:46:04 -0000      1.44.4.8
@@ -144,8 +144,11 @@
        if (b) {
                BATcommit(b);
                b->batDirty = 0;
-               b->batDirtydesc = b->batDirtybuns = 0;
-               b->hheapdirty = b->theapdirty = 0;
+               b->batDirtydesc = b->H->heap.dirty = b->T->heap.dirty = 0;
+               if (b->H->vheap)
+                       b->H->vheap->dirty = 0;
+               if (b->T->vheap)
+                       b->T->vheap->dirty = 0;
        }
        return b;
 }
@@ -170,11 +173,14 @@
        DELTAprintf("#BATundo %s \n", BATgetId(b));
        ALIGNundo(b);
        if (b->batDirtyflushed) {
-               b->batDirtydesc = b->batDirtybuns = 1;
+               b->batDirtydesc = b->H->heap.dirty = b->T->heap.dirty = 1;
        } else {
                b->batDirty = 0;
-               b->batDirtydesc = b->batDirtybuns = 0;
-               b->hheapdirty = b->theapdirty = 0;
+               b->batDirtydesc = b->H->heap.dirty = b->T->heap.dirty = 0;
+               if (b->H->vheap)
+                       b->H->vheap->dirty = 0;
+               if (b->T->vheap)
+                       b->T->vheap->dirty = 0;
        }
        bunfirst = b->batInserted;
        bunlast = BUNlast(b) - 1;

Index: gdk_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_storage.mx,v
retrieving revision 1.128.2.8
retrieving revision 1.128.2.9
diff -u -d -r1.128.2.8 -r1.128.2.9
--- gdk_storage.mx      20 Aug 2007 13:32:05 -0000      1.128.2.8
+++ gdk_storage.mx      19 Sep 2007 13:46:04 -0000      1.128.2.9
@@ -470,9 +470,12 @@
        b->batDirtyflushed = DELTAdirty(b) ? TRUE : FALSE;
        b->batDirty = 0;
        b->batDirtydesc = 0;
-       b->batDirtybuns = 0;
-       b->hheapdirty = 0;
-       b->theapdirty = 0;
+       b->H->heap.dirty = 0;
+       b->T->heap.dirty = 0;
+       if (b->H->vheap)
+               b->H->vheap->dirty = 0;
+       if (b->T->vheap)
+               b->T->vheap->dirty = 0;
 }
 
 BAT *
@@ -525,18 +528,18 @@
 
        /* start saving data */
        nme = BBP_physical(b->batCacheid);
-       if (b->batCopiedtodisk == 0 || b->batDirty || b->batDirtybuns) {
+       if (b->batCopiedtodisk == 0 || b->batDirty || b->H->heap.dirty) 
                if (err == 0 && b->htype)
                        err = HEAPsave(&b->H->heap, nme, "head");
+       if (b->batCopiedtodisk == 0 || b->batDirty || b->T->heap.dirty) 
                if (err == 0 && b->ttype)
                        err = HEAPsave(&b->T->heap, nme, "tail");
-       }
-       if (b->hheap && (b->batCopiedtodisk == 0 || b->batDirty || 
b->hheapdirty))
+       if (b->hheap && (b->batCopiedtodisk == 0 || b->batDirty || 
b->H->vheap->dirty))
                if (b->htype && b->hvarsized) {
                        if (err == 0)
                                err = HEAPsave(b->hheap, nme, "hheap");
                }
-       if (b->theap && (b->batCopiedtodisk == 0 || b->batDirty || 
b->theapdirty))
+       if (b->theap && (b->batCopiedtodisk == 0 || b->batDirty || 
b->T->vheap->dirty))
                if (b->ttype && b->tvarsized) {
                        if (err == 0)
                                err = HEAPsave(b->theap, nme, "theap");

Index: gdk_bat.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB/src/gdk/gdk_bat.mx,v
retrieving revision 1.181.4.13
retrieving revision 1.181.4.14
diff -u -d -r1.181.4.13 -r1.181.4.14
--- gdk_bat.mx  17 Aug 2007 11:45:06 -0000      1.181.4.13
+++ gdk_bat.mx  19 Sep 2007 13:46:02 -0000      1.181.4.14
@@ -1596,7 +1596,9 @@
                if (((b->ttype != TYPE_void) & b->tkey & !(b->tkey & 
BOUND2BTRUE)) && BATcount(b) > 1) {
                        BATkey(bm, FALSE);
                }
-               b->batDirtybuns = b->theapdirty = TRUE;
+               b->T->heap.dirty = TRUE;
+               if (b->T->vheap)
+                       b->T->vheap->dirty = TRUE;
        } else {
                /* committed BUN */
                BUNdelete(b, p, force);
@@ -1988,12 +1990,12 @@
        BATcheck(b, "BATvmsize");
        if (b->batDirty || (b->batPersistence != TRANSIENT && 
!b->batCopiedtodisk))
                dirty = 0;
-       return ((dirty == 0 || b->batDirtybuns) ? HEAPvmsize(&b->H->heap) : 0) +
-               ((dirty == 0 || b->batDirtybuns) ? HEAPvmsize(&b->T->heap) : 0) 
+
-               (((dirty == 0 || b->batDirtybuns) && b->H->hash) ? 
HEAPvmsize(b->H->hash->heap) : 0) +
-               (((dirty == 0 || b->batDirtybuns) && b->T->hash) ? 
HEAPvmsize(b->T->hash->heap) : 0) +
-               (((dirty == 0 || b->hheapdirty) && b->H->vheap) ? 
HEAPvmsize(b->H->vheap) : 0) +
-               (((dirty == 0 || b->theapdirty) && b->T->vheap) ? 
HEAPvmsize(b->T->vheap) : 0);
+       return ((dirty == 0 || b->H->heap.dirty) ? HEAPvmsize(&b->H->heap) : 0) 
+
+               ((dirty == 0 || b->T->heap.dirty) ? HEAPvmsize(&b->T->heap) : 
0) +
+               (((dirty == 0 || b->H->heap.dirty) && b->H->hash) ? 
HEAPvmsize(b->H->hash->heap) : 0) +
+               (((dirty == 0 || b->T->heap.dirty) && b->T->hash) ? 
HEAPvmsize(b->T->hash->heap) : 0) +
+               ((b->H->vheap && (dirty == 0 || b->H->vheap->dirty)) ? 
HEAPvmsize(b->H->vheap) : 0) +
+               ((b->T->vheap && (dirty == 0 || b->T->vheap->dirty)) ? 
HEAPvmsize(b->T->vheap) : 0);
 }
 
 size_t
@@ -2003,12 +2005,12 @@
        if (b->batDirty || (b->batPersistence != TRANSIENT && 
!b->batCopiedtodisk))
                dirty = 0;
        return ((dirty == 0 || b->batDirtydesc) ? sizeof(BATstore) : 0) +
-               ((dirty == 0 || b->batDirtybuns) ? HEAPmemsize(&b->H->heap) : 
0) +
-               ((dirty == 0 || b->batDirtybuns) ? HEAPmemsize(&b->T->heap) : 
0) +
-               (((dirty == 0 || b->batDirtybuns) && b->H->hash) ? 
HEAPmemsize(b->H->hash->heap) : 0) +
-               (((dirty == 0 || b->batDirtybuns) && b->T->hash) ? 
HEAPmemsize(b->T->hash->heap) : 0) +
-               (((dirty == 0 || b->hheapdirty) && b-> H->vheap) ? 
HEAPmemsize(b-> H->vheap) : 0) +
-               (((dirty == 0 || b->theapdirty) && b->T->vheap) ? 
HEAPmemsize(b->T->vheap) : 0);
+               ((dirty == 0 || b->H->heap.dirty) ? HEAPmemsize(&b->H->heap) : 
0) +
+               ((dirty == 0 || b->T->heap.dirty) ? HEAPmemsize(&b->T->heap) : 
0) +
+               (((dirty == 0 || b->H->heap.dirty) && b->H->hash) ? 
HEAPmemsize(b->H->hash->heap) : 0) +
+               (((dirty == 0 || b->T->heap.dirty) && b->T->hash) ? 
HEAPmemsize(b->T->hash->heap) : 0) +
+               ((b->H->vheap && (dirty == 0 || b->H->vheap->dirty)) ? 
HEAPmemsize(b-> H->vheap) : 0) +
+               ((b->T->vheap && (dirty == 0 || b->T->vheap->dirty)) ? 
HEAPmemsize(b->T->vheap) : 0);
 }
 
 @


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to