Changeset: f0ce9f755e99 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f0ce9f755e99
Modified Files:
        NT/monetdb_config.h.in
Branch: default
Log Message:

Merge with Aug2011 branch.


diffs (133 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -596,7 +596,7 @@
 /* #undef HAVE_TIMES */
 
 /* Define to 1 if you have the <time.h> header file. */
-/* #undef HAVE_TIME_H */
+#define HAVE_TIME_H 1
 
 /* Define to 1 if you have the timezone and daylight variables. */
 #define HAVE_TIMEZONE 1
diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -28,12 +28,17 @@ bl_preversion( int oldversion, int newve
 {
 #define CATALOG_FEB2010 50000
 #define CATALOG_OCT2010 51000
+#define CATALOG_APR2011 51100
 
        (void)newversion;
        if (oldversion == CATALOG_OCT2010) {
                catalog_version = oldversion;
                return 0;
        }
+       if (oldversion == CATALOG_APR2011) {
+               catalog_version = oldversion;
+               return 0;
+       }
        return -1;
 }
 
@@ -47,6 +52,14 @@ N( char *buf, char *pre, char *schema, c
        return buf;
 }
 
+static char *
+I( char *buf, char *schema, char *table, char *iname)
+{
+       snprintf(buf, 64, "%s_%s@%s", schema, table, iname);
+       return buf;
+}
+
+
 static void 
 bl_postversion( void *lg) 
 {
@@ -120,6 +133,70 @@ bl_postversion( void *lg)
                                s = NULL;
                }
        }
+       if (catalog_version == CATALOG_APR2011) {
+               char n[64];
+               BAT *b, *b1, *b2, *iname, *tname, *sname;
+               BUN bs;
+               BATiter iiname, itname, isname;
+
+               fprintf(stdout, "# upgrading catalog from Apr2011\n");
+               fflush(stdout);
+
+               /* join         sys.idxs(table_id, name), 
+                *              sys._tables(id,schema_id, name),
+                *              sys.schemas(id,name) */
+               iname = temp_descriptor(logger_find_bat(lg, N(n, "sys", "idxs", 
"name")));
+               bs = BATcount(iname);
+               b = temp_descriptor(logger_find_bat(lg, N(n, "sys", "idxs", 
"table_id")));
+               b1 = temp_descriptor(logger_find_bat(lg, N(n, "sys", "_tables", 
"id")));
+               b2 = BATleftjoin( b, BATmirror(b1), bs);
+               bat_destroy(b);
+               bat_destroy(b1); 
+               b = b2;
+
+               b1 = temp_descriptor(logger_find_bat(lg, N(n, "sys", "_tables", 
"name")));
+               b2 = temp_descriptor(logger_find_bat(lg, N(n, "sys", "_tables", 
"schema_id")));
+               tname = BATleftjoin( b, b1, bs );
+               bat_destroy(b1); 
+               b1 = BATleftjoin( b, b2, bs );
+               bat_destroy(b2); 
+               bat_destroy(b); 
+
+               b = temp_descriptor(logger_find_bat(lg, N(n, "sys", "schemas", 
"id")));
+               b2 = BATleftjoin( b1, BATmirror(b), bs);
+               bat_destroy(b1); 
+               bat_destroy(b); 
+               b = temp_descriptor(logger_find_bat(lg, N(n, "sys", "schemas", 
"name")));
+               sname = BATleftjoin( b2, b, bs);
+               bat_destroy(b2); 
+               bat_destroy(b); 
+
+               iiname = bat_iterator(iname);
+               itname = bat_iterator(tname);
+               isname = bat_iterator(sname);
+               /* rename idx bats */
+               for (bs = 0; bs < BATcount(iname); bs++) {
+                       /* schema_name, table_name, index_name */
+                       char *i = BUNtail(iiname, bs);
+                       char *t = BUNtail(itname, bs);
+                       char *s = BUNtail(isname, bs);
+
+                       b = temp_descriptor(logger_find_bat(lg, N(n, s, t, i)));
+                       if (!b) /* skip idxs without bats */
+                               continue;
+                       b1 = BATcopy(b, b->htype, b->ttype, 1);
+                       if (!b1)
+                               return;
+                       b1 = BATsetaccess(b1, BAT_READ);
+                       logger_del_bat(lg, b->batCacheid);
+                       logger_add_bat(lg, b1, I(n, s, t, i));
+                       bat_destroy(b);
+                       bat_destroy(b1);
+               }
+               bat_destroy(iname);
+               bat_destroy(tname);
+               bat_destroy(sname);
+       }
 }
 
 static int 
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -33,8 +33,8 @@
 #include <restrict/restrict_table.h>
 #include <restrict/restrict_logger.h>
 
-/* version 05.11.00 of catalog */
-#define CATALOG_VERSION 51100
+/* version 05.11.01 of catalog */
+#define CATALOG_VERSION 51101
 int catalog_version = 0;
 
 static MT_Lock bs_lock;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to