Changeset: e1cf401e08b1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e1cf401e08b1 Modified Files: sql/include/sql_catalog.h sql/storage/objectset.c sql/storage/store.c Branch: Aug2024 Log Message:
Bring back schema versioning. Fixes #7537. 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 @@ -309,6 +309,8 @@ typedef struct sql_schema { } sql_schema; typedef struct sql_catalog { + ATOMIC_TYPE schema_version; + struct objectset *schemas; struct objectset *objects; } sql_catalog; @@ -762,6 +764,7 @@ typedef struct sql_session { char *def_schema_name; /* users default schema name */ char *schema_name; /* transaction's schema name */ sql_schema *schema; + ATOMIC_TYPE schema_version; char ac_on_commit; /* if 1, auto_commit should be enabled on commit, rollback, etc. */ diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c --- a/sql/storage/objectset.c +++ b/sql/storage/objectset.c @@ -643,6 +643,7 @@ tc_commit_objectversion(sql_trans *tr, s (void)oldest; if (!tr->parent) change->obj->new = 0; + ATOMIC_INC(&tr->cat->schema_version); } else { os_rollback(ov, tr->store); diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -3875,6 +3875,7 @@ sql_trans_create_(sqlstore *store, sql_t store->cat = tr->cat = ZNEW(sql_catalog); store->cat->schemas = os_new(NULL, (destroy_fptr) &schema_destroy, false, true, true, true, store); store->cat->objects = os_new(NULL, (destroy_fptr) &key_destroy, false, false, true, false, store); + ATOMIC_INIT(&store->cat->schema_version, 0); } tr->tmp = store->tmp; TRC_DEBUG(SQL_STORE, "New transaction: %p\n", tr); @@ -7290,13 +7291,17 @@ sql_trans_begin(sql_session *s) } tr->active = 1; + int res = ATOMIC_GET(&s->schema_version) ? + ATOMIC_GET(&s->schema_version) != ATOMIC_GET(&tr->cat->schema_version) : 0; + ATOMIC_SET(&s->schema_version, tr->cat->schema_version); + ATOMIC_INC(&store->nr_active); list_append(store->active, tr); TRC_DEBUG(SQL_STORE, "Exit sql_trans_begin for transaction: " ULLFMT "\n", tr->tid); store_unlock(store); s->status = tr->status = 0; - return 0; + return res; } int _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org