Skip to content

Commit

Permalink
fix: FATAL
Browse files Browse the repository at this point in the history
  • Loading branch information
veezhang committed Dec 20, 2022
1 parent 03d4e09 commit 71001ee
Show file tree
Hide file tree
Showing 48 changed files with 200 additions and 119 deletions.
3 changes: 2 additions & 1 deletion src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2565,7 +2565,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 @@ -62,7 +62,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 @@ -136,7 +138,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 @@ -851,9 +855,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
4 changes: 2 additions & 2 deletions src/graph/context/Iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "graph/context/Iterator.h"

#include <robin_hood.h>

return TransformResult::noTransform();
#include "common/datatypes/Edge.h"
#include "common/datatypes/Vertex.h"
#include "common/memory/MemoryUtils.h"
Expand Down Expand Up @@ -758,7 +758,7 @@ PropIter::PropIter(std::shared_ptr<Value> value, bool checkMemory)
auto& ds = value->getDataSet();
auto status = makeDataSetIndex(ds);
if (UNLIKELY(!status.ok())) {
DLOG(FATAL) << status;
LOG(DFATAL) << status;
clear();
return;
}
Expand Down
18 changes: 9 additions & 9 deletions src/graph/context/Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ class Iterator {
}

virtual const Value& getTagProp(const std::string&, const std::string&) const {
DLOG(FATAL) << "Shouldn't call the unimplemented method";
LOG(DFATAL) << "Shouldn't call the unimplemented method";
return Value::kEmpty;
}

virtual const Value& getEdgeProp(const std::string&, const std::string&) const {
DLOG(FATAL) << "Shouldn't call the unimplemented method";
LOG(DFATAL) << "Shouldn't call the unimplemented method";
return Value::kEmpty;
}

Expand Down Expand Up @@ -203,11 +203,11 @@ class DefaultIter final : public Iterator {
}

void select(std::size_t, std::size_t) override {
DLOG(FATAL) << "Unimplemented method for default iterator.";
LOG(DFATAL) << "Unimplemented method for default iterator.";
}

void sample(int64_t) override {
DLOG(FATAL) << "Unimplemented default iterator.";
LOG(DFATAL) << "Unimplemented default iterator.";
}

void clear() override {
Expand All @@ -219,27 +219,27 @@ class DefaultIter final : public Iterator {
}

const Value& getColumn(const std::string& /* col */) const override {
DLOG(FATAL) << "This method should not be invoked";
LOG(DFATAL) << "This method should not be invoked";
return Value::kEmpty;
}

const Value& getColumn(int32_t) const override {
DLOG(FATAL) << "This method should not be invoked";
LOG(DFATAL) << "This method should not be invoked";
return Value::kEmpty;
}

StatusOr<std::size_t> getColumnIndex(const std::string&) const override {
DLOG(FATAL) << "This method should not be invoked";
LOG(DFATAL) << "This method should not be invoked";
return Status::Error("Unimplemented method");
}

const Row* row() const override {
DLOG(FATAL) << "This method should not be invoked";
LOG(DFATAL) << "This method should not be invoked";
return nullptr;
}

Row moveRow() override {
DLOG(FATAL) << "This method should not be invoked";
LOG(DFATAL) << "This method should not be invoked";
return Row{};
}

Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/Executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ Executor *Executor::makeExecutor(QueryContext *qctx, const PlanNode *node) {
return pool->makeAndAdd<GetDstBySrcExecutor>(node, qctx);
}
case PlanNode::Kind::kUnknown: {
LOG(FATAL) << "Unknown plan node kind " << static_cast<int32_t>(node->kind());
LOG(DFATAL) << "Unknown plan node kind " << static_cast<int32_t>(node->kind());
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/graph/executor/admin/SubmitJobExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ StatusOr<DataSet> SubmitJobExecutor::buildResult(meta::cpp2::JobOp jobOp,
}
// no default so the compiler will warning when lack
}
DLOG(FATAL) << "Unknown job operation " << static_cast<int>(jobOp);
LOG(DFATAL) << "Unknown job operation " << static_cast<int>(jobOp);
return Status::Error("Unknown job job operation %d.", static_cast<int>(jobOp));
}

