Changeset: 9bfddc652058 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9bfddc652058
Modified Files:
        sql/common/sql_list.c
        sql/include/sql_list.h
        sql/storage/store.c
Branch: Jan2022
Log Message:

merged with jul2021


diffs (83 lines):

diff --git a/sql/common/sql_list.c b/sql/common/sql_list.c
--- a/sql/common/sql_list.c
+++ b/sql/common/sql_list.c
@@ -441,6 +441,23 @@ list_check_prop_all(list *l, prop_check_
        return res;
 }
 
+void
+list_revert(list *l)
+{
+       node *c = NULL;
+
+       l->t = l->h;
+       for (node *o = l->h; o; ) {
+               node *nxt = o->next;
+
+               o->next = c;
+               c = o;
+
+               o = nxt;
+       }
+       l->h = c;
+}
+
 int
 list_traverse(list *l, traverse_func f, void *clientdata)
 {
diff --git a/sql/include/sql_list.h b/sql/include/sql_list.h
--- a/sql/include/sql_list.h
+++ b/sql/include/sql_list.h
@@ -54,7 +54,7 @@ extern node *list_remove_node(list *l, v
 extern void list_remove_data(list *l, void *gdata, void *data);
 extern void list_remove_list(list *l, void *gdata, list *data);
 extern void list_move_data(list *l, list *d, void *data);
-
+extern void list_revert(list *l);
 
 extern int list_traverse(list *l, traverse_func f, void *clientdata);
 
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3609,9 +3609,8 @@ sql_trans_rollback(sql_trans *tr, bool c
        }
        if (!list_empty(tr->changes)) {
                /* revert the change list */
-               list *nl = SA_LIST(tr->sa, (fdestroy) NULL);
-               for(node *n=tr->changes->h; n; n = n->next)
-                       list_prepend(nl, n->data);
+               list *nl = tr->changes;
+               list_revert(nl);
 
                /* rollback */
                if (!commit_lock)
@@ -3633,6 +3632,7 @@ sql_trans_rollback(sql_trans *tr, bool c
                        if (!c->cleanup) {
                                _DELETE(c);
                        } else if (c->cleanup && !c->cleanup(store, c, oldest)) 
{
+                               /* TODO change too node stealing (no allocs 
here) */
                                store->changes = sa_list_append(tr->sa, 
store->changes, c);
                        } else
                                _DELETE(c);
@@ -3640,7 +3640,6 @@ sql_trans_rollback(sql_trans *tr, bool c
                store_unlock(store);
                if (!commit_lock)
                        MT_lock_unset(&store->commit);
-               list_destroy(nl);
                list_destroy(tr->changes);
                tr->changes = NULL;
                tr->logchanges = 0;
@@ -3648,10 +3647,8 @@ sql_trans_rollback(sql_trans *tr, bool c
                if (!commit_lock)
                        MT_lock_set(&store->commit);
                store_lock(store);
-               if (ATOMIC_GET(&store->nr_active) == 1) { /* still just me */
-                       ulng oldest = store_timestamp(store);
-                       store_pending_changes(store, oldest);
-               }
+               ulng oldest = store_oldest(store);
+               store_pending_changes(store, oldest);
                store_unlock(store);
                if (!commit_lock)
                        MT_lock_unset(&store->commit);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to