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

Add handling for isNewerVersionOf #72

Open
iannesbitt opened this issue Jan 23, 2025 · 7 comments
Open

Add handling for isNewerVersionOf #72

iannesbitt opened this issue Jan 23, 2025 · 7 comments
Assignees
Labels
enhancement New feature or request research

Comments

@iannesbitt
Copy link
Contributor

No description provided.

@iannesbitt iannesbitt added enhancement New feature or request research labels Jan 23, 2025
@iannesbitt iannesbitt self-assigned this Jan 23, 2025
@iannesbitt
Copy link
Contributor Author

iannesbitt commented Feb 7, 2025

This is tricky because there's no way to set obsoletedBy when the PID doesn't exist on the CN yet. So perhaps this would be best as a two-pronged approach, where the obsoletes is set in mnlite, then obsoletedBy is set on the CN after those objects get synchronized.

When isNewerVersionOf is in the JSON-LD:

  1. Look up the ID on the CN. If it exists:
  2. Set obsoletes in mnlite to the CN object being obsoleted
  3. Once the objects are harvested, run an operation to link each chain that has an obsoletes item in its first mnlite object to the version it obsoletes in the CN. Follow that linkage and set obsoletedBy in the CN object sysmeta.

@iannesbitt
Copy link
Contributor Author

iannesbitt commented Feb 7, 2025

If the object being obsoleted is in mnlite, this becomes a much simpler operation because all logic can be contained within. mnlite should check its own database for PIDs that match first, then proceed to doing a lookup on the CN if nothing is found. I think this would be handled in opersist.OPersist.addThing().

@mbjones
Copy link
Member

mbjones commented Feb 8, 2025

Once the objects are harvested, run an operation to link each chain that has an obsoletes item in its first mnlite object to the version it obsoletes in the CN. Follow that linkage and set obsoletedBy in the CN object sysmeta

@iannesbitt I'm not sure you need to do this. If you look up the object on the CN to get the prior PID and set obsoletes to that PID on mnlite, when the CN harvests that record, it should see that the new record obsoletes the old PID, and it sets obsoletedBy for the old PID (IIRC). I think you only have to set one half of the relationship. Could be wrong, but worth checking on that.

@iannesbitt
Copy link
Contributor Author

That would be very helpful, I'll check. Thanks for the tip

@iannesbitt
Copy link
Contributor Author

I'm wondering if perhaps this is a MN API function that was not built into mnlite and does not work when harvesting documents to a CN. I can build in something similar for mnlite, but it will not quite be the same, as it can't assume that all documents being referenced are within mnlite itself.

@iannesbitt
Copy link
Contributor Author

iannesbitt commented Feb 14, 2025

Still getting catch-22 errors from the CN when trying to make modifications to the system metadata. It wants me to be making them on the MN, but the MN object doesn't exist anymore.

I assume this means I need to be making modifications directly to the database to obsolete the old objects, which is always a lot scarier.

@mbjones
Copy link
Member

mbjones commented Feb 15, 2025

Yes, that is right. The access control rules for system metadata say that the only identities that can change system metadata for an object are the original node identity, and that it has to be at the original location. @taojing2002 has done some direct patching to fix these issues up, and he may have a recommended route to help automate your version change updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request research
Projects
None yet
Development

No branches or pull requests

2 participants