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

Persisters should error if you try to save something which is gone now, but used to be persisted. #867

Merged
merged 15 commits into from
Oct 15, 2021

Conversation

tpendragon
Copy link
Collaborator

Closes #837

dgcliff
dgcliff previously approved these changes Jul 28, 2021
@tpendragon tpendragon marked this pull request as draft July 28, 2021 19:24
@tpendragon
Copy link
Collaborator Author

Converted to draft because there's an issue with the buffered persister.

@tpendragon
Copy link
Collaborator Author

There's a fundamental issue in that in the case of a CompositePersister, the second persister may not be internally consistent. Like if I'm doing a full reindex it doesn't matter if that resource isn't in Solr - I brought it over from postgres.

@tpendragon tpendragon marked this pull request as ready for review July 29, 2021 17:07
@tpendragon tpendragon force-pushed the 837-persisters-should-error branch from 931cb2e to a845253 Compare September 13, 2021 16:00
@tpendragon tpendragon force-pushed the 837-persisters-should-error branch from a845253 to d81d2ae Compare September 14, 2021 21:12
hackartisan
hackartisan previously approved these changes Sep 15, 2021
Copy link
Contributor

@hackartisan hackartisan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻 with one suggestion for an extra comment

@@ -24,6 +24,12 @@ def delete(resource:)
@deletes << resource
super
end

# A buffered memory persister can save anything, it doesn't have to hold
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it doesn't actually persist anything directly; proxies to other persisters.

@@ -16,12 +16,15 @@ def initialize(adapter)

# Save a single resource.
# @param resource [Valkyrie::Resource] The resource to save.
# @param external_resource [Boolean] Whether the resource to be saved comes
# from a different metadata store. Allows a resource to be saved even if
# it's not already in the store.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add example use case, "e.g. when building a new solr index"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or migrating to a new data store?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tpendragon add an example use case?

tpendragon added a commit to pulibrary/figgy that referenced this pull request Sep 15, 2021
Upgrades Valkyrie to this branch:

samvera/valkyrie#867

See #4672

Work towards #4174
@tpendragon
Copy link
Collaborator Author

We've been running this for a couple weeks now with no badness. I think we can merge it - but this will probably mean 3.0.0.beta1 or something.

@@ -16,12 +16,15 @@ def initialize(adapter)

# Save a single resource.
# @param resource [Valkyrie::Resource] The resource to save.
# @param external_resource [Boolean] Whether the resource to be saved comes
# from a different metadata store. Allows a resource to be saved even if
# it's not already in the store.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tpendragon add an example use case?

@tpendragon
Copy link
Collaborator Author

@hackartisan Take another look?

@tpendragon tpendragon merged commit 3e2bbac into main Oct 15, 2021
@tpendragon tpendragon deleted the 837-persisters-should-error branch October 15, 2021 17:01
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 this pull request may close these issues.

Persisters should error if asked to save a persisted resource which doesn't already exist.
3 participants