Changeset: 62bc8cc6fec3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/62bc8cc6fec3
Modified Files:
sql/include/sql_catalog.h
sql/storage/sql_catalog.c
sql/storage/store.c
Branch: default
Log Message:
make sure globaltmp instantiation is protected
diffs (61 lines):
diff --git a/sql/include/sql_catalog.h b/sql/include/sql_catalog.h
--- a/sql/include/sql_catalog.h
+++ b/sql/include/sql_catalog.h
@@ -327,6 +327,7 @@ typedef struct sql_trans {
sql_store store; /* keep link into the global store */
MT_Lock lock; /* lock protecting concurrent writes to the
changes list */
+ MT_Lock localtmplock; /* lock protecting concurrent writes to
the localtmps list */
list *changes; /* list of changes */
list *dropped; /* protection against recursive cascade action*/
diff --git a/sql/storage/sql_catalog.c b/sql/storage/sql_catalog.c
--- a/sql/storage/sql_catalog.c
+++ b/sql/storage/sql_catalog.c
@@ -259,11 +259,13 @@ find_sql_table(sql_trans *tr, sql_schema
if (lt)
return lt;
+ MT_lock_set(&tr->localtmplock);
lt = (sql_table*) os_find_name(tr->localtmps, tr, tname);
if (!lt)
t = globaltmp_instantiate(tr, t);
else
t = lt;
+ MT_lock_unset(&tr->localtmplock);
return t;
}
@@ -285,11 +287,13 @@ find_sql_table_id(sql_trans *tr, sql_sch
sql_table* lt = (sql_table*) os_find_id(tr->localtmps, tr, id);
if (lt)
return lt;
+ MT_lock_set(&tr->localtmplock);
lt = (sql_table*) os_find_id(tr->localtmps, tr, id);
if (!lt)
t = globaltmp_instantiate(tr, t);
else
t = lt;
+ MT_lock_unset(&tr->localtmplock);
return t;
}
return t;
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -4142,6 +4142,7 @@ sql_trans_destroy(sql_trans *tr)
sqlstore *store = tr->store;
os_destroy(tr->localtmps, store);
MT_lock_destroy(&tr->lock);
+ MT_lock_destroy(&tr->localtmplock);
if (!list_empty(tr->dropped))
list_destroy(tr->dropped);
if (!list_empty(tr->predicates))
@@ -4161,6 +4162,7 @@ sql_trans_create_(sqlstore *store, sql_t
if (!tr)
return NULL;
MT_lock_init(&tr->lock, "trans_lock");
+ MT_lock_init(&tr->localtmplock, "localtmp");
tr->parent = parent;
if (name) {
_DELETE(parent->name);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]