fix: cicada/mvto insert で TupleBody の use-after-move を解消 (#57) - #110
Merged
Conversation
Tuple::init() の 4 引数 overload で受け取る `TupleBody&& body` は本体で 未使用 (`[[maybe_unused]]`) なまま捨てられていた。呼び出し側 (cicada/mvto の TxExecutor::insert) は newVersionGeneration() で `std::move(body)` した 直後に同じ `body` を再度 `std::move()` して init() に渡しており、典型的な use-after-move となっていた。 cicada は `INLINE_VERSION_OPT=1` のとき init() 内で `body_ = std::ref(inline_ver_.body_)` する。inline_ver_.body_ は default-construct されたままで、insert で挿入したはずの値が消える (データロス)。デフォルト ビルド (INLINE_VERSION_OPT=0) と mvto は `new_ver->body_` を参照するため 偶然動いていたが、コードスメルとしての use-after-move は残っていた。 Issue #57 の Intent B (推奨案) に従い、init() overload の 4 番目の引数を 削除し、呼び出し側も 3 引数の呼び出しに揃える。これにより: - 二重 move による use-after-move を除去 - INLINE_VERSION_OPT=1 と =0 で body の所有経路が一致 (`new_ver->body_`) なお INLINE_VERSION_OPT=1 で insert された tuple の body が new_ver 経由でアクセスできることは元のコードでも保証されている。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TxExecutor::insertでTuple::init()4 引数 overload にstd::move(body)を 2 度渡していた use-after-move を解消init()から未使用のTupleBody&& body引数を削除し、呼び出し側も 3 引数化INLINE_VERSION_OPT_CICADA=1で insert 系トランザクションを走らせた際のデータロス経路の遠因となるコードスメルを除去Closes #57
Test plan
bomb_cicada.exe -extime=1/bomb_mvto.exe -extime=1が Debug+ASan で正常完了 (cicada 85619 tps, mvto 97042 tps)INLINE_VERSION_OPT_CICADA=1でビルドが通る (default のINLINE_VERSION_PROMOTIONとの組み合わせは pre-existing な別バグがあり今回は対象外)