@@ -65,13 +65,8 @@ size_t Size(const facade::CapturingReplyBuilder::Payload& payload) {
65
65
atomic_uint64_t MultiCommandSquasher::current_reply_size_ = 0 ;
66
66
67
67
MultiCommandSquasher::MultiCommandSquasher (absl::Span<StoredCmd> cmds, ConnectionContext* cntx,
68
- Service* service, bool verify_commands, bool error_abort)
69
- : cmds_{cmds},
70
- cntx_{cntx},
71
- service_{service},
72
- base_cid_{nullptr },
73
- verify_commands_{verify_commands},
74
- error_abort_{error_abort} {
68
+ Service* service, const Opts& opts)
69
+ : cmds_{cmds}, cntx_{cntx}, service_{service}, base_cid_{nullptr }, opts_{opts} {
75
70
auto mode = cntx->transaction ->GetMultiMode ();
76
71
base_cid_ = cntx->transaction ->GetCId ();
77
72
atomic_ = mode != Transaction::NON_ATOMIC;
@@ -137,9 +132,7 @@ MultiCommandSquasher::SquashResult MultiCommandSquasher::TrySquash(StoredCmd* cm
137
132
138
133
num_squashed_++;
139
134
140
- // Because the squashed hop is currently blocking, we cannot add more than the max channel size,
141
- // otherwise a deadlock occurs.
142
- bool need_flush = sinfo.cmds .size () >= kMaxSquashing - 1 ;
135
+ bool need_flush = sinfo.cmds .size () >= opts_.max_squash_size ;
143
136
return need_flush ? SquashResult::SQUASHED_FULL : SquashResult::SQUASHED;
144
137
}
145
138
@@ -149,11 +142,11 @@ bool MultiCommandSquasher::ExecuteStandalone(facade::RedisReplyBuilder* rb, Stor
149
142
cmd->Fill (&tmp_keylist_);
150
143
auto args = absl::MakeSpan (tmp_keylist_);
151
144
152
- if (verify_commands_ ) {
145
+ if (opts_. verify_commands ) {
153
146
if (auto err = service_->VerifyCommandState (cmd->Cid (), args, *cntx_); err) {
154
147
rb->SendError (std::move (*err));
155
148
rb->ConsumeLastError ();
156
- return !error_abort_ ;
149
+ return !opts_. error_abort ;
157
150
}
158
151
}
159
152
@@ -185,7 +178,7 @@ OpStatus MultiCommandSquasher::SquashedHopCb(EngineShard* es, RespVersion resp_v
185
178
auto args = absl::MakeSpan (arg_vec);
186
179
cmd->Fill (args);
187
180
188
- if (verify_commands_ ) {
181
+ if (opts_. verify_commands ) {
189
182
// The shared context is used for state verification, the local one is only for replies
190
183
if (auto err = service_->VerifyCommandState (cmd->Cid (), args, *cntx_); err) {
191
184
crb.SendError (std::move (*err));
@@ -265,7 +258,7 @@ bool MultiCommandSquasher::ExecuteSquashed(facade::RedisReplyBuilder* rb) {
265
258
auto & replies = sharded_[idx].replies ;
266
259
CHECK (!replies.empty ());
267
260
268
- aborted |= error_abort_ && CapturingReplyBuilder::TryExtractError (replies.back ());
261
+ aborted |= opts_. error_abort && CapturingReplyBuilder::TryExtractError (replies.back ());
269
262
270
263
current_reply_size_.fetch_sub (Size (replies.back ()), std::memory_order_relaxed);
271
264
CapturingReplyBuilder::Apply (std::move (replies.back ()), rb);
0 commit comments