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

more fixes. have some (logging)? problems when 2 clients insert ~1300 tuples 
each and auto-commit mode is off


diffs (140 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
@@ -3549,10 +3549,10 @@ DELTAbat(bat *result, bat *col, bat *uid
                throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
 
        /* bat may change */
-       if (i && BATcount(c) == 0 && BATcount(u_id) == 0) {
+       /*if (i && BATcount(c) == 0 && BATcount(u_id) == 0) {
                BBPincref(*result = *ins, TRUE);
                return MAL_SUCCEED;
-       }
+       }*/
 
        c = BATdescriptor(*col);
        if ((res = BATcopy(c, TYPE_void, c->ttype, TRUE)) == NULL) 
diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -702,17 +702,17 @@ mvc_import_table(Client cntxt, mvc *m, b
                                }
                        }
                }
-               if (locked) { /* fix delta structures and transaction */
-                       for (n = t->columns.set->h, i = 0; n; n = n->next, i++) 
{
-                               sql_column *c = n->data;
-                               BAT *b = store_funcs.bind_col(m->session->tr, 
c, RDONLY);
-                               sql_delta *d = c->data;
+               //if (locked) { /* fix delta structures and transaction */
+               //      for (n = t->columns.set->h, i = 0; n; n = n->next, i++) 
{
+               //              sql_column *c = n->data;
+               //              BAT *b = store_funcs.bind_col(m->session->tr, 
c, RDONLY);
+               //              sql_delta *d = c->data;
 
-                               c->base.wtime = t->base.wtime = 
t->s->base.wtime = m->session->tr->wtime = m->session->tr->wstime;
-                               d->ibase = (oid) (d->cnt = BATcount(b));
-                               BBPunfix(b->batCacheid);
-                       }
-               }
+               //              c->base.wtime = t->base.wtime = 
t->s->base.wtime = m->session->tr->wtime = m->session->tr->wstime;
+                               //d->ibase = (oid) (d->cnt = BATcount(b));
+               //              BBPunfix(b->batCacheid);
+               //      }
+               //}
                if (as.error) 
                        sql_error(m, 500, "%s", as.error);
                for (n = t->columns.set->h, i = 0; n; n = n->next, i++) {
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
@@ -965,7 +965,7 @@ static size_t
 count_col(sql_trans *tr, sql_column *c, int all)
 {
        sql_delta *b;
-       BAT *col;
+       BAT *col = NULL;
        size_t res=0;
 
        if (bat_debug==2)
@@ -1001,7 +1001,9 @@ count_col(sql_trans *tr, sql_column *c, 
 static size_t
 count_idx(sql_trans *tr, sql_idx *i, int all)
 {
+       BAT *idx = NULL;
        sql_delta *b;
+       size_t res = 0;
 
        if (bat_debug==2)
                printf("#in count_idx\n");
@@ -1011,12 +1013,22 @@ count_idx(sql_trans *tr, sql_idx *i, int
                i->data = timestamp_delta(oi->data, tr->stime);
        }
        b = i->data;
+
+       if(b->bid) {
+               idx = temp_descriptor(b->bid);
+               res = (size_t) BATcount(idx);
+               bat_destroy(idx);
+       }
+
+       (void)all;
+
        if (!b)
                return 0;
-       if (all) 
-               return b->cnt;
+
+       if (res)
+               return res;
        else
-               return b->cnt;// - b->ibase;
+               return 0;
 }
 
 static size_t
@@ -1086,9 +1098,8 @@ load_delta(sql_delta *bat, int bid, int 
        if (!b)
                return LOG_ERR;
        bat->bid = temp_create(b);
-       bat->ibase = BATcount(b);
-       bat->cnt = bat->ibase; 
-       bat->ucnt = 0; 
+       bat->cnt = BATcount(b);
+       bat->ucnt = 0;
        bat->ubid = e_ubat(type);
        return LOG_OK;
 }
@@ -1202,7 +1213,7 @@ create_col(sql_trans *tr, sql_column *c)
                                sql_delta *d = fc->data;
 
                                bat->bid = copyBat(d->bid, type, 0);
-                               bat->ibase = d->ibase;
+                               //bat->ibase = d->ibase;
                                bat->cnt = d->cnt;
                                if (d->ubid)
                                        bat->ubid = e_ubat(type);
@@ -1283,7 +1294,7 @@ create_idx(sql_trans *tr, sql_idx *ni)
                        /* These need to be created aligned to the existing 
data */
 
                        bat->bid = copyBat(d->bid, type, 0);
-                       bat->ibase = d->ibase;
+                       //bat->ibase = d->ibase;
                        bat->cnt = d->cnt;
                        bat->ucnt = 0;
 
@@ -2229,10 +2240,10 @@ tr_update_delta( sql_trans *tr, sql_delt
                temp_destroy(obat->ibid);
                obat->ibid = e_bat(cur->ttype);
        }*/
-       if (obat->cnt != cbat->cnt) { /* locked */
-               obat->cnt = cbat->cnt;
-               obat->ibase = cbat->ibase;
-       }
+       //if (obat->cnt != cbat->cnt) { /* locked */
+               //obat->cnt = cbat->cnt;
+               //obat->ibase = cbat->ibase;
+       //}
        //bat_destroy(ins);
 
        if (cbat->ucnt || cleared) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to