Changeset: 13fcad9fe79d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=13fcad9fe79d
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/exports.stable.out
        gdk/ChangeLog
        gdk/gdk.h
        gdk/gdk_bbp.c
        gdk/gdk_bbp.h
        monetdb5/ChangeLog
        monetdb5/mal/Tests/tst275.stable.out
        monetdb5/modules/kernel/bat5.c
        monetdb5/modules/kernel/status.c
        monetdb5/modules/mal/bbp.c
        monetdb5/modules/mal/bbp.h
        monetdb5/modules/mal/bbp.mal
Branch: default
Log Message:

Removed the "lastused" value from the BBP.
Note that databases created using the default branch before this
changeset are not compatible.


diffs (truncated from 375 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -24064,10 +24064,6 @@ command bbp.getDirty():bat[:str]
 address CMDbbpDirty;
 comment Create a BAT with the dirty/ diffs/clean status
 
-command bbp.getHeat():bat[:int] 
-address CMDbbpHeat;
-comment Create a BAT with the heat values
-
 command bbp.getLocation():bat[:str] 
 address CMDbbpLocation;
 comment Create a BAT with their disk locations
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -31923,10 +31923,6 @@ command bbp.getDirty():bat[:str]
 address CMDbbpDirty;
 comment Create a BAT with the dirty/ diffs/clean status
 
-command bbp.getHeat():bat[:int] 
-address CMDbbpHeat;
-comment Create a BAT with the heat values
-
 command bbp.getLocation():bat[:str] 
 address CMDbbpLocation;
 comment Create a BAT with their disk locations
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -973,7 +973,6 @@ str CMDbbp(bat *ID, bat *NS, bat *TT, ba
 str CMDbbpCount(bat *ret);
 str CMDbbpDirty(bat *ret);
 str CMDbbpDiskSpace(lng *ret);
-str CMDbbpHeat(bat *ret);
 str CMDbbpKind(bat *ret);
 str CMDbbpLRefCount(bat *ret);
 str CMDbbpLocation(bat *ret);
diff --git a/gdk/ChangeLog b/gdk/ChangeLog
--- a/gdk/ChangeLog
+++ b/gdk/ChangeLog
@@ -2,6 +2,7 @@
 # This file is updated with Maddlog
 
 * Tue Jul 26 2016 Sjoerd Mullender <[email protected]>
+- Removed the lastused "timestamp" from the BBP.
 - Removed batStamp field from BAT descriptor, and removed the BBPcurstamp
   function.
 
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1667,7 +1667,6 @@ typedef struct {
        str options;            /* A string list of options */
        int refs;               /* in-memory references on which the loaded 
status of a BAT relies */
        int lrefs;              /* logical references on which the existence of 
a BAT relies */
-       int lastused;           /* BBP LRU stamp */
        volatile int status;    /* status mask used for spin locking */
        /* MT_Id pid;           non-zero thread-id if this BAT is private */
 } BBPrec;
@@ -1693,7 +1692,6 @@ gdk_export BBPrec *BBP[N_BBPINIT];
 #define BBP_desc(i)    BBP[(i)>>BBPINITLOG][(i)&(BBPINIT-1)].desc
 #define BBP_refs(i)    BBP[(i)>>BBPINITLOG][(i)&(BBPINIT-1)].refs
 #define BBP_lrefs(i)   BBP[(i)>>BBPINITLOG][(i)&(BBPINIT-1)].lrefs
-#define BBP_lastused(i)        BBP[(i)>>BBPINITLOG][(i)&(BBPINIT-1)].lastused
 #define BBP_status(i)  BBP[(i)>>BBPINITLOG][(i)&(BBPINIT-1)].status
 #define BBP_pid(i)     BBP[(i)>>BBPINITLOG][(i)&(BBPINIT-1)].pid
 
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -129,24 +129,6 @@ static int havehge = 0;
 
 #define BBPnamecheck(s) (BBPtmpcheck(s) ? strtol((s) + 4, NULL, 8) : 0)
 
-#ifdef ATOMIC_LOCK
-static MT_Lock stampLock MT_LOCK_INITIALIZER("stampLock");
-#endif
-static volatile ATOMIC_TYPE stamp = 0;
-
-static inline int
-BBPstamp(void)
-{
-       return (int) ATOMIC_INC(stamp, stampLock);
-}
-
-static void
-BBPsetstamp(int newstamp)
-{
-       ATOMIC_SET(stamp, newstamp, stampLock);
-}
-
-
 static void
 BBP_insert(bat i)
 {
@@ -1054,7 +1036,7 @@ vheapinit(BAT *b, const char *buf, int h
 }
 
 static int
-BBPreadEntries(FILE *fp, int *min_stamp, int *max_stamp, int oidsize, int 
bbpversion)
+BBPreadEntries(FILE *fp, int oidsize, int bbpversion)
 {
        bat bid = 0;
        char buf[4096];
@@ -1107,12 +1089,12 @@ BBPreadEntries(FILE *fp, int *min_stamp,
                           &map_theap,
                           &nread) < 14 :
                    sscanf(buf,
-                          "%lld %hu %128s %128s %d %u %lld %lld %lld"
+                          "%lld %hu %128s %128s %u %lld %lld %lld"
                           "%n",
                           &batid, &status, headname, filename,
-                          &lastused, &properties,
+                          &properties,
                           &count, &capacity, &base,
-                          &nread) < 9)
+                          &nread) < 8)
                        GDKfatal("BBPinit: invalid format for BBP.dir%s", buf);
 
                /* convert both / and \ path separators to our own DIR_SEP */
@@ -1195,11 +1177,6 @@ BBPreadEntries(FILE *fp, int *min_stamp,
                BBP_options(bid) = NULL;
                if (options)
                        BBP_options(bid) = GDKstrdup(options);
-               BBP_lastused(bid) = lastused;
-               if (lastused > *max_stamp)
-                       *max_stamp = lastused;
-               if (lastused < *min_stamp)
-                       *min_stamp = lastused;
                BBP_refs(bid) = 0;
                BBP_lrefs(bid) = 1;     /* any BAT we encounter here is 
persistent, so has a logical reference */
        }
@@ -1320,8 +1297,6 @@ BBPinit(void)
 {
        FILE *fp = NULL;
        struct stat st;
-       int min_stamp = 0x7fffffff, max_stamp = 0;
-       bat bid;
        int bbpversion;
        int oidsize;
        oid BBPoid;
@@ -1331,7 +1306,6 @@ BBPinit(void)
 
 #ifdef NEED_MT_LOCK_INIT
        MT_lock_init(&GDKunloadLock, "GDKunloadLock");
-       ATOMIC_INIT(stampLock);
        ATOMIC_INIT(BBPsizeLock);
 #endif
 
@@ -1378,17 +1352,9 @@ BBPinit(void)
        BBPextend(0, FALSE);            /* allocate BBP records */
        ATOMIC_SET(BBPsize, 1, BBPsizeLock);
 
-       needcommit = BBPreadEntries(fp, &min_stamp, &max_stamp, oidsize, 
bbpversion);
+       needcommit = BBPreadEntries(fp, oidsize, bbpversion);
        fclose(fp);
 
-       /* normalize saved LRU stamps */
-       if (min_stamp <= max_stamp) {
-               for (bid = 1; bid < (bat) ATOMIC_GET(BBPsize, BBPsizeLock); 
bid++)
-                       if (BBPvalid(bid))
-                               BBP_lastused(bid) -= min_stamp;
-               BBPsetstamp(max_stamp - min_stamp);
-       }
-
        BBPinithash(0);
 
        OIDbase(BBPoid);
@@ -1565,13 +1531,12 @@ new_bbpentry(FILE *fp, bat i)
        }
 #endif
 
-       if (fprintf(fp, SSZFMT " %d %s %s %d %d " BUNFMT " "
+       if (fprintf(fp, SSZFMT " %d %s %s %d " BUNFMT " "
                    BUNFMT " " OIDFMT, /* BAT info */
                    (ssize_t) i,
                    BBP_status(i) & BBPPERSISTENT,
                    BBP_logical(i),
                    BBP_physical(i),
-                   BBP_lastused(i),
                    BBP_desc(i)->batRestricted << 1,
                    BBP_desc(i)->batCount,
                    BBP_desc(i)->batCapacity,
@@ -2133,7 +2098,6 @@ BBPcacheit(BAT *bn, int lock)
                MT_lock_set(&GDKswapLock(i));
        mode = (BBP_status(i) | BBPLOADED) & ~(BBPLOADING | BBPDELETING);
        BBP_status_set(i, mode, "BBPcacheit");
-       BBP_lastused(i) = BBPLASTUSED(BBPstamp() + ((mode == BBPLOADED) ? 150 : 
0));
        BBP_desc(i) = bn;
 
        /* cache it! */
@@ -2499,14 +2463,8 @@ decref(bat i, int logical, int releaseSh
         * if they have been made cold or are not dirty */
        if (BBP_refs(i) > 0 ||
            (BBP_lrefs(i) > 0 &&
-            BBP_lastused(i) != 0 &&
             (b == NULL || BATdirty(b) || !(BBP_status(i) & BBPPERSISTENT)))) {
-               /* bat cannot be swapped out. renew its last usage
-                * stamp for the BBP LRU policy */
-               int sec = BBPLASTUSED(BBPstamp());
-
-               if (sec > BBPLASTUSED(BBP_lastused(i)))
-                       BBP_lastused(i) = sec;
+               /* bat cannot be swapped out */
        } else if (b || (BBP_status(i) & BBPTMP)) {
                /* bat will be unloaded now. set the UNLOADING bit
                 * while locked so no other thread thinks it's
@@ -3741,7 +3699,6 @@ gdk_bbp_reset(void)
        memset(BBPfarms, 0, sizeof(BBPfarms));
        BBP_hash = 0;
        BBP_mask = 0;
-       stamp = 0;
 
        BBP_dirty = 0;
        BBPin = 0;
diff --git a/gdk/gdk_bbp.h b/gdk/gdk_bbp.h
--- a/gdk/gdk_bbp.h
+++ b/gdk/gdk_bbp.h
@@ -52,7 +52,6 @@
 #define BBPWAITING      (BBPUNLOADING|BBPLOADING|BBPSAVING|BBPDELETING)
 
 #define BBPTRIM_ALL    (((size_t)1) << (sizeof(size_t)*8 - 2)) /* very large 
positive size_t */
-#define BBPLASTUSED(x)  ((x) & 0x7fffffff)     /* stamp is always a positive 
int */
 
 gdk_export int BBPin;          /* BATs swapped into BBP  */
 gdk_export int BBPout;         /* BATs swapped out of BBP */
diff --git a/monetdb5/ChangeLog b/monetdb5/ChangeLog
--- a/monetdb5/ChangeLog
+++ b/monetdb5/ChangeLog
@@ -1,6 +1,9 @@
 # ChangeLog file for MonetDB5
 # This file is updated with Maddlog
 
+* Tue Jul 26 2016 Sjoerd Mullender <[email protected]>
+- Removed command bbp.getHeat().
+
 * Wed Jun 29 2016 Sjoerd Mullender <[email protected]>
 - Removed bat.setColumn with two arguments and bat.setRole.  Use
   bat.setColumn with one argument instead.
diff --git a/monetdb5/mal/Tests/tst275.stable.out 
b/monetdb5/mal/Tests/tst275.stable.out
--- a/monetdb5/mal/Tests/tst275.stable.out
+++ b/monetdb5/mal/Tests/tst275.stable.out
@@ -65,16 +65,15 @@ Ready.
 [ 28@0,        "tnil", "0"     ]
 [ 29@0,        "batInserted",  "0"     ]
 [ 30@0,        "ttop", "0"     ]
-[ 31@0,        "lastUsed",     "1107"  ]
-[ 32@0,        "batCopiedtodisk",      "0"     ]
-[ 33@0,        "batDirtydesc", "dirty" ]
-[ 34@0,        "T->heap.dirty",        "clean" ]
-[ 35@0,        "tail.free",    "0"     ]
-[ 36@0,        "tail.size",    "1024"  ]
-[ 37@0,        "tail.storage", "malloced"      ]
-[ 38@0,        "tail.newstorage",      "malloced"      ]
-[ 39@0,        "tail.filename",        "22.tail"       ]
-[ 40@0,        "T->vheap->dirty",      "clean" ]
+[ 31@0,        "batCopiedtodisk",      "0"     ]
+[ 32@0,        "batDirtydesc", "dirty" ]
+[ 33@0,        "T->heap.dirty",        "clean" ]
+[ 34@0,        "tail.free",    "0"     ]
+[ 35@0,        "tail.size",    "1024"  ]
+[ 36@0,        "tail.storage", "malloced"      ]
+[ 37@0,        "tail.newstorage",      "malloced"      ]
+[ 38@0,        "tail.filename",        "22.tail"       ]
+[ 39@0,        "T->vheap->dirty",      "clean" ]
 #~EndVariableOutput~#
 #--------------------------#
 # h    t  # name
diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c
--- a/monetdb5/modules/kernel/bat5.c
+++ b/monetdb5/modules/kernel/bat5.c
@@ -806,8 +806,6 @@ BKCinfo(bat *ret1, bat *ret2, const bat 
            BUNappend(bv, local_utoa(b->batInserted), FALSE) != GDK_SUCCEED ||
            BUNappend(bk, "ttop", FALSE) != GDK_SUCCEED ||
            BUNappend(bv, local_utoa(b->theap.free), FALSE) != GDK_SUCCEED ||
-           BUNappend(bk, "lastUsed", FALSE) != GDK_SUCCEED ||
-           BUNappend(bv, local_itoa((ssize_t)(BBP_lastused(b->batCacheid))), 
FALSE) != GDK_SUCCEED ||
            BUNappend(bk, "batCopiedtodisk", FALSE) != GDK_SUCCEED ||
            BUNappend(bv, local_itoa((ssize_t)(b->batCopiedtodisk)), FALSE) != 
GDK_SUCCEED ||
            BUNappend(bk, "batDirtydesc", FALSE) != GDK_SUCCEED ||
diff --git a/monetdb5/modules/kernel/status.c b/monetdb5/modules/kernel/status.c
--- a/monetdb5/modules/kernel/status.c
+++ b/monetdb5/modules/kernel/status.c
@@ -565,7 +565,6 @@ SYSgdkEnv(bat *ret, bat *ret2)
 {
        int pbat = 0;
        int pdisk = 0;
-       int pheat = 0;
        bat i;
        int tmp = 0, per = 0;
        BAT *b,*bn;
@@ -582,7 +581,6 @@ SYSgdkEnv(bat *ret, bat *ret2)
                if (BBPvalid(i)) {
                        pbat++;
                        if (BBP_cache(i)) {
-                               pheat += BBP_lastused(i);
                                if (BBP_cache(i)->batPersistence == PERSISTENT)
                                        per++;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to