Skip to content
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

MariaDB 10.2.7+ #29100

Merged
merged 4 commits into from
Nov 8, 2017
Merged

MariaDB 10.2.7+ #29100

merged 4 commits into from
Nov 8, 2017

Conversation

VicDeo
Copy link
Member

@VicDeo VicDeo commented Sep 26, 2017

Description

Backup solution for #28695
I'm not happy with this solution but if upstream doesn't manage to fix the issue until 10.0.4 we'll need it

Here we bypass native Doctrine/DBAL MySqlSchemaManager::_getPortableTableColumnDefinition implementation for MariaDB >= 10.2.7 and use customized implementation that unquotes default values.
All DB engines from non-MySQL family work as before. For MySQL family a new listener is registered.
Triggering native/customized codeflow is done inside the listener itself.

Related Issue

#28695

Motivation and Context

Fixes MariaDB 10.2.7+ support

How Has This Been Tested?

By installing ownCloud with MariaDB 10.2.7+ as a DB engine

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to change)

  • My code follows the code style of this project.

  • My change requires a change to the documentation.

  • I have updated the documentation accordingly.

  • I have read the CONTRIBUTING document.

  • I have added tests to cover my changes.

  • All new and existing tests passed.

@VicDeo VicDeo added this to the development milestone Sep 26, 2017
@VicDeo VicDeo changed the title Add draft solution MariaDB 10.2.7+ Sep 26, 2017
@PVince81
Copy link
Contributor

PVince81 commented Oct 9, 2017

@VicDeo I'm setting this to p1 to keep it in view before releasing 10.0.4. When the time comes we'll decide whether to use the PR or upstream depending on the progress.

@PVince81 PVince81 added the p1-urgent Critical issue, need to consider hotfix with just that issue label Oct 9, 2017
@VicDeo VicDeo force-pushed the fix-28695-backup branch 5 times, most recently from e74bdc1 to 3a9b4e4 Compare October 12, 2017 21:28
@VicDeo VicDeo mentioned this pull request Oct 13, 2017
9 tasks
@VicDeo
Copy link
Member Author

VicDeo commented Oct 13, 2017

Stable10: #29240

@PVince81
Copy link
Contributor

It looks like it's likely that we won't be able to use the fix from upstream because it will likely not be backported: doctrine/dbal#2825 (comment)

And OC 10 still needs to support PHP 5.6.

So I suggest we merge this for now and kill it once we deprecate PHP 7.0...

@DeepDiver1975 do you still have objections ?

@PVince81
Copy link
Contributor

let's get an explicit statement here: doctrine/dbal#2825 (comment)

@codecov
Copy link

codecov bot commented Oct 18, 2017

Codecov Report

Merging #29100 into master will increase coverage by 0.24%.
The diff coverage is 78.15%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #29100      +/-   ##
============================================
+ Coverage     60.84%   61.08%   +0.24%     
- Complexity    17238    17287      +49     
============================================
  Files          1032     1033       +1     
  Lines         57365    57486     +121     
============================================
+ Hits          34904    35116     +212     
+ Misses        22461    22370      -91
Impacted Files Coverage Δ Complexity Δ
lib/private/DB/ConnectionFactory.php 82.89% <100%> (+19.88%) 21 <0> (ø) ⬇️
...private/DB/MySqlSchemaColumnDefinitionListener.php 77.47% <77.47%> (ø) 46 <46> (?)
lib/private/DB/Connection.php 67.91% <80%> (+2.01%) 48 <3> (+3) ⬆️
lib/private/Repair/SqliteAutoincrement.php 85.18% <0%> (-3.28%) 9% <0%> (ø)
lib/private/DB/AdapterSqlite.php 83.33% <0%> (-2.88%) 7% <0%> (ø)
lib/private/Repair/RepairMismatchFileCachePath.php 82.52% <0%> (+0.4%) 48% <0%> (ø) ⬇️
lib/private/DB/QueryBuilder/QueryBuilder.php 90.68% <0%> (+0.49%) 67% <0%> (ø) ⬇️
lib/private/DB/MDB2SchemaManager.php 85.96% <0%> (+5.26%) 17% <0%> (ø) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 800f59f...a0ed768. Read the comment docs.

@VicDeo VicDeo self-assigned this Oct 19, 2017
@VicDeo VicDeo force-pushed the fix-28695-backup branch 2 times, most recently from 7062d25 to 562d82d Compare October 20, 2017 21:23
@PVince81
Copy link
Contributor

