Changeset: d6019bf23807 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d6019bf23807
Modified Files:
sql/backends/monet5/sql.c
sql/storage/bat/bat_storage.c
sql/storage/store.c
Branch: Oct2020
Log Message:
merged with jun2020
diffs (141 lines):
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -541,6 +541,7 @@ mvc_bind(mvc *m, const char *sname, cons
return NULL;
b = store_funcs.bind_col(tr, c, access);
+ assert(b);
return b;
}
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
@@ -2688,8 +2688,9 @@ static int
update_table(sql_trans *tr, sql_table *ft, sql_table *tt)
{
sql_trans *oldest = oldest_active_transaction();
+ sql_table *ot = NULL;
int ok = LOG_OK;
- node *n, *m;
+ node *n, *m, *o = NULL;
if (ATOMIC_GET(&store_nr_active) == 1 || ft->base.allocated) {
if (ATOMIC_GET(&store_nr_active) > 1 && ft->data) { /* move
delta */
@@ -2706,12 +2707,16 @@ update_table(sql_trans *tr, sql_table *f
bat_destroy(b->cached);
b->cached = NULL;
}
- while (b && b->wtime >= oldest->stime)
- b = b->next;
- if (b && b->next) {
+ /* find table t->base.stime */
+ ot = tr_find_table(oldest, tt);
+ if (b && ot && b->wtime < ot->base.stime) {
+ while (b && b->wtime >= ot->base.stime)
+ b = b->next;
/* anything older can go */
- delayed_destroy_dbat(b->next);
- b->next = NULL;
+ if (b && b->next && b->wtime < ot->base.stime) {
+ delayed_destroy_dbat(b->next);
+ b->next = NULL;
+ }
}
} else if (tt->data && ft->base.allocated) {
if (tr_update_dbat(tr, tt->data, ft->data) != LOG_OK)
@@ -2733,7 +2738,9 @@ update_table(sql_trans *tr, sql_table *f
ft->data = NULL;
}
}
- for (n = ft->columns.set->h, m = tt->columns.set->h; ok == LOG_OK && n
&& m; n = n->next, m = m->next) {
+ if (ot)
+ o = ot->columns.set->h;
+ for (n = ft->columns.set->h, m = tt->columns.set->h; ok == LOG_OK && n
&& m; n = n->next, m = m->next, o=(o?o->next:NULL)) {
sql_column *cc = n->data; // TODO: either stick to to/from
terminology or old/current terminology
sql_column *oc = m->data;
@@ -2741,6 +2748,7 @@ update_table(sql_trans *tr, sql_table *f
assert(!cc->base.wtime || oc->base.wtime <
cc->base.wtime || (oc->base.wtime == cc->base.wtime && oc->base.allocated /*
alter */));
if (ATOMIC_GET(&store_nr_active) > 1 && cc->data) { /*
move delta */
sql_delta *b = cc->data;
+ sql_column *oldc = NULL;
if (!oc->data)
oc->base.allocated = cc->base.allocated;
@@ -2754,12 +2762,17 @@ update_table(sql_trans *tr, sql_table *f
bat_destroy(b->cached);
b->cached = NULL;
}
- while (b && b->wtime >= oldest->stime)
- b = b->next;
- if (b && b->next) {
+ /* find column c->base.stime */
+ if (o)
+ oldc = o->data;
+ if (oldc && b && oldc->base.id == cc->base.id
&& b->wtime < oldc->base.stime) {
+ while (b && b->wtime >=
oldc->base.stime)
+ b = b->next;
/* anything older can go */
- delayed_destroy_bat(b->next);
- b->next = NULL;
+ if (b && b->next && b->wtime <
oldc->base.stime) {
+ delayed_destroy_bat(b->next);
+ b->next = NULL;
+ }
}
} else if (oc->data && cc->base.allocated) {
if (tr_update_delta(tr, oc->data, cc->data,
cc->unique == 1) != LOG_OK)
@@ -2812,7 +2825,9 @@ update_table(sql_trans *tr, sql_table *f
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) {
+ if (ot)
+ o = ot->idxs.set->h;
+ for (n = ft->idxs.set->h, m = tt->idxs.set->h; ok == LOG_OK &&
n && m; n = n->next, m = m->next, o=(o?o->next:NULL)) {
sql_idx *ci = n->data;
sql_idx *oi = m->data;
@@ -2825,6 +2840,7 @@ update_table(sql_trans *tr, sql_table *f
if (ATOMIC_GET(&store_nr_active) == 1 ||
(ci->base.wtime && ci->base.allocated)) {
if (ATOMIC_GET(&store_nr_active) > 1 &&
ci->data) { /* move delta */
sql_delta *b = ci->data;
+ sql_idx *oldi = NULL;
if (!oi->data)
oi->base.allocated =
ci->base.allocated;
@@ -2838,12 +2854,16 @@ update_table(sql_trans *tr, sql_table *f
bat_destroy(b->cached);
b->cached = NULL;
}
- while (b && b->wtime >= oldest->stime)
- b = b->next;
- if (b && b->next) {
+ if (o)
+ oldi = o->data;
+ if (oldi && b && oldi->base.id ==
ci->base.id && b->wtime < oldi->base.stime) {
+ while (b && b->wtime >=
oldi->base.stime)
+ b = b->next;
/* anything older can go */
- delayed_destroy_bat(b->next);
- b->next = NULL;
+ if (b && b->next && b->wtime >=
oldi->base.stime) {
+
delayed_destroy_bat(b->next);
+ b->next = NULL;
+ }
}
} else if (oi->data && ci->base.allocated) {
if (tr_update_delta(tr, oi->data,
ci->data, 0) != LOG_OK)
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -1872,6 +1872,7 @@ bootstrap_create_schema(sql_trans *tr, c
cs_new(&s->types, tr->sa, (fdestroy) NULL);
cs_new(&s->funcs, tr->sa, (fdestroy) NULL);
cs_new(&s->seqs, tr->sa, (fdestroy) NULL);
+ cs_new(&s->parts, tr->sa, (fdestroy) &part_destroy);
s->keys = list_new(tr->sa, (fdestroy) NULL);
s->idxs = list_new(tr->sa, (fdestroy) NULL);
s->triggers = list_new(tr->sa, (fdestroy) NULL);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list