Skip to content

Commit

Permalink
chore: pull latest helio (#4446)
Browse files Browse the repository at this point in the history
This also pulls the latest abseil library 20240722.0
  • Loading branch information
romange authored Jan 13, 2025
1 parent 679df5c commit 29cde99
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/core/interpreter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ std::optional<absl::FixedArray<std::string_view, 4>> Interpreter::PrepareArgs()
switch (lua_type(lua_, idx)) {
case LUA_TNUMBER:
if (lua_isinteger(lua_, idx)) {
blob_len += absl::AlphaNum{lua_tointeger(lua_, idx)}.size();
blob_len += absl::AlphaNum(lua_tointeger(lua_, idx)).size();
} else {
int fmt_len = absl::SNPrintF(tmpbuf, sizeof(tmpbuf), "%.17g", lua_tonumber(lua_, idx));
CHECK_GT(fmt_len, 0);
Expand Down
6 changes: 6 additions & 0 deletions src/core/search/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,17 @@ std::optional<double> ParseNumericField(std::string_view value);
suppress this false warning, we temporarily disable it around this block of code using GCC
diagnostic directives. */
template <typename InlinedVector> std::optional<InlinedVector> EmptyAccessResult() {
#if !defined(__clang__)
// GCC 13.1 throws spurious warnings around this code.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif

return InlinedVector{};

#if !defined(__clang__)
#pragma GCC diagnostic pop
#endif
}

} // namespace dfly::search
7 changes: 5 additions & 2 deletions src/facade/dragonfly_listener.cc
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,11 @@ DispatchTracker::DispatchTracker(absl::Span<facade::Listener* const> listeners,
}

void DispatchTracker::TrackOnThread() {
for (auto* listener : listeners_)
listener->TraverseConnectionsOnThread(absl::bind_front(&DispatchTracker::Handle, this));
for (auto* listener : listeners_) {
listener->TraverseConnectionsOnThread(
[this](unsigned thread_index, util::Connection* conn) { Handle(thread_index, conn); },
UINT32_MAX, nullptr);
}
}

bool DispatchTracker::Wait(absl::Duration duration) {
Expand Down
6 changes: 0 additions & 6 deletions src/facade/reply_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@ namespace facade {

namespace {

inline iovec constexpr IoVec(std::string_view s) {
iovec r{const_cast<char*>(s.data()), s.size()};
return r;
}

constexpr char kCRLF[] = "\r\n";
constexpr char kErrPref[] = "-ERR ";
constexpr char kSimplePref[] = "+";
constexpr char kLengthPrefix[] = "$";
constexpr char kDoublePref[] = ",";
Expand Down
7 changes: 6 additions & 1 deletion src/server/acl/user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ void User::Update(UpdateRequest&& req, const CategoryToIdxStore& cat_to_id,
void User::SetPasswordHash(std::string_view password, bool is_hashed) {
nopass_ = false;
if (is_hashed) {
password_hashes_.insert(absl::HexStringToBytes(password));
std::string binary;
if (absl::HexStringToBytes(password, &binary)) {
password_hashes_.insert(binary);
} else {
LOG(ERROR) << "Invalid password hash: " << password;
}
return;
}
password_hashes_.insert(StringSHA256(password));
Expand Down
2 changes: 1 addition & 1 deletion src/server/cluster/outgoing_slot_migration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void OutgoingMigration::SyncFb() {
continue;
}

OnAllShards([this](auto& migration) { migration->RunSync(); });
OnAllShards([](auto& migration) { migration->RunSync(); });

if (cntx_.GetError()) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/server/journal/journal_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ template <> string ConCat(const CmdArgList& list) {
struct EntryPayloadVisitor {
void operator()(const Entry::Payload& p) {
out->append(p.cmd).append(" ");
*out += visit([this](const auto& args) { return ConCat(args); }, p.args);
*out += visit([](const auto& args) { return ConCat(args); }, p.args);
}

string* out;
Expand Down
2 changes: 1 addition & 1 deletion src/server/main_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ void Service::DispatchMC(const MemcacheParser::Command& cmd, std::string_view va
MCReplyBuilder* mc_builder, facade::ConnectionContext* cntx) {
absl::InlinedVector<MutableSlice, 8> args;
char cmd_name[16];
char ttl[16];
char ttl[absl::numbers_internal::kFastToBufferSize];
char store_opt[32] = {0};
char ttl_op[] = "EXAT";

Expand Down
2 changes: 1 addition & 1 deletion src/server/replica.cc
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ error_code Replica::ConsumeRedisStream() {
}

if (!LastResponseArgs().empty()) {
string_view cmd = absl::CHexEscape(ToSV(LastResponseArgs()[0].GetBuf()));
string cmd = absl::CHexEscape(ToSV(LastResponseArgs()[0].GetBuf()));

// Valkey and Redis may send MULTI and EXEC as part of their replication commands.
// Dragonfly disallows some commands, such as SELECT, inside of MULTI/EXEC, so here we simply
Expand Down
5 changes: 3 additions & 2 deletions src/server/server_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1773,8 +1773,9 @@ void ServerFamily::CancelBlockingOnThread(std::function<OpStatus(ArgSlice)> stat
}
};

for (auto* listener : listeners_)
listener->TraverseConnectionsOnThread(cb);
for (auto* listener : listeners_) {
listener->TraverseConnectionsOnThread(cb, UINT32_MAX, nullptr);
}
}

string GetPassword() {
Expand Down
6 changes: 3 additions & 3 deletions src/server/test_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ static vector<string> SplitLines(const std::string& src) {
return res;
}

TestConnection::TestConnection(Protocol protocol, io::StringSink* sink)
: facade::Connection(protocol, nullptr, nullptr, nullptr), sink_(sink) {
TestConnection::TestConnection(Protocol protocol)
: facade::Connection(protocol, nullptr, nullptr, nullptr) {
cc_.reset(new dfly::ConnectionContext(this, {}));
cc_->skip_acl_validation = true;
SetSocket(ProactorBase::me()->CreateSocket());
Expand Down Expand Up @@ -141,7 +141,7 @@ class BaseFamilyTest::TestConnWrapper {
};

BaseFamilyTest::TestConnWrapper::TestConnWrapper(Protocol proto)
: dummy_conn_(new TestConnection(proto, &sink_)) {
: dummy_conn_(new TestConnection(proto)) {
switch (proto) {
case Protocol::REDIS:
builder_.reset(new RedisReplyBuilder{&sink_});
Expand Down
3 changes: 1 addition & 2 deletions src/server/test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void TEST_InvalidateLockTagOptions();

class TestConnection : public facade::Connection {
public:
TestConnection(Protocol protocol, io::StringSink* sink);
explicit TestConnection(Protocol protocol);
std::string RemoteEndpointStr() const override;

void SendPubMessageAsync(PubMessage pmsg) final;
Expand All @@ -44,7 +44,6 @@ class TestConnection : public facade::Connection {
std::vector<InvalidationMessage> invalidate_messages;

private:
io::StringSink* sink_;
bool is_privileged_ = false;
};

Expand Down
2 changes: 1 addition & 1 deletion src/server/zset_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ OpResult<ScoredArray> ZPopMinMaxInternal(std::string_view key, FilterShards shou
}
auto cb = [&](Transaction* t, EngineShard* shard) {
if (!key_shard.has_value() || *key_shard == shard->shard_id()) {
result = std::move(OpPopCount(range_spec, t->GetOpArgs(shard), key));
result = OpPopCount(range_spec, t->GetOpArgs(shard), key);
}
return OpStatus::OK;
};
Expand Down
2 changes: 1 addition & 1 deletion src/server/zset_family.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace dfly {
class CommandRegistry;
struct CommandContext;
class Transaction;
class OpArgs;
struct OpArgs;

class ZSetFamily {
public:
Expand Down

0 comments on commit 29cde99

Please sign in to comment.