Changeset: 327f5f1efba4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/327f5f1efba4 Modified Files: sql/storage/bat/bat_storage.c sql/storage/store.c Branch: analyze-fix Log Message:
Another lock order fix diffs (59 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 @@ -2333,14 +2333,13 @@ min_max_col(sql_trans *tr, sql_column *c if (col && ATOMIC_PTR_GET(&col->data)) { BAT *b = bind_col(tr, col, QUICK), *fb = NULL; - if (b) { - MT_lock_set(&b->theaplock); - if (b->tminpos != BUN_NONE && b->tmaxpos != BUN_NONE && (fb = bind_col(tr, col, RDONLY))) { - BATiter bi = bat_iterator_nolock(fb); - void *nmin = BUNtail(bi, b->tminpos), *nmax = BUNtail(bi, b->tmaxpos); - - *minlen = ATOMlen(b->ttype, nmin); - *maxlen = ATOMlen(b->ttype, nmax); + if (b && b->tminpos != BUN_NONE && b->tmaxpos != BUN_NONE && (fb = bind_col(tr, col, RDONLY))) { + BATiter bi = bat_iterator(fb); + if (fb->tminpos != BUN_NONE && fb->tmaxpos != BUN_NONE) { + void *nmin = BUNtail(bi, fb->tminpos), *nmax = BUNtail(bi, fb->tmaxpos); + + *minlen = ATOMlen(fb->ttype, nmin); + *maxlen = ATOMlen(fb->ttype, nmax); if (!(*min = GDKmalloc(*minlen)) || !(*max = GDKmalloc(*maxlen))) { GDKfree(*min); GDKfree(*max); @@ -2353,9 +2352,9 @@ min_max_col(sql_trans *tr, sql_column *c memcpy(*max, nmax, *maxlen); ok = 1; } - BBPunfix(fb->batCacheid); } - MT_lock_unset(&b->theaplock); + bat_iterator_end(&bi); + BBPunfix(fb->batCacheid); } } return ok; diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -6194,14 +6194,12 @@ sql_trans_ranges( sql_trans *tr, sql_col void *smin = NULL, *smax = NULL; size_t minlen = 0, maxlen = 0; if (store->storage_api.min_max_col(tr, col, &minlen, &smin, &maxlen, &smax)) { - *min = col->min = sa_alloc(tr->sa, minlen); - *max = col->max = sa_alloc(tr->sa, maxlen); - memcpy(col->min, smin, minlen); - memcpy(col->max, smax, maxlen); + _DELETE(col->min); + _DELETE(col->max); + *min = col->min = smin; + *max = col->max = smax; col->minlen = minlen; col->maxlen = maxlen; - _DELETE(smin); - _DELETE(smax); } } } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list