seems no upstream backport doctrine/dbal#2825 (comment)

@PVince81
Copy link
Contributor

PVince81 commented Nov 2, 2017

@VicDeo please write a unit test for the listener and make codecov happy.

If we're going to carry this workaround long term, better have it properly covered.
Thanks.

@VicDeo
Copy link
Member Author

VicDeo commented Nov 2, 2017

@PVince81 oook... :-/
(I already checked doctrine unit tests and know that they are not reusable here...)

@DeepDiver1975
Copy link
Member

If we're going to carry this workaround long term, better have it properly covered.
Thanks.

@SergioBertolinSG is working on getting coverage for mysql specific code - see #29410
Once merged I assume codecov will be happy here as well ...

@DeepDiver1975
Copy link
Member

@SergioBertolinSG is working on getting coverage for mysql specific code - see #29410
Once merged I assume codecov will be happy here as well ...

looks like we need to add mariadb 10.2.7 to the test matrix

@PVince81
Copy link
Contributor

PVince81 commented Nov 3, 2017

can we get this finished for RC1?

@VicDeo
Copy link
Member Author

VicDeo commented Nov 3, 2017

@DeepDiver1975 yes, looking right now.
Doctrine\DBAL\Driver\PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xF0\x9F\x98\x90, ...' for column 'path' at row 1 seems to related to utf8mb4

While Test\DB\SchemaDiffTest::testZeroChangeOnSchemaMigrations failures are fishy indeed.

@PVince81 PVince81 modified the milestones: development, planned Nov 6, 2017
@VicDeo
Copy link
Member Author

VicDeo commented Nov 6, 2017

@DeepDiver1975 @PVince81 Tests related to false positives for default values are passing now.
Can't reproduce failures related to 4 byte utf-8 with my MariaDB.

@VicDeo
Copy link
Member Author

VicDeo commented Nov 7, 2017

Ok. Drone uses MariaDb 10.3.2
Variable innodb_file_format doesn't exist in MariaDB since 10.3
See https://mariadb.com/kb/en/library/changes-improvements-in-mariadb-103/

innodb_file_format is used for utf8mb4 detection
https://github.com/owncloud/core/blob/master/lib/private/DB/MySqlTools.php#L36
no utf8mb4 support. Tests are failing...

@PVince81
Copy link
Contributor

PVince81 commented Nov 7, 2017

@VicDeo if mb4 is default in 10.3, we might need some kind of migration for the data... raise new ticket ?

@PVince81
Copy link
Contributor

PVince81 commented Nov 7, 2017

@VicDeo I've raised #29483 to look into the absence of said switch.

As @DeepDiver1975 said we need to define max versions for databases. This means we might need to fix our Drone setup for now to test the older MariaDB and bypass the missing innodb switch. @SergioBertolinSG

@VicDeo
Copy link
Member Author

VicDeo commented Nov 7, 2017

@PVince81 as you see everything passes here. I adjusted MariaDB version for Drone in the very last commit

Merging #29100 into master will increase coverage by 0.24%.
The diff coverage is 78.15%.

$eventArgs->setColumn($column);
$version = \OC::$server->getDatabaseConnection()->getDatabaseVersionString();
$mariadb = false !== stripos($version, 'mariadb');
if ($mariadb && version_compare($this->getMariaDbMysqlVersionNumber($version), '10.2.7', '>=')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10.2.7, really ? not even 10.2.0 ? 😢

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$column = $this->_getPortableTableColumnDefinition($tableColumn);
$eventArgs->setColumn($column);
$version = \OC::$server->getDatabaseConnection()->getDatabaseVersionString();
$mariadb = false !== stripos($version, 'mariadb');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if $version is null ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PVince81 stripos will return false without a warning

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. See comments.

If @DeepDiver1975 also agrees with the change then let's merge.

@VicDeo VicDeo requested a review from DeepDiver1975 November 8, 2017 08:32
Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@PVince81 PVince81 merged commit c369e11 into master Nov 8, 2017
@PVince81 PVince81 deleted the fix-28695-backup branch November 8, 2017 09:02
@PVince81
Copy link
Contributor

PVince81 commented Nov 8, 2017

I've explained your changes to @DeepDiver1975 and he agreed for merging

@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 - To Review p1-urgent Critical issue, need to consider hotfix with just that issue status/STALE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants