Re: MonetDB: newstorage - creating delete-transaction bat
If intended for debugging only, wrap them in #ifdef DEBUG_STORE ... #endif On 10/19/13 6:26 PM, Rene Tassy wrote:
Changeset: d5436b5b660d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d5436b5b660d Modified Files: sql/backends/monet5/sql_scenario.c sql/server/sql_mvc.c sql/storage/bat/bat_storage.c sql/storage/bat/bat_storage.h sql/storage/bat/bat_table.c sql/storage/store.c Branch: newstorage Log Message:
creating delete-transaction bat
diffs (truncated from 1821 to 300 lines):
diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -1932,6 +1932,9 @@ SQLparser(Client c) } } finalize: + + printf("-----finalizing\n"); This printf is not correct, use mstr_printf(c->fdout,.... + if (msg) sqlcleanup(m, 0); return msg; diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c --- a/sql/server/sql_mvc.c +++ b/sql/server/sql_mvc.c @@ -182,6 +182,8 @@ mvc_trans(mvc *m) int schema_changed = 0, err = m->session->status; assert(!m->session->active); /* can only start a new transaction */
+ printf("in mvc_trans\n"); + store_lock(); schema_changed = sql_trans_begin(m->session); if (m->qc && (schema_changed || m->qc->nr > m->cache || err)){ @@ -206,6 +208,8 @@ mvc_commit(mvc *m, int chain, char *name assert(tr); assert(m->session->active); /* only commit an active transaction */
+ printf("in mvc commit\n"); + if (mvc_debug) fprintf(stderr, "#mvc_commit %s\n", (name) ? name : "");
@@ -288,6 +292,7 @@ build up the hash (not copyied in the tr mvc_rollback(m, chain, name); return -1; } + sql_trans_end(m->session); if (chain) sql_trans_begin(m->session); @@ -304,6 +309,8 @@ mvc_rollback(mvc *m, int chain, char *na int res = 0; sql_trans *tr = m->session->tr;
+ printf("in mvc_rollback"); + if (mvc_debug) fprintf(stderr, "#mvc_rollback %s\n", (name) ? name : "");
@@ -340,6 +347,7 @@ mvc_rollback(mvc *m, int chain, char *na tr = sql_trans_destroy(tr); } m->session-> tr = tr; + /* make sure we do not reuse changed data */ if (tr->wtime) tr->status = 1; 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 @@ -12,7 +12,7 @@ * The Original Code is the MonetDB Database System. * * The Initial Developer of the Original Code is CWI. - * Portions created by CWI are Copyright (C) 1997-July 2008 CWI. + Portions created by CWI are Copyright (C) 1997-July 2008 CWI. * Copyright August 2008-2013 MonetDB B.V. * All Rights Reserved. */ @@ -50,6 +50,9 @@ 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);
@@ -61,6 +64,9 @@ 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); @@ -77,6 +83,8 @@ delta_bind_ubat(sql_delta *bat, int acce #ifdef NDEBUG (void) access; /* satisfy compiler */ #endif + printf("in delta_bind_ubat\n"); + assert(access == RD_UPD); if (bat->ubid) b = temp_descriptor(bat->ubid); @@ -91,6 +99,8 @@ bind_ucol(sql_trans *tr, sql_column *c, { BAT *u = NULL, *d, *r;
+ printf("in bind_ucol\n"); + if (!c->data) { sql_column *oc = tr_find_column(tr->parent, c); c->data = timestamp_delta(oc->data, tr->stime); @@ -115,6 +125,8 @@ bind_uidx(sql_trans *tr, sql_idx * i, in { BAT *u = NULL, *d, *r;
+ printf("in bind_uidx\n"); + if (!i->data) { sql_idx *oi = tr_find_idx(tr->parent, i); i->data = timestamp_delta(oi->data, tr->stime); @@ -139,6 +151,8 @@ delta_bind_bat( sql_delta *bat, int acce { BAT *b;
+ printf("in delta_bind_bat\n"); + assert(access == RDONLY || access == RD_INS); assert(bat != NULL); if (temp || access == RD_INS) { @@ -169,6 +183,8 @@ delta_bind_bat( sql_delta *bat, int acce static BAT * bind_col(sql_trans *tr, sql_column *c, int access) { + printf("in bind_col\n"); + if (!c->data) { sql_column *oc = tr_find_column(tr->parent, c); c->data = timestamp_delta(oc->data, tr->stime); @@ -183,6 +199,9 @@ 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); @@ -200,6 +219,8 @@ delta_update_bat( sql_delta *bat, BAT *t BAT *b; BAT *upd = BATleftfetchjoin(BATmirror(tids), updates, BATcount(tids));
+ printf("in delta_update_bat\n"); + if (bat->cached) { bat_destroy(bat->cached); bat->cached = NULL; @@ -259,6 +280,8 @@ delta_update_val( sql_delta *bat, oid ri { BAT *b = NULL;
+ printf("in delta_update_val\n"); + assert(rid != oid_nil);
if (bat->cached) { @@ -297,6 +320,9 @@ 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"); + if (!obat) return LOG_OK; bat->ibid = obat->ibid; @@ -359,6 +385,8 @@ dup_delta(sql_trans *tr, sql_delta *obat int dup_bat(sql_trans *tr, sql_table *t, sql_delta *obat, sql_delta *bat, int type, int oc_isnew, int c_isnew) { + printf("in dup_bat\n"); + return dup_delta( tr, obat, bat, type, oc_isnew, c_isnew, isTempTable(t), t->sz); }
@@ -368,6 +396,8 @@ update_col(sql_trans *tr, sql_column *c, BAT *b = tids; sql_delta *bat;
+ printf("in update_col\n"); + if (tpe == TYPE_bat && !BATcount(b)) return;
@@ -393,6 +423,8 @@ update_idx(sql_trans *tr, sql_idx * i, v BAT *b = tids; sql_delta *bat;
+ printf("in update_idx\n"); + if (tpe == TYPE_bat && !BATcount(b)) return;
@@ -422,6 +454,8 @@ delta_append_bat( sql_delta *bat, BAT *i assert(!c || c->htype == TYPE_void); #endif
+ printf("in delta_append_bat\n"); + if (!BATcount(i)) return ; b = temp_descriptor(bat->ibid); @@ -460,12 +494,15 @@ delta_append_bat( sql_delta *bat, BAT *i static void delta_append_val( sql_delta *bat, void *i ) { + BAT *b = temp_descriptor(bat->ibid); #ifndef NDEBUG BAT *c = BBPquickdesc(bat->bid, 0); assert(!c || c->htype == TYPE_void); #endif
+ printf("in delta append val\n"); + assert(b->htype == TYPE_void); if (bat->cached) { bat_destroy(bat->cached); @@ -503,6 +540,8 @@ dup_idx(sql_trans *tr, sql_idx *i, sql_i { int ok = LOG_OK;
+ printf("in dup_idx\n"); + if (i->data) { int type = (ni->type==join_idx)?TYPE_oid:TYPE_wrd; sql_delta *bat = ni->data = ZNEW(sql_delta), *obat = i->data; @@ -515,15 +554,27 @@ dup_idx(sql_trans *tr, sql_idx *i, sql_i static int dup_dbat( sql_trans *tr, sql_dbat *obat, sql_dbat *bat, int is_new, int temp) { + + printf("in dup_dbat\n"); + bat->dbid = obat->dbid; + + bat->dtrbid = obat->dtrbid; + bat->cnt = obat->cnt; + bat->dname = _STRDUP(obat->dname); + + bat->dtrname = _STRDUP(obat->dtrname); + bat->wtime = obat->wtime; if (bat->dbid) { if (is_new) { obat->dbid = temp_copy(bat->dbid, temp); + obat->dtrbid = temp_copy(bat->dtrbid, temp); } else { bat->dbid = ebat_copy(bat->dbid, 0, temp); + bat->dtrbid = ebat_copy(bat->dtrbid, 0, temp); } } (void)tr; @@ -546,6 +597,8 @@ append_col(sql_trans *tr, sql_column *c, BAT *b = i; sql_delta *bat;
+ printf("in append_col\n"); + if (tpe == TYPE_bat && !BATcount(b)) return;
@@ -574,6 +627,8 @@ append_idx(sql_trans *tr, sql_idx * i, v BAT *b = ib; sql_delta *bat;
+ printf("in append_idx\n"); + if (tpe == TYPE_bat && !BATcount(b)) return;
@@ -598,6 +653,8 @@ delta_delete_bat( sql_dbat *bat, BAT *i { BAT *b = temp_descriptor(bat->dbid);
+ printf("in delta_delete_bat\n"); + if (isEbat(b)) { temp_destroy(bat->dbid); bat->dbid = temp_copy(b->batCacheid, FALSE); @@ -616,6 +673,8 @@ delta_delete_val( sql_dbat *bat, oid rid { BAT *b = temp_descriptor(bat->dbid);
+ printf("in delta_delete_val\n"); + if (isEbat(b)) { temp_destroy(bat->dbid); bat->dbid = temp_copy(b->batCacheid, FALSE); @@ -636,6 +695,8 @@ delete_tab(sql_trans *tr, sql_table * t, _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
participants (1)
-
Martin Kersten