Added support for growing the pool back to the minimum number of
connections allowed in the pool when connections are killed or otherwise become unusable; fixed bug when a dynamically sized pool is created with an increment of zero and the pool needs to grow.
This commit is contained in:
parent
5ad4e0635d
commit
762d4ac4e1
|
@ -18,6 +18,9 @@ Thin Mode Changes
|
|||
#) Added support for shrinking the pool back to the minimum number of
|
||||
connections allowed in the pool when the pool is idle for
|
||||
:data:`ConnectionPool.timeout` seconds.
|
||||
#) Added support for growing the pool back to the minimum number of
|
||||
connections allowed in the pool when connections are killed or otherwise
|
||||
made unusable.
|
||||
#) Fixed bug using :attr:`Cursor.arraysize` for tuning data fetches from REF
|
||||
CURSORS.
|
||||
#) Fixed bug connecting to databases with older 11g password verifiers
|
||||
|
@ -31,6 +34,8 @@ Thin Mode Changes
|
|||
listener redirects.
|
||||
#) Fixed bug when executing PL/SQL with a large number of binds.
|
||||
#) Fixed bug when using DRCP with Oracle Database 23c.
|
||||
#) Fixed bug when a dynamically sized pool is created with an increment of
|
||||
zero and the pool needs to grow.
|
||||
#) Fixed bug when a connection is discarded from the pool during
|
||||
acquire() and the ping check fails due to the connection being dead.
|
||||
|
||||
|
|
|
@ -94,3 +94,8 @@ cdef class PoolParamsImpl(ConnectParamsImpl):
|
|||
&self.max_sessions_per_shard)
|
||||
_set_bool_param(args, "soda_metadata_cache", &self.soda_metadata_cache)
|
||||
_set_int_param(args, "ping_interval", &self.ping_interval)
|
||||
|
||||
# if the pool is dynamically sized (min != max) then ensure that the
|
||||
# increment value is non-zero (as otherwise the pool would never grow!)
|
||||
if self.max != self.min and self.increment == 0:
|
||||
self.increment = 1
|
||||
|
|
|
@ -108,9 +108,6 @@ cdef class ThinPoolImpl(BasePoolImpl):
|
|||
list conn_impls_to_drop
|
||||
bint wait
|
||||
|
||||
# create the initial set of connections requested
|
||||
self._create_conn_impls_helper(self.min)
|
||||
|
||||
# create connections and close connections as needed
|
||||
while True:
|
||||
conn_impls_to_drop = []
|
||||
|
@ -119,9 +116,11 @@ cdef class ThinPoolImpl(BasePoolImpl):
|
|||
|
||||
# determine if there is any work to do
|
||||
with self._condition:
|
||||
if self._open and self._num_waiters > 0:
|
||||
open_count = self.get_open_count()
|
||||
num_conns = min(self.increment, self.max - open_count)
|
||||
open_count = self.get_open_count()
|
||||
if self._open and \
|
||||
(self._num_waiters > 0 or open_count < self.min):
|
||||
num_conns = max(self.min - open_count,
|
||||
min(self.increment, self.max - open_count))
|
||||
if not self._open or self._bg_exc is None:
|
||||
conn_impls_to_drop = self._conn_impls_to_drop
|
||||
self._conn_impls_to_drop = []
|
||||
|
|
|
@ -741,5 +741,18 @@ class TestCase(test_env.BaseTestCase):
|
|||
sid = conn.cursor().execute(sql).fetchone()[0]
|
||||
self.assertEqual(sid, sids[0], "not LIFO")
|
||||
|
||||
def test_2433_dynamic_pool_with_zero_increment(self):
|
||||
"2433 - verify that dynamic pool cannot have an increment of zero"
|
||||
pool = test_env.get_pool(min=1, max=3, increment=0)
|
||||
self.assertEqual(pool.increment, 1)
|
||||
conn1 = pool.acquire()
|
||||
conn2 = pool.acquire()
|
||||
|
||||
def test_2434_static_pool_with_zero_increment(self):
|
||||
"2434 - verify that static pool can have an increment of zero"
|
||||
pool = test_env.get_pool(min=1, max=1, increment=0)
|
||||
self.assertEqual(pool.increment, 0)
|
||||
conn = pool.acquire()
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_env.run_test_cases()
|
||||
|
|
Loading…
Reference in New Issue