Skip to content

Commit df1b7e7

Browse files
authored
feat: Generate unique names for pool with dataSource & preAggregation… (cube-js#10680)
1 parent 65fb8a8 commit df1b7e7

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

packages/cubejs-hive-driver/src/HiveDriver.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111
} = require('@cubejs-backend/shared');
1212
const jshs2 = require('jshs2');
1313
const SqlString = require('sqlstring');
14-
const { BaseDriver } = require('@cubejs-backend/base-driver');
14+
const { BaseDriver, createPoolName } = require('@cubejs-backend/base-driver');
1515
const Connection = require('jshs2/lib/Connection');
1616
const IDLFactory = require('jshs2/lib/common/IDLFactory');
1717

@@ -82,8 +82,9 @@ class HiveDriver extends BaseDriver {
8282
};
8383

8484
const configuration = new Configuration(this.config);
85-
86-
this.pool = new Pool('hive', {
85+
86+
const poolName = createPoolName('hive', dataSource, preAggregations);
87+
this.pool = new Pool(poolName, {
8788
create: async () => {
8889
const idl = new IDLContainer();
8990
await idl.initialize(configuration);

packages/cubejs-jdbc-driver/src/JDBCDriver.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from '@cubejs-backend/shared';
1313
import {
1414
BaseDriver,
15+
createPoolName,
1516
DownloadQueryResultsOptions,
1617
DownloadQueryResultsResult,
1718
StreamOptions,
@@ -138,7 +139,8 @@ export class JDBCDriver extends BaseDriver {
138139
throw new Error('url is required property');
139140
}
140141

141-
this.pool = new Pool('jdbc', {
142+
const poolName = createPoolName('jdbc', dataSource, preAggregations);
143+
this.pool = new Pool(poolName, {
142144
create: async () => {
143145
await initMvn(await this.getCustomClassPath());
144146

packages/cubejs-mongobi-driver/src/MongoBIDriver.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { createConnection, Connection, ConnectionOptions, RowDataPacket, Field }
1313
import { Readable } from 'stream';
1414
import {
1515
BaseDriver,
16+
createPoolName,
1617
DownloadQueryResultsOptions,
1718
DownloadQueryResultsResult,
1819
DriverInterface,
@@ -100,7 +101,9 @@ export class MongoBIDriver extends BaseDriver implements DriverInterface {
100101
flags: ['-CONNECT_ATTRS'],
101102
...mongoBIDriverConfiguration
102103
};
103-
this.pool = new Pool('mongobi', {
104+
105+
const poolName = createPoolName('mongobi', dataSource, preAggregations);
106+
this.pool = new Pool(poolName, {
104107
create: async () => {
105108
const conn: Connection = createConnection(this.config);
106109

packages/cubejs-mysql-driver/src/MySqlDriver.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
DownloadTableMemoryData,
2424
DriverCapabilities,
2525
TableColumn,
26+
createPoolName,
2627
} from '@cubejs-backend/base-driver';
2728

2829
const GenericTypeToMySql: Record<GenericDataBaseType, string> = {
@@ -144,7 +145,9 @@ export class MySqlDriver extends BaseDriver implements DriverInterface {
144145
readOnly: true,
145146
...restConfig,
146147
};
147-
this.pool = new Pool('mysql', {
148+
149+
const poolName = createPoolName('mysql', dataSource, preAggregations);
150+
this.pool = new Pool(poolName, {
148151
create: async () => {
149152
const conn: any = mysql.createConnection(this.config);
150153
const connect = promisify(conn.connect.bind(conn));

0 commit comments

Comments
 (0)