Update of /cvsroot/monetdb/sql/src/storage/bat
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv10533/src/storage/bat

Modified Files:
      Tag: Feb2009
        bat_storage.mx 
Log Message:
fixing bad concurrency bug

1) we lost updates
        Problem was in the handling of the update bat, ie we need to always
        keep updates in the update bat. But already apply asap.

2) we got extra inserts (the hard problem)
        We incorrectly kept using an 'empty' bat. These are bats which should
        stay empty and are shared. But we incorrectly inserted data in it
        instead of replacing it with a new bat with data.


U bat_storage.mx
Index: bat_storage.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_storage.mx,v
retrieving revision 1.34.2.3
retrieving revision 1.34.2.4
diff -u -d -r1.34.2.3 -r1.34.2.4
--- bat_storage.mx      20 Apr 2009 20:51:49 -0000      1.34.2.3
+++ bat_storage.mx      22 Apr 2009 08:28:23 -0000      1.34.2.4
@@ -182,14 +182,15 @@
                BAT *ib = temp_descriptor(bat->ibid), *u = upd;
 
                if (BATcount(ib)) { 
-                       BAT *b = temp_descriptor(bat->bid);
-                       BAT *updins, *updcur;
+                       BAT *updins;
 
                        updins = BATsemijoin(upd, ib);
                        void_replace_bat(ib, updins, TRUE);
                        bat_destroy(updins);
-                       updcur = BATsemijoin(upd, b);
-                       u = updcur;
+#if 0
+                       BAT *b = temp_descriptor(bat->bid);
+                       u = BATsemijoin(upd, b);
+#endif
                }
                bat_destroy(ib);
 
@@ -325,8 +326,8 @@
 {
        sql_delta *bat = c->data;
 
+       /* appends only write */
        c->base.wtime = c->t->base.wtime = c->t->s->base.wtime = tr->wtime = 
tr->stime;
-       c->base.rtime = c->t->base.rtime = c->t->s->base.rtime = tr->rtime = 
tr->stime;
        if (tpe == TYPE_bat)
                delta_append_bat(bat, i);
        else
@@ -338,8 +339,8 @@
 {
        sql_delta *bat = i->data;
 
+       /* appends only write */
        i->base.wtime = i->t->base.wtime = i->t->s->base.wtime = tr->wtime = 
tr->stime;
-       i->base.rtime = i->t->base.rtime = i->t->s->base.rtime = tr->rtime = 
tr->stime;
        if (tpe == TYPE_bat)
                delta_append_bat(bat, ib);
        else
@@ -388,8 +389,8 @@
 {
        sql_dbat *bat = t->data;
 
+       /* deletes only write */
        t->base.wtime = t->s->base.wtime = tr->wtime = tr->stime;
-       t->base.rtime = t->s->base.rtime = tr->rtime = tr->stime;
        if (tpe == TYPE_bat)
                delta_delete_bat(bat, ib);
        else
@@ -1156,6 +1157,14 @@
        if (BUNlast(ins) > BUNfirst(ins)) {
                if (BUNlast(ins) > ins->batInserted && (store_nr_active > 1 || 
cluster)) { 
                        BAT *ci = temp_descriptor(obat->ibid);
+
+                       if (isEbat(ci)) {
+                               temp_destroy(obat->ibid);
+                               obat->ibid = temp_copy(ci->batCacheid, FALSE);
+                               bat_destroy(ci);
+                               ci = temp_descriptor(obat->ibid);
+                       }
+                       assert(obat->ibase == cbat->ibase);
                        append_inserted(ci, ins);
                        bat_destroy(ci);
                }
@@ -1183,6 +1192,7 @@
                                cbat->ibid = e_bat(cur->ttype);
                        }
                        bat_clear(pi);
+                       assert(obat->ibase == cbat->ibase);
                        obat->ibase = cbat->ibase = BATcount(cur);
                        BATseqbase(pi, obat->ibase);
                        bat_destroy(pi);
@@ -1235,6 +1245,12 @@
        if (BUNlast(db) > db->batInserted || cleared) {
                BAT *odb = temp_descriptor(tdb->dbid);
 
+               if (isEbat(odb)) {
+                       temp_destroy(tdb->dbid);
+                       tdb->dbid = temp_copy(odb->batCacheid, FALSE);
+                       bat_destroy(odb);
+                       odb = temp_descriptor(tdb->dbid);
+               }
                append_inserted(odb, db);
                bat_destroy(odb);
                BATcommit(db);


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to