Changeset: 856396302fc6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=856396302fc6
Modified Files:
        gdk/gdk_join.c
        gdk/gdk_private.h
        sql/storage/bat/bat_storage.c
        sql/storage/store.c
Branch: default
Log Message:

Merge with Apr2019 branch.


diffs (214 lines):

diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -99,8 +99,6 @@ void BBPdump(void)            /* never called: for
        __attribute__((__visibility__("hidden")));
 __hidden BUN binsearch(const oid *restrict indir, oid offset, int type, const 
void *restrict vals, const char * restrict vars, int width, BUN lo, BUN hi, 
const void *restrict v, int ordering, int last)
        __attribute__((__visibility__("hidden")));
-__hidden bool binsearchcand(const oid *cand, BUN lo, BUN hi, oid v)
-       __attribute__((__visibility__("hidden")));
 __hidden BUN binsearch_bte(const oid *restrict indir, oid offset, const bte 
*restrict vals, BUN lo, BUN hi, bte v, int ordering, int last)
        __attribute__((__visibility__("hidden")));
 __hidden BUN binsearch_sht(const oid *restrict indir, oid offset, const sht 
*restrict vals, BUN lo, BUN hi, sht v, int ordering, int last)
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
@@ -54,6 +54,7 @@ bind_del(sql_trans *tr, sql_table *t, in
                sql_table *ot = tr_find_table(tr->parent, t);
                t->data = timestamp_dbat(ot->data, t->base.stime);
        }
+       assert(!store_initialized || tr != gtrans);
        t->s->base.rtime = t->base.rtime = tr->stime;
        return delta_bind_del(t->data, access);
 }
@@ -101,6 +102,7 @@ bind_ucol(sql_trans *tr, sql_column *c, 
                sql_table *ot = tr_find_table(tr->parent, c->t);
                c->t->data = timestamp_dbat(ot->data, c->t->base.stime);
        }
+       assert(tr != gtrans);
        c->t->s->base.rtime = c->t->base.rtime = c->base.rtime = tr->stime;
        u = delta_bind_ubat(c->data, access, c->type.type->localtype);
        return u;
@@ -120,6 +122,7 @@ bind_uidx(sql_trans *tr, sql_idx * i, in
                sql_table *ot = tr_find_table(tr->parent, i->t);
                i->t->data = timestamp_dbat(ot->data, i->t->base.stime);
        }
+       assert(tr != gtrans);
        i->base.rtime = i->t->base.rtime = i->t->s->base.rtime = tr->rtime = 
tr->stime;
        u = delta_bind_ubat(i->data, access, 
(oid_index(i->type))?TYPE_oid:TYPE_lng);
        return u;
@@ -206,7 +209,8 @@ bind_col(sql_trans *tr, sql_column *c, i
        }
        if (access == RD_UPD_ID || access == RD_UPD_VAL)
                return bind_ucol(tr, c, access);
-       if (tr)
+       assert(access == QUICK || tr != gtrans);
+       if (tr && access != QUICK)
                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));
 }
@@ -223,7 +227,8 @@ bind_idx(sql_trans *tr, sql_idx * i, int
        }
        if (access == RD_UPD_ID || access == RD_UPD_VAL)
                return bind_uidx(tr, i, access);
-       if (tr)
+       assert(access == QUICK || tr != gtrans);
+       if (tr && access != QUICK)
                i->base.rtime = i->t->base.rtime = i->t->s->base.rtime = 
tr->rtime = tr->stime;
        return delta_bind_bat( i->data, access, isTemp(i));
 }
@@ -598,6 +603,7 @@ update_col(sql_trans *tr, sql_column *c,
        }
        bat = c->data;
        bat->wtime = c->base.wtime = c->t->base.wtime = c->t->s->base.wtime = 
tr->wtime = tr->wstime;
+       assert(tr != gtrans);
        c->base.rtime = c->t->base.rtime = c->t->s->base.rtime = tr->rtime = 
tr->stime;
        if (tpe == TYPE_bat)
                return delta_update_bat(bat, tids, upd, isNew(c));
@@ -628,6 +634,7 @@ update_idx(sql_trans *tr, sql_idx * i, v
        }
        bat = i->data;
        bat->wtime = i->base.wtime = i->t->base.wtime = i->t->s->base.wtime = 
tr->wtime = tr->wstime;
+       assert(tr != gtrans);
        i->base.rtime = i->t->base.rtime = i->t->s->base.rtime = tr->rtime = 
tr->stime;
        if (tpe == TYPE_bat)
                return delta_update_bat(bat, tids, upd, isNew(i));
@@ -843,6 +850,7 @@ append_col(sql_trans *tr, sql_column *c,
        bat->wtime = c->base.wtime = c->t->base.wtime = c->t->s->base.wtime = 
tr->wtime = tr->wstime;
        /* inserts are ordered with the current delta implementation */
        /* therefor mark appends as reads */
+       assert(tr != gtrans);
        c->t->s->base.rtime = c->t->base.rtime = tr->stime;
        if (tpe == TYPE_bat)
                ok = delta_append_bat(bat, i);
