prooph / pdo-event-store

PDO implementation of ProophEventStore http://getprooph.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MariaDB 10.2.16 causes issues

codeliner opened this issue · comments

During release of pdo-event-store 1.9 we encountered errors testing mariadb.
BETA was tested against mariadb 10.2.15 and everything worked fine. But now with mariadb 10.2.16 being available our travis build fails: https://travis-ci.org/prooph/pdo-event-store/jobs/398146743

We were able to reproduce the bug locally using official mariadb docker images:
mariadb 10.2.15 ✔️
mariadb 10.2.16 🚫

We try to identify the exact problem. For now, don't use mariadb 10.2.16 with pdo-event-store!!!

Here are the steps to reproduce the phpunit errors locally:

$ git clone git@github.com:prooph/pdo-event-store.git
$ cd pdo-event-store
$ docker run --rm -ti -v "$PWD":/app --user "$(id -u):$(id -g)" -w /app composer install --ignore-platform-reqs
$ docker run --rm -ti -p "3306:3306" -e MYSQL_ALLOW_EMPTY_PASSWORD=yes --name pdo-event-store-mariadb -d mariadb:10.2.16
$ docker exec -it pdo-event-store-mariadb mysql -e 'create database event_store_tests;'
$ cp phpunit.xml.mariadb phpunit.xml
$ sed -i 's/127.0.0.1/pdo-event-store-mariadb/g' phpunit.xml
$ docker run --rm -ti -v "$PWD":/app -w /app --user "$(id -u):$(id -g)" --link "pdo-event-store-mariadb" prooph/php:7.1-cli vendor/bin/phpunit
$ docker kill pdo-event-store-maria-db

And here's the diff between MariaDB/server@mariadb-10.2.15...mariadb-10.2.16 (if of any help).

remark. I found I needed 10.2.14 not 10.2.15 to get the tests working. So, 10.2.14 one would need.

I can confirm what @basz says, as I also ran into the same errors with 10.2.15.

EDIT: Please ignore this comment and jump to #164 (comment)


Indeed the testsuite fails under 10.2.15, but for different reasons (which are the same as for 10.2.14).
The 10.2.15 and 10.2.14 failures disappear when running tests separately.

Am I the only to encouter these issues? (the process to run the tests locally is described above).

MariaDB 10.2.16

PHPUnit 7.1.4 by Sebastian Bergmann and contributors.
                                                                                                                                                                                                                  
.......................................E..EE..E................  63 / 394 ( 15%)
...............................E..EE..E........................ 126 / 394 ( 31%)
.................FF............................................ 189 / 394 ( 47%)
FF............................................................. 252 / 394 ( 63%)
............................................................... 315 / 394 ( 79%)                                                                                                                                  
............................................................... 378 / 394 ( 95%)
................                                                394 / 394 (100%)

Time: 1.29 minutes, Memory: 28.00MB
                                                                                                                                                                                                                  
There were 8 errors:

1) ProophTest\EventStore\Pdo\MariaDbCustomStrategiesEventStoreTest::it_loads_events_by_matching_metadata with data set #0 (array(true))                                                                           
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:365

2) ProophTest\EventStore\Pdo\MariaDbCustomStrategiesEventStoreTest::it_loads_events_by_matching_metadata with data set #3 (array(true, 123, 'bar'))                                                               
BadMethodCallException: Accessing the key of an EmptyIterator                                                                                                                                                     

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:365

3) ProophTest\EventStore\Pdo\MariaDbCustomStrategiesEventStoreTest::it_loads_events_reverse_by_matching_metadata with data set #0 (array(true))                                                                   
BadMethodCallException: Accessing the key of an EmptyIterator                                                                                                                                                     

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:405

4) ProophTest\EventStore\Pdo\MariaDbCustomStrategiesEventStoreTest::it_loads_events_reverse_by_matching_metadata with data set #3 (array(true, 123, 'bar'))                                                       
BadMethodCallException: Accessing the key of an EmptyIterator                                                                                                                                                     

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:405

5) ProophTest\EventStore\Pdo\MariaDbEventStoreTest::it_loads_events_by_matching_metadata with data set #0 (array(true))                                                                                           
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:365

6) ProophTest\EventStore\Pdo\MariaDbEventStoreTest::it_loads_events_by_matching_metadata with data set #3 (array(true, 123, 'bar'))                                                                               
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:365

7) ProophTest\EventStore\Pdo\MariaDbEventStoreTest::it_loads_events_reverse_by_matching_metadata with data set #0 (array(true))                                                                                   
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:405

8) ProophTest\EventStore\Pdo\MariaDbEventStoreTest::it_loads_events_reverse_by_matching_metadata with data set #3 (array(true, 123, 'bar'))                                                                       
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:405

--

There were 4 failures:

1) ProophTest\EventStore\Pdo\Projection\MariaDbEventStoreProjectorCustomTablesTest::it_deletes_projection_during_run_when_it_was_deleted_from_outside                                                             
Failed asserting that 5 matches expected 49.

/app/vendor/prooph/event-store/tests/Projection/AbstractEventStoreProjectorTest.php:466

2) ProophTest\EventStore\Pdo\Projection\MariaDbEventStoreProjectorCustomTablesTest::it_deletes_projection_incl_emitted_events_during_run_when_it_was_deleted_from_outside                                         
Failed asserting that 5 matches expected 49.

/app/vendor/prooph/event-store/tests/Projection/AbstractEventStoreProjectorTest.php:508

3) ProophTest\EventStore\Pdo\Projection\MariaDbEventStoreProjectorTest::it_deletes_projection_during_run_when_it_was_deleted_from_outside                                                                         
Failed asserting that 5 matches expected 49.

/app/vendor/prooph/event-store/tests/Projection/AbstractEventStoreProjectorTest.php:466

4) ProophTest\EventStore\Pdo\Projection\MariaDbEventStoreProjectorTest::it_deletes_projection_incl_emitted_events_during_run_when_it_was_deleted_from_outside                                                     
Failed asserting that 5 matches expected 49.

/app/vendor/prooph/event-store/tests/Projection/AbstractEventStoreProjectorTest.php:508

ERRORS!
Tests: 394, Assertions: 2163, Errors: 8, Failures: 4.

MariaDB 10.2.15 & 10.2.14

PHPUnit 7.1.4 by Sebastian Bergmann and contributors.

...............................................................  63 / 394 ( 15%)
............................................................... 126 / 394 ( 31%)
.................FF............................................ 189 / 394 ( 47%)
FF............................................................. 252 / 394 ( 63%)
............................................................... 315 / 394 ( 79%)
............................................................... 378 / 394 ( 95%)
................                                                394 / 394 (100%)

Time: 1.29 minutes, Memory: 24.00MB

There were 4 failures:

1) ProophTest\EventStore\Pdo\Projection\MariaDbEventStoreProjectorCustomTablesTest::it_deletes_projection_during_run_when_it_was_deleted_from_outside                                                             
Failed asserting that 5 matches expected 49.

/app/vendor/prooph/event-store/tests/Projection/AbstractEventStoreProjectorTest.php:466

2) ProophTest\EventStore\Pdo\Projection\MariaDbEventStoreProjectorCustomTablesTest::it_deletes_projection_incl_emitted_events_during_run_when_it_was_deleted_from_outside                                         
Failed asserting that 5 matches expected 49.

/app/vendor/prooph/event-store/tests/Projection/AbstractEventStoreProjectorTest.php:508

3) ProophTest\EventStore\Pdo\Projection\MariaDbEventStoreProjectorTest::it_deletes_projection_during_run_when_it_was_deleted_from_outside                                                                         
Failed asserting that 5 matches expected 49.

/app/vendor/prooph/event-store/tests/Projection/AbstractEventStoreProjectorTest.php:466

4) ProophTest\EventStore\Pdo\Projection\MariaDbEventStoreProjectorTest::it_deletes_projection_incl_emitted_events_during_run_when_it_was_deleted_from_outside                                                     
Failed asserting that 5 matches expected 49.

/app/vendor/prooph/event-store/tests/Projection/AbstractEventStoreProjectorTest.php:508

FAILURES!
Tests: 394, Assertions: 2179, Failures: 4.

I've forgotten to run composer update... my bad.

Here's the new results per MariaDB version with the latest dependencies:

MariaDB version Result
10.2.14 OK (394 tests, 2183 assertions)
10.2.15 OK (394 tests, 2183 assertions)
10.2.16 ERRORS! Tests: 394, Assertions: 2167, Errors: 8.1

1Here are testsuite errors with MariaDB 10.2.16:

There were 8 errors:

1) ProophTest\EventStore\Pdo\MariaDbCustomStrategiesEventStoreTest::it_loads_events_by_matching_metadata with data set #0 (array(true))
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:365

2) ProophTest\EventStore\Pdo\MariaDbCustomStrategiesEventStoreTest::it_loads_events_by_matching_metadata with data set #3 (array(true, 123, 'bar'))
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:365

3) ProophTest\EventStore\Pdo\MariaDbCustomStrategiesEventStoreTest::it_loads_events_reverse_by_matching_metadata with data set #0 (array(true))
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:405

4) ProophTest\EventStore\Pdo\MariaDbCustomStrategiesEventStoreTest::it_loads_events_reverse_by_matching_metadata with data set #3 (array(true, 123, 'bar'))
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:405

5) ProophTest\EventStore\Pdo\MariaDbEventStoreTest::it_loads_events_by_matching_metadata with data set #0 (array(true))
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:365

6) ProophTest\EventStore\Pdo\MariaDbEventStoreTest::it_loads_events_by_matching_metadata with data set #3 (array(true, 123, 'bar'))
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:365

7) ProophTest\EventStore\Pdo\MariaDbEventStoreTest::it_loads_events_reverse_by_matching_metadata with data set #0 (array(true))
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:405

8) ProophTest\EventStore\Pdo\MariaDbEventStoreTest::it_loads_events_reverse_by_matching_metadata with data set #3 (array(true, 123, 'bar'))
BadMethodCallException: Accessing the key of an EmptyIterator

/app/vendor/prooph/event-store/tests/AbstractEventStoreTest.php:405

@basz @drgomesp Could you desribe (ideally with a test) what's wrong on your side with 10.2.15, please?

MariaDB version Result
mariadb:10.2.14 OK (394 tests, 2183 assertions)
mariadb:10.2.15 OK (394 tests, 2183 assertions)
mariadb:10.2.16 Tests: 394, Assertions: 2167, Errors: 8. (same output as above)

10.2.15 seems good after all.

note: all done with composer update and docker-compose -f docker-compose-tests.yml down --rmi all -v --remove-orphans in-between runs.

Currently debugging this, I'll leave my notes here to keep track of them.

I've detected a difference in the behavior of the json_value function between 10.2.15 and 10.2.16.
(Note: this function is used to load events with a metadata matcher here).

As a matter of fact,
the query SELECT json_value('{"foo":true}', '$.foo'); will return

10.2.15

MariaDB [none]> SELECT json_value('{"foo":true}', '$.foo');                                                                                                                                          
+-------------------------------------+
| json_value('{"foo":true}', '$.foo') |
+-------------------------------------+
| true                                |
+-------------------------------------+
1 row in set (0.00 sec)

10.2.16

MariaDB [(none)]> SELECT json_value('{"foo":true}', '$.foo');
+-------------------------------------+
| json_value('{"foo":true}', '$.foo') |
+-------------------------------------+
| 1                                   |
+-------------------------------------+
1 row in set (0.00 sec)

It looks like it's been done on purpose (aka feature, not a bug) => MariaDB/server@352c7e0

EDIT: https://jira.mariadb.org/browse/MDEV-15905