Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace LOG(FATAL) with LOG(DFATAL) #5078

Merged
merged 3 commits into from
Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2567,7 +2567,8 @@ folly::Future<StatusOr<bool>> MetaClient::heartbeat() {
if (FileBasedClusterIdMan::persistInFile(resp.get_cluster_id(), FLAGS_cluster_id_path)) {
options_.clusterId_.store(resp.get_cluster_id());
} else {
LOG(FATAL) << "Can't persist the clusterId in file " << FLAGS_cluster_id_path;
LOG(DFATAL) << "Can't persist the clusterId in file " << FLAGS_cluster_id_path;
return false;
}
}
heartbeatTime_ = time::WallClock::fastNowInMilliSec();
Expand Down
3 changes: 2 additions & 1 deletion src/codec/RowReaderV1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ int64_t RowReaderV1::skipToNext(int64_t index, int64_t offset) const noexcept {
}
default: {
// TODO
LOG(FATAL) << "Unimplemented";
LOG(DFATAL) << "Unimplemented";
return -1;
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/codec/RowReaderV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ Value RowReaderV2::getValueByIndex(const int64_t index) const noexcept {
case PropertyType::UNKNOWN:
break;
}
LOG(FATAL) << "Should not reach here";
LOG(DFATAL) << "Should not reach here, illegal property type: "
<< static_cast<int>(field->type());
return Value::kNullBadType;
}

int64_t RowReaderV2::getTimestamp() const noexcept {
Expand Down
4 changes: 3 additions & 1 deletion src/codec/RowReaderWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ RowReaderWrapper::RowReaderWrapper(const meta::SchemaProviderIf* schema,
readerV2_.resetImpl(schema, row);
currReader_ = &readerV2_;
} else {
LOG(FATAL) << "Should not reach here";
LOG(DFATAL) << "Should not reach here";
readerV2_.resetImpl(schema, row);
currReader_ = &readerV2_;
}
}

Expand Down
15 changes: 10 additions & 5 deletions src/codec/RowWriterV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ RowWriterV2::RowWriterV2(const meta::SchemaProviderIf* schema)
header = 0x0F; // 0x08 | 0x07, seven bytes for the schema version
headerLen_ = 8;
} else {
LOG(FATAL) << "Schema version too big";
LOG(DFATAL) << "Schema version too big";
header = 0x0F; // 0x08 | 0x07, seven bytes for the schema version
headerLen_ = 8;
}
buf_.append(&header, 1);
buf_.append(reinterpret_cast<char*>(&ver), buf_[0] & 0x07);
Expand Down Expand Up @@ -137,7 +139,9 @@ RowWriterV2::RowWriterV2(RowReader& reader) : RowWriterV2(reader.getSchema()) {
set(i, v.moveDuration());
break;
default:
LOG(FATAL) << "Invalid data: " << v << ", type: " << v.typeName();
LOG(DFATAL) << "Invalid data: " << v << ", type: " << v.typeName();
isSet_[i] = false;
continue;
}
isSet_[i] = true;
}
Expand Down Expand Up @@ -852,9 +856,10 @@ WriteResult RowWriterV2::checkUnsetFields() noexcept {
r = write(i, defVal.getDuration());
break;
default:
LOG(FATAL) << "Unsupported default value type: " << defVal.typeName()
<< ", default value: " << defVal
<< ", default value expr: " << field->defaultValue();
LOG(DFATAL) << "Unsupported default value type: " << defVal.typeName()
<< ", default value: " << defVal
<< ", default value expr: " << field->defaultValue();
return WriteResult::TYPE_MISMATCH;
}
} else {
// Set NULL
Expand Down
2 changes: 1 addition & 1 deletion src/common/base/Arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void* Arena::allocateAligned(const std::size_t alloc) {
kAlignment - (reinterpret_cast<uintptr_t>(currentPtr_) & (kAlignment - 1));
const std::size_t consumption = alloc + pad;
if (UNLIKELY(consumption > kMaxChunkSize)) {
DLOG(FATAL) << "Arena can't allocate so large memory.";
LOG(DFATAL) << "Arena can't allocate so large memory.";
return nullptr;
}
if (LIKELY(consumption <= availableSize_)) {
Expand Down
2 changes: 1 addition & 1 deletion src/common/base/Status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const char *Status::toString(Code code) {
case kSessionNotFound:
return "SessionNotFound";
}
DLOG(FATAL) << "Invalid status code: " << static_cast<uint16_t>(code);
LOG(DFATAL) << "Invalid status code: " << static_cast<uint16_t>(code);
return "";
}

Expand Down
33 changes: 20 additions & 13 deletions src/common/datatypes/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,8 @@ folly::dynamic Value::toJson() const {
// no default so the compiler will warning when lack
}

LOG(FATAL) << "Unknown value type " << static_cast<int>(type_);
LOG(DFATAL) << "Unknown value type " << static_cast<int>(type_);
return folly::dynamic(nullptr);
}

folly::dynamic Value::getMetaData() const {
Expand Down Expand Up @@ -1550,7 +1551,8 @@ folly::dynamic Value::getMetaData() const {
break;
}

LOG(FATAL) << "Unknown value type " << static_cast<int>(type_);
LOG(DFATAL) << "Unknown value type " << static_cast<int>(type_);
return folly::dynamic(nullptr);
}

std::string Value::toString() const {
Expand All @@ -1575,7 +1577,8 @@ std::string Value::toString() const {
case NullType::OUT_OF_RANGE:
return "__NULL_OUT_OF_RANGE__";
}
LOG(FATAL) << "Unknown Null type " << static_cast<int>(getNull());
LOG(DFATAL) << "Unknown Null type " << static_cast<int>(getNull());
return "__NULL_BAD_TYPE__";
}
case Value::Type::BOOL: {
return getBool() ? "true" : "false";
Expand Down Expand Up @@ -1628,7 +1631,8 @@ std::string Value::toString() const {
// no default so the compiler will warning when lack
}

LOG(FATAL) << "Unknown value type " << static_cast<int>(type_);
LOG(DFATAL) << "Unknown value type " << static_cast<int>(type_);
return "__NULL_BAD_TYPE__";
}

Value Value::toBool() const {
Expand Down Expand Up @@ -1850,7 +1854,7 @@ Value Value::lessThan(const Value& v) const {
return kNullBadType;
}
}
DLOG(FATAL) << "Unknown type " << static_cast<int>(v.type());
LOG(DFATAL) << "Unknown type " << static_cast<int>(v.type());
return Value::kNullBadType;
}

Expand Down Expand Up @@ -1949,7 +1953,7 @@ Value Value::equal(const Value& v) const {
return false;
}
}
DLOG(FATAL) << "Unknown type " << static_cast<int>(v.type());
LOG(DFATAL) << "Unknown type " << static_cast<int>(v.type());
return Value::kNullBadType;
}

Expand All @@ -1971,7 +1975,8 @@ bool Value::implicitBool() const {
case Type::LIST:
return !getList().empty();
default:
LOG(FATAL) << "Impossible to reach here!";
LOG(DFATAL) << "Impossible to reach here!";
return false;
}
}

Expand Down Expand Up @@ -2253,7 +2258,8 @@ Value operator+(const Value& lhs, const Value& rhs) {
return Value::kNullValue;
}
}
LOG(FATAL) << "Unknown type: " << rhs.type();
LOG(DFATAL) << "Unknown type: " << rhs.type();
return Value::kNullBadType;
}
case Value::Type::VERTEX: {
switch (rhs.type()) {
Expand Down Expand Up @@ -2686,15 +2692,15 @@ bool operator<(const Value& lhs, const Value& rhs) {
return lhs.getGeography() < rhs.getGeography();
}
case Value::Type::DURATION: {
DLOG(FATAL) << "Duration is not comparable.";
LOG(DFATAL) << "Duration is not comparable.";
return false;
}
case Value::Type::NULLVALUE:
case Value::Type::__EMPTY__: {
return false;
}
}
DLOG(FATAL) << "Unknown type " << static_cast<int>(lType);
LOG(DFATAL) << "Unknown type " << static_cast<int>(lType);
return false;
}

