#33537: Cloning test database fails with mysql-client 8.x and older 
mysql-server or
mariadb-server
-------------------------------------+-------------------------------------
               Reporter:  Stephen    |          Owner:  nobody
  Finucane                           |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.2
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 I've been seeing the following error message when attempting to run tests
 in parallel using a MySQL backend:

 {{{
 py36-django22 run-test-pre: PYTHONHASHSEED='1711093702'
 py36-django22 run-test: commands[0] | python
 /home/patchwork/patchwork/manage.py test --noinput --parallel -- patchwork
 mysqldump: Couldn't execute 'SELECT COLUMN_NAME,
 JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"')
 FROM information_schema.COLUMN_STATISTICS                WHERE SCHEMA_NAME
 = 'test_patchwork' AND TABLE_NAME = 'auth_group';': Unknown table
 'COLUMN_STATISTICS' in information_schema (1109)
 mysqldump: Couldn't execute 'SELECT COLUMN_NAME,
 JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"')
 FROM information_schema.COLUMN_STATISTICS                WHERE SCHEMA_NAME
 = 'test_patchwork' AND TABLE_NAME = 'auth_group';': Unknown table
 'COLUMN_STATISTICS' in information_schema (1109)
 System check identified no issues (0 silenced).
 Creating test database for alias 'default'...
 Cloning test database for alias 'default'...
 Cloning test database for alias 'default'...
 ...
 }}}

 This is followed by a lot of test failures due to missing databases.

 In my instance, I traced this back to the fact that I was using `mariadb-
 server` with `mysql-client` rather than `mariadb-server`. Switching the
 client packages resolved the issue. However, posts on StackOverflow
 suggest the same issue can occur when using older MySQL servers (5.7?)
 that don't provide these statistics with newer clients so it's not as
 clear cut as this.

 I'm not sure there's much to be done here from a Django perspective. We
 could arguably add the `-column-statistics=0` flag to the `mysqldump` call
 (in `django.db.backends.mysql.creation.DatabaseCreation._clone_db`), but
 this is not compatible with the version of this tool provided by `mariadb-
 client`. We might also want to make this a more serious error and fail the
 test run rather than attempt to proceed, obscuring the failure in the
 process (this could conceivably get flaky if you had a mix of DB and non-
 DB tests running in different runner instances). Perhaps the best thing to
 do here is close this and leave it here as a breadcrumb for others that
 run into the issue.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33537>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.333fcd734245b86c7f9cfb0accdfb88d%40djangoproject.com.

Reply via email to