Skip to content

Commit 2bce30c

Browse files
committed
alignment
1 parent dba74cb commit 2bce30c

2 files changed

Lines changed: 52 additions & 15 deletions

File tree

src/apps/hnsw/partition/search.rs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,12 @@ impl HnswOnlinePartition {
393393
}
394394
Err(NeighbourhoodError::IdListError(IdListError::ContainerCellNotReady)) => {
395395
// If the container cell is not ready, we need to prepare the it
396+
append_job_log(
397+
logger,
398+
job_id,
399+
JobLogLevel::Info,
400+
format!("Container cell not ready for vertex {:?}, preparing it", id),
401+
);
396402
let field_id = ed.as_field();
397403
let _ = engine
398404
.graph_transaction(DefaultPartitioner, move |txn| {
@@ -650,6 +656,17 @@ impl HnswOnlinePartition {
650656
EdgeDirection::Undirected,
651657
) {
652658
Ok(neighbors) => {
659+
append_job_log(
660+
logger,
661+
job_id,
662+
JobLogLevel::Info,
663+
format!(
664+
"Found {} neighbors for vertex {:?} with level schema {}",
665+
neighbors.len(),
666+
current_vertex,
667+
level_schema
668+
),
669+
);
653670
for (neighbor_id, _) in neighbors {
654671
let is_local = self.conshash.get_server_id(neighbor_id.higher)
655672
== Some(self.server_id);
@@ -895,7 +912,18 @@ impl HnswOnlinePartition {
895912
job_id,
896913
)
897914
.await?;
898-
915+
append_job_log(
916+
logger,
917+
job_id,
918+
JobLogLevel::Info,
919+
format!(
920+
"Found {} nearest neighbors at level {} for vertex {:?}, with entry points {:?}",
921+
nearest_neighbors.len(),
922+
level,
923+
vertex_id,
924+
entry_points
925+
),
926+
);
899927
// Apply the neighbor selection heuristic to choose diverse neighbors
900928
let selected_neighbors = self.select_neighbors_heuristic(
901929
&vertex_id,
@@ -919,6 +947,15 @@ impl HnswOnlinePartition {
919947
);
920948
for neighbor_id in &selected_neighbors {
921949
// Create bidirectional edges
950+
append_job_log(
951+
logger,
952+
job_id,
953+
JobLogLevel::Info,
954+
format!(
955+
"Connecting vertex {:?} to neighbor {:?} at level {}",
956+
vertex_id, neighbor_id, level
957+
),
958+
);
922959
match engine
923960
.link(
924961
vertex_id, // from (new vertex)

src/graph/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -517,36 +517,36 @@ impl GraphEngine {
517517
V: ToVertexId,
518518
{
519519
let vertex_field = ed.as_field();
520-
let edge_schema_id = edge_schema.to_id(&self.schemas);
521-
let vertex_id = vertex.to_id();
522-
let edge_attr = match self.schemas.schema_type(edge_schema_id) {
520+
let schema_id = edge_schema.to_id(&self.schemas);
521+
let vertex_id = &vertex.to_id();
522+
let edge_attrs = match self.schemas.schema_type(schema_id) {
523523
Some(GraphSchema::Edge(ea)) => ea,
524-
Some(_) => return Err(NeighbourhoodError::EdgeError(EdgeError::WrongSchema)),
525-
None => return Err(NeighbourhoodError::EdgeError(EdgeError::CannotFindSchema)),
524+
_ => {
525+
return Err(NeighbourhoodError::EdgeError(
526+
EdgeError::CannotFindSchema,
527+
))
528+
}
526529
};
527-
if edge_attr.has_body {
528-
return Err(NeighbourhoodError::LocalEdgeCannotHaveBody);
529-
}
530-
match LocalIdList::new(&*self.local_chunks, vertex_id, vertex_field, edge_schema_id).iter()
530+
match LocalIdList::new(&*self.local_chunks, *vertex_id, vertex_field, schema_id).iter()
531531
{
532532
Ok(Ok(mut id_list)) => {
533533
let mut result = Vec::new();
534534
while let Some(opposite_id) = id_list.next() {
535-
match edge_attr.edge_type {
535+
match edge_attrs.edge_type {
536536
EdgeType::Directed => {
537537
let edge = DirectedEdge::build_edge(
538-
vertex_id,
538+
*vertex_id,
539539
opposite_id,
540-
edge_schema_id,
540+
schema_id,
541541
None,
542542
);
543543
result.push((opposite_id, Edge::Directed(edge)));
544544
}
545545
EdgeType::Undirected => {
546546
let edge = UndirectedEdge::build_edge(
547-
vertex_id,
547+
*vertex_id,
548548
opposite_id,
549-
edge_schema_id,
549+
schema_id,
550550
None,
551551
);
552552
result.push((opposite_id, Edge::Undirected(edge)));

0 commit comments

Comments
 (0)