Changeset: dc71eeaede6f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dc71eeaede6f
Modified Files:
gdk/gdk_calc.c
sql/storage/bat/bat_table.c
sql/storage/store.c
Branch: default
Log Message:
merged with 2016
diffs (129 lines):
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -13234,7 +13234,7 @@ BATcalcifthenelse(BAT *b, BAT *b1, BAT *
return NULL;
if (checkbats(b, b2, "BATcalcifthenelse") != GDK_SUCCEED)
return NULL;
- if (b->ttype != TYPE_bit || b1->ttype != b2->ttype) {
+ if (b->ttype != TYPE_bit || ATOMtype(b1->ttype) != ATOMtype(b2->ttype))
{
GDKerror("BATcalcifthenelse: \"then\" and \"else\" BATs have
different types.\n");
return NULL;
}
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,12 +478,17 @@ table_vacuum(sql_trans *tr, sql_table *t
BAT *tids = delta_cands(tr, t);
BAT **cols;
node *n;
+
+ if (!tids)
+ return SQL_ERR;
// FIXME unchecked_malloc NEW_ARRAY can return NULL
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
@@ -1687,6 +1687,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;
@@ -1697,9 +1698,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;
@@ -1709,6 +1712,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;
@@ -1718,26 +1722,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;
}
@@ -1767,7 +1773,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);
}
@@ -1819,14 +1825,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