Skip to content

Commit

Permalink
Check if schema exist and ignore the bad data. (vesoft-inc#1850)
Browse files Browse the repository at this point in the history
close vesoft-inc#1843
This error will happen when schema was rebuilt.
  • Loading branch information
CPWstatic authored Mar 11, 2020
1 parent 38e4a09 commit 6419d9e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/graph/FetchVerticesExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,9 @@ void FetchVerticesExecutor::processAllPropsResult(RpcResponse &&result) {
}
auto schema = ectx()->schemaManager()->getTagSchema(spaceId_, tdata.tag_id, ver);
if (schema == nullptr) {
LOG(ERROR) << "Schema not found for id: " << tdata.tag_id;
doError(Status::Error("Get schema failed when handle data."));
return;
VLOG(3) << "Schema not found for tag id: " << tdata.tag_id;
// Ignore the bad data.
continue;
}
if (rsWriter == nullptr) {
outputSchema = std::make_shared<SchemaWriter>();
Expand All @@ -363,9 +363,9 @@ void FetchVerticesExecutor::processAllPropsResult(RpcResponse &&result) {

auto tagFound = ectx()->schemaManager()->toTagName(spaceId_, tdata.tag_id);
if (!tagFound.ok()) {
LOG(ERROR) << "Tag not found for id: " << tdata.tag_id;
doError(Status::Error("Tag not found for id: %d", tdata.tag_id));
return;
VLOG(3) << "Tag name not found for tag id: " << tdata.tag_id;
// Ignore the bad data.
continue;
}
auto tagName = std::move(tagFound).value();
auto iter = schema->begin();
Expand Down
4 changes: 4 additions & 0 deletions src/storage/query/QueryEdgePropsProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ kvstore::ResultCode QueryEdgePropsProcessor::collectEdgesProps(
}

auto schema = this->schemaMan_->getEdgeSchema(spaceId_, std::abs(edgeKey.edge_type));
if (schema == nullptr) {
VLOG(3) << "Schema not found for edge type: " << edgeKey.edge_type;
return kvstore::ResultCode::ERR_EDGE_NOT_FOUND;
}
auto retTTLOpt = getEdgeTTLInfo(edgeKey.edge_type);
// Only use the latest version.
if (iter && iter->valid()) {
Expand Down
5 changes: 5 additions & 0 deletions src/storage/query/QueryVertexPropsProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ kvstore::ResultCode QueryVertexPropsProcessor::collectVertexProps(
VLOG(3) << "Found tag " << tagId << " for vId" << vId;

auto schema = this->schemaMan_->getTagSchema(spaceId_, tagId);
if (schema == nullptr) {
// Ignore the bad data.
VLOG(3) << "Schema not found for tag id: " << tagId;
continue;
}
auto reader = RowReader::getTagPropReader(this->schemaMan_, val, spaceId_, tagId);
// Check if ttl data expired
auto retTTL = getTagTTLInfo(tagId);
Expand Down

0 comments on commit 6419d9e

Please sign in to comment.