fix: Disable column-statistics during mysqldump command. This option

was recently enabled by default in mysqldump, but the generation of
histogram statistics fails in devstack during this script's mysqldump
commands. The SQL statement and output of the failure:

mysql> SELECT \
COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"') \
FROM information_schema.COLUMN_STATISTICS \
WHERE \
SCHEMA_NAME = 'edxtest' AND \
TABLE_NAME = 'agreements_integritysignature';
ERROR 1109 (42S02): Unknown table 'COLUMN_STATISTICS' in information_schema
This commit is contained in:
Julia Eskew
2021-06-04 10:46:10 -04:00
committed by Julia Eskew
parent 9ca8c430de
commit b84e8937ff

View File

@@ -89,11 +89,11 @@ rebuild_cache_for_db() {
echo "Using the dumpdata command to save the $db fixture data to the filesystem."
./manage.py lms --settings $SETTINGS dumpdata --database $db > $DB_CACHE_DIR/bok_choy_data_$db.json --exclude=api_admin.Catalog
echo "Saving the schema of the $db bok_choy DB to the filesystem."
mysqldump $MYSQL_HOST -u root --no-data --skip-comments --skip-dump-date "${databases[$db]}" > $DB_CACHE_DIR/bok_choy_schema_$db.sql
mysqldump --column_statistics=0 $MYSQL_HOST -u root --no-data --skip-comments --skip-dump-date "${databases[$db]}" > $DB_CACHE_DIR/bok_choy_schema_$db.sql
# dump_data does not dump the django_migrations table so we do it separately.
echo "Saving the django_migrations table of the $db bok_choy DB to the filesystem."
mysqldump $MYSQL_HOST -u root --no-create-info --skip-comments --skip-dump-date "${databases["$db"]}" django_migrations > $DB_CACHE_DIR/bok_choy_migrations_data_$db.sql
mysqldump --column_statistics=0 $MYSQL_HOST -u root --no-create-info --skip-comments --skip-dump-date "${databases["$db"]}" django_migrations > $DB_CACHE_DIR/bok_choy_migrations_data_$db.sql
}
for db in "${database_order[@]}"; do