Skip to content

Commit ba85b9d

Browse files
committed
more fixes
1 parent 1263dc7 commit ba85b9d

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/server/hset_family.cc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@ struct OpSetParams {
455455
};
456456

457457
OpResult<CbVariant<uint32_t>> OpSet(const OpArgs& op_args, string_view key, CmdArgList values,
458-
const OpSetParams& op_sp = OpSetParams{}) {
458+
const OpSetParams& op_sp = OpSetParams{},
459+
optional<util::fb2::Future<bool>>* bp_anker = nullptr) {
459460
DCHECK(!values.empty() && 0 == values.size() % 2);
460461
VLOG(2) << "OpSet(" << key << ")";
461462

@@ -542,8 +543,11 @@ OpResult<CbVariant<uint32_t>> OpSet(const OpArgs& op_args, string_view key, CmdA
542543

543544
op_args.shard->search_indices()->AddDoc(key, op_args.db_cntx, pv);
544545

545-
if (auto* ts = op_args.shard->tiered_storage(); ts)
546-
ts->TryStash(op_args.db_cntx.db_index, key, &pv);
546+
if (auto* ts = op_args.shard->tiered_storage(); ts) {
547+
auto bp = ts->TryStash(op_args.db_cntx.db_index, key, &pv, true);
548+
if (bp && bp_anker)
549+
*bp_anker = std::move(*bp);
550+
}
547551

548552
return CbVariant<uint32_t>{created};
549553
}
@@ -907,14 +911,19 @@ void HSetFamily::HSet(CmdArgList args, const CommandContext& cmd_cntx) {
907911
return cmd_cntx.rb->SendError(facade::WrongNumArgsError(cmd), kSyntaxErrType);
908912
}
909913

914+
optional<util::fb2::Future<bool>> tiered_backpressure;
915+
910916
args.remove_prefix(1);
911917
auto cb = [&](Transaction* t, EngineShard* shard) {
912-
return OpSet(t->GetOpArgs(shard), key, args);
918+
return OpSet(t->GetOpArgs(shard), key, args, OpSetParams{}, &tiered_backpressure);
913919
};
914920

915921
auto delayed_result = cmd_cntx.tx->ScheduleSingleHopT(std::move(cb));
916922
OpResult<uint32_t> result = Unwrap(std::move(delayed_result));
917923

924+
if (tiered_backpressure)
925+
tiered_backpressure->GetFor(10ms);
926+
918927
if (result && cmd == "HSET") {
919928
cmd_cntx.rb->SendLong(*result);
920929
} else {

0 commit comments

Comments
 (0)