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
introduce extra SQL scripts for OMERO 5.3 #4732
Conversation
See https://ci.openmicroscopy.org/view/Failing/job/OMERO-DEV-merge-deploy/347/console, the addition of new forms of SQL scripts break the semantics expected by |
I guess it needs a tighter regex, @manics? (Isn't there a card relating to DB version/patch naming? Trello's really hampered by the lack of any decent search.) |
Also happy to just rename the script so that its purpose remains clear but that it doesn't clash with possible version/patch numbers: any suggestions as to what will fit best with omego's expectations? |
At the |
Ideas from chat in slack: perhaps
|
Worth discussing- on one hand it makes omego robust against future upgrades, OTOH it's one less check against mistakes in the sql naming.
Definitely makes sense. If you define the exact naming convention, and how the pre-check should be performed, (e.g. |
Also if you can see a requirement for other scripts which must be run in a certain order (e.g. pre1, pre2, post1, etc) it'd be worth scoping that now. |
Yeah, you just run the precheck script before upgrade, it either errors out or doesn't, and never changes the database. I'd just named it the same as the upgrade script but with a I can imagine a I can also imagine optional scripts that one might run, some before the upgrade, some after it, like the other included with this PR. While I'm not suggesting that omego should offer those anytime soon, perhaps you'd like to constrain now how they should be named? |
At risk of getting too far of topic, how about anything that should be automatically handled follows one naming convention, and everything else follows another (e.g. a different prefix, suffix, or some other unambiguous convention). That deals with my comment checking for mistakes in sql script names. |
@pwalczysko: Probably easiest from
Happy to further help / explain. |
Another option would be everything that should not be automatically handled goes into subdirectories. |
These 4 tests passed. |
Coming to this late, no objections if we need to add a subdirectory (or even review the general directory layout) but I think that some "well-known" naming scheme (like another |
In 5.2 DB, I set up following objects:
For these purposes here, the items like "linked", "non-linked" mean "without any manually added namespace and linked", "without any manually added namespace and non-linked" and analogically for all the items except the "with-namespace-xxx" items. |
Ran the |
In summary, all the functional tests here passed. |
Moving to breaking to test the deployment with omego 0.4.1 |
See https://ci.openmicroscopy.org/view/Failing/job/OMERO-DEV-breaking-deploy/627/, removing |
--- Delete non-sharable orphaned annotations from OMERO 5.3. Optional. | ||
--- | ||
|
||
DELETE FROM annotation WHERE |
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.
Were we to be using PostgreSQL table inheritance, this could be using DELETE FROM ONLY
to avoid deleting from child tables!
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.
Ha, good point; I wonder how that fits with Hibernate.
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.
Unsure. I imagine that it would be entirely transparent, up until the point you need that bit of nonstandard SQL for the deletes.
@rleigh-dundee: Good to merge, from your point of view? |
Sorry, I didn't comment. I read through and it looked fine to me (though I didn't do any testing). I liked the impressive use of PL/pgSQL for the transform parsing! |
What this PR does
This PR adds a couple of SQL utility scripts for OMERO server admins to use:
OMERO5.2__0-precheck.sql
on an OMERO 5.2 DB checks thatOMERO5.3DEV__7/OMERO5.2__0.sql
is expected to proceed without errors: there are no ROI keywords or namespaces set and all the transform strings are parseable. It does not itself make any changes to the DB.delete-ns-orphans.sql
on an OMERO 5.3 DB deletes non-sharable annotations that do not annotate anything and are not set to some blank or OME namespace. This is intended as an optional upgrade step.Testing this PR
Start out from OMERO 5.2. Test that the precheck script fails if you set,
(
bin/omero obj
can be very handy here.)Set a parseable transform instead (e.g.,
rotate(30)
) and see if the precheck passes.Annotate some objects with various things: comments, ratings, tags, files, whatever. Unlink some of them without deleting the actual annotation (
bin/omero delete
's--exclude
option might help here). You can put some annotations into your own namespace usingbin/omero obj
again. (Read ahead a bit to see exactly what to try creating.)Go ahead and do the DB upgrade to OMERO 5.3 patch 7.
Check that no annotations were deleted.
Now, try running the optional delete script. See that linked annotations, sharable annotations (tags, files, etc.), annotations in your own namespace all survive. Orphaned comments, ratings, etc., that are not in your own namespace should now be deleted.
Related reading
Note that this PR will require a companion documentation PR.