Skip to content

Commit adea524

Browse files
committed
Implement session max lifetime and max usage
1 parent 43dd861 commit adea524

20 files changed

+3428
-3019
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* OLTP workload gets ociping and connect times
88
* Bitwise operations and input of hexadecimal constants
99
* Bit set/clear assignments
10+
* session pool can set max usage count and max lifetime
1011
* dbsecounds() and ociseconds() functions
1112

1213
## 3.1.3

docs/ERRORLIST.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,10 @@ allowed.
13381338
The right operand of the bitwise shift operation is larger than or equal to
13391339
the bit width of the left operand. The right operand should be at most 63.
13401340

1341+
### RWL-328 error: "the connection pool database '%s' cannot use release %s"
1342+
The release count or every time can only be provided for session pools, you can
1343+
use release time (without the count or every keyword) as an alternative.
1344+
13411345
### RWL-600 internal error: '%s'
13421346
An abnormal situation caused an internal error in rwloadsim.
13431347
This is in most cases due to a programming error and it

docs/refman/connping.html

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/refman/databasedeclaration.html

Lines changed: 42 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/refman/ociping.html

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/refman/utilities.html

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/man1rwl/databasedeclaration.1rwl

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ databasedeclaration \- RWP*Load Simulator declare a database connection
66
\fC
77
databasedeclaration ::=
88
\fBdatabase\fR identifier [ concatenation ]
9-
databasespecification { databasespecification }
9+
{ databasespecification }
1010

1111
databasespecification ::=
1212
\fBusername\fR concatenation
@@ -18,14 +18,25 @@ databasespecification ::=
1818
| \fBreconnect\fR
1919
| [ \fBthreads\fR ] \fBdedicated\fR [ \fBrequestmark\fR | \fBstatemark\fR ]
2020
| \fBcursorcache\fR expression
21-
| \fBsessionpool\fR expression [ \fB..\fR expression ] [ releasepool ] [ waitsession ]
21+
| \fBsessionpool\fR expression [ \fB..\fR expression ] { sessionrelease } ] [ waitsession ]
2222
| \fBconnectionclass\fR concatenation
23-
| \fBconnectionpool\fR expression [ \fB..\fR expression ] [ releasepool ]
23+
| \fBconnectionpool\fR expression [ \fB..\fR expression ] [ idlerelease ]
2424
| \fBconnect\fR \fBconnectionpool\fR identifier
2525

26-
releasepool ::=
26+
sessionrelease ::=
27+
idlerelease
28+
| countrelease
29+
| lifetimerelease
30+
31+
idlerelease ::=
2732
\fBrelease\fR expression
2833

34+
lifetimerelease ::=
35+
\fBrelease\fR \fBevery\fR expression
36+
37+
countrelease ::=
38+
\fBrelease\fR \fBcount\fR expression
39+
2940
waitsession ::=
3041
\fBwait\fR expression
3142
| \fBwait\fR expression \fBthen break\fR
@@ -121,7 +132,7 @@ Note that this can imply a high number of database connections and dis-connectio
121132
.RE
122133
.P
123134
\fBdedicated\fR
124-
.P
135+
.br
125136
\fBthreads dedicated\fR
126137
.RS 4
127138
Use dedicated connections that are established once and kept logged on during
@@ -169,13 +180,25 @@ does not have the counterpart of an OCIConnectionPool.
169180
.RE
170181
.P
171182
.B \fBrelease\fR value
183+
.br
184+
.B \fBrelease count\fR value
185+
.br
186+
.B \fBrelease every\fR value
172187
.RS 4
173-
For a pool, set the timeout value for idle
188+
For a pool, the first option sets the timeout value for idle
174189
sessions (OCI_ATTR_SPOOL_TIMEOUT)
175190
or connections (OCI_ATTR_CONN_TIMEOUT);
176191
the default is 60s.
177192
Sessions or connections in the pool that have been idle for more than the release value
178193
will disconnect unless the pool already has its minimum size.
194+
.P
195+
For a session pool, you can also set the max usage count (OCI_ATTR_SPOOL_MAX_USE_SESSION)
196+
or the max lifetime (OCI_ATTR_SPOOL_MAX_LIFETIME_SESSION)
197+
using the either of the two last options.
198+
The default is 0 implying sessions will not have a max usage count or max lifetime.
199+
.P
200+
For all three attributes, you may provide a double value, but since the value used in OCI
201+
is an integer, only the integer part of the value will be used.
179202
.RE
180203
.P
181204
.B \fBwait\fR value