Expand Down Expand Up @@ -2790,7 +2796,7 @@ bool Value::equals(const Value& rhs) const {
return false;
}
}
DLOG(FATAL) << "Unknown type " << static_cast<int>(type());
LOG(DFATAL) << "Unknown type " << static_cast<int>(type());
return false;
}

Expand Down Expand Up @@ -2848,12 +2854,13 @@ std::size_t Value::hash() const {
return std::hash<Duration>()(getDuration());
}
case Type::DATASET: {
LOG(FATAL) << "Hash for DATASET has not been implemented";
LOG(DFATAL) << "Hash for DATASET has not been implemented";
}
default: {
LOG(FATAL) << "Unknown type";
LOG(DFATAL) << "Unknown type";
}
}
return ~0UL;
}

bool operator!=(const Value& lhs, const Value& rhs) {
Expand Down
4 changes: 3 additions & 1 deletion src/common/expression/ArithmeticExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const Value& ArithmeticExpression::eval(ExpressionContext& ctx) {
result_ = lhs % rhs;
break;
default:
LOG(FATAL) << "Unknown type: " << kind_;
LOG(DFATAL) << "Unknown type: " << kind_;
result_ = Value::kNullBadType;
}
return result_;
}
Expand All @@ -54,6 +55,7 @@ std::string ArithmeticExpression::toString() const {
op = "%";
break;
default:
LOG(DFATAL) << "Illegal kind for arithmetic expression: " << static_cast<int>(kind());
op = "illegal symbol ";
}
std::stringstream out;
Expand Down
11 changes: 6 additions & 5 deletions src/common/expression/Expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ Expression* Expression::decode(ObjectPool* pool, Expression::Decoder& decoder) {
return exp;
}
case Expression::Kind::kInputProperty: {
LOG(FATAL) << "Should not decode input property expression";
LOG(DFATAL) << "Should not decode input property expression";
return exp;
}
case Expression::Kind::kVarProperty: {
Expand Down Expand Up @@ -459,7 +459,7 @@ Expression* Expression::decode(ObjectPool* pool, Expression::Decoder& decoder) {
return exp;
}
case Expression::Kind::kVersionedVar: {
LOG(FATAL) << "Should not decode version variable expression";
LOG(DFATAL) << "Should not decode version variable expression";
return exp;
}
case Expression::Kind::kUUID: {
Expand Down Expand Up @@ -516,17 +516,18 @@ Expression* Expression::decode(ObjectPool* pool, Expression::Decoder& decoder) {
case Expression::Kind::kTSWildcard:
case Expression::Kind::kTSRegexp:
case Expression::Kind::kTSFuzzy: {
LOG(FATAL) << "Should not decode text search expression";
LOG(DFATAL) << "Should not decode text search expression";
return exp;
}
case Expression::Kind::kMatchPathPattern: {
LOG(FATAL) << "Should not decode match path pattern expression.";
LOG(DFATAL) << "Should not decode match path pattern expression.";
return exp;
}
// no default so the compiler will warning when lack
}

LOG(FATAL) << "Unknown expression: " << decoder.getHexStr();
LOG(DFATAL) << "Unknown expression: " << decoder.getHexStr();
return exp;
}

std::ostream& operator<<(std::ostream& os, Expression::Kind kind) {
Expand Down
6 changes: 3 additions & 3 deletions src/common/expression/LabelAttributeExpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LabelAttributeExpression final : public Expression {
}

const Value& eval(ExpressionContext&) override {
DLOG(FATAL) << "LabelAttributeExpression has to be rewritten";
DLOG(DFATAL) << "LabelAttributeExpression has to be rewritten";
return Value::kNullBadData;
}

Expand Down Expand Up @@ -76,11 +76,11 @@ class LabelAttributeExpression final : public Expression {
}

void writeTo(Encoder&) const override {
LOG(FATAL) << "LabelAttributeExpression not supported to encode.";
LOG(DFATAL) << "LabelAttributeExpression not supported to encode.";
}

void resetFrom(Decoder&) override {
LOG(FATAL) << "LabelAttributeExpression not supported to decode.";
LOG(DFATAL) << "LabelAttributeExpression not supported to decode.";
}

private:
Expand Down
6 changes: 4 additions & 2 deletions src/common/expression/LogicalExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const Value &LogicalExpression::eval(ExpressionContext &ctx) {
case Kind::kLogicalXor:
return evalXor(ctx);
default:
LOG(FATAL) << "Illegal kind for logical expression: " << static_cast<int>(kind());
LOG(DFATAL) << "Illegal kind for logical expression: " << static_cast<int>(kind());
return Value::kNullBadType;
}
}

Expand Down Expand Up @@ -115,7 +116,8 @@ std::string LogicalExpression::toString() const {
op = " XOR ";
break;
default:
LOG(FATAL) << "Illegal kind for logical expression: " << static_cast<int>(kind());
LOG(DFATAL) << "Illegal kind for logical expression: " << static_cast<int>(kind());
op = " illegal symbol ";
}
std::string buf;
buf.reserve(256);
Expand Down
2 changes: 1 addition & 1 deletion src/common/expression/LogicalExpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class LogicalExpression final : public Expression {
} else if (kind_ == Kind::kLogicalOr) {
kind_ = Kind::kLogicalAnd;
} else {
LOG(FATAL) << "Should not reverse logical expression except and/or kind.";
LOG(DFATAL) << "Should not reverse logical expression except and/or kind.";
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/common/expression/MatchPathPatternExpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ class MatchPathPatternExpression final : public Expression {

// This expression contains variable implicitly, so we don't support persist or transform it.
void writeTo(Encoder&) const override {
LOG(FATAL) << "Not implemented";
LOG(DFATAL) << "Not implemented";
}

// This expression contains variable implicitly, so we don't support persist or transform it.
void resetFrom(Decoder&) override {
LOG(FATAL) << "Not implemented";
LOG(DFATAL) << "Not implemented";
}

private:
Expand Down
3 changes: 2 additions & 1 deletion src/common/expression/PropertyExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ void PropertyExpression::resetFrom(Decoder& decoder) {
const Value& PropertyExpression::eval(ExpressionContext& ctx) {
// TODO maybe cypher need it.
UNUSED(ctx);
LOG(FATAL) << "Unimplemented";
LOG(DFATAL) << "Unimplemented";
return Value::kNullBadType;
}

const Value& EdgePropertyExpression::eval(ExpressionContext& ctx) {
Expand Down
4 changes: 3 additions & 1 deletion src/common/expression/RelationalExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ const Value& RelationalExpression::eval(ExpressionContext& ctx) {
break;
}
default:
LOG(FATAL) << "Unknown type: " << kind_;
LOG(DFATAL) << "Unknown type: " << kind_;
result_ = Value::kNullBadType;
}
return result_;
}
Expand Down Expand Up @@ -249,6 +250,7 @@ std::string RelationalExpression::toString() const {
op = " NOT ENDS WITH ";
break;
default:
LOG(DFATAL) << "Illegal kind for relational expression: " << static_cast<int>(kind());
op = " illegal symbol ";
}
std::stringstream out;
Expand Down
3 changes: 2 additions & 1 deletion src/common/expression/TextSearchExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ std::string TextSearchExpression::toString() const {
break;
}
default: {
LOG(FATAL) << "Unimplemented";
LOG(DFATAL) << "Illegal kind for text search expression: " << static_cast<int>(kind());
buf = "illegal symbol(";
}
}
buf += arg_ ? arg_->toString() : "";
Expand Down
Loading