tarantool / tarantool/tarantool

box: check slice on every operation

Open
#11,838 0 comments 0 reactions 1 assignee View on GitHub

@drewdzzz is already working on this.

Since Sep 16, 2025.

Dominant language
Lua
Stars
3.7k
Forks
419
Avg merge
1d 23h
Merged PRs (30d)
88

Description

Checking fiber slice is actually a cheap operation since it uses clock_lowres to obtain current time. But we somewhy check it every 1000 operations:
https://github.com/tarantool/tarantool/blob/7a6319528c0c3342187fa5ff2c3ecde882a5fd11/src/box/box.h#L184-L197

It would make sense if we used clock_gettime instead of clock_lowres. We've considered this alternative, so probably we just didn't remove this periodic check when switching to clock_lowres. Here a benchmarks clock_gettime vs clock_lowres and all the checks are periodic. Also, AFAIR, I measured approach with non-periodic clock_lowres back then, but I'm not really sure about it.

Let's try check slice on every iteration and compare performance of these two approaches. Fortunately, we have stable perf CI now, so it should be easy.

Rationale for this change:

  1. We've chosen interval of 1000 operations because we considered all operations fast. That's not true now, at least for MemCS. Insertions there are much more heavy, also there are batch writes and reads that can take a long time. So fiber slice can be checked too seldom there.
  2. Checking slice on each operation would be more predictable for users and for us (we could write simpler and faster tests of fiber slice check then). Also it's a bit weird that if one operation has thrown fiber slice error, the next operation won't throw it.

Original issue: https://github.com/tarantool/tarantool/issues/6085

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.