Changeset: 2d552eb3ade2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2d552eb3ade2
Modified Files:
sql/server/sql_mvc.c
sql/storage/store.c
Branch: Jul2021
Log Message:
More defensive way to look for changes
diffs (74 lines):
diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -541,7 +541,7 @@ mvc_commit(mvc *m, int chain, const char
}
/* if there is nothing to commit reuse the current transaction */
- if (tr->changes == NULL) {
+ if (list_empty(tr->changes)) {
if (!chain)
(void)sql_trans_end(m->session, ok);
m->type = Q_TRANS;
@@ -598,7 +598,7 @@ mvc_rollback(mvc *m, int chain, const ch
tr = m->session->tr;
while (!tr->name || strcmp(tr->name, name) != 0) {
/* make sure we do not reuse changed data */
- if (tr->changes)
+ if (!list_empty(tr->changes))
tr->status = 1;
tr = sql_trans_destroy(tr);
}
@@ -615,7 +615,7 @@ mvc_rollback(mvc *m, int chain, const ch
tr = sql_trans_destroy(tr);
m->session-> tr = tr;
/* make sure we do not reuse changed data */
- if (tr->changes)
+ if (!list_empty(tr->changes))
tr->status = 1;
(void)sql_trans_end(m->session, SQL_ERR);
if (chain && sql_trans_begin(m->session) < 0)
@@ -631,7 +631,7 @@ mvc_rollback(mvc *m, int chain, const ch
TRC_INFO(SQL_TRANS,
"Commit%s%s rolled back%s\n",
name ? " " : "", name ? name : "",
- !tr->changes ? " (no changes)" : "");
+ list_empty(tr->changes) ? " (no changes)" : "");
return msg;
}
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3479,7 +3479,7 @@ sql_trans_destroy(sql_trans *tr)
_DELETE(tr->name);
tr->name = NULL;
}
- if (tr->changes)
+ if (!list_empty(tr->changes))
sql_trans_rollback(tr);
sqlstore *store = tr->store;
store_lock(store);
@@ -6608,19 +6608,20 @@ sql_session_create(sqlstore *store, sql_
if (store->singleuser > 1)
return NULL;
- s = SA_ZNEW(/*sa*/NULL, sql_session);
+ s = ZNEW(sql_session);
if (!s)
return NULL;
s->sa = sa;
assert(sa);
s->tr = sql_trans_create_(store, NULL, NULL);
if (!s->tr) {
+ _DELETE(s);
return NULL;
}
- s->schema_name = NULL;
s->tr->active = 0;
if (!sql_session_reset(s, ac)) {
sql_trans_destroy(s->tr);
+ _DELETE(s);
return NULL;
}
if (store->singleuser)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list