Closed TheDeafCreeper closed 1 year ago
Alright so there seems to be three main issues right now:
I suppose issue 2 is what #33 is for.
Now that I think about it, I almost wonder if #37 is caused by DB access as well, just significantly less noticeable due to being a SQLite DB currently.
Edit: After some testing it didn't seem like the case, but when looking at the spark timing in the issue it looks like it is a call to SqlPathRecordManager causing the lag.
Alright, cause for issue 1 is the fact journeydb.ver exists, which it almost always will when switching to MySQL.
Issues 1 and 3 should be fixed now, leaving performance issues.
I didn't use if not exists
because not all database engines has that technology, so I'm managing database version manually. Although, I see the problem with have a single version file separate from the database itself rather than storing the version in the database itself because changing database engine will use the old database version file.
The whole versioning system exists to handle future database migrations (schema alterations) which is bound to happen.
To fix this, we should create a new version management system. I'm leaning towards just creating another table called journey_db_version
that just has a single indexed integer column. MAX()
of that column will dictate what version the database is on, and the db migrations for every missing version will be applied and the updated version will be set on that table.
For backwards compatibility, we'll have to check if there's a .ver
file, which would insinuate the db is already on version 1, and since we'll be enabling MySQL at the same time as the new versioning method, it must be version 1 on SQLite. So, from there we'll update to the current version by applying the migrations needed (in this case, we have a migration to add a version table) and then set the version properly. We can also delete the .ver
at that point.
Fair enough on the if not exists
.
I'll write up something to still check DB version, just in the DB itself
Alright I think this should all be functional now.
Actually just removed the legacy functions since if they're needed again they can be fetched via git.
The lag with MySQL probably won't matter on a local DB, though if it does then we would probably want to make connection pooling part of this PR.
Edit: Can confirm, it does not seem to cause any more lag than with SQLite when it's on the same machine.
Alright I think all the changes should be made, and the plugin works in the testing I did.
Also I changed Intelij settings so imports should hopefully stop being combined.
I realized I forgot to actually test the latest changes, and apparently it doesn't actually work because the connection just closes immediately after it's used it seems.
Alright, fixed the connection issue.
That should be everything resolved, now to:
[x] Switching to MySQL from scratch works
[x] Update with SqLite enabled
[x] Update with MySQL enabled
Resolves #30. Currently non functional it seems as it's not creating one or more tables.