Skip to content

Commit

Permalink
Tan review
Browse files Browse the repository at this point in the history
  • Loading branch information
liyuheng55555 committed Jan 21, 2025
1 parent 0848a53 commit 651c72b
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,35 @@ public void loadSnapshot(File latestSnapshotRootDir) {

protected PlanNode grabPlanNode(IndexedConsensusRequest indexedRequest) {
List<SearchNode> searchNodes = new ArrayList<>();
PlanNode onlyOne = null;
for (IConsensusRequest req : indexedRequest.getRequests()) {
// PlanNode in IndexedConsensusRequest should always be InsertNode
PlanNode planNode = getPlanNode(req);
if (planNode instanceof SearchNode) {
((SearchNode) planNode).setSearchIndex(indexedRequest.getSearchIndex());
searchNodes.add((SearchNode) planNode);
} else {
logger.warn("Unexpected plan node type {}", planNode.getClass());
logger.warn("Unexpected PlanNode type {}, which is not SearchNode", planNode.getClass());
if (onlyOne == null) {
onlyOne = planNode;
} else {
throw new IllegalArgumentException(
String.format(
"There are two types of PlanNode in one request: %s and %s",
onlyOne.getClass(), planNode.getClass()));
}
}
}
if (onlyOne != null) {
if (!searchNodes.isEmpty()) {
throw new IllegalArgumentException(
String.format(
"There are two types of PlanNode in one request: %s and SearchNode",
onlyOne.getClass()));
}
return onlyOne;
}
// searchNodes should never be empty here
return searchNodes.get(0).merge(searchNodes);
}

Expand Down

0 comments on commit 651c72b

Please sign in to comment.