Changeset: 7001a523b63b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7001a523b63b
Modified Files:
        
Branch: sciql
Log Message:

merged with default


diffs (truncated from 1017 to 300 lines):

diff --git a/common/utils/mcrypt.c b/common/utils/mcrypt.c
--- a/common/utils/mcrypt.c
+++ b/common/utils/mcrypt.c
@@ -52,7 +52,7 @@ mcrypt_getHashAlgorithms(void)
  * the MD5 hash of the given string.
  */
 char *
-mcrypt_MD5Sum(const char *string, const int len)
+mcrypt_MD5Sum(const char *string, size_t len)
 {
        unsigned char md[16]; /* should be MD5_DIGEST_LENGTH */
        char *ret;
@@ -75,7 +75,7 @@ mcrypt_MD5Sum(const char *string, const 
  * the SHA-1 hash of the given string.
  */
 char *
-mcrypt_SHA1Sum(const char *string, const int len)
+mcrypt_SHA1Sum(const char *string, size_t len)
 {
        unsigned char md[20]; /* should be SHA_DIGEST_LENGTH */
        char *ret;
@@ -98,7 +98,7 @@ mcrypt_SHA1Sum(const char *string, const
  * the SHA-224 hash of the given string.
  */
 char *
-mcrypt_SHA224Sum(const char *string, const int len)
+mcrypt_SHA224Sum(const char *string, size_t len)
 {
        unsigned char md[28];
        char *ret;
@@ -125,7 +125,7 @@ mcrypt_SHA224Sum(const char *string, con
  * the SHA-256 hash of the given string.
  */
 char *
-mcrypt_SHA256Sum(const char *string, const int len)
+mcrypt_SHA256Sum(const char *string, size_t len)
 {
        unsigned char md[32];
        char *ret;
@@ -154,7 +154,7 @@ mcrypt_SHA256Sum(const char *string, con
  * the SHA-384 hash of the given string.
  */
 char *
-mcrypt_SHA384Sum(const char *string, const int len)
+mcrypt_SHA384Sum(const char *string, size_t len)
 {
        unsigned char md[48];
        char *ret;
@@ -187,7 +187,7 @@ mcrypt_SHA384Sum(const char *string, con
  * the SHA-512 hash of the given string.
  */
 char *
-mcrypt_SHA512Sum(const char *string, const int len)
+mcrypt_SHA512Sum(const char *string, size_t len)
 {
        unsigned char md[64];
        char *ret;
@@ -225,7 +225,7 @@ mcrypt_SHA512Sum(const char *string, con
  * the RIPEMD-160 hash of the given string.
  */
 char *
-mcrypt_RIPEMD160Sum(const char *string, const int len)
+mcrypt_RIPEMD160Sum(const char *string, size_t len)
 {
        unsigned char md[20]; /* should be RIPEMD160_DIGEST_LENGTH */
        char *ret;
@@ -248,7 +248,7 @@ mcrypt_RIPEMD160Sum(const char *string, 
  * the by the backend used hash of the given string.
  */
 char *
-mcrypt_BackendSum(const char *string, const int len)
+mcrypt_BackendSum(const char *string, size_t len)
 {
        if (strcmp(MONETDB5_PASSWDHASH, "RIPEMD160") == 0)
                return mcrypt_RIPEMD160Sum(string, len);
diff --git a/common/utils/mcrypt.h b/common/utils/mcrypt.h
--- a/common/utils/mcrypt.h
+++ b/common/utils/mcrypt.h
@@ -21,14 +21,14 @@
 #define _SEEN_MCRYPT_H 1
 
 char *mcrypt_getHashAlgorithms(void);
-char *mcrypt_MD5Sum(const char *string, const int len);
-char *mcrypt_SHA1Sum(const char *string, const int len);
-char *mcrypt_SHA224Sum(const char *string, const int len);
-char *mcrypt_SHA256Sum(const char *string, const int len);
-char *mcrypt_SHA384Sum(const char *string, const int len);
-char *mcrypt_SHA512Sum(const char *string, const int len);
-char *mcrypt_RIPEMD160Sum(const char *string, const int len);
-char *mcrypt_BackendSum(const char *string, const int len);
+char *mcrypt_MD5Sum(const char *string, size_t len);
+char *mcrypt_SHA1Sum(const char *string, size_t len);
+char *mcrypt_SHA224Sum(const char *string, size_t len);
+char *mcrypt_SHA256Sum(const char *string, size_t len);
+char *mcrypt_SHA384Sum(const char *string, size_t len);
+char *mcrypt_SHA512Sum(const char *string, size_t len);
+char *mcrypt_RIPEMD160Sum(const char *string, size_t len);
+char *mcrypt_BackendSum(const char *string, size_t len);
 char *mcrypt_hashPassword(const char *algo, const char *password, const char 
*challenge);
 
 #endif
diff --git a/gdk/ChangeLog.Aug2011 b/gdk/ChangeLog.Aug2011
--- a/gdk/ChangeLog.Aug2011
+++ b/gdk/ChangeLog.Aug2011
@@ -1,6 +1,10 @@
 # ChangeLog file for MonetDB
 # This file is updated with Maddlog
 
+* Thu Aug 25 2011 Sjoerd Mullender <[email protected]>
+- Removed conversion code for databases that still used the (more than
+  two year) old format of "string heaps".
+
 * Wed Aug 10 2011 Sjoerd Mullender <[email protected]>
 - On Windows and Linux/Unix we can now read databases built on the other
   O/S, as long as the hardware-related architecture (bit size, floating
diff --git a/gdk/gdk.mx b/gdk/gdk.mx
--- a/gdk/gdk.mx
+++ b/gdk/gdk.mx
@@ -874,7 +874,6 @@ typedef struct {
 /* assert that atom width is power of 2, i.e., width == 1<<shift */
 #define assert_shift_width(shift,width) assert(((shift) == 0 && (width) == 0) 
|| ((unsigned)1<<(shift)) == (unsigned)(width))
 
-#define GDKLIBRARY_PRE_VARSHIFT        061022  /* almost compatible version, 
see gdk_bbp.mx */
 #define GDKLIBRARY_PRE_VARWIDTH 061023  /* backward compatible version */
 #define GDKLIBRARY             061024
 
diff --git a/gdk/gdk_bbp.mx b/gdk/gdk_bbp.mx
--- a/gdk/gdk_bbp.mx
+++ b/gdk/gdk_bbp.mx
@@ -521,8 +521,9 @@ static int BBPdiskscan(const char *);
  * safe. */
 
 static void
-fixoidheapcolumn(BAT *b, const char *nme, const char *filename,
-                const char *headtail, const char *htheap)
+fixoidheapcolumn(BAT *b, const char *srcdir, const char *nme,
+                const char *filename, const char *headtail,
+                const char *htheap)
 {
        bat bid = ABS(b->batCacheid);
        Heap h1, h2;
@@ -531,8 +532,36 @@ fixoidheapcolumn(BAT *b, const char *nme
        BUN i;
        char *s;
        unsigned short w;
+       const char *bnme;
+       int ht;
+
+       if ((bnme = strrchr(nme, DIR_SEP)) != NULL)
+               bnme++;
+       else
+               bnme = nme;
+
+       if (GDKmove(srcdir, bnme, headtail, BAKDIR, bnme, headtail) != 0)
+               GDKfatal("fixoidheap: cannot make backup of %s.%s\n", nme, 
headtail);
+
+       if ((ht = b->H->type) < 0) {
+               const char *anme;
+
+               /* as yet unknown head column type */
+               anme = ATOMunknown_name(ht);
+               if (strcmp(anme, "url") == 0)
+                       b->H->type = TYPE_str;
+               else if (strcmp(anme, "sqlblob") == 0 ||
+                        strcmp(anme, "wkb") == 0)
+                       b->H->type = TYPE_int;
+               else
+                       GDKfatal("fixoidheap: unrecognized column "
+                                "type %s for BAT %d\n", anme, bid);
+       }
 
        if (b->H->type == TYPE_str) {
+               if (GDKmove(srcdir, bnme, htheap, BAKDIR, bnme, htheap) != 0)
+                       GDKfatal("fixoidheap: cannot make backup of %s.%s\n", 
nme, htheap);
+
                h1 = b->H->heap;
                h1.filename = NULL;
                h1.base = NULL;
@@ -553,9 +582,6 @@ fixoidheapcolumn(BAT *b, const char *nme
                                 "for BAT %d failed\n", bid);
 
                /* create new string heap */
-               if (HEAPdelete(&b->H->heap, nme, headtail))
-                       GDKfatal("fixoidheap: deleting %s heap "
-                                "for BAT %d failed\n", headtail, bid);
                b->H->heap.filename = GDKmalloc(strlen(nme) + 12);
                if (b->H->heap.filename == NULL)
                        GDKfatal("fixoidheap: GDKmalloc failed\n");
@@ -568,9 +594,6 @@ fixoidheapcolumn(BAT *b, const char *nme
                                 "for BAT %d failed\n", headtail, bid);
 
                b->H->heap.dirty = TRUE;
-               if (HEAPdelete(b->H->vheap, nme, htheap))
-                       GDKfatal("fixoidheap: deleting string heap "
-                                "for BAT %d failed\n", bid);
                b->H->vheap->filename = GDKmalloc(strlen(nme) + 12);
                if (b->H->vheap->filename == NULL)
                        GDKfatal("fixoidheap: GDKmalloc failed\n");
@@ -605,8 +628,11 @@ fixoidheapcolumn(BAT *b, const char *nme
                }
                HEAPfree(&h1);
                HEAPfree(&h2);
-       } else if (b->H->type == TYPE_oid ||
-                  (b->H->type != TYPE_void && b->H->varsized)) {
+               HEAPsave(b->H->vheap, nme, htheap);
+               HEAPfree(b->H->vheap);
+       } else {
+               assert(b->H->type == TYPE_oid ||
+                      (b->H->type != TYPE_void && b->H->varsized));
                h1 = b->H->heap;
                h1.filename = NULL;
                h1.base = NULL;
@@ -619,9 +645,6 @@ fixoidheapcolumn(BAT *b, const char *nme
                                 "for BAT %d failed\n", headtail, bid);
 
                /* create new heap */
-               if (HEAPdelete(&b->H->heap, nme, headtail))
-                       GDKfatal("fixoidheap: deleting %s heap "
-                                "for BAT %d failed\n", headtail, bid);
                b->H->heap.filename = GDKmalloc(strlen(nme) + 12);
                if (b->H->heap.filename == NULL)
                        GDKfatal("fixoidheap: GDKmalloc failed\n");
@@ -645,6 +668,12 @@ fixoidheapcolumn(BAT *b, const char *nme
                b->H->heap.free = h1.free << 1;
                HEAPfree(&h1);
        }
+       HEAPsave(&b->H->heap, nme, headtail);
+       HEAPfree(&b->H->heap);
+
+       if (ht < 0)
+               b->H->type = ht;
+
        return;
 
   bunins_failed:
@@ -656,12 +685,11 @@ fixoidheap(void)
 {
        bat bid;
        BATstore *bs;
-       BAT *b;
        str nme, bnme;
+       long_str srcdir;
        long_str filename;
-       int ht, tt;
-       char hs, hvs = '\0', ts, tvs = '\0';    /* saved storage types */
        size_t len;
+       FILE *fp;
 
        fprintf(stderr,
                "# upgrading database from 32 bit OIDs to 64 bit OIDs\n");
@@ -681,7 +709,11 @@ fixoidheap(void)
                        snprintf(filename, sizeof(filename),
                                 "%.*s_32-64-convert",
                                 (int) (len - 8), BBP[bid].nme[0]);
-                       fclose(fopen(filename, "w"));
+                       fp = fopen(filename, "w");
+                       if (fp == NULL)
+                               GDKfatal("fixoidheap: cannot create file %s\n",
+                                        filename);
+                       fclose(fp);
                }
 
                /* OID and (non-void) varsized columns have to be rewritten */
@@ -690,49 +722,6 @@ fixoidheap(void)
                    bs->T.type != TYPE_oid &&
                    (bs->T.type == TYPE_void || !bs->T.varsized))
                        continue; /* nothing to do for this BAT */
-               if ((ht = bs->H.type) < 0) {
-                       /* as yet unknown head column type */
-                       nme = ATOMunknown_name(ht);
-                       if (strcmp(nme, "url") == 0)
-                               bs->H.type = TYPE_str;
-                       else if (strcmp(nme, "sqlblob") == 0 ||
-                                strcmp(nme, "wkb") == 0)
-                               bs->H.type = TYPE_int;
-                       else if (bs->H.varsized)
-                               GDKfatal("fixoidheap: unrecognized column "
-                                        "type %s for BAT %d\n", nme, bid);
-                       else if (bs->H.width == 1)
-                               bs->H.type = TYPE_bte;
-                       else if (bs->H.width == 2)
-                               bs->H.type = TYPE_sht;
-                       else if (bs->H.width == 4)
-                               bs->H.type = TYPE_int;
-                       else
-                               bs->H.type = TYPE_lng;
-               }
-               if ((tt = bs->T.type) < 0) {
-                       nme = ATOMunknown_name(tt);
-                       if (strcmp(nme, "url") == 0)
-                               bs->T.type = TYPE_str;
-                       else if (strcmp(nme, "sqlblob") == 0 ||
-                                strcmp(nme, "wkb") == 0)
-                               bs->T.type = TYPE_int;
-                       else if (bs->H.varsized)
-                               GDKfatal("fixoidheap: unrecognized column "
-                                        "type %s for BAT %d\n", nme, bid);
-                       else if (bs->H.width == 1)
-                               bs->H.type = TYPE_bte;
-                       else if (bs->H.width == 2)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to