transactions should always start with the last revision and release it when done

This commit is contained in:
Krasimir Angelov
2022-05-23 19:50:41 +02:00
parent d66cf23811
commit fc09bc776b
8 changed files with 15 additions and 15 deletions

View File

@@ -260,7 +260,7 @@ public:
return node->right;
} else {
ref<Node> left = pop_first(node->left, res);
ref<Node> node = upd_node(node, left, node->right);
node = upd_node(node, left, node->right);
return balanceR(node);
}
}
@@ -275,7 +275,7 @@ public:
return node->left;
} else {
ref<Node> right = pop_last(node->right, res);
ref<Node> node = upd_node(node, node->left, right);
node = upd_node(node, node->left, right);
return balanceL(node);
}
}

View File

@@ -1057,13 +1057,12 @@ void pgf_check_type(PgfDB *db, PgfRevision revision,
}
PGF_API
PgfRevision pgf_start_transaction(PgfDB *db, PgfRevision revision,
PgfExn *err)
PgfRevision pgf_start_transaction(PgfDB *db, PgfExn *err)
{
PGF_API_BEGIN {
DB_scope scope(db, WRITER_SCOPE);
ref<PgfPGF> pgf = db->revision2pgf(revision);
ref<PgfPGF> pgf = db->get_active_revision();
db->start_transaction();
@@ -1079,6 +1078,8 @@ PgfRevision pgf_start_transaction(PgfDB *db, PgfRevision revision,
object rev = db->register_revision(new_pgf.tagged(), PgfDB::get_txn_id());
PgfDB::free(pgf);
db->ref_count++;
return rev;
} PGF_API_END

View File

@@ -462,8 +462,7 @@ void pgf_check_type(PgfDB *db, PgfRevision revision,
PgfExn *err);
PGF_API_DECL
PgfRevision pgf_start_transaction(PgfDB *db, PgfRevision revision,
PgfExn *err);
PgfRevision pgf_start_transaction(PgfDB *db, PgfExn *err);
PGF_API_DECL
void pgf_commit_transaction(PgfDB *db, PgfRevision revision,