Skip to content

Commit

Permalink
Added an option to enable compression on MySQL tables (disabled by de…
Browse files Browse the repository at this point in the history
…fault)
  • Loading branch information
dvanaken committed Oct 24, 2019
1 parent ec896d0 commit 40024b4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
14 changes: 12 additions & 2 deletions server/website/website/migrations/0002_enable_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from django.db import migrations, ProgrammingError

from website.settings import MYSQL_COMPRESSION

LOG = logging.getLogger(__name__)

TABLES_TO_COMPRESS = [
Expand Down Expand Up @@ -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),
]

7 changes: 7 additions & 0 deletions server/website/website/settings/credentials_TEMPLATE.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
}
}

# Enables compression on MySQL >= 5.6 on tables:
# - website_backupdata
# - website_knobdata
# - website_metricdata
# - website_pipelinedata
MYSQL_COMPRESSION = False

# ==============================================
# DEBUG CONFIGURATION
# ==============================================
Expand Down

0 comments on commit 40024b4

Please sign in to comment.