Changeset: 9fbd6d70f01b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9fbd6d70f01b
Modified Files:
sql/storage/bat/bat_storage.c
sql/storage/store.c
Branch: transaction_layer_revamp
Log Message:
set tr->tid and tr->ts equal modulo child transaction id.
diffs (70 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
@@ -408,7 +408,14 @@ merge_segments(storage *s, sql_trans *tr
node *n = store->active->h;
for (int i = 0; i < store->active->cnt; i++, n
= n->next) {
sql_trans* other =
((sql_trans*)n->data);
- ulng active = other->ts;
+ ulng ots;
+ { /* TODO: just a temporary
syntactically trick to
+ * make all references to
(sql_trans*)->tid and (sql_trans*)->ts
+ * searchable as tr->tid and
tr->ts respectively */
+ sql_trans* tr = other;
+ ots = tr->ts;
+ }
+ ulng active = ots;
if(other->active == 2)
continue; /* pretend that
another recently committed transaction is no longer active */
if (active == tr->ts)
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3718,12 +3718,23 @@ sql_trans_create_(sqlstore *store, sql_t
store_lock(store);
tr->store = store;
if (parent) {
- tr->ts = parent->ts;
- tr->tid = parent->tid + 1;
- }
- ulng nt_part = parent?(parent->tid - parent->ts):0;
- tr->ts = (store_timestamp(store) | TRANSACTION_ID_BASE);
- tr->tid = tr->ts + nt_part ;
+ ulng pts;
+ ulng ptid;
+ { /* TODO: just a temporary syntactically trick to
+ * make all references to (sql_trans*)->tid and
(sql_trans*)->ts
+ * searchable as tr->tid and tr->ts respectively */
+ sql_trans* tr = parent;
+ pts = tr->ts;
+ ptid = tr->tid;
+ }
+ tr->ts = pts;
+ tr->tid = ptid + 1;
+ assert((tr->tid | TS_MASK) == tr->ts);
+ }
+ else {
+ tr->ts = (store_timestamp(store) | TRANSACTION_ID_BASE);
+ tr->tid = tr->ts;
+ }
tr->cat = store->cat;
if (!tr->cat) {
store->cat = tr->cat = SA_ZNEW(tr->sa, sql_catalog);
@@ -3952,7 +3963,16 @@ sql_trans_commit(sql_trans *tr)
store_lock(store);
if (tr->parent) {
- commit_ts = oldest = tr->parent->tid;
+ sql_trans* parent = tr;
+ ulng ptid;
+ { /* TODO: just a temporary syntactically trick to
+ * make all references to (sql_trans*)->tid and
(sql_trans*)->ts
+ * searchable as tr->tid and tr->ts respectively
+ */
+ sql_trans* tr = parent;
+ ptid = tr->tid;
+ }
+ commit_ts = oldest = ptid;
tr->parent->logchanges += tr->logchanges;
}
else {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]