Hi , All,

I am working on the NOVA with sqlalchemy.
And one problem is that I did not find any different with the DB 
configuration with max_pool_size/max_overflow:

example: /tmp/nova.conf

[database]
connection = 
postgresql://openstack:openstack@xxxx:5432/nova?application_name=nova
max_pool_size = 0
max_overflow=1
idle_timeout=60

When I use the model_query in the nova api, the session still not closed.
In my understand, the max_overflow means the session was returned to pool 
and will be closed also.

Here is my samples:

ctxt = context_module.get_admin_context()  ###### each session need one ctxt

@oslo_db_api.wrap_db_retry(max_retries=5, retry_on_deadlock=True)
@sqlalchemy_api.main_context_manager.reader
def get_instance_by_uuid_with_demorator(ctxt,uuid):
    # with sqlalchemy_api.main_context_manager.reader.using(ctxt):
    ctxt.session.query(func.pg_sleep(0.250)).scalar()
    result = 
sqlalchemy_api.model_query(ctxt,models.Instance,read_deleted="no").options(joinedload_all('security_groups.rules')).
 \
                options(joinedload('info_cache')). \
                filter(models.Instance.uuid == uuid).\
                first()
    return result


The session managemant was wrapped in the OSLO.DB module,  which is class 
TransactionContextManager.
My question is:
1. Do I need to invoke session.close() in my application code?
2. What the different between max_pool_size connections and max_overflow 
connections.

Thanks.



-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to