Skip to content

Commit 848ebc0

Browse files
committed
Merge branch 'master' into develop
2 parents 5058c83 + a268e71 commit 848ebc0

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

documentation/callback-api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ Specific options for pools are :
229229
| **`minimumIdle`** | Permit to set a minimum number of connection in pool. **Recommendation is to use fixed pool, so not setting this value**.|*integer* | *set to connectionLimit value* |
230230
| **`minDelayValidation`** | When asking a connection to pool, the pool will validate the connection state. "minDelayValidation" permits disabling this validation if the connection has been borrowed recently avoiding useless verifications in case of frequent reuse of connections. 0 means validation is done each time the connection is asked. (in ms) |*integer*| 500|
231231
| **`noControlAfterUse`** | After giving back connection to pool (connection.end) connector will reset or rollback connection to ensure a valid state. This option permit to disable those controls|*boolean*| false|
232+
| **`resetAfterUse`** | When a connection is given back to pool, reset the connection if the server allows it (MariaDB >=10.2.4 / MySQL >= 5.7.3). If disabled or server version doesn't allows reset, pool will only rollback open transaction if any|*boolean*| true|
232233

233234
## Pool events
234235

@@ -565,6 +566,10 @@ reset the connection. Reset will:
565566
* remove temporary tables
566567
* remove all PREPARE statement
567568
569+
This command is only available for MariaDB >=10.2.4 or MySQL >= 5.7.3.
570+
function will be rejected with error "Reset command not permitted for server XXX" if version doesn't permit reset.
571+
572+
For previous MariaDB version, reset connection can be done using [`connection.changeUser(options[, callback])`](#connectionchangeuseroptions-callback) that do the same + redo authentication phase.
568573
569574
## `connection.isValid() → boolean`
570575

documentation/promise-api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ Specific options for pools are :
232232
| **`minimumIdle`** | Permit to set a minimum number of connection in pool. **Recommendation is to use fixed pool, so not setting this value**.|*integer* | *set to connectionLimit value* |
233233
| **`minDelayValidation`** | When asking a connection to pool, the pool will validate the connection state. "minDelayValidation" permits disabling this validation if the connection has been borrowed recently avoiding useless verifications in case of frequent reuse of connections. 0 means validation is done each time the connection is asked. (in ms) |*integer*| 500|
234234
| **`noControlAfterUse`** | After giving back connection to pool (connection.end) connector will reset or rollback connection to ensure a valid state. This option permit to disable those controls|*boolean*| false|
235+
| **`resetAfterUse`** | When a connection is given back to pool, reset the connection if the server allows it (MariaDB >=10.2.4 / MySQL >= 5.7.3). If disabled or server version doesn't allows reset, pool will only rollback open transaction if any|*boolean*| true|
235236

236237
### `createPoolCluster(options) → PoolCluster`
237238

@@ -777,6 +778,10 @@ reset the connection. Reset will:
777778
* remove temporary tables
778779
* remove all PREPARE statement
779780

781+
This command is only available for MariaDB >=10.2.4 or MySQL >= 5.7.3.
782+
function will be rejected with error "Reset command not permitted for server XXX" if version doesn't permit reset.
783+
784+
For previous MariaDB version, reset connection can be done using [`connection.changeUser(options) → Promise`](#connectionchangeuseroptions--promise) that do the same + redo authentication phase.
780785

781786
## `connection.isValid() → boolean`
782787

lib/connection.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ function Connection(options) {
256256
});
257257
}
258258
return Promise.reject(
259-
new Error('Reset command not permitted for server ' + this.info.serverVersion)
259+
new Error(
260+
'Reset command not permitted for server ' +
261+
this.info.serverVersion +
262+
' (requires server MariaDB version 10.2.4+ or MySQL 5.7.3+)'
263+
)
260264
);
261265
};
262266

lib/pool-cluster.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function PoolCluster(args) {
245245
retry < nodeList.length - 1
246246
) {
247247
retry++;
248-
nodeKey = selectorFct(nodeList);
248+
nodeKey = selectorFct(nodeList, retry);
249249
}
250250
return nodeKey;
251251
};

0 commit comments

Comments
 (0)