Expand Down
3 changes: 2 additions & 1 deletion src/graph/executor/query/DataCollectExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ folly::Future<Status> DataCollectExecutor::doCollect() {
break;
}
default:
LOG(FATAL) << "Unknown data collect type: " << static_cast<int64_t>(dc->kind());
LOG(DFATAL) << "Unknown data collect type: " << static_cast<int64_t>(dc->kind());
return Status::Error("Unknown data collect type: %d.", static_cast<int64_t>(dc->kind());
}
ResultBuilder builder;
builder.value(Value(std::move(result_))).iter(Iterator::Kind::kSequential);
Expand Down
2 changes: 1 addition & 1 deletion src/graph/optimizer/rule/PushEFilterDownRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ std::string PushEFilterDownRule::toString() const {
ret = EdgePropertyExpression::make(pool, std::move(edgeNameResult).value(), exp->prop());
break;
default:
LOG(FATAL) << "Unexpected expr: " << exp->kind();
LOG(DFATAL) << "Unexpected expr: " << exp->kind();
}
return ret;
}
Expand Down
6 changes: 3 additions & 3 deletions src/graph/optimizer/rule/PushFilterDownNodeRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ StatusOr<OptRule::TransformResult> PushFilterDownNodeRule::transform(
auto *append = static_cast<const AppendVertices *>(node);
vFilter = append->vFilter()->clone();
} else {
DLOG(FATAL) << "Unsupported node kind: " << node->kind();
LOG(DFATAL) << "Unsupported node kind: " << node->kind();
return TransformResult::noTransform();
}
auto visitor = graph::ExtractFilterExprVisitor::makePushGetVertices(pool);
Expand Down Expand Up @@ -83,7 +83,7 @@ StatusOr<OptRule::TransformResult> PushFilterDownNodeRule::transform(
append->setVertexFilter(remainedExpr);
append->setFilter(vFilter);
} else {
DLOG(FATAL) << "Unsupported node kind: " << newExplore->kind();
LOG(DFATAL) << "Unsupported node kind: " << newExplore->kind();
return TransformResult::noTransform();
}

Expand Down Expand Up @@ -111,7 +111,7 @@ bool PushFilterDownNodeRule::match(OptContext *octx, const MatchedResult &matche
return false;
}
} else {
DLOG(FATAL) << "Unexpected node kind: " << node->kind();
LOG(DFATAL) << "Unexpected node kind: " << node->kind();
return false;
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/graph/optimizer/rule/UnionAllIndexScanBaseRule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ StatusOr<TransformResult> UnionAllIndexScanBaseRule::transform(OptContext* ctx,
break;
}
default:
LOG(FATAL) << "Invalid expression kind: " << static_cast<uint8_t>(conditionType);
break;
LOG(DFATAL) << "Invalid expression kind: " << static_cast<uint8_t>(conditionType);
return TransformResult::noTransform();
}

DCHECK(transformedExpr->kind() == ExprKind::kLogicalOr);
Expand Down
2 changes: 1 addition & 1 deletion src/graph/planner/match/SegmentsConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ SubPlan SegmentsConnector::addInput(const SubPlan& left, const SubPlan& right, b
siLeft->setLeftDep(const_cast<PlanNode*>(right.root));
siLeft->setLeftVar(right.root->outputVar());
} else {
DLOG(FATAL) << "Unsupported plan node: " << left.tail->kind();
LOG(DFATAL) << "Unsupported plan node: " << left.tail->kind();
return newPlan;
}
newPlan.tail = right.tail;
Expand Down
3 changes: 2 additions & 1 deletion src/graph/planner/plan/PlanNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ const char* PlanNode::toString(PlanNode::Kind kind) {
return "GetDstBySrc";
// no default so the compiler will warning when lack
}
LOG(FATAL) << "Impossible kind plan node " << static_cast<int>(kind);
LOG(DFATAL) << "Impossible kind plan node " << static_cast<int>(kind);
return "Unknown";
}

