Update of /cvsroot/monetdb/sql/src/storage/bat
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17119/src/storage/bat

Modified Files:
      Tag: SQL_2-18
        bat_store.mx 
Log Message:
fix concurrency problem (related to temp tables)


Index: bat_store.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_store.mx,v
retrieving revision 1.138.2.4
retrieving revision 1.138.2.5
diff -u -d -r1.138.2.4 -r1.138.2.5
--- bat_store.mx        15 Jun 2007 11:45:45 -0000      1.138.2.4
+++ bat_store.mx        30 Jun 2007 13:21:21 -0000      1.138.2.5
@@ -3786,7 +3786,7 @@
                cur = temp_descriptor(oc->bat.bid);
                if (ft->cleared && ttr == gtrans) {
                        bat_clear(cur);
-                       BATcommit(cur);
+                       BATcommit(cur); 
                        ok = log_bat_clear(sql_logger, oc->bat.name);
                        if (ok == LOG_OK) 
                                ok = log_bat_clear(sql_logger, oc->bat.uname);
@@ -3826,6 +3826,9 @@
                                        ins = cur;
                                        cur = swpbat;
                                } else {
+                                       if (BATcount(cur)+BATcount(ins) > 
(size_t) REMAP_PAGE_MAXSIZE) { /* try to use mmap() */
+                                               BATmmap(cur, STORE_MMAP, 
STORE_MMAP, STORE_MMAP);
+                                       }
                                        BATappend(cur,ins,TRUE);
                                        bat_clear(ins);
                                }
@@ -3938,6 +3941,9 @@
                                                ins = cur;
                                                cur = swpbat;
                                        } else {
+                                               if (BATcount(cur)+BATcount(ins) 
> (size_t) REMAP_PAGE_MAXSIZE) { /* try to use mmap() */
+                                                       BATmmap(cur, 
STORE_MMAP, STORE_MMAP, STORE_MMAP);
+                                               }
                                                BATappend(cur,ins,TRUE);
                                                bat_clear(ins);
                                        }
@@ -4027,6 +4033,23 @@
 {
        int ok = LOG_OK;
 
+       if (isTempSchema(fs)) {
+               if (fs->tables.set) {
+                       node *n;
+                       for (n = fs->tables.set->h; n; n = n->next) {
+                               sql_table *t = n->data;
+       
+                               if ((isTable(t) && isGlobalTable(t)) || 
+                                   t->commit_action == CA_DELETE) {
+                                       sql_trans_clear_table(tr, t);
+                               } else if (t->commit_action == CA_DROP) {
+                                       sql_trans_drop_table(tr, t->s, 
t->base.id, DROP_RESTRICT);
+                               }
+                       }
+               }
+               return ok;
+       }
+
        if (ok == LOG_OK)
                ok = rollforward_changeset_updates(tr, &fs->types, &ts->types, 
&ts->base, (rfufunc) NULL, (rfcfunc) &rollforward_create_type, (rfdfunc) NULL, 
(dupfunc) &type_dup);
 
@@ -4359,9 +4382,27 @@
 static int
 reset_schema(sql_trans *tr, sql_schema *fs, sql_schema *pfs)
 {
+       int ok = LOG_OK;
+
+       if (isTempSchema(fs)) {
+               if (fs->tables.set) {
+                       node *n;
+                       for (n = fs->tables.set->h; n; n = n->next) {
+                               sql_table *t = n->data;
+       
+                               if ((isTable(t) && isGlobalTable(t)) || 
+                                    t->commit_action == CA_DELETE) {
+                                       sql_trans_clear_table(tr, t);
+                               } else if (t->commit_action == CA_DROP) {
+                                       sql_trans_drop_table(tr, t->s, 
t->base.id, DROP_RESTRICT);
+                               }
+                       }
+               }
+               return ok;
+       }
+
        /* did we make changes or is the global changed after we started */
        if (fs->base.wtime || tr->stime < pfs->base.wtime) {
-               int ok = LOG_OK;
                fs->base.wtime = fs->base.rtime = 0;
 
                ok = reset_changeset(tr, &fs->types, &pfs->types, &fs->base, 
(resetf) &reset_type, (dupfunc) &type_dup);
@@ -4374,7 +4415,7 @@
                if (ok == LOG_OK)
                        return reset_changeset(tr, &fs->tables, &pfs->tables, 
&fs->base, (resetf) &reset_table, (dupfunc) &table_dup);
        }
-       return LOG_OK;
+       return ok;
 }
 
 static int
@@ -4432,7 +4473,8 @@
                        sql_schema *s = n->data;
                        sql_schema *os;
 
-                       if (strcmp(s->base.name,"tmp") == 0)
+                       
+                       if (isTempSchema(s))
                                continue;
 
                        os = find_sql_schema(tr->parent, s->base.name);


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to