Changeset: 7b201813ee06 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7b201813ee06
Modified Files:
sql/storage/bat/bat_storage.c
sql/storage/sql_storage.h
sql/storage/store.c
Branch: Jul2021
Log Message:
Add table and column locks around cleanup.
diffs (58 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
@@ -3997,8 +3997,10 @@ bind_cands(sql_trans *tr, sql_table *t,
}
static void
-temp_del_tab(sql_table *t, ulng tid)
+temp_del_tab(sql_trans *tr, sql_table *t)
{
+ ulng tid = tr->tid;
+ lock_table(tr->store, t->base.id);
for (storage *d = ATOMIC_PTR_GET(&t->data), *p = NULL, *n = NULL; d; d
= n) {
n = d->next;
if (d->cs.ts == tid) {
@@ -4013,8 +4015,10 @@ temp_del_tab(sql_table *t, ulng tid)
p = d;
}
}
+ unlock_table(tr->store, t->base.id);
for (node *nd = t->columns->l->h; nd; nd = nd->next) {
sql_column *c = nd->data;
+ lock_column(tr->store, c->base.id);
for (sql_delta *d = ATOMIC_PTR_GET(&c->data), *p = NULL, *n =
NULL; d; d = n) {
n = d->next;
if (d->cs.ts == tid) {
@@ -4029,6 +4033,7 @@ temp_del_tab(sql_table *t, ulng tid)
p = d;
}
}
+ unlock_column(tr->store, c->base.id);
}
}
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
@@ -198,7 +198,7 @@ typedef BUN (*clear_table_fptr) (sql_tra
*/
typedef int (*update_table_fptr) (sql_trans *tr, sql_table *ft, sql_table *tt);
-typedef void (*temp_del_tab_fptr) (sql_table *ft, ulng tid);
+typedef void (*temp_del_tab_fptr) (sql_trans *tr, sql_table *ft);
/* backing struct for this interface */
typedef struct store_functions {
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3556,7 +3556,7 @@ sql_trans_destroy(sql_trans *tr)
struct os_iter oi;
os_iterator(&oi, tr->tmp->tables, tr, NULL);
for (sql_table *t = (sql_table *) oi_next(&oi); t; t = (sql_table *)
oi_next(&oi)) {
- store->storage_api.temp_del_tab(t, tr->tid);
+ store->storage_api.temp_del_tab(tr, t);
}
store_unlock(store);
MT_lock_destroy(&tr->lock);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list