Changeset: d7e066436035 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d7e066436035
Modified Files:
        sql/backends/monet5/sql.mx
        sql/storage/bat/bat_storage.c
        sql/storage/store.c
Branch: newstorage
Log Message:

concurrent inserts seem to work. SELECT * returns less tuples however 
columns(bats) during SQLtid() have the expected content and length.


diffs (146 lines):

diff --git a/sql/backends/monet5/sql.mx b/sql/backends/monet5/sql.mx
--- a/sql/backends/monet5/sql.mx
+++ b/sql/backends/monet5/sql.mx
@@ -3569,11 +3569,11 @@ DELTAbat(bat *result, bat *col, bat *uid
                res = BATreplace(res, u, TRUE);
        BBPunfix(u->batCacheid);
 
-       if (i && BATcount(i)) {
+       /*if (i && BATcount(i)) {
                i = BATdescriptor(*ins);
                res = BATappend(res, i, TRUE);
                BBPunfix(i->batCacheid);
-       }
+       }*/
 
        BBPkeepref(*result = res->batCacheid);
        return MAL_SUCCEED;
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -239,7 +239,7 @@ bind_col(sql_trans *tr, sql_column *c, i
                return bind_ucol(tr, c, access);
        if (tr)
                c->base.rtime = c->t->base.rtime = c->t->s->base.rtime = 
tr->rtime = tr->stime;
-       return delta_bind_bat( c->data, access, isTemp(c));
+       return delta_bind_bat(c->data, access, isTemp(c));
 }
 
 static BAT *
@@ -615,8 +615,9 @@ claim_tab(sql_trans *tr, sql_table *t, w
 
        sql_timestamps *ts;
 
-       node *n, *in;
-       int growF=0;
+       node *n;
+       // *in;
+       //int growF=0;
 
        BAT *insb, *delb = NULL;
 
@@ -633,7 +634,7 @@ claim_tab(sql_trans *tr, sql_table *t, w
         }
        ts = t->data;
 
-       in = t->columns.set->h; /* initial node */
+       //in = t->columns.set->h; /* initial node */
 
        /* claim # of column buns */
        for (n = t->columns.set->h; n; n = n->next) {
@@ -653,8 +654,8 @@ claim_tab(sql_trans *tr, sql_table *t, w
                        BUN newCap = BUNlast(cmbat) + (BUN)cnt;
                        BUN grows = BATgrows(cmbat);
 
-                       if(n==in) /* only once */
-                               growF=1;
+                       //if(n==in) /* only once */
+                               //growF=1;
 
                        if(newCap > grows)
                                grows = newCap;
@@ -700,7 +701,7 @@ claim_tab(sql_trans *tr, sql_table *t, w
        delb = temp_descriptor(ts->delbid);
 
        /* grow insbat */
-       if(((BUN)cnt > (BATcapacity(insb) - BUNlast(insb))) && growF) {
+       if(((BUN)cnt > (BATcapacity(insb) - BUNlast(insb)))/* && growF*/) {
                BUN newCap = BUNlast(insb) + (BUN)cnt;
                 BUN grows = BATgrows(insb);
 
@@ -712,7 +713,7 @@ claim_tab(sql_trans *tr, sql_table *t, w
        BATsetcount(insb, (BATcount(insb) + (BUN)cnt));
 
        /* grow delbat */
-       if(((BUN)cnt > (BATcapacity(delb) - BUNlast(delb))) && growF) {
+       if(((BUN)cnt > (BATcapacity(delb) - BUNlast(delb))) /*&& growF*/) {
                BUN newCap = BUNlast(delb) + (BUN)cnt;
                 BUN grows = BATgrows(delb);
 
@@ -964,6 +965,8 @@ static size_t
 count_col(sql_trans *tr, sql_column *c, int all)
 {
        sql_delta *b;
+       BAT *col;
+       size_t res=0;
 
        if (bat_debug==2)
                printf("#in count_col\n");
@@ -974,12 +977,25 @@ count_col(sql_trans *tr, sql_column *c, 
        }
         b = c->data;
 
+       if(b->bid) {
+               col = temp_descriptor(b->bid);
+               res = (size_t) BATcount(col);
+               bat_destroy(col);
+       }
+
+       (void)all;
+
        if (!b)
                return 1;
-       if (all)
+
+       if(res)
+               return res;
+       else
+               return 0;
+       /*if (all)
                return b->cnt;
        else
-               return 0;
+               return 0;*/
 }
 
 static size_t
@@ -2408,7 +2424,7 @@ update_table(sql_trans *tr, sql_table *f
                        cc->base.allocated = cc->base.rtime = cc->base.wtime = 
0;
                        continue;
                }
-               assert(oc->base.wtime < cc->base.wtime);
+               /*assert(oc->base.wtime < cc->base.wtime);*/
                if (store_nr_active > 1) { /* move delta */
                        sql_delta *b = cc->data, *p = NULL;
 
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -2943,7 +2943,7 @@ validate_tables(sql_schema *s, sql_schem
 
                        ot = find_sql_table(os, t->base.name);
                        if (ot && isKindOfTable(ot) && isKindOfTable(t)) {
-                               if ((t->base.wtime && (t->base.wtime < 
ot->base.rtime || t->base.wtime < ot->base.wtime)) ||
+                               if ((t->base.wtime && (t->base.wtime < 
ot->base.rtime /*|| t->base.wtime < ot->base.wtime*/)) ||
                                    (t->base.rtime && (t->base.rtime < 
ot->base.wtime))) 
                                        return 0;
                                for (o = t->columns.set->h, p = 
ot->columns.set->h; o && p; o = o->next, p = p->next) {
@@ -2956,7 +2956,7 @@ validate_tables(sql_schema *s, sql_schem
                                        /* t wrote, ie. check read and write 
time */
                                        /* read or write after t's write */
                                        if (c->base.wtime && (c->base.wtime < 
oc->base.rtime
-                                                         ||  c->base.wtime < 
oc->base.wtime)) 
+                                                         /*||  c->base.wtime < 
oc->base.wtime*/))
                                                return 0;
                                        /* commited write before t's read */
                                        if (c->base.rtime && c->base.rtime < 
oc->base.wtime) 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to