chore: enable experimental_new_io by default. (#3605)

* chore: enable experimental_new_io by default.

It has been running for weeks with the flag on, so enabled it also for community.

---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Co-authored-by: Vladislav Oleshko <vlad@dragonflydb.io>
This commit is contained in:
Roman Gershman 2024-08-29 23:30:26 +03:00 committed by GitHub
parent fa2d67b8a8
commit 20336805f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 14 deletions

View file

@ -142,7 +142,7 @@ jobs:
EOF EOF
gdb -ix ./init.gdb --batch -ex r --args ./dragonfly_test --force_epoll gdb -ix ./init.gdb --batch -ex r --args ./dragonfly_test --force_epoll
DFLY_use_new_io=true FLAGS_force_epoll=true GLOG_vmodule=rdb_load=1,rdb_save=1,snapshot=1 timeout 20m ctest -V -L DFLY FLAGS_force_epoll=true GLOG_vmodule=rdb_load=1,rdb_save=1,snapshot=1 timeout 20m ctest -V -L DFLY
echo "Finished running tests with --force_epoll" echo "Finished running tests with --force_epoll"

View file

@ -9,7 +9,9 @@
#include "facade/dragonfly_connection.h" #include "facade/dragonfly_connection.h"
#include "facade/reply_builder.h" #include "facade/reply_builder.h"
ABSL_FLAG(bool, use_new_io, false, "Use new IO by default"); ABSL_FLAG(bool, experimental_new_io, true,
"Use new replying code - should "
"reduce latencies for pipelining");
namespace facade { namespace facade {
@ -21,8 +23,9 @@ ConnectionContext::ConnectionContext(::io::Sink* stream, Connection* owner) : ow
if (stream) { if (stream) {
switch (protocol_) { switch (protocol_) {
case Protocol::REDIS: { case Protocol::REDIS: {
RedisReplyBuilder* rb = absl::GetFlag(FLAGS_use_new_io) ? new RedisReplyBuilder2(stream) RedisReplyBuilder* rb = absl::GetFlag(FLAGS_experimental_new_io)
: new RedisReplyBuilder(stream); ? new RedisReplyBuilder2(stream)
: new RedisReplyBuilder(stream);
rbuilder_.reset(rb); rbuilder_.reset(rb);
break; break;
} }

View file

@ -881,7 +881,7 @@ void RedisReplyBuilder2Base::SendLong(long val) {
} }
void RedisReplyBuilder2Base::SendDouble(double val) { void RedisReplyBuilder2Base::SendDouble(double val) {
char buf[DoubleToStringConverter::kBase10MaximalLength + 1]; char buf[DoubleToStringConverter::kBase10MaximalLength + 8]; // +8 to be on the safe side.
static_assert(ABSL_ARRAYSIZE(buf) < kMaxInlineSize, "Write temporary string from buf inline"); static_assert(ABSL_ARRAYSIZE(buf) < kMaxInlineSize, "Write temporary string from buf inline");
string_view val_str = FormatDouble(val, buf, ABSL_ARRAYSIZE(buf)); string_view val_str = FormatDouble(val, buf, ABSL_ARRAYSIZE(buf));
@ -983,7 +983,7 @@ void RedisReplyBuilder2::SendStored() {
} }
void RedisReplyBuilder2::SendSetSkipped() { void RedisReplyBuilder2::SendSetSkipped() {
SendSimpleString("SKIPPED"); SendNull();
} }
void RedisReplyBuilder2::StartArray(unsigned len) { void RedisReplyBuilder2::StartArray(unsigned len) {

View file

@ -347,7 +347,7 @@ class RedisReplyBuilder : public SinkReplyBuilder {
RedisReplyBuilder(::io::Sink* stream); RedisReplyBuilder(::io::Sink* stream);
virtual void SetResp3(bool is_resp3); virtual void SetResp3(bool is_resp3);
bool IsResp3() const { virtual bool IsResp3() const {
return is_resp3_; return is_resp3_;
} }
@ -418,7 +418,7 @@ class RedisReplyBuilder2Base : public SinkReplyBuilder2, public RedisReplyBuilde
static char* FormatDouble(double d, char* dest, unsigned len); static char* FormatDouble(double d, char* dest, unsigned len);
virtual void SendVerbatimString(std::string_view str, VerbatimFormat format = TXT) override; virtual void SendVerbatimString(std::string_view str, VerbatimFormat format = TXT) override;
bool IsResp3() const { bool IsResp3() const override {
return resp3_; return resp3_;
} }

View file

@ -1156,9 +1156,8 @@ void HSetFamily::HRandField(CmdArgList args, ConnectionContext* cntx) {
if (result) { if (result) {
if ((result->size() == 1) && (args.size() == 1)) if ((result->size() == 1) && (args.size() == 1))
rb->SendBulkString(result->front()); rb->SendBulkString(result->front());
else { else
rb->SendStringArr(*result, facade::RedisReplyBuilder::MAP); rb->SendStringArr(*result, facade::RedisReplyBuilder::ARRAY);
}
} else if (result.status() == OpStatus::KEY_NOTFOUND) { } else if (result.status() == OpStatus::KEY_NOTFOUND) {
if (args.size() == 1) if (args.size() == 1)
rb->SendNull(); rb->SendNull();

View file

@ -349,9 +349,6 @@ class DflyInstanceFactory:
# Add 1 byte limit for big values # Add 1 byte limit for big values
args.setdefault("serialization_max_chunk_size", 1) args.setdefault("serialization_max_chunk_size", 1)
if version > 1.21:
args.setdefault("use_new_io")
for k, v in args.items(): for k, v in args.items():
args[k] = v.format(**self.params.env) if isinstance(v, str) else v args[k] = v.format(**self.params.env) if isinstance(v, str) else v