fix: tarantool yields on load metadata while holding mut reference
Previously for every query we hold a mutable reference on an engine and tried to load a cluster metadata if the cache was empty. The problem was that tarantool yields on a first query uploading the cache to a new one, that also tries to get a mutable reference to the engine. The main problem was that we should never hold a mutable reference to an object with a Lua code, that can be yielded by tarantool (such behavior is opaque to the Rust compiler). To deal with it we shrink a metadata upload to a list of separate methods. For the ones that can yield we always hold an immutable reference. Those methods that need a mutable reference to the engine never yield.
Showing
- benches/engine.rs 9 additions, 5 deletionsbenches/engine.rs
- benches/parse.rs 2 additions, 2 deletionsbenches/parse.rs
- src/executor/engine.rs 15 additions, 3 deletionssrc/executor/engine.rs
- src/executor/engine/cartridge.rs 48 additions, 38 deletionssrc/executor/engine/cartridge.rs
- src/executor/engine/mock.rs 9 additions, 1 deletionsrc/executor/engine/mock.rs
- src/parser.rs 42 additions, 9 deletionssrc/parser.rs
Loading
Please register or sign in to comment