Changeset: 14dab2234b18 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=14dab2234b18 Modified Files: sql/storage/bat/bat_storage.c Branch: Jun2016 Log Message:
only flush dirty tables (reduces the amount bats read during a log flush) diffs (150 lines): 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 @@ -1660,7 +1660,7 @@ BATcleanProps( BAT *b ) } static int -gtr_update_delta( sql_trans *tr, sql_delta *cbat, int *changes) +gtr_update_delta( sql_trans *tr, sql_delta *cbat) { int ok = LOG_OK; BAT *ins, *cur; @@ -1672,7 +1672,6 @@ gtr_update_delta( sql_trans *tr, sql_del ins = temp_descriptor(cbat->ibid); /* any inserts */ if (BUNlast(ins) > BUNfirst(ins)) { - (*changes)++; assert(cur->T->heap.storage != STORE_PRIV); BATappend(cur,ins,TRUE); cbat->cnt = cbat->ibase = BATcount(cur); @@ -1687,7 +1686,6 @@ gtr_update_delta( sql_trans *tr, sql_del BAT *uv = temp_descriptor(cbat->uvbid); /* any updates */ if (BUNlast(ui) > BUNfirst(ui)) { - (*changes)++; void_replace_bat(cur, ui, uv, TRUE); temp_destroy(cbat->uibid); temp_destroy(cbat->uvbid); @@ -1707,7 +1705,7 @@ gtr_update_delta( sql_trans *tr, sql_del } static int -gtr_update_dbat(sql_dbat *d, int *changes) +gtr_update_dbat(sql_dbat *d) { int ok = LOG_OK; BAT *idb; @@ -1720,7 +1718,6 @@ gtr_update_dbat(sql_dbat *d, int *change if (BUNlast(idb) > idb->batInserted) { BAT *cdb = temp_descriptor(dbid); - (*changes)++; append_inserted(cdb, idb); bat_destroy(cdb); } @@ -1730,73 +1727,63 @@ gtr_update_dbat(sql_dbat *d, int *change static int -gtr_update_table(sql_trans *tr, sql_table *t, int *tchanges) +gtr_update_table(sql_trans *tr, sql_table *t) { int ok = LOG_OK; node *n; - gtr_update_dbat(t->data, tchanges); + if (!t->base.wtime) + return ok; + gtr_update_dbat(t->data); for (n = t->columns.set->h; ok == LOG_OK && n; n = n->next) { - int changes = 0; sql_column *c = n->data; if (!c->base.wtime) continue; - ok = gtr_update_delta(tr, c->data, &changes); - if (changes) - c->base.wtime = tr->wstime; - (*tchanges) |= changes; + ok = gtr_update_delta(tr, c->data); + c->base.wtime = 0; } if (ok == LOG_OK && t->idxs.set) { for (n = t->idxs.set->h; ok == LOG_OK && n; n = n->next) { - int changes = 0; sql_idx *ci = n->data; /* some indices have no bats */ if (!ci->base.wtime) continue; - ok = gtr_update_delta(tr, ci->data, &changes); - if (changes) - ci->base.wtime = tr->wstime; - (*tchanges) |= changes; + ok = gtr_update_delta(tr, ci->data); + ci->base.wtime = 0; } } - if (*tchanges) - t->base.wtime = tr->wstime; + t->base.wtime = 0; return ok; } -typedef int (*gtr_update_table_fptr)( sql_trans *tr, sql_table *t, int *changes); +typedef int (*gtr_update_table_fptr)( sql_trans *tr, sql_table *t); static int _gtr_update( sql_trans *tr, gtr_update_table_fptr gtr_update_table_f) { - int ok = LOG_OK, tchanges = 0; + int ok = LOG_OK; node *sn; for(sn = tr->schemas.set->h; sn && ok == LOG_OK; sn = sn->next) { - int schanges = 0; sql_schema *s = sn->data; - if (!isTempSchema(s) && s->tables.set) { + if (!isTempSchema(s) && s->tables.set && s->base.wtime) { node *n; for (n = s->tables.set->h; n && ok == LOG_OK; n = n->next) { - int changes = 0; sql_table *t = n->data; if (isTable(t) && isGlobal(t)) - ok = gtr_update_table_f(tr, t, &changes); - schanges |= changes; + ok = gtr_update_table_f(tr, t); } } - if (schanges){ - s->base.wtime = tr->wstime; - tchanges ++; - } + if (gtr_update_table_f == gtr_update_table) + s->base.wtime = 0; } - if (tchanges) - tr->wtime = tr->wstime; + if (gtr_update_table_f == gtr_update_table) + tr->wtime = 0; return LOG_OK; } @@ -1834,12 +1821,11 @@ gtr_minmax_col( sql_trans *tr, sql_colum } static int -gtr_minmax_table(sql_trans *tr, sql_table *t, int *changes) +gtr_minmax_table(sql_trans *tr, sql_table *t) { int ok = LOG_OK; node *n; - (void)changes; if (t->access > TABLE_WRITABLE) { for (n = t->columns.set->h; ok == LOG_OK && n; n = n->next) { sql_column *c = n->data; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list