Changeset: 8d0d7838c869 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8d0d7838c869 Modified Files: sql/backends/monet5/sql.c sql/storage/bat/bat_storage.c sql/storage/sql_storage.h Branch: default Log Message:
direct calls to vacuum will no always renew the bat. diffs (116 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 @@ -4928,13 +4928,13 @@ finalize: } static str -do_str_column_vacuum(sql_trans *tr, sql_column *c) +do_str_column_vacuum(sql_trans *tr, sql_column *c, bool force) { if (ATOMvarsized(c->type.type->localtype)) { int res = 0; sqlstore *store = tr->store; - if ((res = (int) store->storage_api.vacuum_col(tr, c)) != LOG_OK) { + if ((res = (int) store->storage_api.vacuum_col(tr, c, force)) != LOG_OK) { if (res == LOG_CONFLICT) throw(SQL, "do_str_column_vacuum", SQLSTATE(25S01) "TRANSACTION CONFLICT in storage_api.vacuum_col %s.%s.%s", c->t->s->base.name, c->t->base.name, c->base.name); if (res == LOG_ERR) @@ -4946,12 +4946,12 @@ do_str_column_vacuum(sql_trans *tr, sql_ } static str -do_str_table_vacuum(sql_trans *tr, sql_table *t) +do_str_table_vacuum(sql_trans *tr, sql_table *t, bool force) { int res = 0; sqlstore *store = tr->store; - if ((res = (int) store->storage_api.vacuum_tab(tr, t)) != LOG_OK) { + if ((res = (int) store->storage_api.vacuum_tab(tr, t, force)) != LOG_OK) { if (res == LOG_CONFLICT) throw(SQL, "do_str_table_vacuum", SQLSTATE(25S01) "TRANSACTION CONFLICT in storage_api.vacuum_col %s.%s", t->s->base.name, t->base.name); if (res == LOG_ERR) @@ -5005,9 +5005,9 @@ SQLstr_vacuum(Client cntxt, MalBlkPtr mb } if (c) - return do_str_column_vacuum(tr, c); + return do_str_column_vacuum(tr, c, true); else - return do_str_table_vacuum(tr, t); + return do_str_table_vacuum(tr, t, true); } @@ -5065,12 +5065,12 @@ str_vacuum_callback(int argc, void *argv break; } - if((msg=do_str_column_vacuum(session->tr, c)) != MAL_SUCCEED) { + if((msg=do_str_column_vacuum(session->tr, c, false)) != MAL_SUCCEED) { TRC_ERROR((component_t) SQL, "[str_vacuum_callback] -- %s", msg); res = GDK_FAIL; } } else { - if((msg=do_str_table_vacuum(session->tr, t)) != MAL_SUCCEED) { + if((msg=do_str_table_vacuum(session->tr, t, false)) != MAL_SUCCEED) { TRC_ERROR((component_t) SQL, "[str_vacuum_callback] -- %s", msg); res = GDK_FAIL; } 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 @@ -5032,7 +5032,7 @@ swap_bats(sql_trans *tr, sql_column *col } static int -vacuum_col(sql_trans *tr, sql_column *c) +vacuum_col(sql_trans *tr, sql_column *c, bool force) { if (segments_in_transaction(tr, c->t)) return LOG_CONFLICT; @@ -5044,7 +5044,7 @@ vacuum_col(sql_trans *tr, sql_column *c) return LOG_CONFLICT; /* do we have enough to clean */ - if ((d->nr_updates) < 1024) + if (!force && (d->nr_updates) < 1024) return LOG_OK; BAT *b = NULL, *bn = NULL;; @@ -5062,7 +5062,7 @@ vacuum_col(sql_trans *tr, sql_column *c) } static int -vacuum_tab(sql_trans *tr, sql_table *t) +vacuum_tab(sql_trans *tr, sql_table *t, bool force) { if (segments_in_transaction(tr, t)) return LOG_CONFLICT; @@ -5083,8 +5083,8 @@ vacuum_tab(sql_trans *tr, sql_table *t) return LOG_CONFLICT; /* do we have enough to clean */ - if ((d->nr_updates + s->segs->nr_reused) < 1024) - return LOG_OK; + if (!force && (d->nr_updates + s->segs->nr_reused) < 1024) + continue; BAT *b = NULL, *bn = NULL;; if ((b = bind_col(tr, c, 0)) == NULL) diff --git a/sql/storage/sql_storage.h b/sql/storage/sql_storage.h --- a/sql/storage/sql_storage.h +++ b/sql/storage/sql_storage.h @@ -188,8 +188,8 @@ typedef void *(*del_dup_fptr) (sql_table typedef int (*upgrade_col_fptr) (sql_trans *tr, sql_column *c); typedef int (*upgrade_idx_fptr) (sql_trans *tr, sql_idx *i); typedef int (*upgrade_del_fptr) (sql_trans *tr, sql_table *t); -typedef int (*vacuum_col_fptr) (sql_trans *tr, sql_column *c); -typedef int (*vacuum_tab_fptr) (sql_trans *tr, sql_table *t); +typedef int (*vacuum_col_fptr) (sql_trans *tr, sql_column *c, bool force); +typedef int (*vacuum_tab_fptr) (sql_trans *tr, sql_table *t, bool force); /* -- free the storage resources for columns, indices and tables _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org