std::string PlanNode::toString() const {
Expand Down
8 changes: 4 additions & 4 deletions src/graph/planner/plan/PlanNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ class SingleDependencyNode : public PlanNode {
}

PlanNode* clone() const override {
LOG(FATAL) << "Shouldn't call the unimplemented method";
LOG(DFATAL) << "Shouldn't call the unimplemented method";
return nullptr;
}

Expand All @@ -370,7 +370,7 @@ class SingleInputNode : public SingleDependencyNode {
std::unique_ptr<PlanNodeDescription> explain() const override;

PlanNode* clone() const override {
LOG(FATAL) << "Shouldn't call the unimplemented method";
LOG(DFATAL) << "Shouldn't call the unimplemented method";
return nullptr;
}

Expand Down Expand Up @@ -420,7 +420,7 @@ class BinaryInputNode : public PlanNode {
}

PlanNode* clone() const override {
LOG(FATAL) << "Shouldn't call the unimplemented method for " << kind_;
LOG(DFATAL) << "Shouldn't call the unimplemented method for " << kind_;
return nullptr;
}

Expand All @@ -442,7 +442,7 @@ class VariableDependencyNode : public PlanNode {
std::unique_ptr<PlanNodeDescription> explain() const override;

PlanNode* clone() const override {
LOG(FATAL) << "Shouldn't call the unimplemented method";
LOG(DFATAL) << "Shouldn't call the unimplemented method";
return nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion src/graph/util/ParserUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void ParserUtil::rewriteLC(QueryContext *qctx,
return static_cast<Expression *>(mpp);
} break;
default:
LOG(FATAL) << "Unexpected expression kind: " << expr->kind();
LOG(DFATAL) << "Unexpected expression kind: " << expr->kind();
}
return ret;
};
Expand Down
2 changes: 1 addition & 1 deletion src/graph/util/ToJson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ folly::dynamic toJson(const Value &value) {
// TODO store to object or array
return value.toString();
}
DLOG(FATAL) << "Impossible reach.";
LOG(DFATAL) << "Impossible reach.";
return folly::dynamic::object();
}

Expand Down
4 changes: 2 additions & 2 deletions src/graph/validator/LookupValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ Expression* LookupValidator::reverseRelKind(RelationalExpression* expr) {
reversedKind = ExprKind::kRelLE;
break;
default:
LOG(FATAL) << "Invalid relational expression kind: " << static_cast<uint8_t>(kind);
break;
LOG(DFATAL) << "Invalid relational expression kind: " << static_cast<uint8_t>(kind);
return expr;
}

auto left = expr->left();
Expand Down
4 changes: 2 additions & 2 deletions src/graph/validator/Validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ std::unique_ptr<Validator> Validator::makeValidator(Sentence* sentence, QueryCon
case Sentence::Kind::kUnknown:
case Sentence::Kind::kReturn: {
// nothing
DLOG(FATAL) << "Unimplemented sentence " << kind;
LOG(DFATAL) << "Unimplemented sentence " << kind;
}
}
DLOG(FATAL) << "Unknown sentence " << static_cast<int>(kind);
LOG(DFATAL) << "Unknown sentence " << static_cast<int>(kind);
return std::make_unique<ReportError>(sentence, context);
}

Expand Down
24 changes: 18 additions & 6 deletions src/graph/visitor/DeduceTypeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,12 @@ void DeduceTypeVisitor::visit(UnaryExpression *expr) {
break;
}
default: {
LOG(FATAL) << "Invalid unary expression kind: " << static_cast<uint8_t>(expr->kind());
break;
LOG(DFATAL) << "Invalid unary expression kind: " << static_cast<uint8_t>(expr->kind());
std::stringstream ss;
ss << "`" << expr->toString() << "' is invalid unary expression, kind is "
<< static_cast<uint8_t>(expr->kind()) << ".";
status_ = Status::SemanticError(ss.str());
return;
}
}
}
Expand Down Expand Up @@ -280,8 +284,12 @@ void DeduceTypeVisitor::visit(ArithmeticExpression *expr) {
break;
}
default: {
LOG(FATAL) << "Invalid arithmetic expression kind: " << static_cast<uint8_t>(expr->kind());
break;
LOG(DFATAL) << "Invalid arithmetic expression kind: " << static_cast<uint8_t>(expr->kind());
std::stringstream ss;
ss << "`" << expr->toString() << "' is invalid arithmetic expression, kind is "
<< static_cast<uint8_t>(expr->kind()) << ".";
status_ = Status::SemanticError(ss.str());
return;
}
}
}
Expand Down Expand Up @@ -422,8 +430,12 @@ void DeduceTypeVisitor::visit(LogicalExpression *expr) {
break;
}
default: {
LOG(FATAL) << "Invalid logical expression kind: " << static_cast<uint8_t>(expr->kind());
break;
LOG(DFATAL) << "Invalid logical expression kind: " << static_cast<uint8_t>(expr->kind());
std::stringstream ss;
ss << "`" << expr->toString() << "' is invalid logical expression, kind is "
<< static_cast<uint8_t>(expr->kind()) << ".";
status_ = Status::SemanticError(ss.str());
return;
}
}
}
Expand Down
Loading

0 comments on commit 71001ee

Please sign in to comment.