src/rwl.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*
1212
* History
1313
*
14+
* bengsig 10-oct-2024 - sessionpool release every/count
1415
* bengsig 2-sep-2024 - |= (bis) and &~= (bic) assignments
1516
* bengsig 29-aug-2024 - rwldorxtosb8 macro
1617
* bengsig 28-aug-2024 - Add rwloeradd function
@@ -461,6 +462,8 @@ struct rwl_cinfo
461462

462463
ub4 stmtcache; /* size of statement cache */
463464
ub4 ptimeout; /* session/conneciton pool timeout */
465+
ub4 pmaxuse; /* session pool max use count */
466+
ub4 pmaxlife; /* session pool max life time */
464467
#define RWL_DBPOOL_DEFAULT_TIMEOUT 60 // for ptimeout
465468
double wtimeout; /* sessionpool wait timeout */
466469

@@ -488,7 +491,13 @@ struct rwl_cinfo
488491
#define RWL_DB_CREDEXT 0x0010000 // Use OCI_CRED_EXT (for wallet authentication)
489492
#define RWL_DB_SP_NORLB 0x0020000 // Includ the OCI_SPC_NO_RLB during OCISessionPoolCreate
490493
#define RWL_DB_SPTOBREAK 0x0040000 // Break to end of procedure if OCISessionGet timeout
491-
#define RWL_DB_COPY_FLAGS (RWL_DB_SPTOBREAK|RWL_DB_CREDEXT|RWL_DB_REQMARK|RWL_DB_STATEMARK|RWL_DB_USECPOOL|RWL_DB_CCACHUSER|RWL_DB_SP_NORLB)
494+
#define RWL_DB_COPY_FLAGS (RWL_DB_SPTOBREAK \
495+
| RWL_DB_CREDEXT \
496+
| RWL_DB_REQMARK \
497+
| RWL_DB_STATEMARK \
498+
| RWL_DB_USECPOOL \
499+
| RWL_DB_CCACHUSER \
500+
| RWL_DB_SP_NORLB)
492501
rwl_estack *tobreak; // time out break routine
493502
sb4 errcode; // last error code
494503

src/rwlerror.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*
1212
* History
1313
*
14+
* bengsig 10-oct-2024 - sessionpool release count/every
1415
* obakhir 7-aug-2024 - Add RWL Errors from 324 to 327 for bitwise operators
1516
* obakhir 24-jun-2024 - Add RWL_ERROR_CLOB_TOO_LARGE for rwlreadlob
1617
* bengsig 4-jun-2024 - $ora01013:break
@@ -1850,6 +1851,11 @@ RWLERROR("bitwise shifting by an amount greater than or equal to the bit width",
18501851
RWLEDESC("The right operand of the bitwise shift operation is larger than or equal to" RWL_LINEEND
18511852
"the bit width of the left operand. The right operand should be at most 63")
18521853

1854+
#define RWL_ERROR_CPOOL_NOT_RELEASE_COUNT 328
1855+
RWLERROR("the connection pool database '%s' cannot use release %s", RWL_ERROR_PARSE)
1856+
RWLEDESC("The release count or every time can only be provided for session pools, you can" RWL_LINEEND
1857+
"use release time (without the count or every keyword) as an alternative")
1858+
18531859
// When adding new errors, add them before these lines
18541860
// and make sure the #define follows a format like
18551861
// #define RWL_ERROR_whatever_reasonable_here NNN

0 commit comments

Comments
 (0)