[Tarantool-patches] [PATCH 3/4] txn_limbo: add timeout when waiting for acks.
Serge Petrenko
sergepetrenko at tarantool.org
Thu Jun 18 15:14:02 MSK 2020
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 b45068fdd..a715a136e 100644
--- a/src/box/txn_limbo.c
+++ b/src/box/txn_limbo.c
@@ -128,12 +128,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.24.3 (Apple Git-128)
More information about the Tarantool-patches
mailing list