Changeset: dab037c68348 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dab037c68348
Modified Files:
sql/server/sql_mvc.c
sql/storage/store.c
Branch: HTM
Log Message:
Rename var ok to results
It's way more meaningful and correct
diffs (189 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
@@ -194,7 +194,7 @@ mvc_trans(mvc *m)
int
mvc_commit_prepare(mvc *m, int chain, char *name, sql_trans *tr) {
sql_trans *cur = m->session->tr;
- int ok = SQL_OK;//, wait = 0;
+ int result = SQL_OK;//, wait = 0;
assert(tr);
assert(m->session->active); /* only commit an active transaction */
@@ -231,7 +231,7 @@ build up the hash (not copied in the tra
tr = tr->parent;
if (tr->parent) {
store_lock();
- while (tr->parent != NULL && ok == SQL_OK) {
+ while (tr->parent != NULL && result == SQL_OK) {
tr = sql_trans_destroy(tr);
}
store_unlock();
@@ -264,7 +264,7 @@ build up the hash (not copied in the tra
store_lock();
}
* */
- return ok;
+ return result;
}
void
@@ -282,16 +282,16 @@ int
mvc_commit(mvc *m, int chain, char *name)
{
sql_trans *tr = m->session->tr;
- int ok = SQL_OK;//, wait = 0;
+ int result = SQL_OK;//, wait = 0;
- if ((ok = mvc_commit_prepare(m, chain, name, tr)) != SQL_OK) {
+ if ((result = mvc_commit_prepare(m, chain, name, tr)) != SQL_OK) {
store_unlock();
return 0;
}
if (sql_trans_validate(tr)) {
/* execute commit */
- if ((ok = sql_trans_commit(tr)) != SQL_OK) {
+ if ((result = sql_trans_commit(tr)) != SQL_OK) {
store_unlock();
char *msg = sql_message("40000!COMMIT: transaction
commit failed (perhaps your disk is full?) exiting (kernel error: %s)",
GDKerrbuf);
GDKfatal("%s", msg);
@@ -306,22 +306,22 @@ mvc_commit(mvc *m, int chain, char *name
mvc_commit_finish(m, chain, name);
- return ok;
+ return result;
}
sql_trans *
mvc_precommit(mvc *m, int chain, char *name) {
sql_trans *tr = m->session->tr;
- int ok = SQL_OK;//, wait = 0;
+ int result = SQL_OK;//, wait = 0;
- if ((ok = mvc_commit_prepare(m, chain, name, tr)) != SQL_OK) {
+ if ((result = mvc_commit_prepare(m, chain, name, tr)) != SQL_OK) {
store_unlock();
return 0;
}
if (sql_trans_validate(tr)) {
// pre-commit the transaction
- if ((ok = sql_trans_precommit(tr)) != SQL_OK) {
+ if ((result = sql_trans_precommit(tr)) != SQL_OK) {
store_unlock();
char *msg = sql_message("40000!PRECOMMIT: transaction
commit failed (perhaps your disk is full?) exiting (kernel error: %s)",
GDKerrbuf);
GDKfatal("%s", msg);
@@ -358,7 +358,7 @@ mvc_persistcommit(mvc *m, int chain, cha
// set it
tr = m->session->tr;
// persist it
- if ((ok = sql_trans_persistcommit(tr)) != SQL_OK) {
+ if ((result = sql_trans_persistcommit(tr)) != SQL_OK) {
char *msg = sql_message("40000!PERSISTCOMMIT: transaction
commit failed (perhaps your disk is full?) exiting (kernel error: %s)",
GDKerrbuf);
GDKfatal("%s", msg);
_DELETE(msg);
@@ -366,7 +366,7 @@ mvc_persistcommit(mvc *m, int chain, cha
// clean up
mvc_commit_finish(m, chain, name);
- return ok;
+ return result;
}
int
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -3235,67 +3235,67 @@ catalog_corrupt( sql_trans *tr )
int
sql_trans_commit(sql_trans *tr)
{
- int ok = LOG_OK;
+ int result = LOG_OK;
/* write phase */
if (bs_debug)
fprintf(stderr, "#forwarding changes %d,%d %d,%d\n",
gtrans->stime, tr->stime, gtrans->wstime, tr->wstime);
/* do a pre-commit first, writing the changes to the write-ahead log
and rollingforward the transaction */
- ok = sql_trans_precommit(tr);
- if (ok == LOG_OK) {
+ result = sql_trans_precommit(tr);
+ if (result == LOG_OK) {
/* write the changes in the persistent store */
- ok = sql_trans_persistcommit(tr);
+ result = sql_trans_persistcommit(tr);
}
if (bs_debug)
fprintf(stderr, "#done forwarding changes %d,%d\n",
gtrans->stime, gtrans->wstime);
- return (ok==LOG_OK)?SQL_OK:SQL_ERR;
+ return (result==LOG_OK)?SQL_OK:SQL_ERR;
}
int
sql_trans_precommit(sql_trans *tr)
{
- int ok = LOG_OK;
+ int result = LOG_OK;
/* snap shots should be saved first */
if (tr->parent == gtrans) {
if (bs_debug) {
fprintf(stderr, "#writing changes to WAL %d,%d
%d,%d\n", gtrans->stime, tr->stime, gtrans->wstime, tr->wstime);
}
- ok = rollforward_trans(tr, R_SNAPSHOT);
-
- if (ok == LOG_OK)
- ok = logger_funcs.log_tstart();
- if (ok == LOG_OK)
- ok = rollforward_trans(tr, R_LOG);
- return ok;
+ result = rollforward_trans(tr, R_SNAPSHOT);
+
+ if (result == LOG_OK)
+ result = logger_funcs.log_tstart();
+ if (result == LOG_OK)
+ result = rollforward_trans(tr, R_LOG);
+ return result;
}
- return (ok==LOG_OK)?SQL_OK:SQL_ERR;
+ return (result==LOG_OK)?SQL_OK:SQL_ERR;
}
int
sql_trans_persistcommit(sql_trans *tr)
{
- int ok = LOG_OK;
+ int result = LOG_OK;
if (bs_debug) {
fprintf(stderr, "#writing changes to persistent store
%d,%d\n", gtrans->stime, gtrans->wstime);
}
- if (ok == LOG_OK) {
- if (ok == LOG_OK && prev_oid != store_oid)
- ok = logger_funcs.log_sequence(OBJ_SID, store_oid);
+ if (result == LOG_OK) {
+ if (result == LOG_OK && prev_oid != store_oid)
+ result = logger_funcs.log_sequence(OBJ_SID, store_oid);
prev_oid = store_oid;
- if (ok == LOG_OK)
- ok = logger_funcs.log_tend();
+ if (result == LOG_OK)
+ result = logger_funcs.log_tend();
tr->schema_number = store_schema_number();
}
- if (ok == LOG_OK) {
+ if (result == LOG_OK) {
/* It is save to rollforward the changes now. In case
of failure, the log will be replayed. */
- ok = rollforward_trans(tr, R_APPLY);
+ result = rollforward_trans(tr, R_APPLY);
}
- return (ok==LOG_OK)?SQL_OK:SQL_ERR;
+ return (result==LOG_OK)?SQL_OK:SQL_ERR;
}
static void
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list