Changeset: 52cba3e788de for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/52cba3e788de
Modified Files:
sql/storage/bat/bat_storage.c
sql/storage/store.c
Branch: smart-merge-jan22
Log Message:
Remove committing transaction from remaining actives.
diffs (56 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,6 @@ merge_segments(storage *s, sql_trans *tr
int merge = 1;
for (int i = 0; active[i] != 0; i++) {
assert(active[i] != seg->ts &&
active[i] != cur->ts);
- if (active[i] != tr->ts) /* the
transaction can ignore its own active timestamp since it's committing */
if ((active[i] > seg->ts && active[i] <
cur->ts) ||
(active[i] < seg->ts &&
active[i] > cur->ts)) {
/* cannot safely merge since
there is an active transaction between the segments */
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -58,14 +58,17 @@ store_oldest(sqlstore *store)
}
static ulng *
-store_get_active(sqlstore *store)
-{
- ulng *active = malloc(sizeof(ulng) * (store->active->cnt + 1));
+store_get_active(sqlstore *store, sql_trans* tr)
+{
+ ulng *active = malloc(sizeof(ulng) * store->active->cnt);
node *cur = store->active->h;
+ int j = 0;
for (int i = 0; i < store->active->cnt; i++, cur = cur->next) {
- active[i] = ((sql_session*)cur->data)->tr->ts;
- }
- active[store->active->cnt] = 0;
+ ulng ts = ((sql_session*)cur->data)->tr->ts;
+ if (ts != tr->ts)
+ active[j++] = ((sql_session*)cur->data)->tr->ts;
+ }
+ active[j] = 0;
return active;
}
@@ -3636,7 +3639,7 @@ sql_trans_rollback(sql_trans *tr, bool c
store_lock(store);
ulng oldest = store_oldest(store);
ulng commit_ts = store_get_timestamp(store); /* use most recent
timestamp such that we can cleanup savely */
- ulng *active = store_get_active(store); /* get active
transactions (to merge segments) */
+ ulng *active = store_get_active(store, tr); /* get active
transactions (to merge segments) */
for(node *n=nl->h; n; n = n->next) {
sql_change *c = n->data;
@@ -3989,7 +3992,7 @@ sql_trans_commit(sql_trans *tr)
if (ATOMIC_GET(&store->nr_active) == 1 && !tr->parent)
oldest = commit_ts;
store_pending_changes(store, oldest);
- ulng *active = store_get_active(store); /* get active
transactions (to merge segments) */
+ ulng *active = store_get_active(store, tr); /* get active
transactions (to merge segments) */
for(node *n=tr->changes->h; n && ok == LOG_OK; n = n->next) {
sql_change *c = n->data;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]