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

WIP api: fix recid reservation in PidStore #40

Closed
wants to merge 1 commit into from

Conversation

kaplun
Copy link
Member

@kaplun kaplun commented Sep 18, 2015

This is a first tentative to address #39, but it fails with a different error.

@kaplun
Copy link
Member Author

kaplun commented Sep 18, 2015

@egabancho do you have better proposals?

@jirikuncar jirikuncar changed the title WIP 1st tentative WIP api: fix recid reservation in PidStore Sep 18, 2015
@jirikuncar jirikuncar added this to the v0.3.4 milestone Sep 18, 2015
@jirikuncar
Copy link
Member

@kaplun for sake of easier understanding of PR please create meaningful commit messages and PR titles. Thank you!

PS: As you are part of triage team please assign proper milestone and assignee.

@egabancho
Copy link
Member

I can't think about a better alternative right now

@kaplun
Copy link
Member Author

kaplun commented Sep 18, 2015

@jirikuncar what about what I am trying to implement. Does it make sense to you? (albeit it is still failing...)

@kaplun
Copy link
Member Author

kaplun commented Sep 18, 2015

Just asking because in the old times of BibUpload it took us many moons before deciding on implicit behaviors (such as forcing recids, allowing singletons, etc.) :)

@egabancho
Copy link
Member

Actually I was thinking about what our old beloved BibUpload would do, I think it would fail if we try bibupload -i record_with_recid.xml, should we keep the same behavior here or should we "force" the insert?
Note that if we force the insert the list of record ids will potentially have gaps

@kaplun
Copy link
Member Author

kaplun commented Sep 18, 2015

Exactly: that is the only drawbacks. No further unexpected harm. I personally believe --force would not be needed in this case.

@jirikuncar
Copy link
Member

pid = PersistentIdentifier.create('recid', pid_value=None,
pid_provider='invenio')
pid.reserve()
record['recid'] = int(pid.pid_value)
elif not PersistentIdentifier.get('recid', pid_value=recid):
Copy link
Member

Choose a reason for hiding this comment

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

Manipulating PIDStore for existing recids might be a dirty business. We should discuss it in wider circle. (cc @inveniosoftware/triagers)

If you are inserting a record with recid, then this recid have been reserved beforehand, hence this elif branch should not happen.

IMHO we can perform this check after insert asynchronously in "checker" module. I see it useful only for initial migration otherwise it will just slow down the normal insertion process.

Copy link
Member Author

Choose a reason for hiding this comment

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

Manipulating PIDStore for existing recids might be a dirty business. We should discuss it in wider circle. (cc @inveniosoftware/triagers)

Just to clarify for everybody: this is the use case where incoming record is specifying a recid, which does not exist yet, neither in bibrec nor in pidstore.

In our scenario this is not going to happen only upon first migration, but for an interim period while records are going to be still created on the legacy service and then sent over to the labs one.

IMHO we can perform this check after insert asynchronously in "checker" module. I see it useful only for initial migration otherwise it will just slow down the normal insertion process.

In this case, wouldn't the record then be inserted with a different recid than the one available in the metadata? Then the checker should not/can not amend back pidstore/bibrec, IMHO.

Copy link
Member

Choose a reason for hiding this comment

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

In our scenario this is not going to happen only upon first migration, but for an interim period while records are going to be still created on the legacy service and then sent over to the labs one.

You should use different provider for your PersistentIdenfiers or force your legacy installation to use labs for reserving recids.

Copy link
Member Author

Choose a reason for hiding this comment

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

You should use different provider for your PersistentIdenfiers

That sounds like the most correct usage of PidStore indeed. In this case though records will receive different recids on Labs than on legacy. And this might have many implications in all the relations etc.

force your legacy installation to use labs for reserving recids.

Maybe this is the least painful one. That assumes there is a service running on Labs that wraps the recid provider of invenio-records, correct?

@@ -39,4 +39,5 @@ PACKAGES = [
'invenio_formatter',
'invenio_upgrader',
'invenio_base',
'invenio_pidstore',
Copy link
Member

Choose a reason for hiding this comment

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

invenio_base should be the last package.

* In case incoming record contains a non existing recid, preallocate
  the recid in the PidStore.
  (closes inveniosoftware#39)

Signed-off-by: Samuele Kaplun <samuele.kaplun@cern.ch>
@jirikuncar
Copy link
Member

  • amend the test to check that if a record contains recid then this recid is registered in PID.

@lnielsen
Copy link
Member

This has been supersede by new Invenio-Records and new Invenio-PIDStore

@lnielsen lnielsen closed this Nov 20, 2015
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.

None yet

4 participants