From fdcccb4737ca6d8ec7f66e63843bdac4f2023636 Mon Sep 17 00:00:00 2001
From: Vladimir Davydov <vdavydov.dev@gmail.com>
Date: Mon, 4 Mar 2019 13:32:40 +0300
Subject: [PATCH] vinyl: rename tx statement begin/rollback routines

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 478dd81592..87b9eefacf 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 ac02ee4d4a..53c495d4ff 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 9524936fb1..590538d809 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.
-- 
GitLab