Browse Source

HUE-2466 [core] MySQL should default to using InnoDB

Jenny Kim 10 years ago
parent
commit
2291e8d

+ 2 - 1
desktop/conf.dist/hue.ini

@@ -452,7 +452,8 @@
     # Database engine is typically one of:
     # Database engine is typically one of:
     # postgresql_psycopg2, mysql, sqlite3 or oracle.
     # postgresql_psycopg2, mysql, sqlite3 or oracle.
     #
     #
-    # Note that for sqlite3, 'name', below is a path to the filename. For other backends, it is the database name.
+    # Note that for sqlite3, 'name', below is a path to the filename. For other backends, it is the database name
+    # Note that for MySQL, the default storage engine will be set to InnoDB
     # Note for Oracle, options={"threaded":true} must be set in order to avoid crashes.
     # Note for Oracle, options={"threaded":true} must be set in order to avoid crashes.
     # Note for Oracle, you can use the Oracle Service Name by setting "port=0" and then "name=<host>:<port>/<service_name>".
     # Note for Oracle, you can use the Oracle Service Name by setting "port=0" and then "name=<host>:<port>/<service_name>".
     # Note for MariaDB use the 'mysql' engine.
     # Note for MariaDB use the 'mysql' engine.

+ 1 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -457,6 +457,7 @@
     # postgresql_psycopg2, mysql, sqlite3 or oracle.
     # postgresql_psycopg2, mysql, sqlite3 or oracle.
     #
     #
     # Note that for sqlite3, 'name', below is a path to the filename. For other backends, it is the database name.
     # Note that for sqlite3, 'name', below is a path to the filename. For other backends, it is the database name.
+    # Note that for MySQL, the default storage engine will be set to InnoDB
     # Note for Oracle, options={"threaded":true} must be set in order to avoid crashes.
     # Note for Oracle, options={"threaded":true} must be set in order to avoid crashes.
     # Note for Oracle, you can use the Oracle Service Name by setting "port=0" and then "name=<host>:<port>/<service_name>".
     # Note for Oracle, you can use the Oracle Service Name by setting "port=0" and then "name=<host>:<port>/<service_name>".
     # Note for MariaDB use the 'mysql' engine.
     # Note for MariaDB use the 'mysql' engine.

+ 7 - 2
desktop/core/src/desktop/settings.py

@@ -27,14 +27,13 @@ import sys
 
 
 from guppy import hpy
 from guppy import hpy
 
 
+from django.utils.translation import ugettext_lazy as _
 
 
 import desktop.conf
 import desktop.conf
 import desktop.log
 import desktop.log
 import desktop.redaction
 import desktop.redaction
-
 from desktop.lib.paths import get_desktop_root
 from desktop.lib.paths import get_desktop_root
 from desktop.lib.python_util import force_dict_to_strings
 from desktop.lib.python_util import force_dict_to_strings
-from django.utils.translation import ugettext_lazy as _
 
 
 
 
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
@@ -318,6 +317,12 @@ else:
     "ATOMIC_REQUESTS" : True,
     "ATOMIC_REQUESTS" : True,
   }
   }
 
 
+# If database engine is MySQL, set to InnoDB
+if default_db['ENGINE'] == 'django.db.backends.mysql':
+  if not 'OPTIONS' in default_db or default_db['OPTIONS'] is None:
+    default_db['OPTIONS'] = dict()
+  default_db['OPTIONS'].update({'init_command': 'SET storage_engine=INNODB'})
+
 DATABASES = {
 DATABASES = {
   'default': default_db
   'default': default_db
 }
 }