• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tarantool / tarantool / 13837328311

13 Mar 2025 02:33PM UTC coverage: 87.467% (-0.02%) from 87.484%
13837328311

push

github

locker
vinyl: fix space truncation being aborted by yield under load

Under the hood, `space:truncate()` calls `space_vtab::build_index` to
notify the engine about index recreation, see `TruncateIndex::prepare`.
`space_vtab::build_index` isn't supposed to yield in this case because
the space is empty (note that `TruncateIndex::prepare` passes the new
space to the callback). However, there's a bug in vinyl that makes this
callback yield for no good reason, aborting `space:truncate()` with
`ER_TRANSACTION_YIELD`.

The problem lies in `vy_tx_manager_abort_writers_for_ddl()`, which is
called by `vinyl_space_build_index()` to abort all transactions that
write to the target space. If a transaction can't be aborted because
it has reached WAL, the function sets the `need_wal_sync` flag which
indicates the caller that they should call `wal_sync()` to flush all
unconfirmed transactions. In case of a space truncation, the function
should do nothing because there can't possibly be a transaction writing
to the new space, but actually it sets `need_wal_sync` if there's any
transaction waiting for WAL. This mistake doesn't lead to any problems
during an actual index build, but in case of a space truncation it
results in the transaction being aborted by a fiber yield.

Let's fix this problem by setting the `need_wal_sync` flag only if
there are transactions that actually write to the target space.

Closes #11249

NO_DOC=bug fix

(cherry picked from commit b145c0c89)

69849 of 123715 branches covered (56.46%)

8 of 8 new or added lines in 1 file covered. (100.0%)

49 existing lines in 17 files now uncovered.

102882 of 117624 relevant lines covered (87.47%)

2178261.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.51
/src/box/engine.c


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc