@@ -628,6 +628,22 @@ private static Edge asEdgeOrDanglingEntry(final RID edgeRID) {
628628 }
629629 }
630630
631+ /**
632+ * Shared by the {@code DanglingEdgeListEntryException} catch in both {@link #checkIncomingEdges} and
633+ * {@link #checkOutgoingEdges}: the record loaded fine, only the (Edge) cast on {@code edgeRID} failed. Drop
634+ * just the dangling LIST entry and NEVER schedule the pointed-to record for deletion - fix mode raw-deletes
635+ * every {@code corruptedRecords} RID with {@code bucket.deleteRecord}, which would destroy that valid record
636+ * and bypass graph-aware cleanup (a deleted vertex would leave its OWN edges dangling, cascading the
637+ * damage). Report it and repair the list, nothing else. Extracted so the two copies - drifting apart is
638+ * exactly what caused the bug this handler fixes - cannot go out of sync again.
639+ */
640+ private static void handleDanglingEdgeListEntry (final CheckReport report , final RID edgeRID ,
641+ final DanglingEdgeListEntryException e , final boolean fix ) {
642+ report .warn ("edge " + edgeRID + " error on loading (error: " + describe (e .getCause ()) + ")"
643+ + (fix ? ", dropping the dangling list entry (record preserved)" : "" ));
644+ ++report .invalidLinks ;
645+ }
646+
631647 private void checkIncomingEdges (boolean fix , Vertex vertex , RID vertexIdentity , Set <RID > reconnectInEdges ,
632648 Set <RID > reconnectOutEdges , Map <RID , Long > missingReferences , Map <RID , String > missingReferenceErrors ,
633649 CheckReport report ) {
@@ -811,16 +827,8 @@ else if (edgeIn.equals(edge.getIn()))
811827 removeEntry = true ;
812828 ++report .invalidLinks ;
813829 } catch (final DanglingEdgeListEntryException e ) {
814- // edgeRID ITSELF resolves to a record that is NOT an edge (e.g. a vertex wrongly linked into
815- // this adjacency list by an older build): the record loaded fine, only the (Edge) cast failed.
816- // Drop just the dangling LIST entry and NEVER schedule the pointed-to record for deletion:
817- // fix mode raw-deletes every corruptedRecords RID with bucket.deleteRecord, which would
818- // destroy that valid record and bypass graph-aware cleanup (a deleted vertex would leave its
819- // OWN edges dangling, cascading the damage). Report it and repair the list, nothing else.
820- report .warn ("edge " + edgeRID + " error on loading (error: " + describe (e .getCause ()) + ")"
821- + (fix ? ", dropping the dangling list entry (record preserved)" : "" ));
830+ handleDanglingEdgeListEntry (report , edgeRID , e , fix );
822831 removeEntry = true ;
823- ++report .invalidLinks ;
824832 } catch (final Exception e ) {
825833 // UNKNOWN ERROR ON LOADING - also catches a ClassCastException thrown while processing a
826834 // DIFFERENT RID than edgeRID (the sibling-entry rescan or the far-vertex resolution above):
@@ -1060,16 +1068,8 @@ else if (edgeOut.equals(edge.getOut()))
10601068 removeEntry = true ;
10611069 ++report .invalidLinks ;
10621070 } catch (final DanglingEdgeListEntryException e ) {
1063- // edgeRID ITSELF resolves to a record that is NOT an edge (e.g. a vertex wrongly linked into
1064- // this adjacency list by an older build): the record loaded fine, only the (Edge) cast failed.
1065- // Drop just the dangling LIST entry and NEVER schedule the pointed-to record for deletion:
1066- // fix mode raw-deletes every corruptedRecords RID with bucket.deleteRecord, which would
1067- // destroy that valid record and bypass graph-aware cleanup (a deleted vertex would leave its
1068- // OWN edges dangling, cascading the damage). Report it and repair the list, nothing else.
1069- report .warn ("edge " + edgeRID + " error on loading (error: " + describe (e .getCause ()) + ")"
1070- + (fix ? ", dropping the dangling list entry (record preserved)" : "" ));
1071+ handleDanglingEdgeListEntry (report , edgeRID , e , fix );
10711072 removeEntry = true ;
1072- ++report .invalidLinks ;
10731073 } catch (final Exception e ) {
10741074 // UNKNOWN ERROR ON LOADING - also catches a ClassCastException thrown while processing a
10751075 // DIFFERENT RID than edgeRID (the sibling-entry rescan or the far-vertex resolution above):
0 commit comments