Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Structure adjustments "repaired" orphaned Nodes which is not replayable #5352

Closed
mhsdesign opened this issue Nov 8, 2024 · 0 comments · Fixed by #5363
Closed

BUG: Structure adjustments "repaired" orphaned Nodes which is not replayable #5352

mhsdesign opened this issue Nov 8, 2024 · 0 comments · Fixed by #5363

Comments

@mhsdesign
Copy link
Member

A replay in beta 15 might fail with this error

Cannot update node with copy on write since no anchor point could be resolved for node d6cefdef-5aa4-4f27-9722-3f477c0d2c71 in content stream 092cd743-55dc-4c1e-b62c-9e4543704740

TLTR: we didn't correctly delete recursive child nodes in the past, which allowed events to exist that shoujldn't and cannot be replayed.


Denny and christian did some debugging for this, with the following noticeable results:

  • the event in question appears to have just appeared in the live content stream, it's not related to any publish event at all, has no metadata, no causation or correlation and there is a whole block of them appearing together.
  • it's a NodePropertyWasSet on the node in question, in which a property is unset! that might be a clue at how these events happened. our thought was maybe a node migration but that should have happened in a workspace with a publish, but we don't see such events...
  • the node in question did exist correctly in live, BUT was indirectly removed by a grandparent removal, therefore no NodeWasRemoved appears anywhere yet the node is simply not there, we found the respective event removing the node but it is far before the offending event.
  • how did the NodePropertyWasSet event ever get into the DB given that the node it applies to cannot have existed at the time the even was created and thus a constraint check should have prevented it.

So far we can explain the problem due to a bugfix in NodeAggregateWasRemoved and the use of structure adjustments before:

There is one known case which emits events without metadata: structure adjustments
Two of these use \Neos\ContentRepository\StructureAdjustment\Adjustment\PropertyAdjustment::removeProperty which would cause to immediately PUBLISH aNodePropertyWasSet without metadata and no constraint checks.

The query used for structure adjustments is findNodeAggregatesByType, but it behaves well if the projection is okay which does not seem to be:

We tested that a change in beta15 #5320 which fixes NodeAggregateWasRemoved to correctly delete previously orphaned nodes (commit 9df5948) causes this problem to be noticed.

This also fixes a bug in NodeRemoval where only one child node was removed per removed parent


As a migration to fix this, we can introduce possibly a NoopEvent that is will be inserted at the places of the malformed events.
To automate this (super expensive but i see no other way) we need to replay the content graph one event at a time, or as much until we get the errror? And then get the event, see if it has no metadata, and then replace it with a NoopEvent and continue the replay.

Alternatively we would need to have the graph projections logic in memory just to keep track which node was removed and which not.

The NoopEvent could actually reduce complexity as WorkspaceWasRenamed and other legacy events that are just noops could be transformed into these as well and thus removing legacy code.


That we dont set metadata or correlation infos always MUST be addressed before release:


See also our slack discussion: https://neos-project.slack.com/archives/C04PYL8H3/p1730799833465089

@mhsdesign mhsdesign changed the title BUG: BUG: Structure adjustments "repaired" orphaned Nodes which is not replayable Nov 8, 2024
mhsdesign added a commit to mhsdesign/neos-development-collection that referenced this issue Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant