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

MCR-3046 allow id generation independent from actual storage #2067

Conversation

sebhofmann
Copy link
Member

@sebhofmann sebhofmann marked this pull request as ready for review February 16, 2024 16:06
@sebhofmann sebhofmann force-pushed the issues/MCR-3046_allow_id_generation_independent_from_actual_storage branch from d9d8521 to 9fea7c7 Compare February 19, 2024 11:26
@sebhofmann sebhofmann changed the base branch from main to 2023.06.x February 19, 2024 11:27

try (
FileChannel channel = FileChannel.open(cacheFile, StandardOpenOption.WRITE,
StandardOpenOption.SYNC, StandardOpenOption.CREATE);){
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we use here at least a FileLock, too?
A ReentrantWriteLock is probably not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is only used by the migration Command.

Copy link
Member Author

Choose a reason for hiding this comment

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

i added javadoc that the caller has to do locking. The method should only be rarely used anyway.

@@ -0,0 +1,58 @@
package org.mycore.datamodel.common;
Copy link
Member

Choose a reason for hiding this comment

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

MyCoRe License Header is missing

Copy link
Member Author

Choose a reason for hiding this comment

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

added

throws IOException {
buffer.clear();
channel.position(0);
buffer.putInt(nextID.getNumberAsInteger());
Copy link
Member

Choose a reason for hiding this comment

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

For me if would be nicer to see the Integer not as byte, but readable string in the file - or maybe store the whole MCRObjectID-String?
So it would be easier to Debug the MyCoRe-System.

Copy link
Member Author

Choose a reason for hiding this comment

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

i store the entire id as string now

* store ids as strings to make debugging easier
* add a docs to setNextFreeId
* add missing copyrights
Copy link
Member

@rsteph-de rsteph-de left a comment

Choose a reason for hiding this comment

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

looks good for me now

@kkrebs kkrebs merged commit d8ccf6c into 2023.06.x Feb 20, 2024
3 checks passed
@kkrebs kkrebs deleted the issues/MCR-3046_allow_id_generation_independent_from_actual_storage branch February 20, 2024 16:19
sebhofmann added a commit that referenced this pull request Feb 21, 2024
* 2023.06.x:
  MCR-3011 fix duplicate dateModified
  MCR-3030 Isolated the HTTP-client in use by MCRRESTResolver  (#2051)
  MCR-3035 fix empty p tags in wcms
  MCR-3037 Added getUsableSpace() to MCRXMLFunctions (#2058)
  MCR-3038 MCRMETSDefaultGenerator.structureMets generates double logical ids
  MCR-3039 fix upload size detection and fix error messages (#2059)
  MCR-3040 fix XSLT 3 issues
  MCR-3041 rest api v 2 quirks (#2065)
  MCR-3041 rest api v 2 quirks (#2062)
  MCR-3046 allow id generation independent from actual storage (#2067)
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.

3 participants