From 40024b4d3c1922f1c72d5d87e08f5ad5dd72fd11 Mon Sep 17 00:00:00 2001 From: dvanaken Date: Wed, 23 Oct 2019 17:41:10 -0400 Subject: [PATCH] Added an option to enable compression on MySQL tables (disabled by default) --- .../website/migrations/0002_enable_compression.py | 14 ++++++++++++-- .../website/settings/credentials_TEMPLATE.py | 7 +++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/server/website/website/migrations/0002_enable_compression.py b/server/website/website/migrations/0002_enable_compression.py index 6bfcafe..8404a39 100644 --- a/server/website/website/migrations/0002_enable_compression.py +++ b/server/website/website/migrations/0002_enable_compression.py @@ -4,6 +4,8 @@ import logging from django.db import migrations, ProgrammingError +from website.settings import MYSQL_COMPRESSION + LOG = logging.getLogger(__name__) TABLES_TO_COMPRESS = [ @@ -70,6 +72,14 @@ class Migration(migrations.Migration): ('website', '0001_initial'), ] - operations = [migrations.RunPython(enable_compression, disable_compression)] - + if MYSQL_COMPRESSION: + operations = [ + migrations.RunPython(enable_compression, + disable_compression) + ] + else: + operations = [ + migrations.RunSQL(migrations.RunSQL.noop, + migrations.RunSQL.noop), + ] diff --git a/server/website/website/settings/credentials_TEMPLATE.py b/server/website/website/settings/credentials_TEMPLATE.py index cc25c90..6277ae3 100644 --- a/server/website/website/settings/credentials_TEMPLATE.py +++ b/server/website/website/settings/credentials_TEMPLATE.py @@ -34,6 +34,13 @@ DATABASES = { } } +# Enables compression on MySQL >= 5.6 on tables: +# - website_backupdata +# - website_knobdata +# - website_metricdata +# - website_pipelinedata +MYSQL_COMPRESSION = False + # ============================================== # DEBUG CONFIGURATION # ==============================================