Changeset: d567c47aeaff for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d567c47aeaff
Modified Files:
sql/storage/bat/bat_table.c
sql/storage/store.c
Branch: Dec2016
Log Message:
fixed problem with system vacuum, ie make sure we only vacuum on the
pesistent bits (not the inserts/updates)
diffs (115 lines):
diff --git a/sql/storage/bat/bat_table.c b/sql/storage/bat/bat_table.c
--- a/sql/storage/bat/bat_table.c
+++ b/sql/storage/bat/bat_table.c
@@ -478,11 +478,15 @@ table_vacuum(sql_trans *tr, sql_table *t
BAT **cols;
node *n;
+ if (!tids)
+ return SQL_ERR;
cols = NEW_ARRAY(BAT*, cs_size(&t->columns));
for (n = t->columns.set->h; n; n = n->next) {
sql_column *c = n->data;
BAT *v = store_funcs.bind_col(tr, c, RDONLY);
+ if (!v)
+ return SQL_ERR;
cols[c->colnr] = BATproject(tids, v);
BBPunfix(v->batCacheid);
}
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -1698,6 +1698,7 @@ store_flush_log(void)
static int
store_needs_vacuum( sql_trans *tr )
{
+ size_t max_dels = GDKdebug & FORCEMITOMASK ? 1 : 128;
sql_schema *s = find_sql_schema(tr, "sys");
node *n;
@@ -1708,9 +1709,11 @@ store_needs_vacuum( sql_trans *tr )
if (!t->system)
continue;
/* no inserts, updates and enough deletes ? */
- if (!store_funcs.count_col(tr, c, 0) &&
+ if (store_funcs.count_col(tr, c, 0) &&
+ (store_funcs.count_col(tr, c, 1) -
+ store_funcs.count_col(tr, c, 0)) == 0 &&
!store_funcs.count_upd(tr, t) &&
- store_funcs.count_del(tr, t) > 128)
+ store_funcs.count_del(tr, t) >= max_dels)
return 1;
}
return 0;
@@ -1720,6 +1723,7 @@ static void
store_vacuum( sql_trans *tr )
{
/* tables */
+ size_t max_dels = GDKdebug & FORCEMITOMASK ? 1 : 128;
sql_schema *s = find_sql_schema(tr, "sys");
node *n;
@@ -1729,26 +1733,28 @@ store_vacuum( sql_trans *tr )
if (!t->system)
continue;
- if (!store_funcs.count_col(tr, c, 0) &&
+ if (store_funcs.count_col(tr, c, 0) &&
+ (store_funcs.count_col(tr, c, 1) -
+ store_funcs.count_col(tr, c, 0)) == 0 &&
!store_funcs.count_upd(tr, t) &&
- store_funcs.count_del(tr, t) > 128) {
+ store_funcs.count_del(tr, t) >= max_dels)
table_funcs.table_vacuum(tr, t);
- }
}
}
void
store_manager(void)
{
- const int timeout = GDKdebug & FORCEMITOMASK ? 10 : 50;
+ const int sleeptime = GDKdebug & FORCEMITOMASK ? 10 : 50;
+ const int timeout = GDKdebug & FORCEMITOMASK ? 500 : 50000;
while (!GDKexiting()) {
int res = LOG_OK;
int t;
lng shared_transactions_drift = -1;
- for (t = 30000; t > 0 && !need_flush; t -= timeout) {
- MT_sleep_ms(timeout);
+ for (t = timeout; t > 0 && !need_flush; t -= sleeptime) {
+ MT_sleep_ms(sleeptime);
if (GDKexiting())
return;
}
@@ -1778,7 +1784,7 @@ store_manager(void)
MT_lock_unset(&bs_lock);
if (GDKexiting())
return;
- MT_sleep_ms(timeout);
+ MT_sleep_ms(sleeptime);
MT_lock_set(&bs_lock);
}
@@ -1830,14 +1836,15 @@ store_manager(void)
void
idle_manager(void)
{
- const int timeout = GDKdebug & FORCEMITOMASK ? 10 : 50;
+ const int sleeptime = GDKdebug & FORCEMITOMASK ? 10 : 50;
+ const int timeout = GDKdebug & FORCEMITOMASK ? 50 : 5000;
while (!GDKexiting()) {
sql_session *s;
int t;
- for (t = 5000; t > 0; t -= timeout) {
- MT_sleep_ms(timeout);
+ for (t = timeout; t > 0; t -= sleeptime) {
+ MT_sleep_ms(sleeptime);
if (GDKexiting())
return;
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list