Draft -- PostgreSQL db replaces Oracle db #1956
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This draft PR addresses 2 pending questions: 1) how much work would still remain to move CMR from Oracle to Postgres, following the datastore prototype? (wiki report here) & 2) how should we approach refactoring CMR to allow for running with an external datastore that is different from the official one? (discussion wiki here)
"Why are there still oracle namespaces here?" -- These changes have been made 'in place' as much as possible, except for certain Postgres core aspects, mostly to help address question 2 -- much "oracle" code contains general CMR logic for working with external data stores in general (health check, etc.) or at least RDBMS (jdbc utils), and conversely much of CMR code is actually specific to Oracle (explicit SQL, assumption of receiving blob instead of bytes, etc.)
What's been done so far
cmr setup db
-- creation of all users, schemas, data migrations have been converted from Oracle to PostgresWhat remains to be done
FIRST PRIORITY BUG -- proper start of DB system component [2] -- (hard)cmr setup db
-- the tear-down of users and migrations (e.g.(drop)
,(drop-user)
) etc. (easy)find-one
sql utility -- currently functional due to redundantfirst
but needs to limit results in the actual sql to reduce load on db.stop
Misc. dev notes
How to run this locally
Much the same as using the Oracle container. Make sure your
profiles.clj
content is set as environment variables. Runcmr setup dev
. Launch a container using the official postgres image with these configs: (you can add a volume if you want)After the container is 'running', run
cmr setup db
to create users, schemas, migrations. Upon entering REPL, run(reset :db :external)
.Footnotes
(dev-start)
'sbootstrap
is commented out not just because it errors due to connection error, also because I have an M1 chip and the new Oracle ARM image does not work with this function either so I couldn't even compare for debugging. Also this function might be removed in a different current ticket.The expected way that a CMR service launches its DB within itscreate-system
is not working properly here. It appears the lifecyclestart
doesn't execute, because it returns having:datasource nil
. Note that the PostgresStore record itself does successfullystart
when used in an atom instead of component, as insetup db
. This atom method has been added to the neededcreate-system
's as a WORKAROUND ONLY.