~ubuntu-branches/ubuntu/vivid/ceilometer/vivid

« back to all changes in this revision

Viewing changes to ceilometer/openstack/common/db/sqlalchemy/session.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2014-03-06 14:44:28 UTC
  • mto: (28.1.1 utopic-proposed) (1.2.1)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: package-import@ubuntu.com-20140306144428-rvphsh4igwyulzf0
Tags: upstream-2014.1~b3
ImportĀ upstreamĀ versionĀ 2014.1~b3

Show diffs side-by-side

added added

removed removed

Lines of Context:
271
271
"""
272
272
 
273
273
import functools
 
274
import logging
274
275
import os.path
275
276
import re
276
277
import time
285
286
 
286
287
from ceilometer.openstack.common.db import exception
287
288
from ceilometer.openstack.common.gettextutils import _
288
 
from ceilometer.openstack.common import log as logging
289
289
from ceilometer.openstack.common import timeutils
290
290
 
291
291
sqlite_db_opts = [
292
292
    cfg.StrOpt('sqlite_db',
293
293
               default='ceilometer.sqlite',
294
 
               help='the filename to use with sqlite'),
 
294
               help='The file name to use with SQLite'),
295
295
    cfg.BoolOpt('sqlite_synchronous',
296
296
                default=True,
297
 
                help='If true, use synchronous mode for sqlite'),
 
297
                help='If True, SQLite uses synchronous mode'),
298
298
]
299
299
 
300
300
database_opts = [
324
324
                                                  group='DATABASE'),
325
325
                                cfg.DeprecatedOpt('idle_timeout',
326
326
                                                  group='sql')],
327
 
               help='timeout before idle sql connections are reaped'),
 
327
               help='Timeout before idle sql connections are reaped'),
328
328
    cfg.IntOpt('min_pool_size',
329
329
               default=1,
330
330
               deprecated_opts=[cfg.DeprecatedOpt('sql_min_pool_size',
347
347
                                                  group='DEFAULT'),
348
348
                                cfg.DeprecatedOpt('sql_max_retries',
349
349
                                                  group='DATABASE')],
350
 
               help='maximum db connection retries during startup. '
 
350
               help='Maximum db connection retries during startup. '
351
351
                    '(setting -1 implies an infinite retry count)'),
352
352
    cfg.IntOpt('retry_interval',
353
353
               default=10,
355
355
                                                  group='DEFAULT'),
356
356
                                cfg.DeprecatedOpt('reconnect_interval',
357
357
                                                  group='DATABASE')],
358
 
               help='interval between retries of opening a sql connection'),
 
358
               help='Interval between retries of opening a sql connection'),
359
359
    cfg.IntOpt('max_overflow',
360
360
               default=None,
361
361
               deprecated_opts=[cfg.DeprecatedOpt('sql_max_overflow',
737
737
    if engine.name in ['mysql', 'ibm_db_sa']:
738
738
        callback = functools.partial(_ping_listener, engine)
739
739
        sqlalchemy.event.listen(engine, 'checkout', callback)
740
 
        if mysql_traditional_mode:
741
 
            sqlalchemy.event.listen(engine, 'checkout', _set_mode_traditional)
742
 
        else:
743
 
            LOG.warning(_("This application has not enabled MySQL traditional"
744
 
                          " mode, which means silent data corruption may"
745
 
                          " occur. Please encourage the application"
746
 
                          " developers to enable this mode."))
 
740
        if engine.name == 'mysql':
 
741
            if mysql_traditional_mode:
 
742
                sqlalchemy.event.listen(engine, 'checkout',
 
743
                                        _set_mode_traditional)
 
744
            else:
 
745
                LOG.warning(_("This application has not enabled MySQL "
 
746
                              "traditional mode, which means silent "
 
747
                              "data corruption may occur. "
 
748
                              "Please encourage the application "
 
749
                              "developers to enable this mode."))
747
750
    elif 'sqlite' in connection_dict.drivername:
748
751
        if not CONF.sqlite_synchronous:
749
752
            sqlalchemy.event.listen(engine, 'connect',