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

BC Break in 2.9.0 for MySQL Tables containing partitions #3398

Closed
bcremer opened this issue Dec 10, 2018 · 8 comments
Closed

BC Break in 2.9.0 for MySQL Tables containing partitions #3398

bcremer opened this issue Dec 10, 2018 · 8 comments

Comments

@bcremer
Copy link
Contributor

bcremer commented Dec 10, 2018

BC Break Report

Q A
BC Break yes
Version 2.9.0

Summary

Commit a7cffda#r31615323 introduces a regression for MySQL Tables that are Partitioned.

May be related to #3389.

Previous behaviour

\Doctrine\DBAL\Schema\AbstractSchemaManager::listTableDetails emits no PHP Notice for MySQL Tables that are Partitioned.

Current behavior

\Doctrine\DBAL\Schema\AbstractSchemaManager::listTableDetails emits PHP Notice for MySQL Tables that are Partitioned.

How to reproduce

Add the following testcase to tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php:

    public function testEnsureTableOptionsSupportPartitionedTables() : void
    {
        $this->connection->query('DROP TABLE IF EXISTS test_table_partitioned');

        $sql = <<<'SQL'
CREATE TABLE test_table_partitioned (
  col1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY
) 
COLLATE=utf8mb4_unicode_ci
ENGINE=InnoDB 
PARTITION BY RANGE (col1) (
 PARTITION p1 VALUES LESS THAN (2) ENGINE = InnoDB,
 PARTITION pMax VALUES LESS THAN MAXVALUE
)
SQL;

        $this->connection->query($sql);
        $onlineTable = $this->schemaManager->listTableDetails('test_table_partitioned');

        self::assertEquals(['partitioned' => true], $onlineTable->getOption('create_options'));
    }
 MySQL> SELECT ENGINE, AUTO_INCREMENT, TABLE_COLLATION, TABLE_COMMENT, CREATE_OPTIONS FROM information_schema.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'redacted';
+--------+----------------+--------------------+---------------+----------------+
| ENGINE | AUTO_INCREMENT | TABLE_COLLATION    | TABLE_COMMENT | CREATE_OPTIONS |
+--------+----------------+--------------------+---------------+----------------+
| InnoDB |           NULL | utf8mb4_unicode_ci |               | partitioned    |
+--------+----------------+--------------------+---------------+----------------+
1 row in set (0.00 sec)

This will emit a PHP Notice:

PHP Notice: Undefined offset: 1 in /home/apidev/current/vendor/doctrine  
  /dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php on line 319
@bcremer bcremer changed the title BC Break in 2.9.0 for MySQL Tables containing Partitiones BC Break in 2.9.0 for MySQL Tables containing partitions Dec 10, 2018
@Ocramius
Copy link
Member

Not a BC break: partitioned tables were never really supported by the schema tooling.

@bcremer
Copy link
Contributor Author

bcremer commented Dec 10, 2018

Fair enough. Still the schemamanager was perfectly usable for partitioned tables before.
This bug may also effect other CREATE_OPTIONS that are not formatted as key=value.

Would you accept a patch that fixes CREATE_OPTIONS parsing for non key/value pairs?

@Ocramius
Copy link
Member

Sure thing: send in the test that you're mentioning in the OP first, then add commits with a fix if you think you already have one

@bcremer
Copy link
Contributor Author

bcremer commented Dec 10, 2018

@Ocramius Nevermind. This was already fixed in the 2.9 Branch by @morozov. See: 6e1bb80

@bcremer bcremer closed this as completed Dec 10, 2018
@Ocramius
Copy link
Member

@bcremer is the test still relevant though?

@bcremer
Copy link
Contributor Author

bcremer commented Dec 10, 2018

The relevant testcase is already included in 6e1bb80#diff-921db63349be598a376afb1584ccc8b5.

@Ocramius
Copy link
Member

Marking as duplicate of #3393 then 👍

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants