drizzle-sybase 2.0.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -6
- package/dist/columns/index.d.ts +186 -36
- package/dist/columns/index.d.ts.map +1 -1
- package/dist/columns/index.js +113 -23
- package/dist/columns/index.js.map +1 -1
- package/dist/connection.d.ts +77 -157
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +244 -506
- package/dist/connection.js.map +1 -1
- package/dist/datetime.d.ts +15 -0
- package/dist/datetime.d.ts.map +1 -1
- package/dist/datetime.js +25 -0
- package/dist/datetime.js.map +1 -1
- package/dist/db.d.ts +36 -10
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +15 -25
- package/dist/db.js.map +1 -1
- package/dist/dialect.d.ts +24 -0
- package/dist/dialect.d.ts.map +1 -1
- package/dist/dialect.js +63 -9
- package/dist/dialect.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/introspect/codegen.d.ts +8 -1
- package/dist/introspect/codegen.d.ts.map +1 -1
- package/dist/introspect/codegen.js +117 -29
- package/dist/introspect/codegen.js.map +1 -1
- package/dist/introspect/fetch.d.ts +9 -2
- package/dist/introspect/fetch.d.ts.map +1 -1
- package/dist/introspect/fetch.js +37 -8
- package/dist/introspect/fetch.js.map +1 -1
- package/dist/introspect/index.d.ts +1 -0
- package/dist/introspect/index.d.ts.map +1 -1
- package/dist/introspect/index.js +8 -5
- package/dist/introspect/index.js.map +1 -1
- package/dist/introspect/type-map.d.ts +17 -8
- package/dist/introspect/type-map.d.ts.map +1 -1
- package/dist/introspect/type-map.js +28 -9
- package/dist/introspect/type-map.js.map +1 -1
- package/dist/native/index.d.ts +4 -1
- package/dist/native/index.d.ts.map +1 -1
- package/dist/native/index.js.map +1 -1
- package/dist/native/sybase_native.darwin-arm64.node +0 -0
- package/dist/native/sybase_native.darwin-x64.node +0 -0
- package/dist/native/sybase_native.linux-arm64.node +0 -0
- package/dist/native/sybase_native.linux-x64.node +0 -0
- package/dist/native/sybase_native.win32-x64.node +0 -0
- package/dist/pool.d.ts +197 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/pool.js +638 -0
- package/dist/pool.js.map +1 -0
- package/dist/query-builders/delete.d.ts +6 -4
- package/dist/query-builders/delete.d.ts.map +1 -1
- package/dist/query-builders/delete.js +4 -4
- package/dist/query-builders/delete.js.map +1 -1
- package/dist/query-builders/index.d.ts +1 -1
- package/dist/query-builders/index.d.ts.map +1 -1
- package/dist/query-builders/index.js.map +1 -1
- package/dist/query-builders/insert.d.ts +28 -4
- package/dist/query-builders/insert.d.ts.map +1 -1
- package/dist/query-builders/insert.js +8 -5
- package/dist/query-builders/insert.js.map +1 -1
- package/dist/query-builders/select-types.d.ts +132 -0
- package/dist/query-builders/select-types.d.ts.map +1 -0
- package/dist/query-builders/select-types.js +2 -0
- package/dist/query-builders/select-types.js.map +1 -0
- package/dist/query-builders/select.d.ts +54 -34
- package/dist/query-builders/select.d.ts.map +1 -1
- package/dist/query-builders/select.js +99 -92
- package/dist/query-builders/select.js.map +1 -1
- package/dist/query-builders/update.d.ts +7 -5
- package/dist/query-builders/update.d.ts.map +1 -1
- package/dist/query-builders/update.js +4 -4
- package/dist/query-builders/update.js.map +1 -1
- package/dist/session.d.ts +141 -14
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +456 -40
- package/dist/session.js.map +1 -1
- package/dist/sql-classify.d.ts +70 -0
- package/dist/sql-classify.d.ts.map +1 -0
- package/dist/sql-classify.js +189 -0
- package/dist/sql-classify.js.map +1 -0
- package/dist/table.d.ts +85 -3
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +8 -2
- package/dist/table.js.map +1 -1
- package/package.json +9 -8
- package/scripts/clean.ts +4 -3
- package/src/native/binding.c +463 -62
package/dist/pool.js
ADDED
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sybase connection pool: sizing, health checks, idle cleanup, acquire
|
|
3
|
+
* deadlines, retries, graceful drain, metrics, query logging — and the
|
|
4
|
+
* guarantee that a connection returns to the pool in its baseline session
|
|
5
|
+
* state.
|
|
6
|
+
*/
|
|
7
|
+
import { checkInteger, emitQueryLog, MAX_INT32, SybaseConnection, validateConnectionConfig, validateQueryOptions } from "./connection.js";
|
|
8
|
+
import { SybaseError, SybaseConnectionError, SybaseTimeoutError, SybasePoolError } from "./errors.js";
|
|
9
|
+
import { isReadOnlySql, mayChangeIdentity, mayCreateTempTable, mayLeaveSessionState } from "./sql-classify.js";
|
|
10
|
+
/**
|
|
11
|
+
* Production-grade connection pool for Sybase ASE.
|
|
12
|
+
*
|
|
13
|
+
* Features:
|
|
14
|
+
* - max pool sizing with automatic scaling
|
|
15
|
+
* - Health checks (dead connection detection + optional ping)
|
|
16
|
+
* - Idle connection cleanup
|
|
17
|
+
* - Acquire timeout with fair queuing
|
|
18
|
+
* - Retry on transient connection failures
|
|
19
|
+
* - Graceful drain/shutdown
|
|
20
|
+
* - Observable metrics for monitoring
|
|
21
|
+
* - Query logging middleware
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const pool = new SybasePool({
|
|
26
|
+
* host: "sybase-host",
|
|
27
|
+
* port: 5000,
|
|
28
|
+
* database: "mydb",
|
|
29
|
+
* username: "sa",
|
|
30
|
+
* password: "secret",
|
|
31
|
+
* max: 10,
|
|
32
|
+
* logger: { query(log) { console.log(`[${log.durationMs}ms] ${log.sql}`); } }
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* const result = await pool.query("SELECT 1 AS val");
|
|
36
|
+
* console.log(pool.metrics);
|
|
37
|
+
* await pool.drain();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export class SybasePool {
|
|
41
|
+
pool = [];
|
|
42
|
+
waitQueue = [];
|
|
43
|
+
closed = false;
|
|
44
|
+
draining = false;
|
|
45
|
+
cleanupTimer = null;
|
|
46
|
+
cfg;
|
|
47
|
+
// Metrics tracking
|
|
48
|
+
_totalConnectionsCreated = 0;
|
|
49
|
+
_totalConnectionsDestroyed = 0;
|
|
50
|
+
_totalQueriesExecuted = 0;
|
|
51
|
+
_totalQueryErrors = 0;
|
|
52
|
+
_totalAcquireTimeouts = 0;
|
|
53
|
+
_queryDurationSum = 0;
|
|
54
|
+
_queryDurationCount = 0;
|
|
55
|
+
_activeCount = 0;
|
|
56
|
+
/** Number of connections currently being created (prevents exceeding max). */
|
|
57
|
+
_pendingCreates = 0;
|
|
58
|
+
constructor(config) {
|
|
59
|
+
const max = config.max ?? 5;
|
|
60
|
+
if (!(Number.isInteger(max) && max >= 1)) {
|
|
61
|
+
throw new SybasePoolError(`Pool max must be at least 1, got ${String(max)}`, "closed");
|
|
62
|
+
}
|
|
63
|
+
// Before the cleanup timer is started, so a bad option cannot leave a
|
|
64
|
+
// half-built pool behind.
|
|
65
|
+
validateConnectionConfig(config);
|
|
66
|
+
checkInteger("idleTimeoutMs", config.idleTimeoutMs, 1, MAX_INT32);
|
|
67
|
+
checkInteger("acquireTimeoutMs", config.acquireTimeoutMs, 1, MAX_INT32);
|
|
68
|
+
checkInteger("cleanupIntervalMs", config.cleanupIntervalMs, 1, MAX_INT32);
|
|
69
|
+
checkInteger("retries", config.retries, 0, 100);
|
|
70
|
+
checkInteger("retryDelayMs", config.retryDelayMs, 0, MAX_INT32);
|
|
71
|
+
this.cfg = {
|
|
72
|
+
...config,
|
|
73
|
+
timeout: config.timeout ?? 30,
|
|
74
|
+
max,
|
|
75
|
+
idleTimeoutMs: config.idleTimeoutMs ?? 60000,
|
|
76
|
+
acquireTimeoutMs: config.acquireTimeoutMs ?? 10000,
|
|
77
|
+
cleanupIntervalMs: config.cleanupIntervalMs ?? 30000,
|
|
78
|
+
healthCheck: config.healthCheck ?? false,
|
|
79
|
+
retries: config.retries ?? 2,
|
|
80
|
+
retryDelayMs: config.retryDelayMs ?? 500,
|
|
81
|
+
logger: config.logger
|
|
82
|
+
};
|
|
83
|
+
// Start idle cleanup timer
|
|
84
|
+
this.cleanupTimer = setInterval(() => {
|
|
85
|
+
this.cleanupIdle();
|
|
86
|
+
}, this.cfg.cleanupIntervalMs);
|
|
87
|
+
// Unref so it doesn't keep the process alive
|
|
88
|
+
if (this.cleanupTimer && typeof this.cleanupTimer.unref === "function") {
|
|
89
|
+
this.cleanupTimer.unref();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Acquire a connection from the pool.
|
|
94
|
+
* - Validates existing connections (health check)
|
|
95
|
+
* - Creates new connections up to `max`
|
|
96
|
+
* - Queues if pool is full
|
|
97
|
+
*
|
|
98
|
+
* `acquireTimeoutMs` bounds the whole call — waiting in the queue, but also
|
|
99
|
+
* opening a connection and the health check. A connection that arrives after
|
|
100
|
+
* the caller gave up goes back to the pool.
|
|
101
|
+
*/
|
|
102
|
+
async acquire() {
|
|
103
|
+
if (this.closed || this.draining) {
|
|
104
|
+
throw this.unavailableError();
|
|
105
|
+
}
|
|
106
|
+
const timeoutMs = this.cfg.acquireTimeoutMs;
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
let settled = false;
|
|
109
|
+
let queued;
|
|
110
|
+
const timer = setTimeout(() => {
|
|
111
|
+
if (settled) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
settled = true;
|
|
115
|
+
if (queued) {
|
|
116
|
+
const idx = this.waitQueue.indexOf(queued);
|
|
117
|
+
if (idx !== -1) {
|
|
118
|
+
this.waitQueue.splice(idx, 1);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
this._totalAcquireTimeouts++;
|
|
122
|
+
reject(new SybaseTimeoutError(`Connection acquire timeout after ${timeoutMs}ms`, "acquire", timeoutMs));
|
|
123
|
+
}, timeoutMs);
|
|
124
|
+
this.claim(waiter => {
|
|
125
|
+
queued = waiter;
|
|
126
|
+
}).then(conn => {
|
|
127
|
+
clearTimeout(timer);
|
|
128
|
+
if (settled) {
|
|
129
|
+
this.release(conn);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
settled = true;
|
|
133
|
+
resolve(conn);
|
|
134
|
+
}, (err) => {
|
|
135
|
+
clearTimeout(timer);
|
|
136
|
+
if (!settled) {
|
|
137
|
+
settled = true;
|
|
138
|
+
reject(err);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/** Get a connection by any means, without a deadline; see {@link acquire}. */
|
|
144
|
+
async claim(onQueued) {
|
|
145
|
+
if (this.closed || this.draining) {
|
|
146
|
+
throw this.unavailableError();
|
|
147
|
+
}
|
|
148
|
+
// Try to find an idle, healthy connection
|
|
149
|
+
for (let i = 0; i < this.pool.length; i++) {
|
|
150
|
+
const pooled = this.pool[i];
|
|
151
|
+
if (!pooled.inUse) {
|
|
152
|
+
// Check if connection is still alive
|
|
153
|
+
if (!pooled.conn.isConnected) {
|
|
154
|
+
// Dead connection — remove and continue
|
|
155
|
+
this.removeFromPool(i);
|
|
156
|
+
i--;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
// Claim before the health check: it awaits, and a concurrent acquire()
|
|
160
|
+
// must not hand out the same connection in the meantime.
|
|
161
|
+
pooled.inUse = true;
|
|
162
|
+
pooled.lastUsed = Date.now();
|
|
163
|
+
this._activeCount++;
|
|
164
|
+
// Optional health check (lightweight query)
|
|
165
|
+
if (this.cfg.healthCheck) {
|
|
166
|
+
try {
|
|
167
|
+
await pooled.conn.query("SELECT 1");
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
// Health check failed — the pool may have changed during the await
|
|
171
|
+
// (or been closed), so locate the entry again rather than trusting `i`.
|
|
172
|
+
const idx = this.pool.indexOf(pooled);
|
|
173
|
+
if (idx !== -1) {
|
|
174
|
+
this._activeCount--;
|
|
175
|
+
this.removeFromPool(idx);
|
|
176
|
+
this.checkDrainComplete();
|
|
177
|
+
}
|
|
178
|
+
return this.claim(onQueued);
|
|
179
|
+
}
|
|
180
|
+
// The pool may have been closed or started draining during the
|
|
181
|
+
// check. close() has already closed the connection; under drain,
|
|
182
|
+
// hand it back so the drain can complete.
|
|
183
|
+
if (this.closed || this.draining) {
|
|
184
|
+
this.release(pooled.conn);
|
|
185
|
+
throw this.unavailableError();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return pooled.conn;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Can we create a new connection?
|
|
192
|
+
if (this.pool.length + this._pendingCreates < this.cfg.max) {
|
|
193
|
+
this._pendingCreates++;
|
|
194
|
+
let conn;
|
|
195
|
+
try {
|
|
196
|
+
conn = await this.createConnection();
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
this._pendingCreates--;
|
|
200
|
+
// The slot this attempt held is free again: give a queued caller its
|
|
201
|
+
// own attempt now rather than leave it waiting out its timeout.
|
|
202
|
+
void this.serveWaiter();
|
|
203
|
+
throw err;
|
|
204
|
+
}
|
|
205
|
+
this._pendingCreates--;
|
|
206
|
+
// Re-check after async gap: the pool may have been closed or started
|
|
207
|
+
// draining, and nothing would ever close a connection added now.
|
|
208
|
+
if (this.closed || this.draining) {
|
|
209
|
+
conn.close();
|
|
210
|
+
this._totalConnectionsDestroyed++;
|
|
211
|
+
throw this.unavailableError();
|
|
212
|
+
}
|
|
213
|
+
// Another acquire may have filled the pool
|
|
214
|
+
if (this.pool.length >= this.cfg.max) {
|
|
215
|
+
// Pool is full now — close the extra connection
|
|
216
|
+
conn.close();
|
|
217
|
+
this._totalConnectionsDestroyed++;
|
|
218
|
+
// Fall through to wait queue below
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
const pooled = {
|
|
222
|
+
conn,
|
|
223
|
+
lastUsed: Date.now(),
|
|
224
|
+
createdAt: Date.now(),
|
|
225
|
+
inUse: true
|
|
226
|
+
};
|
|
227
|
+
this._activeCount++;
|
|
228
|
+
this.pool.push(pooled);
|
|
229
|
+
return conn;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// Pool full — wait for one to become available. acquire() owns the
|
|
233
|
+
// deadline and takes the waiter out of the queue if it passes.
|
|
234
|
+
return new Promise((resolve, reject) => {
|
|
235
|
+
const waiter = { resolve, reject };
|
|
236
|
+
this.waitQueue.push(waiter);
|
|
237
|
+
onQueued(waiter);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Release a connection back to the pool.
|
|
242
|
+
*/
|
|
243
|
+
release(conn) {
|
|
244
|
+
const pooled = this.pool.find(p => p.conn === conn);
|
|
245
|
+
if (!pooled || !pooled.inUse) {
|
|
246
|
+
// Already released or not in pool — ignore
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
pooled.inUse = false;
|
|
250
|
+
pooled.lastUsed = Date.now();
|
|
251
|
+
this._activeCount--;
|
|
252
|
+
// Session state is reset by query() before release, never here: an async
|
|
253
|
+
// reset could run concurrently with the next user's query.
|
|
254
|
+
// If connection died during use, remove it
|
|
255
|
+
if (!conn.isConnected) {
|
|
256
|
+
const idx = this.pool.indexOf(pooled);
|
|
257
|
+
if (idx !== -1) {
|
|
258
|
+
this.pool.splice(idx, 1);
|
|
259
|
+
conn.close();
|
|
260
|
+
this._totalConnectionsDestroyed++;
|
|
261
|
+
}
|
|
262
|
+
// Try to serve a waiter with a new connection (only if not draining)
|
|
263
|
+
if (this.draining) {
|
|
264
|
+
this.checkDrainComplete();
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
void this.serveWaiter();
|
|
268
|
+
}
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
// If draining and no in-use connections, we're done
|
|
272
|
+
if (this.draining) {
|
|
273
|
+
this.checkDrainComplete();
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
// If someone is waiting, give them this connection
|
|
277
|
+
if (this.waitQueue.length > 0) {
|
|
278
|
+
const waiter = this.waitQueue.shift();
|
|
279
|
+
pooled.inUse = true;
|
|
280
|
+
pooled.lastUsed = Date.now();
|
|
281
|
+
this._activeCount++;
|
|
282
|
+
waiter.resolve(conn);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Execute a query using a pooled connection (auto acquire/release).
|
|
287
|
+
*
|
|
288
|
+
* Read-only statements are retried on transient connection failures. Anything
|
|
289
|
+
* else is not: a connection that dies mid-statement may already have applied
|
|
290
|
+
* it on the server, so re-running it could repeat a write.
|
|
291
|
+
*/
|
|
292
|
+
async query(sql, options) {
|
|
293
|
+
// Classified only when a retry is actually possible: scanning every
|
|
294
|
+
// statement up front would cost a full pass over large batches on the
|
|
295
|
+
// common path, where nothing fails.
|
|
296
|
+
let readOnly;
|
|
297
|
+
validateQueryOptions(options);
|
|
298
|
+
for (let attempt = 0;; attempt++) {
|
|
299
|
+
let conn;
|
|
300
|
+
try {
|
|
301
|
+
conn = await this.acquire();
|
|
302
|
+
}
|
|
303
|
+
catch (err) {
|
|
304
|
+
// Nothing reached the server, so even a write is safe to try again.
|
|
305
|
+
if (err instanceof SybaseConnectionError && attempt < this.cfg.retries) {
|
|
306
|
+
await this.delay(this.cfg.retryDelayMs);
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
throw err;
|
|
310
|
+
}
|
|
311
|
+
const startTime = Date.now();
|
|
312
|
+
/** Set when the statement succeeded but left the session in a state that had to be undone. */
|
|
313
|
+
let stateError;
|
|
314
|
+
try {
|
|
315
|
+
const result = await conn.query(sql, options);
|
|
316
|
+
const durationMs = Date.now() - startTime;
|
|
317
|
+
this._totalQueriesExecuted++;
|
|
318
|
+
this._queryDurationSum += durationMs;
|
|
319
|
+
this._queryDurationCount++;
|
|
320
|
+
emitQueryLog(this.cfg.logger, {
|
|
321
|
+
sql,
|
|
322
|
+
durationMs,
|
|
323
|
+
rowCount: result.rowCount,
|
|
324
|
+
timestamp: new Date(startTime)
|
|
325
|
+
});
|
|
326
|
+
// Each pool query may land on a different connection, so a
|
|
327
|
+
// transaction opened here can never be committed by a later one; left
|
|
328
|
+
// open it would hold its locks and swallow the next user's writes.
|
|
329
|
+
const leftOpen = mayLeaveSessionState(sql) ? await this.resetOrDiscard(conn) : false;
|
|
330
|
+
// After the reset: a drop inside a transaction it rolls back would be undone.
|
|
331
|
+
await this.dropTempTablesOrDiscard(conn, sql);
|
|
332
|
+
this.discardIfIdentityChanged(conn, sql);
|
|
333
|
+
if (leftOpen === false) {
|
|
334
|
+
return result;
|
|
335
|
+
}
|
|
336
|
+
stateError = new SybaseError(leftOpen
|
|
337
|
+
? "The statement left a transaction open (or enabled chained mode); it was rolled " +
|
|
338
|
+
"back. Use db.transaction() for multi-statement transactions."
|
|
339
|
+
: "The statement succeeded, but the session state could not be verified afterwards; " +
|
|
340
|
+
"the connection was discarded, rolling back any transaction it left open.");
|
|
341
|
+
}
|
|
342
|
+
catch (err) {
|
|
343
|
+
this._totalQueryErrors++;
|
|
344
|
+
emitQueryLog(this.cfg.logger, {
|
|
345
|
+
sql,
|
|
346
|
+
durationMs: Date.now() - startTime,
|
|
347
|
+
rowCount: 0,
|
|
348
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
349
|
+
timestamp: new Date(startTime)
|
|
350
|
+
});
|
|
351
|
+
// A failed raw batch can skip its trailing `SET ROWCOUNT 0`, and a
|
|
352
|
+
// raw batch that opened a transaction and then failed may have left it
|
|
353
|
+
// open, holding its locks.
|
|
354
|
+
await this.resetOrDiscard(conn);
|
|
355
|
+
await this.dropTempTablesOrDiscard(conn, sql);
|
|
356
|
+
this.discardIfIdentityChanged(conn, sql);
|
|
357
|
+
if (!(err instanceof SybaseConnectionError) ||
|
|
358
|
+
attempt >= this.cfg.retries ||
|
|
359
|
+
!(readOnly ??= isReadOnlySql(sql))) {
|
|
360
|
+
throw err;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
finally {
|
|
364
|
+
this.release(conn);
|
|
365
|
+
}
|
|
366
|
+
if (stateError) {
|
|
367
|
+
throw stateError;
|
|
368
|
+
}
|
|
369
|
+
// Transient failure on a read-only statement — retry after delay
|
|
370
|
+
await this.delay(this.cfg.retryDelayMs);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Drop the `#temp` tables a pool query may have created (see
|
|
375
|
+
* {@link SybaseConnection.dropTempTables}): the next query may land on
|
|
376
|
+
* another connection, so they cannot be used again, and the next user of
|
|
377
|
+
* this one must not find them. If that fails the connection is discarded.
|
|
378
|
+
*/
|
|
379
|
+
async dropTempTablesOrDiscard(conn, sql) {
|
|
380
|
+
if (!mayCreateTempTable(sql) || !conn.isConnected) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
try {
|
|
384
|
+
await conn.dropTempTables();
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
conn.close();
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Discard a connection that may have run `setuser`: its identity cannot be
|
|
392
|
+
* restored to a known baseline (see {@link mayChangeIdentity}), so release()
|
|
393
|
+
* must not hand it to the next user.
|
|
394
|
+
*/
|
|
395
|
+
discardIfIdentityChanged(conn, sql) {
|
|
396
|
+
if (mayChangeIdentity(sql)) {
|
|
397
|
+
conn.close();
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Bring a connection back to its baseline session state before it returns
|
|
402
|
+
* to the pool (see {@link SybaseConnection.resetSessionState}).
|
|
403
|
+
*
|
|
404
|
+
* Resolves to whether a transaction was left open, or `undefined` when the
|
|
405
|
+
* state could not be established — the connection is then closed so that
|
|
406
|
+
* release() discards it.
|
|
407
|
+
*/
|
|
408
|
+
async resetOrDiscard(conn) {
|
|
409
|
+
if (!conn.isConnected) {
|
|
410
|
+
return undefined;
|
|
411
|
+
}
|
|
412
|
+
try {
|
|
413
|
+
return (await conn.resetSessionState()).leftOpen;
|
|
414
|
+
}
|
|
415
|
+
catch {
|
|
416
|
+
conn.close();
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Gracefully drain the pool — finish all in-flight operations, then close.
|
|
422
|
+
*
|
|
423
|
+
* New acquire() calls will be rejected immediately.
|
|
424
|
+
* Returns a promise that resolves when all active connections are released.
|
|
425
|
+
*
|
|
426
|
+
* @param timeoutMs - Maximum time to wait for drain. Default: 30000ms
|
|
427
|
+
*/
|
|
428
|
+
async drain(timeoutMs = 30000) {
|
|
429
|
+
if (this.closed) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
// Concurrent callers share one drain; a second timer or callback would
|
|
433
|
+
// leave the first caller waiting.
|
|
434
|
+
if (this.drainPromise) {
|
|
435
|
+
return this.drainPromise;
|
|
436
|
+
}
|
|
437
|
+
this.draining = true;
|
|
438
|
+
// Reject all waiters immediately
|
|
439
|
+
for (const waiter of this.waitQueue) {
|
|
440
|
+
waiter.reject(new SybasePoolError("Pool is draining", "draining"));
|
|
441
|
+
}
|
|
442
|
+
this.waitQueue = [];
|
|
443
|
+
// Settled by close(), whichever path triggers it: the last release, the
|
|
444
|
+
// timeout, or a direct close() call.
|
|
445
|
+
this.drainPromise = new Promise(resolve => {
|
|
446
|
+
const timer = setTimeout(() => {
|
|
447
|
+
// Force close after timeout
|
|
448
|
+
void this.close();
|
|
449
|
+
}, timeoutMs);
|
|
450
|
+
if (typeof timer.unref === "function") {
|
|
451
|
+
timer.unref();
|
|
452
|
+
}
|
|
453
|
+
this.settleDrain = () => {
|
|
454
|
+
clearTimeout(timer);
|
|
455
|
+
resolve();
|
|
456
|
+
};
|
|
457
|
+
});
|
|
458
|
+
// No active connections — close immediately
|
|
459
|
+
this.checkDrainComplete();
|
|
460
|
+
return this.drainPromise;
|
|
461
|
+
}
|
|
462
|
+
drainPromise = null;
|
|
463
|
+
settleDrain;
|
|
464
|
+
checkDrainComplete() {
|
|
465
|
+
if (this.draining && this.active === 0) {
|
|
466
|
+
void this.close();
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Close all connections and shut down the pool.
|
|
471
|
+
*/
|
|
472
|
+
async close() {
|
|
473
|
+
this.closed = true;
|
|
474
|
+
this.draining = false;
|
|
475
|
+
// Stop cleanup timer
|
|
476
|
+
if (this.cleanupTimer) {
|
|
477
|
+
clearInterval(this.cleanupTimer);
|
|
478
|
+
this.cleanupTimer = null;
|
|
479
|
+
}
|
|
480
|
+
// Reject all waiters
|
|
481
|
+
for (const waiter of this.waitQueue) {
|
|
482
|
+
waiter.reject(new SybasePoolError("Pool is closing", "closed"));
|
|
483
|
+
}
|
|
484
|
+
this.waitQueue = [];
|
|
485
|
+
// Close all connections
|
|
486
|
+
for (const pooled of this.pool) {
|
|
487
|
+
pooled.conn.close();
|
|
488
|
+
this._totalConnectionsDestroyed++;
|
|
489
|
+
}
|
|
490
|
+
this.pool = [];
|
|
491
|
+
this._activeCount = 0;
|
|
492
|
+
// Settle a pending drain() — the pool it was waiting on is now closed.
|
|
493
|
+
const settle = this.settleDrain;
|
|
494
|
+
this.settleDrain = undefined;
|
|
495
|
+
this.drainPromise = null;
|
|
496
|
+
settle?.();
|
|
497
|
+
}
|
|
498
|
+
// ---------------------------------------------------------------------------
|
|
499
|
+
// Pool state accessors
|
|
500
|
+
// ---------------------------------------------------------------------------
|
|
501
|
+
/** Number of total connections in the pool. */
|
|
502
|
+
get size() {
|
|
503
|
+
return this.pool.length;
|
|
504
|
+
}
|
|
505
|
+
/** Number of idle (available) connections. */
|
|
506
|
+
get idle() {
|
|
507
|
+
return this.pool.length - this._activeCount;
|
|
508
|
+
}
|
|
509
|
+
/** Number of active (in-use) connections. */
|
|
510
|
+
get active() {
|
|
511
|
+
return this._activeCount;
|
|
512
|
+
}
|
|
513
|
+
/** Number of waiters in queue. */
|
|
514
|
+
get waiting() {
|
|
515
|
+
return this.waitQueue.length;
|
|
516
|
+
}
|
|
517
|
+
/** Whether the pool is currently draining. */
|
|
518
|
+
get isDraining() {
|
|
519
|
+
return this.draining;
|
|
520
|
+
}
|
|
521
|
+
/** Whether the pool is closed. */
|
|
522
|
+
get isClosed() {
|
|
523
|
+
return this.closed;
|
|
524
|
+
}
|
|
525
|
+
/** @internal Get the configured logger (if any). */
|
|
526
|
+
get logger() {
|
|
527
|
+
return this.cfg.logger;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Get a snapshot of pool metrics for monitoring/observability.
|
|
531
|
+
*/
|
|
532
|
+
get metrics() {
|
|
533
|
+
return {
|
|
534
|
+
totalConnectionsCreated: this._totalConnectionsCreated,
|
|
535
|
+
totalConnectionsDestroyed: this._totalConnectionsDestroyed,
|
|
536
|
+
totalQueriesExecuted: this._totalQueriesExecuted,
|
|
537
|
+
totalQueryErrors: this._totalQueryErrors,
|
|
538
|
+
totalAcquireTimeouts: this._totalAcquireTimeouts,
|
|
539
|
+
avgQueryDurationMs: this._queryDurationCount > 0
|
|
540
|
+
? Math.round(this._queryDurationSum / this._queryDurationCount)
|
|
541
|
+
: 0,
|
|
542
|
+
currentSize: this.size,
|
|
543
|
+
currentActive: this.active,
|
|
544
|
+
currentIdle: this.idle,
|
|
545
|
+
currentWaiting: this.waiting
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
// ---------------------------------------------------------------------------
|
|
549
|
+
// Private
|
|
550
|
+
// ---------------------------------------------------------------------------
|
|
551
|
+
async createConnection() {
|
|
552
|
+
const conn = new SybaseConnection(this.cfg);
|
|
553
|
+
await conn.connect();
|
|
554
|
+
this._totalConnectionsCreated++;
|
|
555
|
+
return conn;
|
|
556
|
+
}
|
|
557
|
+
removeFromPool(index) {
|
|
558
|
+
const removed = this.pool.splice(index, 1)[0];
|
|
559
|
+
if (removed) {
|
|
560
|
+
removed.conn.close();
|
|
561
|
+
this._totalConnectionsDestroyed++;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
unavailableError() {
|
|
565
|
+
return this.closed
|
|
566
|
+
? new SybasePoolError("Pool is closed", "closed")
|
|
567
|
+
: new SybasePoolError("Pool is draining — no new connections allowed", "draining");
|
|
568
|
+
}
|
|
569
|
+
async serveWaiter() {
|
|
570
|
+
if (this.waitQueue.length === 0 ||
|
|
571
|
+
this.closed ||
|
|
572
|
+
this.draining ||
|
|
573
|
+
this.pool.length + this._pendingCreates >= this.cfg.max) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
this._pendingCreates++;
|
|
577
|
+
try {
|
|
578
|
+
const conn = await this.createConnection();
|
|
579
|
+
this._pendingCreates--;
|
|
580
|
+
// close()/drain() rejected every waiter during the await; a connection
|
|
581
|
+
// added now would never be closed.
|
|
582
|
+
if (this.closed || this.draining) {
|
|
583
|
+
conn.close();
|
|
584
|
+
this._totalConnectionsDestroyed++;
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
const pooled = {
|
|
588
|
+
conn,
|
|
589
|
+
lastUsed: Date.now(),
|
|
590
|
+
createdAt: Date.now(),
|
|
591
|
+
inUse: true
|
|
592
|
+
};
|
|
593
|
+
this._activeCount++;
|
|
594
|
+
this.pool.push(pooled);
|
|
595
|
+
// Re-check queue after async operation — waiter may have timed out
|
|
596
|
+
const waiter = this.waitQueue.shift();
|
|
597
|
+
if (waiter) {
|
|
598
|
+
waiter.resolve(conn);
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
// No waiter left — release the connection back to idle
|
|
602
|
+
pooled.inUse = false;
|
|
603
|
+
this._activeCount--;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
catch (err) {
|
|
607
|
+
this._pendingCreates--;
|
|
608
|
+
// Can't create connection — reject the first waiter if any
|
|
609
|
+
const waiter = this.waitQueue.shift();
|
|
610
|
+
if (waiter) {
|
|
611
|
+
waiter.reject(err instanceof Error ? err : new SybaseError(String(err)));
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Remove idle connections that have exceeded the idle timeout.
|
|
617
|
+
*/
|
|
618
|
+
cleanupIdle() {
|
|
619
|
+
const now = Date.now();
|
|
620
|
+
let i = 0;
|
|
621
|
+
while (i < this.pool.length) {
|
|
622
|
+
const pooled = this.pool[i];
|
|
623
|
+
const isIdle = !pooled.inUse;
|
|
624
|
+
const isExpired = now - pooled.lastUsed > this.cfg.idleTimeoutMs;
|
|
625
|
+
if (isIdle && isExpired) {
|
|
626
|
+
this.removeFromPool(i);
|
|
627
|
+
// Don't increment i — the array shifted
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
i++;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
delay(ms) {
|
|
635
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
//# sourceMappingURL=pool.js.map
|
package/dist/pool.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool.js","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAyE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,UAAU;IACb,IAAI,GAAuB,EAAE,CAAC;IAC9B,SAAS,GAAa,EAAE,CAAC;IACzB,MAAM,GAAG,KAAK,CAAC;IACf,QAAQ,GAAG,KAAK,CAAC;IACjB,YAAY,GAA0C,IAAI,CAAC;IAClD,GAAG,C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