@@ -2824,11 +2832,9 @@ update_table(sql_trans *tr, sql_table *f
                        oc->base.rtime = cc->base.rtime;
                if (oc->base.wtime < cc->base.wtime)
                        oc->base.wtime = cc->base.wtime;
-               if (cc->base.stime < oc->base.wtime)
-                       cc->base.stime = oc->base.wtime;
                if (cc->data) 
                        destroy_col(tr, cc);
-               cc->base.allocated = cc->base.rtime = cc->base.wtime = 0;
+               cc->base.allocated = 0;
        }
        if (ok == LOG_OK && tt->idxs.set) {
                for (n = ft->idxs.set->h, m = tt->idxs.set->h; ok == LOG_OK && 
n && m; n = n->next, m = m->next) {
@@ -2838,7 +2844,7 @@ update_table(sql_trans *tr, sql_table *f
                        /* some indices have no bats */
                        if (!oi->data) {
                                ci->data = NULL;
-                               ci->base.allocated = ci->base.rtime = 
ci->base.wtime = 0;
+                               ci->base.allocated = 0;
                                continue;
                        }
                        if (ATOMIC_GET(&store_nr_active) == 1 || 
(ci->base.wtime && ci->base.allocated)) {
@@ -2875,22 +2881,18 @@ update_table(sql_trans *tr, sql_table *f
                                oi->base.rtime = ci->base.rtime;
                        if (oi->base.wtime < ci->base.wtime)
                                oi->base.wtime = ci->base.wtime;
-                       if (ci->base.stime < oi->base.wtime)
-                               ci->base.stime = oi->base.wtime;
                        if (ci->data)
                                destroy_idx(tr, ci);
-                       ci->base.allocated = ci->base.rtime = ci->base.wtime = 
0;
+                       ci->base.allocated = 0;
                }
        }
        if (tt->base.rtime < ft->base.rtime)
                tt->base.rtime = ft->base.rtime;
        if (tt->base.wtime < ft->base.wtime)
                tt->base.wtime = ft->base.wtime;
-       if (ft->base.stime < tt->base.wtime)
-               ft->base.stime = tt->base.wtime;
        if (ft->data)
                destroy_del(tr, ft);
-       ft->base.allocated = ft->base.rtime = ft->base.wtime = 0;
+       ft->base.allocated = 0;
        return ok;
 }
 
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -64,7 +64,7 @@ key_cmp(sql_key *k, sqlid *id)
 
 static int stamp = 1;
 
-static int timestamp (void) {
+static int timestamp(void) {
        return stamp++;
 }
 
@@ -1254,7 +1254,7 @@ create_trans(sql_allocator *sa, backend_
        t->name = NULL;
        t->wtime = t->rtime = 0;
        t->stime = 0;
-       t->wstime = timestamp ();
+       t->wstime = timestamp();
        t->schema_updates = 0;
        t->status = 0;
 
@@ -2201,6 +2201,7 @@ store_exit(void)
        fprintf(stderr, "#store exit unlocked\n");
 #endif
        MT_lock_unset(&bs_lock);
+       store_initialized=0;
 }
 
 
@@ -3152,7 +3153,7 @@ static void
 {
        tr->wtime = tr->rtime = 0;
        tr->stime = otr->wtime;
-       tr->wstime = timestamp ();
+       tr->wstime = timestamp();
        tr->schema_updates = 0;
        tr->dropped = NULL;
        tr->status = 0;
@@ -3321,6 +3322,7 @@ rollforward_changeset_updates(sql_trans 
                                if (fb->wtime && !newFlagSet(fb->flags)) {
                                        node *tbn = cs_find_id(ts, fb->id);
 
+                                       assert(fb->rtime <= fb->wtime);
                                        if (tbn) {
                                                sql_base *tb = tbn->data;
 
@@ -3333,6 +3335,7 @@ rollforward_changeset_updates(sql_trans 
                                                        tb->wtime = fb->wtime;
                                                if (apply)
                                                        fb->stime = tb->stime = 
tb->wtime;
+                                               assert(!apply || tb->rtime <= 
tb->wtime);
                                        }
                                }
                        }
@@ -3752,7 +3755,6 @@ rollforward_update_table(sql_trans *tr, 
                                fprintf(stderr, "#update table %s\n", 
tt->base.name);
                        ok = store_funcs.update_table(tr, ft, tt);
                        ft->cleared = 0;
-                       ft->base.rtime = ft->base.wtime = 0;
                        tt->access = ft->access;
                }
        }
@@ -4143,13 +4145,11 @@ reset_schema(sql_trans *tr, sql_schema *
                                n = nxt;
                        }
                }
-               fs->base.wtime = fs->base.rtime = 0;
                return ok;
        }
 
        /* did we access the schema or is the global changed after we started */
        if (fs->base.rtime || fs->base.wtime || tr->stime < pfs->base.wtime) {
-               fs->base.wtime = fs->base.rtime = 0;
 
                if (tr->status == 1 && isRenamed(fs)) { /* remove possible 
renaming */
                        list_hash_delete(tr->schemas.set, fs, NULL);
@@ -4179,7 +4179,6 @@ reset_trans(sql_trans *tr, sql_trans *pt
 #ifdef STORE_DEBUG
        fprintf(stderr,"#reset trans %d\n", tr->wtime);
 #endif
-       tr->wtime = tr->rtime = 0;
        return res;
 }
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to