Skip to content

Commit ba26bb4

Browse files
committed
Merge branch 'release/2.1.1'
2 parents a268e71 + 24bc77b commit ba26bb4

File tree

14 files changed

+191
-97
lines changed

14 files changed

+191
-97
lines changed

.travis.yml

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,43 +39,41 @@ env:
3939

4040
matrix:
4141
allow_failures:
42-
- node_js: "11"
43-
env: DB=build
42+
- node_js: "12"
43+
env: DB=build SKIP_LEAK=1
4444
include:
45-
- node_js: "11"
46-
env: DB=build
47-
- node_js: "6"
48-
env: DB=mariadb:10.4 SKIP_LEAK=1
45+
- node_js: "12"
46+
env: DB=build SKIP_LEAK=1
4947
- node_js: "8"
5048
env: DB=mariadb:10.4
5149
- node_js: "10"
5250
env: DB=mariadb:10.4
53-
- node_js: "11"
54-
env: DB=mariadb:10.4
55-
- node_js: "11"
56-
env: DB=mariadb:10.4 LINT=1
57-
- node_js: "11"
58-
env: DB=mariadb:10.4 BENCH=1
59-
- node_js: "11"
60-
env: DB=mariadb:10.4 MAXSCALE_VERSION=2.2.9 TEST_PORT=4007 TEST_USER=bob TEXT_DATABASE=test2
61-
- node_js: "11"
62-
env: DB=mariadb:5.5
63-
- node_js: "11"
64-
env: DB=mariadb:10.0
65-
- node_js: "11"
66-
env: DB=mariadb:10.1
67-
- node_js: "11"
68-
env: DB=mariadb:10.2
69-
- node_js: "11"
70-
env: DB=mariadb:10.3
71-
- node_js: "11"
72-
env: DB=mysql:5.5
73-
- node_js: "11"
74-
env: DB=mysql:5.6
75-
- node_js: "11"
76-
env: DB=mysql:5.7
77-
- node_js: "11"
78-
env: DB=mysql:8.0
51+
- node_js: "12"
52+
env: DB=mariadb:10.4 SKIP_LEAK=1
53+
- node_js: "12"
54+
env: DB=mariadb:10.4 LINT=1 SKIP_LEAK=1
55+
- node_js: "12"
56+
env: DB=mariadb:10.4 BENCH=1 SKIP_LEAK=1
57+
- node_js: "12"
58+
env: DB=mariadb:10.4 MAXSCALE_VERSION=2.2.9 TEST_PORT=4007 TEST_USER=bob TEXT_DATABASE=test2 SKIP_LEAK=1
59+
- node_js: "12"
60+
env: DB=mariadb:5.5 SKIP_LEAK=1
61+
- node_js: "12"
62+
env: DB=mariadb:10.0 SKIP_LEAK=1
63+
- node_js: "12"
64+
env: DB=mariadb:10.1 SKIP_LEAK=1
65+
- node_js: "12"
66+
env: DB=mariadb:10.2 SKIP_LEAK=1
67+
- node_js: "12"
68+
env: DB=mariadb:10.3 SKIP_LEAK=1
69+
- node_js: "12"
70+
env: DB=mysql:5.5 SKIP_LEAK=1
71+
- node_js: "12"
72+
env: DB=mysql:5.6 SKIP_LEAK=1
73+
- node_js: "12"
74+
env: DB=mysql:5.7 SKIP_LEAK=1
75+
- node_js: "12"
76+
env: DB=mysql:8.0 SKIP_LEAK=1
7977

8078
notifications:
8179
email: false

appveyor.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ environment:
1212
TEST_LOG_PACKETS: true
1313
matrix:
1414

15-
- DB: '10.4.6'
16-
MEM: "21"
17-
nodejs_version: "6"
18-
SKIP_LEAK: "1"
19-
2015
- DB: '10.4.6'
2116
MEM: "21"
2217
nodejs_version: "8"
@@ -27,37 +22,45 @@ environment:
2722

2823
- DB: '10.4.6'
2924
MEM: "21"
30-
nodejs_version: "11"
25+
nodejs_version: "12"
26+
SKIP_LEAK: "1"
3127

3228
- DB: '10.4.6'
33-
nodejs_version: "10"
29+
nodejs_version: "12"
3430
MEM: "21"
3531
TEST_ZIP: 1
32+
SKIP_LEAK: "1"
3633

3734
- DB: '10.4.6'
38-
nodejs_version: "10"
35+
nodejs_version: "12"
3936
MEM: "21"
4037
BENCH: "1"
38+
SKIP_LEAK: "1"
4139

4240
- DB: '10.3.16'
4341
MEM: "21"
44-
nodejs_version: "10"
42+
nodejs_version: "12"
43+
SKIP_LEAK: "1"
4544

4645
- DB: '10.2.25'
4746
MEM: "21"
48-
nodejs_version: "10"
47+
nodejs_version: "12"
48+
SKIP_LEAK: "1"
4949

5050
- DB: '10.1.40'
5151
MEM: "21"
52-
nodejs_version: "10"
52+
nodejs_version: "12"
53+
SKIP_LEAK: "1"
5354

