-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Replay migrations on the created schema before copying data #30643
Conversation
Codecov Report
@@ Coverage Diff @@
## master #30643 +/- ##
============================================
+ Coverage 65.53% 65.63% +0.09%
- Complexity 18648 18663 +15
============================================
Files 1218 1218
Lines 70549 70588 +39
Branches 1288 1288
============================================
+ Hits 46236 46331 +95
+ Misses 23936 23880 -56
Partials 377 377
Continue to review full report at Codecov.
|
@PVince81 it fixes the conversion but it needs to be polished and covered with tests |
apps/files_external/appinfo/app.php
Outdated
@@ -35,7 +35,7 @@ | |||
$appContainer = \OC_Mount_Config::$app->getContainer(); | |||
|
|||
$config = \OC::$server->getConfig(); | |||
if ($config->getAppValue('core', 'enable_external_storage', 'no') === 'yes') { | |||
if (class_exists('OCA\Files\App') && $config->getAppValue('core', 'enable_external_storage', 'no') === 'yes') { |
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.
unrelated ? can you submit this as a separate tech debt 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.
@PVince81
Related due to a cross-app dependency which is not a subject of this PR. I need to load app to read its migrations.
If files
app is not loaded (it doesn't use migrations) - result of loading files_external
(using migrations) is 💥
bb54729
to
fb5489b
Compare
5b03d29
to
8ea2f87
Compare
core/Command/Db/ConvertType.php
Outdated
$apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps(); | ||
$this->replayMigrations($fromDB, $toDB, 'core'); | ||
|
||
$apps = $input->getOption('all-apps') ? $this->appManager->getAllApps() : $this->appManager->getInstalledApps(); |
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.
getAllApps
is not what we need here
$sourceMigrationService = new MigrationService($app, $fromDB); | ||
$currentMigration = $sourceMigrationService->getMigration('current'); | ||
if ($currentMigration !== '0') { | ||
$targetMigrationService = new MigrationService($app, $toDB); |
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.
are you not filtering migrations by "SQL" only ?
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.
Consider that some migrations are operating on data, for example making some conversion.
When converting the DB we don't need to re-process the data as it was already processed.
This only works if all migrations work correctly with already converted data and have no side effect.
We should likely make it a requirement that every migration must be "replayable" in a way that it doesn't break if the prerequisite was already been resolved before (ex: already migrated data)
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.
@PVince81 target migrations
table will not have these migrations if I skip them. As the target DB is a bare structure with no data we need to replay everything on it.
Otherwise these migrations can be reapplied after the data is copied = applied twice.
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.
Good point. In any case it seems sensible to make sure that non-schema migrations work correctly when replayed
what's left to do ? |
No, it doesn't affect other code paths. |
I'm merging this as it would bring the command in a more usable state, potentially with remaining bugs to uncover. We should advertise this as beta / experimental for now until more testing is done. @pmaier1 FYI |
@VicDeo can you add a note on the CLI help / output that this is currently experimental ? |
I'm trying to follow this and figure out what the status is for the database conversion tool... I have OC 10.0.10.4 installed but unfortunately using SQLite and want to convert to MariaDB. I found out the hard way about the table limit in SQLite last December. Managed to recover and stabilize everything, but really want to get away from SQLite. Is the DB conversion tool usable in 10.0.10 yet? |
done
No, it isn't |
@jvillafanez thanks for your efforts but I have no plans to invest more time into this 1 year old PR until it will be planned for the sprint. |
I think you're using the class as a data holder (for the DB parameters)... not sure if we have time to improve that. |
we should at least finish and ship as beta. for that we need a review. |
Yes, if you feel confident now, let's include it in the next minor and mention that it's beta / waiting for feedback. |
@jvillafanez please rereview |
How much time do we have or do we want to invest here? There are several changes we should consider to improve the code quality, but those will take some time. |
It should work and not cause issues, of course. Anything else is out-of-scope here right now. If that's satisfied here, let's ship this with the next minor release and let people try and get feedback. @micbar can you take this into your scope for the next release, please? THX. |
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 assume the code works properly.
There are several code changes we should do, but we can't in the allocated time
brifly retested and rebased once again |
stable10: #35390 |
Ref #27075 (comment)
some more fixes:
now it looks like this: