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
fix!: add upgrade plugin that fixes invalid date serialisations #2081
fix!: add upgrade plugin that fixes invalid date serialisations #2081
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are specific dates for values (valueCreationDate etc.). Did you check if they were affected as well? And/or if they are updated as well?
@@ -90,7 +90,7 @@ WHERE { | |||
|
|||
@maybeLastModificationDate match { | |||
case Some(lastModificationDate) => { | |||
?resource knora-base:lastModificationDate "@lastModificationDate"^^xsd:dateTime . | |||
?resource knora-base:lastModificationDate ?lastModificationDate . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the last modification date still typed in the triplestore with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I'm just using whatever is in the triplestore already rather than the value passed to he template, when deleting the old last modification date. (The idea is to make this independent of the serialization in the triplestore)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I misread it. It's only inside the DELETE and WHERE clause, the INSERT still has the typed version! Ignore my comment then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but check the comments for some cosmetic things to fix. Also it will not change much in term of versioning, but this is rather fix
than feat
.
.../src/main/scala/org/knora/webapi/store/triplestore/upgrade/plugins/UpgradePluginPR2081.scala
Outdated
Show resolved
Hide resolved
val statementsToRemove: collection.mutable.Set[Statement] = collection.mutable.Set.empty | ||
val statementsToAdd: collection.mutable.Set[Statement] = collection.mutable.Set.empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks familiarly inelegant 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad you dislike it too! xD
Makefile
Outdated
.PHONY: init-db-test-from-ls-test-server-trig-file | ||
init-db-test-from-ls-test-server-trig-file: init-db-test-empty ## init local database with data from a local ls-test-server dump | ||
@echo $@ | ||
@curl -X POST -H "Content-Type: application/sparql-update" -d "DROP ALL" -u "admin:test" "http://localhost:3030/knora-test" | ||
@curl -X POST -H "Content-Type: application/trig" --data-binary "@${CURRENT_DIR}/db_ls_test_server_dump.trig" -u "admin:test" "http://localhost:3030/knora-test" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we could have above init-db-test-from-ls-test-server
make command split into 2 steps anyway
- dump the data first
- load it from that file
So basically command introduced by you stays and the other one could be reduced. Reason for that is the huge amount of data and the issue with that file if the download dies before it ends.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my initial thought. (Additionally, once downloaded, you don't need the password anymore, which is nice.)
But I didn't want to mess with the other make target, so I thought I'd add a separate one. Do you think it makes a difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can leave it like that for now, I might fo it later on. I had some problems with dumping the data and then you need to remember to remove the file otherwise another error appears. This could be overall improved but not the scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you quickly add what Marcin suggested? It follows the pattern we are using in other cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Kudos, SonarCloud Quality Gate passed!
|
Resolves DEV-1033
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: DEV-1033
What is the new behavior?
Does this PR introduce a breaking change?
Major version bump is required to run the upgrade plugin.
Other information