-
-
Notifications
You must be signed in to change notification settings - Fork 835
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
Remove MyISAM Requirement #2442
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.
I am fine with making InnoDB the default, overall InnoDB has better performance anyways, I'm not sure if theirs a valid reason it defaults to MyISAM.
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.
@tankerkiller125 Just history, we generally don't change old migration (although this seems to be a good reason to do so).
Aside from the StyleCI complaint, a few minor questions below
@@ -31,7 +31,7 @@ | |||
|
|||
$table->unique(['discussion_id', 'number']); | |||
|
|||
$table->engine = 'MyISAM'; |
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 no default needed here? Why not explicitly default to Innodb
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.
The issue I had was the Database did not support MyISAM. Wouldn't changing it to Innodb just bake in the same issue for a future version of me, with a Database that does not support Innodb. As such I determined that NULL (or no default) was the best option. Leaving it up to the Laravel Backend to determine.
src/Install/DatabaseConfig.php
Outdated
@@ -47,7 +47,7 @@ public function toArray() | |||
'collation' => 'utf8mb4_unicode_ci', | |||
'prefix' => $this->prefix, | |||
'strict' => false, | |||
'engine' => 'InnoDB', | |||
'engine' => NULL, |
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.
Again, why mark this as null and not tell it to use innodb?
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.
The issue I had was the Database did not support MyISAM. Wouldn't changing it to Innodb just bake in the same issue for a future version of me, with a Database that does not support Innodb. As such I determined that NULL (or no default) was the best option. Leaving it up to the Laravel Backend to determine.
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.
After further review (on an actual desktop this time) I think I'd actually rather see a migration or migrations to update existing Flarum installs to InnoDB if we do this at all.
As far as actually doing this though I'm not 100% sure now after further research MyISAM is far more performant when it comes to a lot of read operations. However InnoDB does much better with a mix. Given that Flarum is forum software I'm inclined to believe that InnoDB would be better for it, but I don't have data on SQL reads vs writes on a active Flarum install.
For historical reasons, I'm going to pitch in. The MyISAM requirement on the posts table was added to support Fulltext search. Which hasn't been supported by InnoDB for a very long time. We recently (ahem) updated our requirements to MySQL 5.6+ and Mariadb 10.0.5+, both of these versions now allow using fulltext indices to be created with InnoDB. So we can safely start doing this. Two considerations:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We do this to keep the amount of open issues to a manageable minimum. |
The last point from @luceos is a good point that running a migration against millions of post will be very bad. My proposal then would be to change all the current migrations to InnoDB (thus all new installs get that benefit) and then post a set of instructions to migrate existing databases manually (with a backup/restore of tables as part of that instruction set) This ensures that new installs get the benefits, and if people want to take risk they can get them too. If they don't want to take risk though they can just simply leave things as is. |
Not stale, but I propose we close this in favor of a discussion to work out exactly how we want to approach this. |
This commit does resolve an install breaking issue. That could have been resolved 3 months ago (how time flys), leading to (presumably) less install issues and greater adoption. Committing migrations/2015_02_24_000000_create_posts_table.php is only removing the default on install. It does not as @tankerkiller125 outlines cause existing databases to be migrated to InnoDB or otherwise. Nor does it prevent a migration file at a later date to do that, if the community chooses. I'd be repeating myself for Committing src/Install/DatabaseConfig.php this is (as far as I know) only used in install. It removes an install braking issue. It does not prevent future modifications as discussions continue. I can view this as a Critical Commit but not as one that requires a prolonged discussion @askvortsov1 though there is, of course, discussions to be had related to this. Should MySSIAM be the default (instead of none)? Should old tables be migrated? Thanks for the historical perspective @luceos a lot of thought went into these two lines in the past. TL'DR. The guy who created the pull request obviously wants it committed. It fixed installs and can leave wider discussions on database engines to those who want to have them. |
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.
Replacing Old Default with a New Default could create a future issue. Having no default allows the system to use the available Database Engine. This is a preference thing, and not firmly committed to no default if others believe a default database engine is preferable.
Other systems give the user the preference? Though would require further modificaitons.
I'm not really one to look into our open PR's that much, apologies for that. Here's what I think if we consider adopting this right away.
As to not merging this in the past couple of months; we are pushing all effort in reaching stable. These PR's seem minor, but they cannot and should not be merged without proper evaluation. Open source isn't just about accepting code by others, but also about having to deal with every single repercussion way past author involvement. |
If your referring to fixing issues on DigitialOcean managed MySQL installs they have actually changed even more things in the past 3 months that permanently break installing Flarum that are well outside the scope of this projects goals. |
I apologize for my stark wording in the comment above; often PRs are opened, and then activity on them dies. In those cases, discussion can get lost (closed issues are a better record of decision making closed PRs). I'm also sorry for our inactivity on this: we're in the middle of a large release, and our priority was stabilizing the extension API. As Daniel noted above, we initially defaulted to MYISAM because InnoDB didn't support fulltext search. Now that it does, I am in favor of dropping the migration and changing the default. That being said, my main concern is that some databases could default to an engine that isn't InnoDB or MyISAM, and someone would end up with a partially broken Flarum install, as opposed to not being able to install due to requirements issues. That being said, I am not that familiar with how Laravel handles database engines (or the engines themselves for that matter), so I might be misinterpreting this. |
If my recommendation to drop the initial engine change is applied, I would love to see a core dev do a test run with:
Then I'd be okay with merging. |
What'd be the benefit of that, since the migration is dropped? |
Yeah was hoping to confirm nothing breaks, but indeed the entry still exists in the database even though the migration files does not. So .. only a new install test would be required. |
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've tested a fresh install using this PR. And while everything works I have concerns over the lack of a proper default engine setting.
My main issue around it is one that's already been stated: If no default is set and then someone sets a very strange engine as default in MySQL it may cause install errors for Flarum. It would be by recommendation that we revert the change in DatabaseConfig.php
and only change the migration.
As for the concern over a database not having InnoDB, given our current MySQL/MariaDB requirements this is incredibly unlikely unless someone built MySQL without it on-purpose. In which case that user probably has the technical ability required to resolve the issue (not to mention the issues they would get with other PHP projects by not having InnoDB)
According to // Engine
if (! isset($options['engine'])) {
$options['engine'] = 'InnoDB';
} Flarum will always fallback on InnoDB, unless |
That works for me 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.
Before merging, let's replace the NULL with null
, as that's more consistent with what we use.
@@ -47,7 +47,7 @@ public function toArray() | |||
'collation' => 'utf8mb4_unicode_ci', | |||
'prefix' => $this->prefix, | |||
'strict' => false, | |||
'engine' => 'InnoDB', | |||
'engine' => null, |
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.
Should we even specify this key if we're just setting it to null?
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's the convention in Laravel, yes. And if I'm not mistaken it exists also to indicate the options available in general.
@@ -47,7 +47,7 @@ public function toArray() | |||
'collation' => 'utf8mb4_unicode_ci', | |||
'prefix' => $this->prefix, | |||
'strict' => false, | |||
'engine' => 'InnoDB', | |||
'engine' => null, |
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.
'engine' => null, |
Thank you again for the PR, sorry for the long review process on this one. |
Fixes
The requirement for Database to be MyISAM Compatible.
DigitalOcean Managed Databases do not have MyISAM enabled and there is no way of allowing it. The solution offered by the forum was to not elegant.
If this is not have breaking changes, it is an improvement to the installation process for those with Limited Database Engines.
Changes proposed in this pull request:
Installation Changes
Edits Create Post, Migration table to remove hardcoded MyISAM requirement.
Edits Installation DatabaseConfig.php to remove hardcoded MyISAM requirement, leaving it up to the database to decide.
Reviewers should focus on:
Can you just edit old Migration Files? It shouldn't affect existing installations and will allow easier to install new installations. That do not have MyISAM.
What effect does setting engine to NULL have in real terms. Was MyISAM selected by default for a reason? Would it be better to fallback if MyISAM is not available?
Issue #1661 and #677 and #1675 are loosely relevant
Screenshot