[Tarantool-patches] [PATCH v2 09/19] txn_limbo: add timeout when waiting for acks.
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue Jun 30 02:15:28 MSK 2020
From: Serge Petrenko <sergepetrenko at tarantool.org>
Now txn_limbo_wait_complete() waits for acks only for txn_limbo_confirm_timeout
seconds. If a timeout is reached, the entry and all the ones following
it must be rolled back.
Part-of #4848
---
src/box/txn_limbo.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
index bee8e8155..ac57fd1bd 100644
--- a/src/box/txn_limbo.c
+++ b/src/box/txn_limbo.c
@@ -130,12 +130,13 @@ txn_limbo_wait_complete(struct txn_limbo *limbo, struct txn_limbo_entry *entry)
return;
}
bool cancellable = fiber_set_cancellable(false);
- while (!txn_limbo_entry_is_complete(entry))
- fiber_yield();
+ bool timed_out = fiber_yield_timeout(txn_limbo_confirm_timeout(limbo));
fiber_set_cancellable(cancellable);
- // TODO: implement rollback.
- assert(!entry->is_rollback);
- assert(entry->is_commit);
+ if (timed_out) {
+ // TODO: implement rollback.
+ entry->is_rollback = true;
+ }
+ assert(txn_limbo_entry_is_complete(entry));
txn_limbo_remove(limbo, entry);
txn_clear_flag(txn, TXN_WAIT_ACK);
}
--
2.21.1 (Apple Git-122.3)
More information about the Tarantool-patches
mailing list