[PATCH 1/4] vinyl: rename tx statement begin/rollback routines
Vladimir Davydov
vdavydov.dev at gmail.com
Mon Mar 4 18:39:24 MSK 2019
Rename vy_tx_rollback_to_savepoint to vy_tx_rollback_statement and
vy_tx_savepoint to vy_tx_begin_statement, because soon we will do some
extra work there.
Needed for #4016
---
src/box/vinyl.c | 4 ++--
src/box/vy_tx.c | 9 ++++++++-
src/box/vy_tx.h | 21 ++++++++++++---------
3 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/box/vinyl.c b/src/box/vinyl.c
index 478dd815..87b9eefa 100644
--- a/src/box/vinyl.c
+++ b/src/box/vinyl.c
@@ -2409,7 +2409,7 @@ vinyl_engine_begin_statement(struct engine *engine, struct txn *txn)
struct vy_tx *tx = txn->engine_tx;
struct txn_stmt *stmt = txn_current_stmt(txn);
assert(tx != NULL);
- stmt->engine_savepoint = vy_tx_savepoint(tx);
+ stmt->engine_savepoint = vy_tx_begin_statement(tx);
return 0;
}
@@ -2420,7 +2420,7 @@ vinyl_engine_rollback_statement(struct engine *engine, struct txn *txn,
(void)engine;
struct vy_tx *tx = txn->engine_tx;
assert(tx != NULL);
- vy_tx_rollback_to_savepoint(tx, stmt->engine_savepoint);
+ vy_tx_rollback_statement(tx, stmt->engine_savepoint);
}
/* }}} Public API of transaction control */
diff --git a/src/box/vy_tx.c b/src/box/vy_tx.c
index ac02ee4d..53c495d4 100644
--- a/src/box/vy_tx.c
+++ b/src/box/vy_tx.c
@@ -833,8 +833,15 @@ vy_tx_rollback(struct vy_tx *tx)
mempool_free(&xm->tx_mempool, tx);
}
+void *
+vy_tx_begin_statement(struct vy_tx *tx)
+{
+ assert(tx->state == VINYL_TX_READY);
+ return stailq_last(&tx->log);
+}
+
void
-vy_tx_rollback_to_savepoint(struct vy_tx *tx, void *svp)
+vy_tx_rollback_statement(struct vy_tx *tx, void *svp)
{
assert(tx->state == VINYL_TX_READY);
struct stailq_entry *last = svp;
diff --git a/src/box/vy_tx.h b/src/box/vy_tx.h
index 9524936f..590538d8 100644
--- a/src/box/vy_tx.h
+++ b/src/box/vy_tx.h
@@ -311,20 +311,23 @@ void
vy_tx_rollback(struct vy_tx *tx);
/**
+ * Begin a statement in the vinyl transaction manager.
* Return the save point corresponding to the current
* transaction state. The transaction can be rolled back
- * to a save point with vy_tx_rollback_to_savepoint().
+ * to a save point with vy_tx_rollback_statement().
*/
-static inline void *
-vy_tx_savepoint(struct vy_tx *tx)
-{
- assert(tx->state == VINYL_TX_READY);
- return stailq_last(&tx->log);
-}
+void *
+vy_tx_begin_statement(struct vy_tx *tx);
-/** Rollback a transaction to a given save point. */
+/**
+ * Rollback a transaction statement.
+ *
+ * @param tx Transaction in question.
+ * @param svp Save point to rollback to, as returned by
+ * vy_tx_begin_statement().
+ */
void
-vy_tx_rollback_to_savepoint(struct vy_tx *tx, void *svp);
+vy_tx_rollback_statement(struct vy_tx *tx, void *svp);
/**
* Remember a read interval in the conflict manager index.
--
2.11.0
More information about the Tarantool-patches
mailing list