diff options
author | lqslan <lqslan@cn.ibm.com> | 2014-11-25 12:35:37 +0800 |
---|---|---|
committer | Eoghan Glynn <eglynn@redhat.com> | 2014-11-27 17:07:33 +0000 |
commit | d3bcd1442c816df5b09adee781892a8a5370cba4 (patch) | |
tree | 26a785e25bbfc820962c0c3aef7509e1425677fc | |
parent | 0cce6021a1f4b01bf8307bbfef7a9279ce43144b (diff) | |
download | ceilometer-d3bcd1442c816df5b09adee781892a8a5370cba4.tar.gz |
Database.max_retries only override on sqlalchemy side
Currently, the max_retries parameter will be override in
get_connection_from_config function. But it will be used
later in safe_mongo_call function.
Since the override of max_retries only need on sqlalchemy
side, this patch move the override from get_connection_
from_config to storage.impl_sqlalchemy.Connection.__init__
and make sure max_retries can be used on mongoDB side.
Change-Id: I83f35c886bc8b7299c1efd7297fdbc980214567f
Closes-Bug: #1395972
(cherry picked from commit afb90e0cfc7fadae17ed9d360124e5683cb0b99a)
-rw-r--r-- | ceilometer/storage/impl_sqlalchemy.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ceilometer/storage/impl_sqlalchemy.py b/ceilometer/storage/impl_sqlalchemy.py index a8dc436c..a77cb15e 100644 --- a/ceilometer/storage/impl_sqlalchemy.py +++ b/ceilometer/storage/impl_sqlalchemy.py @@ -222,6 +222,11 @@ class Connection(base.Connection): ) def __init__(self, url): + # Set max_retries to 0, since oslo.db in certain cases may attempt + # to retry making the db connection retried max_retries ^ 2 times + # in failure case and db reconnection has already been implemented + # in storage.__init__.get_connection_from_config function + cfg.CONF.set_override('max_retries', 0, group='database') self._engine_facade = db_session.EngineFacade( url, **dict(cfg.CONF.database.items()) |