5455
- DB: '10.0.38'
5556
MEM: "21"
56-
nodejs_version: "10"
57+
nodejs_version: "12"
58+
SKIP_LEAK: "1"
5759

5860
- DB: '5.5.64'
5961
MEM: "5"
60-
nodejs_version: "10"
62+
nodejs_version: "12"
63+
SKIP_LEAK: "1"
6164

6265
cache:
6366
- node_modules

benchmarks/benchmarkOne.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const launchBenchs = function(path) {
99

1010
const test = 'bench_promise_select_one_user.js';
1111
const m = require(path + '/' + test);
12-
bench.initFcts.push(m.initFct);
12+
bench.initFcts.push([m.initFct, m.promise]);
1313
bench.add(m.title, m.displaySql, m.benchFct, m.onComplete, m.promise, m.pool); //, bench.CONN.MYSQL);
1414

1515
bench.suiteReady();

benchmarks/benchmarks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const launchBenchs = function(path) {
1313
for (let i = 0; i < list.length; i++) {
1414
console.log('benchmark: ./benchs/' + list[i]);
1515
const m = require('./benchs/' + list[i]);
16-
bench.initFcts.push(m.initFct);
16+
bench.initFcts.push([m.initFct, m.promise]);
1717
bench.add(m.title, m.displaySql, m.benchFct, m.onComplete, m.promise, m.pool);
1818
}
1919
bench.suiteReady();

benchmarks/common_benchmarks.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,11 @@ function Bench() {
197197
console.log('start : init test : ' + bench.initFcts.length);
198198
for (let i = 0; i < bench.initFcts.length; i++) {
199199
console.log('initializing test data ' + (i + 1) + '/' + bench.initFcts.length);
200-
if (bench.initFcts[i]) {
201-
bench.initFcts[i].call(this, bench.CONN.MARIADB.drv);
200+
if (bench.initFcts[i][0]) {
201+
bench.initFcts[i][0].call(
202+
this,
203+
bench.initFcts[i][1] ? bench.CONN.PROMISE_MARIADB.drv : bench.CONN.MARIADB.drv
204+
);
202205
}
203206
}
204207
this.currentNb = 0;

documentation/changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
#### 2.1.1 - 06-09-2019
2+
3+
* node.je v12 CI testing
4+
* cluster ordered selector bug fix on failover (thanks to @kkx)
5+
* bump dependencies
6+
* documentation update with node.js v12 minimum TLSv1.2 default support
7+
* connection.reset() error message improvement (and documentation)
8+
* small performance improvement when debug not enable
9+
110
#### 2.1.0 - 11-07-2019
211

312
* [CONJS-19] implement Ed25519 plugin

documentation/connection-options.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ Hostname/IP doesn't match certificate's altnames: "Host: other.example.com. is n
367367
```
368368
To fix this, correct the `host` value to correspond to the host identified in the certificate.
369369

370-
370+
#### routines:ssl_choose_client_version:unsupported protocol
371+
372+
Since Node.js 12 minimum TLS version is set to 1.2.
373+
MariaDB server can be build with different SSL library, old version supporting only TLS up to 1.1.
374+
The error "1976:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol" can occur if MariaDB SSL implementation doesn't support TLSv1.2.
375+
This can be solved by :
376+
- Server side: update MariaDB to a recent version
377+
- Client side: permit lesser version with "tls.DEFAULT_MIN_VERSION = 'TLSv1.1';" or with connection configuration: using option `ssl: { secureProtocol: 'TLSv1_1_method' }'
371378

372379

lib/connection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ function Connection(options) {
442442
*/
443443
this.debug = val => {
444444
opts.debug = val;
445+
opts.emit('debug', opts.logPackets, opts.debug);
445446
};
446447

447448
this.debugCompress = val => {

lib/io/packet-input-stream.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ class PacketInputStream {
2626
this.parts = null;
2727
this.partsTotalLen = 0;
2828
this.changeEncoding(this.opts.collation);
29+
this.changeDebug(this.opts.logPackets, this.opts.debug);
2930
this.opts.on('collation', this.changeEncoding.bind(this));
31+
this.opts.on('debug', this.changeDebug.bind(this));
3032
}
3133

3234
changeEncoding(collation) {
@@ -36,10 +38,17 @@ class PacketInputStream {
3638
: PacketIconvEncoded;
3739
}
3840

39-
receivePacket(packet) {
41+
changeDebug(logPackets, debug) {
42+
this.logPackets = logPackets;
43+
this.debug = debug;
44+
this.receivePacket =
45+
this.logPackets || this.debug ? this.receivePacketDebug : this.receivePacketBasic;
46+
}
47+
48+
receivePacketDebug(packet) {
4049
let cmd = this.currentCmd();
4150

42-
if (packet && (this.opts.logPackets || this.opts.debug)) {
51+
if (packet) {
4352
const packetStr = Utils.log(this.opts, packet.buf, packet.pos, packet.end, this.header);
4453
if (this.opts.logPackets) {
4554
this.info.addPacket(
@@ -85,6 +94,17 @@ class PacketInputStream {
8594
if (!cmd.onPacketReceive) this.receiveQueue.shift();
8695
}
8796

97+
receivePacketBasic(packet) {
98+
let cmd = this.currentCmd();
99+
if (!cmd) {
100+
this.unexpectedPacket(packet);
101+
return;
102+
}
103+
cmd.sequenceNo = this.header[3];
104+
cmd.onPacketReceive(packet, this.out, this.opts, this.info);
105+
if (!cmd.onPacketReceive) this.receiveQueue.shift();
106+
}
107+
88108
resetHeader() {
89109
this.remainingLen = null;
90110
this.headerLen = 0;

lib/io/packet-output-stream.js

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ class PacketOutputStream {
3030
this.pos = 4;
3131
this.buf = Buffer.allocUnsafe(SMALL_BUFFER_SIZE);
3232
this.changeEncoding(this.opts.collation);
33+
this.changeDebug(this.opts.logPackets, this.opts.debug);
34+
3335
this.opts.on('collation', this.changeEncoding.bind(this));
36+
this.opts.on('debug', this.changeDebug.bind(this));
3437
}
3538

3639
changeEncoding(collation) {
@@ -47,6 +50,13 @@ class PacketOutputStream {
4750
}
4851
}
4952

53+
changeDebug(logPackets, debug) {
54+
this.logPackets = logPackets;
55+
this.debug = debug;
56+
this.flushBuffer =
57+
this.logPackets || this.debug ? this.flushBufferDebug : this.flushBufferBasic;
58+
}
59+
5060
setStream(stream) {
5161
this.stream = stream;
5262
}
@@ -381,39 +391,57 @@ class PacketOutputStream {
381391
/**
382392
* Flush the internal buffer.
383393
*/
384-
flushBuffer(commandEnd, remainingLen) {
394+
flushBufferDebug(commandEnd, remainingLen) {
385395
this.buf[0] = this.pos - 4;
386396
this.buf[1] = (this.pos - 4) >>> 8;
387397
this.buf[2] = (this.pos - 4) >>> 16;
388398
this.buf[3] = ++this.cmd.sequenceNo;
389399

390400
this.stream.writeBuf(this.buf.slice(0, this.pos), this.cmd);
391401

392-
if (this.opts.logPackets || this.opts.debug) {
393-
const packet = Utils.log(this.opts, this.buf, 0, this.pos);
394-
if (this.opts.logPackets) {
395-
this.info.addPacket(
396-
'==> conn:' +
397-
(this.info.threadId ? this.info.threadId : -1) +
398-
' ' +
399-
this.cmd.constructor.name +
400-
'(0,' +
401-
this.pos +
402-
')\n' +
403-
packet
404-
);
405-
}
402+
const packet = Utils.log(this.opts, this.buf, 0, this.pos);
403+
if (this.opts.logPackets) {
404+
this.info.addPacket(
405+
'==> conn:' +
406+
(this.info.threadId ? this.info.threadId : -1) +
407+
' ' +
408+
this.cmd.constructor.name +
409+
'(0,' +
410+
this.pos +
411+
')\n' +
412+
packet
413+
);
414+
}
406415

407-
if (this.opts.debug) {
408-
console.log(
409-
'==> conn:%d %s\n%s',
410-
this.info.threadId ? this.info.threadId : -1,
411-
this.cmd.constructor.name + '(0,' + this.pos + ')',
412-
Utils.log(this.opts, this.buf, 0, this.pos)
413-
);
416+
if (this.opts.debug) {
417+
console.log(
418+
'==> conn:%d %s\n%s',
419+
this.info.threadId ? this.info.threadId : -1,
420+
this.cmd.constructor.name + '(0,' + this.pos + ')',
421+
Utils.log(this.opts, this.buf, 0, this.pos)
422+
);
423+
}
424+
425+
if (commandEnd) {
426+
//if last packet fill the max size, must send an empty com to indicate that command end.
427+
if (this.pos === MAX_BUFFER_SIZE) {
428+
this.writeEmptyPacket();
429+
} else {
430+
this.stream.flush(true, this.cmd);
431+
this.buf = Buffer.allocUnsafe(SMALL_BUFFER_SIZE);
414432
}
433+
} else {
434+
this.buf = allocateBuffer(remainingLen + 4);
435+
this.pos = 4;
415436
}
437+
}
416438

439+
flushBufferBasic(commandEnd, remainingLen) {
440+
this.buf[0] = this.pos - 4;
441+
this.buf[1] = (this.pos - 4) >>> 8;
442+
this.buf[2] = (this.pos - 4) >>> 16;
443+
this.buf[3] = ++this.cmd.sequenceNo;
444+
this.stream.writeBuf(this.buf.slice(0, this.pos), this.cmd);
417445
if (commandEnd) {
418446
//if last packet fill the max size, must send an empty com to indicate that command end.
419447
if (this.pos === MAX_BUFFER_SIZE) {

0 commit comments

Comments
 (0)