Skip to content

Commit 5575648

Browse files
committed
Change the default of "events" to true for better O-O-B HA
1 parent 0052190 commit 5575648

File tree

7 files changed

+24
-17
lines changed

7 files changed

+24
-17
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080
Database ([ODPI-C
8181
change](https://github.com/oracle/odpi/commit/58e6a07ff5bb428a09068456ef5231884fcb77db)).
8282

83+
- Change the
84+
[`events`](https://oracle.github.io/node-oracledb/doc/api.html#propdbevents)
85+
default to *true*.
86+
8387
- Updated the JavaScript syntax in class implementations.
8488

8589
- Class methods are now configurable. For example via

doc/api.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ Boolean events
10601060

10611061
Determines whether Oracle Client events mode should be enabled.
10621062

1063-
The default value for `events` is *false*.
1063+
The default value for `events` is *true*.
10641064

10651065
This property can be overridden in the
10661066
[`oracledb.createPool()`](#createpoolpoolattrsevents) call and when
@@ -1072,7 +1072,8 @@ Notification](#consubscribe), [Fast Application Notification
10721072
(FAN)](#connectionfan) and [Runtime Load Balancing
10731073
(RLB)](#connectionrlb).
10741074

1075-
This property was added in node-oracledb 2.2.
1075+
This property was added in node-oracledb 2.2. Up until node-oracledb
1076+
4.0 the default value for `events` was *false*.
10761077

10771078
##### Example
10781079

@@ -3693,7 +3694,7 @@ changed in the database by any committed transaction, or when there
36933694
are Advanced Queuing messages to be dequeued.
36943695
36953696
For notification to work, the connection must be created with
3696-
[`events`](#propdbevents) mode *true*.
3697+
[`events`](#propdbevents) mode *true*, which is the default.
36973698
36983699
The database must be able to connect to the node-oracledb machine for
36993700
notifications to be received. Typically this means that the machine
@@ -6803,7 +6804,7 @@ application is not feasible.
68036804

68046805
The `oraaccess.xml` file has other uses including:
68056806

6806-
- Turning on [Fast Application Notification (FAN)](#connectionfan) events to enable FAN notifications and [Runtime Load Balancing (RLB)](#connectionrlb).
6807+
- Changing the value of [Fast Application Notification (FAN)](#connectionfan) events which affects FAN notifications and [Runtime Load Balancing (RLB)](#connectionrlb).
68076808
- Configuring [Client Result Caching][66] parameters
68086809
- Turning on [Client Statement Cache Auto-tuning][67]
68096810

@@ -8346,10 +8347,11 @@ availability and performance tuning. For example the database's
83468347
83478348
#### <a name="connectionfan"></a> 14.9.1 Fast Application Notification (FAN)
83488349
8349-
Users of [Oracle Database FAN][64] should set
8350-
[`oracledb.events`](#propdbevents) to *true*. This can also be
8351-
enabled via [Oracle Client Configuration](#oraaccess). Your
8352-
application must connect to a FAN-enabled database service.
8350+
Users of [Oracle Database FAN][64] must connect to a FAN-enabled
8351+
database service. The application should have
8352+
[`oracledb.events`](#propdbevents) is set to *true*, which is the
8353+
default. This value can also be changed via [Oracle Client
8354+
Configuration](#oraaccess).
83538355
83548356
FAN support is useful for planned and unplanned outages. It provides
83558357
immediate notification to node-oracledb following outages related to
@@ -8382,9 +8384,9 @@ Notification][97].
83828384
83838385
[Oracle Database RAC][93] users with [Oracle Database (RLB)][65]
83848386
advisory events configured should use node-oracledb [Connection
8385-
Pooling](#connpooling) and set [`oracledb.events`](#propdbevents) to
8386-
*true*. The events mode can also be enabled via [Oracle Client
8387-
Configuration](#oraaccess).
8387+
Pooling](#connpooling) and make sure
8388+
[`oracledb.events`](#propdbevents) is *true*. The events mode can
8389+
also be changed via [Oracle Client Configuration](#oraaccess).
83888390
83898391
RLB allows optimal use of database resources by balancing database
83908392
requests across RAC instances.

examples/connectionpool.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async function init() {
4545
password: dbConfig.password,
4646
connectString: dbConfig.connectString
4747
// edition: 'ORA$BASE', // used for Edition Based Redefintion
48-
// events: false, // whether to handle Oracle Database FAN and RLB events or support CQN
48+
// events: true, // whether to handle Oracle Database FAN and RLB events or support CQN
4949
// externalAuth: false, // whether connections should be established using External Authentication
5050
// homogeneous: true, // all connections in the pool have the same credentials
5151
// poolAlias: 'default', // set an alias to allow access to the pool via a name.

examples/cqn2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
const oracledb = require("oracledb");
4141
const dbConfig = require('./dbconfig.js');
4242

43-
dbConfig.events = true; // CQN needs events mode
43+
// dbConfig.events = true; // CQN needs events mode, which is true by default in 4.0
4444

4545
const interval = setInterval(function() {
4646
console.log("waiting...");

examples/webappawait.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function init() {
5656
password: dbConfig.password,
5757
connectString: dbConfig.connectString
5858
// edition: 'ORA$BASE', // used for Edition Based Redefintion
59-
// events: false, // whether to handle Oracle Database FAN and RLB events or support CQN
59+
// events: true, // whether to handle Oracle Database FAN and RLB events or support CQN
6060
// externalAuth: false, // whether connections should be established using External Authentication
6161
// homogeneous: true, // all connections in the pool have the same credentials
6262
// poolAlias: 'default', // set an alias to allow access to the pool via a name.

src/njsOracleDb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,7 @@ bool njsOracleDb_new(napi_env env, napi_value instanceObj,
11161116
oracleDb->fetchArraySize = DPI_DEFAULT_FETCH_ARRAY_SIZE;
11171117
oracleDb->lobPrefetchSize = NJS_LOB_PREFETCH_SIZE;
11181118
oracleDb->poolPingInterval = NJS_POOL_DEFAULT_PING_INTERVAL;
1119+
oracleDb->events = true;
11191120

11201121
// wrap the structure for use by JavaScript
11211122
if (napi_wrap(env, instanceObj, oracleDb, njsOracleDb_finalize, NULL,

test/properties.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,10 @@ describe('58. properties.js', function() {
328328

329329
it('58.1.28 events', function() {
330330
var t = oracledb.events;
331-
oracledb.events = true;
331+
oracledb.events = false;
332332

333-
should.strictEqual(t, false);
334-
should.strictEqual(oracledb.events, true);
333+
should.strictEqual(t, true);
334+
should.strictEqual(oracledb.events, false);
335335
});
336336

337337
it('58.1.29 Negative - events', function() {

0 commit comments

Comments
 (0)