Changeset: 43729456ea0a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=43729456ea0a
Modified Files:
sql/backends/monet5/sql.mx
sql/storage/bat/bat_storage.c
sql/storage/bat/bat_storage.h
sql/storage/bat/bat_table.c
sql/storage/sql_storage.h
sql/storage/store.c
Branch: newstorage
Log Message:
fixed all bugs during startup. fixed/finished claim_tab, append_col,
append_idx, timestamps_insert. discard delta ibid.
diffs (truncated from 1337 to 300 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
@@ -7010,11 +7010,11 @@ str SQLcluster1(Client cntxt, MalBlkPtr
d = c->data;
if (d->bid)
BBPdecref(d->bid, TRUE);
- if (d->ibid)
- BBPdecref(d->ibid, TRUE);
+ //if (d->ibid)
+ //BBPdecref(d->ibid, TRUE);
d->bid = 0;
d->ibase = 0;
- d->ibid = bid; /* use the insert bat */
+ //d->ibid = bid; /* use the insert bat */
c->base.wtime = tr->wstime;
c->base.rtime = tr->stime;
}
@@ -7087,11 +7087,11 @@ SQLcluster2(Client cntxt, MalBlkPtr mb,
d = c->data;
if (d->bid)
BBPdecref(d->bid, TRUE);
- if (d->ibid)
- BBPdecref(d->ibid, TRUE);
+ //if (d->ibid)
+ // BBPdecref(d->ibid, TRUE);
d->bid = 0;
d->ibase = 0;
- d->ibid = bid; /* use the insert bat */
+ //d->ibid = bid; /* use the insert bat */
c->base.wtime = tr->wstime;
c->base.rtime = tr->stime;
@@ -7342,11 +7342,11 @@ compression(Client cntxt, MalBlkPtr mb,
d = c->data;
if (d->bid)
BBPdecref(d->bid, TRUE);
- if (d->ibid)
- BBPdecref(d->ibid, TRUE);
+ //if (d->ibid)
+ //BBPdecref(d->ibid, TRUE);
d->bid = 0;
d->ibase = 0;
- d->ibid = e->batCacheid; /* use the insert bat */
+ //d->ibid = e->batCacheid; /* use the insert bat */
c->base.wtime = tr->wstime;
c->base.rtime = tr->stime;
snprintf(buf,BUFSIZ,"%s/%s/%s/0", *sch, *tbl, c->base.name);
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
@@ -58,7 +58,6 @@ delta_bind_del(sql_dbat *bat, int access
#ifdef NDEBUG
(void) access; /* satisfy compiler */
#endif
- //printf("#in delta_bind_del\n");
assert(access == RDONLY || access == RD_INS);
assert(access!=RD_UPD);
@@ -71,7 +70,6 @@ delta_bind_del(sql_dbat *bat, int access
static BAT *
bind_del(sql_trans *tr, sql_table *t, int access)
{
- //printf("#in bind_del\n");
if (!t->data) {
sql_table *ot = tr_find_table(tr->parent, t);
t->data = timestamp_dbat(ot->data, tr->stime);
@@ -80,6 +78,7 @@ bind_del(sql_trans *tr, sql_table *t, in
return delta_bind_del(t->data, access);
}
+/* ToDo : bind ts bats */
/**static BAT *
bind_ts_insert(sql_trans *tr, sql_table *t, int access) {
@@ -162,10 +161,11 @@ delta_bind_bat( sql_delta *bat, int acce
BAT *b;
printf("#in delta_bind_bat\n");
+ (void)temp;
assert(access == RDONLY || access == RD_INS);
assert(bat != NULL);
- if (temp || access == RD_INS) {
+ /*if (temp || access == RD_INS) {
assert(bat->ibid);
b = temp_descriptor(bat->ibid);
if (BATcount(b) && bat->ubid) {
@@ -182,10 +182,10 @@ delta_bind_bat( sql_delta *bat, int acce
tt = b->ttype;
bat_destroy(b);
b = e_BAT(tt);
- } else {
- b = temp_descriptor(bat->bid);
- bat_set_access(b, BAT_READ);
- }
+ } else { */
+ b = temp_descriptor(bat->bid);
+ bat_set_access(b, BAT_READ);
+ //}
assert(b);
return b;
}
@@ -209,9 +209,6 @@ bind_col(sql_trans *tr, sql_column *c, i
static BAT *
bind_idx(sql_trans *tr, sql_idx * i, int access)
{
-
- printf("#in bind_idx\n");
-
if (!i->data) {
sql_idx *oi = tr_find_idx(tr->parent, i);
i->data = timestamp_delta(oi->data, tr->stime);
@@ -236,16 +233,17 @@ delta_update_bat( sql_delta *bat, BAT *t
bat->cached = NULL;
}
if (!is_new && bat->ubid) {
- BAT *ib = temp_descriptor(bat->ibid), *u = upd;
-
- if (BATcount(ib)) {
+ BAT *u = upd;
+ /*BAT *ib = temp_descriptor(bat->ibid);
+
+ if (BATcount(ib)) {
BAT *updins;
updins = BATsemijoin(upd, ib);
void_replace_bat(ib, updins, TRUE);
bat_destroy(updins);
}
- bat_destroy(ib);
+ bat_destroy(ib);*/
b = temp_descriptor(bat->ubid);
assert(b);
@@ -260,10 +258,10 @@ delta_update_bat( sql_delta *bat, BAT *t
BATreplace(b, u, TRUE);
if (upd != u)
bat_destroy(u);
- } else if (is_new && bat->bid) {
- BAT *ib = temp_descriptor(bat->ibid);
+ } else /*if (is_new && bat->bid)*/ {
+ //BAT *ib = temp_descriptor(bat->ibid);
b = temp_descriptor(bat->bid);
- if (BATcount(ib)) {
+ /*if (BATcount(ib)) {
BAT *updins, *updcur;
updins = BATsemijoin(upd, ib);
void_replace_bat(ib, updins, TRUE);
@@ -271,15 +269,15 @@ delta_update_bat( sql_delta *bat, BAT *t
updcur = BATsemijoin(upd, b);
void_replace_bat(b, updcur, TRUE);
bat_destroy(updcur);
- } else {
+ } else {*/
b = temp_descriptor(bat->bid);
void_replace_bat(b, upd, TRUE);
- }
- bat_destroy(ib);
- } else {
+ //}
+ //bat_destroy(ib);
+ } /*else {
b = temp_descriptor(bat->ibid);
void_replace_bat(b, upd, TRUE);
- }
+ }*/
bat->ucnt = BATcount(b);
bat_destroy(b);
bat_destroy(upd);
@@ -299,11 +297,11 @@ delta_update_val( sql_delta *bat, oid ri
bat->cached = NULL;
}
if (bat->ubid) {
- BAT *ib = temp_descriptor(bat->ibid);
-
- if (BATcount(ib) && ib->hseqbase <= rid) {
- void_inplace(ib, rid, upd, TRUE);
- } else {
+ //BAT *ib = temp_descriptor(bat->ibid);
+
+ //if (BATcount(ib) && ib->hseqbase <= rid) {
+ //void_inplace(ib, rid, upd, TRUE);
+ //} else {
b = temp_descriptor(bat->ubid);
assert(b);
@@ -316,11 +314,11 @@ delta_update_val( sql_delta *bat, oid ri
BATkey(b, BOUND2BTRUE);
BUNins(b, (ptr) &rid, upd, TRUE);
}
- bat_destroy(ib);
- } else {
+ //bat_destroy(ib);
+ /*} else {
b = temp_descriptor(bat->ibid);
void_inplace(b, rid, upd, TRUE);
- }
+ }*/
if (b) {
bat->ucnt = BATcount(b);
bat_destroy(b);
@@ -330,73 +328,79 @@ delta_update_val( sql_delta *bat, oid ri
static int
dup_delta(sql_trans *tr, sql_delta *obat, sql_delta *bat, int type, int
oc_isnew, int c_isnew, int temp, int sz)
{
-
printf("#in dup_delta\n");
+ (void)temp; (void)tr; (void)type; (void)oc_isnew; (void)sz;
if (!obat)
return LOG_OK;
- bat->ibid = obat->ibid;
- bat->bid = obat->bid;
- bat->ubid = obat->ubid;
- bat->ibase = obat->ibase;
- bat->cnt = obat->cnt;
- bat->ucnt = obat->ucnt;
- bat->wtime = obat->wtime;
-
- bat->name = _STRDUP(obat->name);
-
- if (!bat->ibid)
+ //bat->ibid = obat->ibid;
+ if(obat->bid)
+ bat->bid = obat->bid;
+ if(obat->ubid)
+ bat->ubid = obat->ubid;
+ if(obat->ibase)
+ bat->ibase = obat->ibase;
+ if(obat->cnt)
+ bat->cnt = obat->cnt;
+ if(obat->ucnt)
+ bat->ucnt = obat->ucnt;
+ if(obat->wtime)
+ bat->wtime = obat->wtime;
+
+ if(obat->name)
+ bat->name = _STRDUP(obat->name);
+
+ if (!bat->bid)
return LOG_OK;
- if (bat->ibid) {
- BAT *b;
- if (temp) {
- bat->ibid = temp_copy(bat->ibid, 1);
- } else if (oc_isnew && !bat->bid) {
+ //if (bat->ibid) {
+ //BAT *b;
+ //if (temp) {
+ // bat->ibid = temp_copy(bat->ibid, 1);
+ //} else if (oc_isnew && !bat->bid) {
/* move the bat to the new col, fixup the old col*/
- b = bat_new(TYPE_void, type, sz);
- bat_set_access(b, BAT_READ);
- obat->ibid = temp_create(b);
- obat->ibase = bat->ibase = (oid) obat->cnt;
- BATseqbase(b, obat->ibase);
- bat_destroy(b);
- if (c_isnew && tr->parent == gtrans) {
+ //b = bat_new(TYPE_void, type, sz);
+ //bat_set_access(b, BAT_READ);
+ //obat->ibid = temp_create(b);
+ //obat->ibase = bat->ibase = (oid) obat->cnt;
+ //BATseqbase(b, obat->ibase);
+ //bat_destroy(b);
+ //if (c_isnew && tr->parent == gtrans) {
/* new cols are moved to gtrans and bat.bid */
- temp_dup(bat->ibid);
- obat->bid = bat->ibid;
- } else if (!c_isnew) {
- bat->bid = bat->ibid;
-
- b = bat_new(TYPE_void, type, sz);
- bat_set_access(b, BAT_READ);
- BATseqbase(b, bat->ibase);
- bat->ibid = temp_create(b);
- }
- } else { /* old column */
- bat->ibid = ebat_copy(bat->ibid, bat->ibase, 0);
- }
- }
- if (!temp && bat->ibid) {
+ //temp_dup(bat->bid);
+ //obat->bid = bat->bid;
+ //} else if (!c_isnew) {
+ // bat->bid = bat->ibid;
+
+ // b = bat_new(TYPE_void, type, sz);
+ // bat_set_access(b, BAT_READ);
+ // BATseqbase(b, bat->ibase);
+ // bat->ibid = temp_create(b);
+ //}
+ //} else { /* old column */
+ // bat->ibid = ebat_copy(bat->ibid, bat->ibase, 0);
+ //}
+ //}
+ if (!temp && bat->bid) {
if (bat->ubid) {
- if (c_isnew && tr->parent == gtrans) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list