fdb2 1.0.41 → 1.0.42
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 +10 -0
- package/dist/public/.vite/manifest.json +11 -9
- package/dist/public/database-monitor.css +109 -86
- package/dist/public/database-monitor.js +153 -33
- package/dist/public/database.js +41 -2
- package/dist/public/explorer.css +303 -252
- package/dist/public/explorer.js +633 -412
- package/dist/public/export.js +7 -7
- package/dist/public/index.js +101 -8
- package/dist/public/layout.js +1 -1
- package/dist/public/{theme.js → modal.js} +88 -2
- package/dist/public/sql-query-editor.css +82 -82
- package/dist/public/sql-query-editor.js +64 -47
- package/dist/scripts/verify-db-support.cjs +93 -7
- package/dist/server/__tests__/excel-export.test.ts +136 -0
- package/dist/server/__tests__/export-progress.test.ts +80 -0
- package/dist/server/__tests__/health-check.test.ts +67 -0
- package/dist/server/__tests__/query-metrics.test.ts +96 -0
- package/dist/server/__tests__/remote-proxy.test.ts +14 -0
- package/dist/server/__tests__/sql-safety.test.ts +36 -0
- package/dist/server/core/dialect.d.ts +3 -0
- package/dist/server/core/dialect.d.ts.map +1 -1
- package/dist/server/core/dialect.js +17 -0
- package/dist/server/core/dialect.js.map +1 -1
- package/dist/server/core/dialect.ts +20 -0
- package/dist/server/core/query-metrics.d.ts +33 -0
- package/dist/server/core/query-metrics.d.ts.map +1 -0
- package/dist/server/core/query-metrics.js +117 -0
- package/dist/server/core/query-metrics.js.map +1 -0
- package/dist/server/core/query-metrics.ts +137 -0
- package/dist/server/core/sql-safety.d.ts +9 -0
- package/dist/server/core/sql-safety.d.ts.map +1 -0
- package/dist/server/core/sql-safety.js +74 -0
- package/dist/server/core/sql-safety.js.map +1 -0
- package/dist/server/core/sql-safety.ts +72 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +211 -17
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.ts +217 -17
- package/dist/server/service/database/base.service.d.ts +15 -0
- package/dist/server/service/database/base.service.d.ts.map +1 -1
- package/dist/server/service/database/base.service.js +108 -0
- package/dist/server/service/database/base.service.js.map +1 -1
- package/dist/server/service/database/base.service.ts +99 -6
- package/dist/server/service/database/clickhouse.service.d.ts.map +1 -1
- package/dist/server/service/database/clickhouse.service.js +9 -35
- package/dist/server/service/database/clickhouse.service.js.map +1 -1
- package/dist/server/service/database/clickhouse.service.ts +9 -44
- package/dist/server/service/database/cockroachdb.service.d.ts.map +1 -1
- package/dist/server/service/database/cockroachdb.service.js +9 -38
- package/dist/server/service/database/cockroachdb.service.js.map +1 -1
- package/dist/server/service/database/cockroachdb.service.ts +10 -49
- package/dist/server/service/database/database.service.d.ts +15 -2
- package/dist/server/service/database/database.service.d.ts.map +1 -1
- package/dist/server/service/database/database.service.js +400 -6
- package/dist/server/service/database/database.service.js.map +1 -1
- package/dist/server/service/database/database.service.ts +402 -7
- package/dist/server/service/database/export-progress.d.ts +43 -0
- package/dist/server/service/database/export-progress.d.ts.map +1 -0
- package/dist/server/service/database/export-progress.js +117 -0
- package/dist/server/service/database/export-progress.js.map +1 -0
- package/dist/server/service/database/export-progress.ts +125 -0
- package/dist/server/service/database/mongodb.service.d.ts +2 -0
- package/dist/server/service/database/mongodb.service.d.ts.map +1 -1
- package/dist/server/service/database/mongodb.service.js +79 -44
- package/dist/server/service/database/mongodb.service.js.map +1 -1
- package/dist/server/service/database/mongodb.service.ts +76 -43
- package/dist/server/service/database/mssql.service.d.ts.map +1 -1
- package/dist/server/service/database/mssql.service.js +10 -9
- package/dist/server/service/database/mssql.service.js.map +1 -1
- package/dist/server/service/database/mssql.service.ts +10 -9
- package/dist/server/service/database/mysql.service.js +10 -10
- package/dist/server/service/database/mysql.service.js.map +1 -1
- package/dist/server/service/database/mysql.service.ts +10 -10
- package/dist/server/service/database/oracle.service.d.ts +4 -0
- package/dist/server/service/database/oracle.service.d.ts.map +1 -1
- package/dist/server/service/database/oracle.service.js +32 -13
- package/dist/server/service/database/oracle.service.js.map +1 -1
- package/dist/server/service/database/oracle.service.ts +33 -13
- package/dist/server/service/database/postgres.service.d.ts.map +1 -1
- package/dist/server/service/database/postgres.service.js +10 -9
- package/dist/server/service/database/postgres.service.js.map +1 -1
- package/dist/server/service/database/postgres.service.ts +10 -9
- package/dist/server/service/database/sap.service.d.ts.map +1 -1
- package/dist/server/service/database/sap.service.js +9 -38
- package/dist/server/service/database/sap.service.js.map +1 -1
- package/dist/server/service/database/sap.service.ts +10 -49
- package/dist/server/service/database/sqlite.service.d.ts.map +1 -1
- package/dist/server/service/database/sqlite.service.js +10 -9
- package/dist/server/service/database/sqlite.service.js.map +1 -1
- package/dist/server/service/database/sqlite.service.ts +10 -9
- package/package.json +1 -1
- package/scripts/verify-db-support.cjs +93 -7
- package/server.js +15 -2
|
@@ -5,7 +5,15 @@ import {
|
|
|
5
5
|
DatabaseEntity,
|
|
6
6
|
TableEntity
|
|
7
7
|
} from '../../model/database.entity';
|
|
8
|
-
import { getDialectInfo, quoteIdentifier } from '../../core/dialect';
|
|
8
|
+
import { getDialectInfo, getHealthCheckMode, quoteIdentifier } from '../../core/dialect';
|
|
9
|
+
import { classifySql } from '../../core/query-builder';
|
|
10
|
+
import { isSafeReadOnlySql } from '../../core/sql-safety';
|
|
11
|
+
import {
|
|
12
|
+
clearSlowQueries,
|
|
13
|
+
listSlowQueries,
|
|
14
|
+
recordQuery,
|
|
15
|
+
type QuerySource
|
|
16
|
+
} from '../../core/query-metrics';
|
|
9
17
|
import { canonicalizeTableEntity, canonicalizeTableSpec } from '../../core/schema/canonical';
|
|
10
18
|
import { diffTable } from '../../core/schema/diff';
|
|
11
19
|
import { ddlCapabilities, emitAlterDdl, emitCreateDdl, tableNameEquals } from '../../core/schema/ddl-emitter';
|
|
@@ -271,12 +279,47 @@ export class DatabaseService {
|
|
|
271
279
|
}
|
|
272
280
|
|
|
273
281
|
/**
|
|
274
|
-
* 执行SQL
|
|
282
|
+
* 执行SQL查询。source='editor' 的查询会进入进程内慢查询采样,不写磁盘。
|
|
275
283
|
*/
|
|
276
|
-
async executeQuery(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
284
|
+
async executeQuery(
|
|
285
|
+
connectionId: string,
|
|
286
|
+
sql: string,
|
|
287
|
+
databaseName?: string,
|
|
288
|
+
source: QuerySource = 'internal'
|
|
289
|
+
): Promise<any> {
|
|
290
|
+
const startedAt = Date.now();
|
|
291
|
+
let dialect = 'unknown';
|
|
292
|
+
let rowCount: number | null = null;
|
|
293
|
+
let success = false;
|
|
294
|
+
let errorMessage: string | undefined;
|
|
295
|
+
|
|
296
|
+
try {
|
|
297
|
+
const dataSource = await this.connectionService.getActiveConnection(connectionId, databaseName);
|
|
298
|
+
dialect = String(dataSource.options.type || '');
|
|
299
|
+
const databaseService = this.getDatabaseService(dialect);
|
|
300
|
+
const result = await databaseService.executeQuery(dataSource, sql);
|
|
301
|
+
rowCount = Array.isArray(result) ? result.length : null;
|
|
302
|
+
success = true;
|
|
303
|
+
return result;
|
|
304
|
+
} catch (error: any) {
|
|
305
|
+
errorMessage = error?.message ? String(error.message).split('\n')[0] : String(error);
|
|
306
|
+
throw error;
|
|
307
|
+
} finally {
|
|
308
|
+
// 所有经 executeQuery 的语句都参与采样:编辑器查询与表数据 CRUD/DDL 都可能成为慢查询。
|
|
309
|
+
const kind = classifySql(sql).kind;
|
|
310
|
+
recordQuery({
|
|
311
|
+
connectionId,
|
|
312
|
+
database: databaseName,
|
|
313
|
+
dialect,
|
|
314
|
+
sql,
|
|
315
|
+
type: kind === 'select' || kind === 'write' || kind === 'ddl' ? kind : 'other',
|
|
316
|
+
durationMs: Date.now() - startedAt,
|
|
317
|
+
success,
|
|
318
|
+
rowCount,
|
|
319
|
+
errorMessage,
|
|
320
|
+
source
|
|
321
|
+
});
|
|
322
|
+
}
|
|
280
323
|
}
|
|
281
324
|
|
|
282
325
|
// ---- 表列表缓存 ----
|
|
@@ -900,7 +943,8 @@ export class DatabaseService {
|
|
|
900
943
|
label: 'MongoDB',
|
|
901
944
|
icon: 'bi-database',
|
|
902
945
|
defaultPort: 27017,
|
|
903
|
-
description: 'MongoDB
|
|
946
|
+
description: 'MongoDB文档数据库(实验性)',
|
|
947
|
+
experimental: true,
|
|
904
948
|
features: {
|
|
905
949
|
supportSchemas: false,
|
|
906
950
|
supportProcedures: false,
|
|
@@ -1181,6 +1225,357 @@ export class DatabaseService {
|
|
|
1181
1225
|
return this.runMaintenance(connectionId, databaseName, 'repair');
|
|
1182
1226
|
}
|
|
1183
1227
|
|
|
1228
|
+
/**
|
|
1229
|
+
* 只读健康检查:能执行完整性检查的方言执行真实检查,其余明确降级为索引有效性或 unsupported。
|
|
1230
|
+
* 不调用任何 repair/optimize 操作,避免把健康检查变成写操作。
|
|
1231
|
+
*/
|
|
1232
|
+
async checkDatabaseHealth(connectionId: string, databaseName: string): Promise<any> {
|
|
1233
|
+
const startedAt = Date.now();
|
|
1234
|
+
const dataSource = await this.connectionService.getActiveConnection(connectionId, databaseName);
|
|
1235
|
+
const type = String(dataSource.options.type || '');
|
|
1236
|
+
const info = getDialectInfo(type);
|
|
1237
|
+
const service = this.getDatabaseService(type);
|
|
1238
|
+
const mode = getHealthCheckMode(info.kind);
|
|
1239
|
+
const checks: any[] = [];
|
|
1240
|
+
const maxTables = 50;
|
|
1241
|
+
const reasonOf = (error: any): string => {
|
|
1242
|
+
const message = error?.message ? String(error.message) : String(error);
|
|
1243
|
+
return message.split('\n')[0] ?? '';
|
|
1244
|
+
};
|
|
1245
|
+
const push = (checkKey: string, status: string, detail?: any, target?: string) => {
|
|
1246
|
+
checks.push({
|
|
1247
|
+
checkKey,
|
|
1248
|
+
status,
|
|
1249
|
+
...(target ? { target } : {}),
|
|
1250
|
+
...(detail ? { detail } : {}),
|
|
1251
|
+
durationMs: Date.now() - startedAt
|
|
1252
|
+
});
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1255
|
+
try {
|
|
1256
|
+
const connected = info.kind === 'mongodb'
|
|
1257
|
+
? Array.isArray(await service.getDatabases(dataSource))
|
|
1258
|
+
: await service.testConnection(dataSource);
|
|
1259
|
+
if (!connected) throw new Error('连通性检查失败');
|
|
1260
|
+
push('connectivity', 'healthy');
|
|
1261
|
+
} catch (error: any) {
|
|
1262
|
+
push('connectivity', 'error', { reasonCode: 'CONNECTIVITY_FAILED', reason: reasonOf(error) });
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
let tables: any[] = [];
|
|
1266
|
+
let inventoryOk = false;
|
|
1267
|
+
try {
|
|
1268
|
+
tables = (await service.getTables(dataSource, databaseName)) || [];
|
|
1269
|
+
inventoryOk = true;
|
|
1270
|
+
push('table_inventory', 'healthy', { tableCount: tables.length });
|
|
1271
|
+
} catch (error: any) {
|
|
1272
|
+
push('table_inventory', 'error', { reasonCode: 'TABLE_LIST_UNAVAILABLE', reason: reasonOf(error) });
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
const visibleTables = tables.slice(0, maxTables);
|
|
1276
|
+
if (!inventoryOk) {
|
|
1277
|
+
push('index_stats', 'skipped', { reasonCode: 'TABLE_LIST_UNAVAILABLE', reason: '表清单不可用,跳过索引统计' });
|
|
1278
|
+
} else {
|
|
1279
|
+
try {
|
|
1280
|
+
let indexCount = 0;
|
|
1281
|
+
for (const table of visibleTables) {
|
|
1282
|
+
const indexes = await service.getIndexes(dataSource, databaseName, table.name);
|
|
1283
|
+
indexCount += Array.isArray(indexes) ? indexes.length : 0;
|
|
1284
|
+
}
|
|
1285
|
+
push('index_stats', 'healthy', {
|
|
1286
|
+
tableCount: visibleTables.length,
|
|
1287
|
+
totalTableCount: tables.length,
|
|
1288
|
+
indexCount,
|
|
1289
|
+
partial: tables.length > maxTables
|
|
1290
|
+
});
|
|
1291
|
+
} catch (error: any) {
|
|
1292
|
+
push('index_stats', 'error', { reason: reasonOf(error) });
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
if (!inventoryOk) {
|
|
1297
|
+
push(mode === 'index-only' ? 'index_validity' : 'table_integrity', 'skipped', { reasonCode: 'TABLE_LIST_UNAVAILABLE', reason: '表清单不可用,跳过明细检查' });
|
|
1298
|
+
} else if (mode === 'integrity') {
|
|
1299
|
+
switch (info.kind) {
|
|
1300
|
+
case 'sqlite': {
|
|
1301
|
+
try {
|
|
1302
|
+
const result = await dataSource.query('PRAGMA integrity_check');
|
|
1303
|
+
const first = Array.isArray(result) && result.length ? result[0] : undefined;
|
|
1304
|
+
const value = first ? (first.integrity_check ?? Object.values(first)[0]) : undefined;
|
|
1305
|
+
const ok = String(value ?? '').toLowerCase() === 'ok';
|
|
1306
|
+
push('table_integrity', ok ? 'healthy' : 'error', {
|
|
1307
|
+
...(ok ? {} : { raw: result, reasonCode: 'SQLITE_INTEGRITY_CHECK_FAILED', reason: 'integrity_check 未返回 ok' })
|
|
1308
|
+
}, '*');
|
|
1309
|
+
} catch (error: any) {
|
|
1310
|
+
push('table_integrity', 'error', { reason: reasonOf(error) }, '*');
|
|
1311
|
+
}
|
|
1312
|
+
break;
|
|
1313
|
+
}
|
|
1314
|
+
case 'mysql':
|
|
1315
|
+
for (const table of visibleTables) {
|
|
1316
|
+
const sql = `CHECK TABLE ${quoteIdentifier(type, String(table.name))}`;
|
|
1317
|
+
try {
|
|
1318
|
+
const result = await dataSource.query(sql);
|
|
1319
|
+
const rows = Array.isArray(result) ? result : result ? [result] : [];
|
|
1320
|
+
const failures = rows.filter((row: any) =>
|
|
1321
|
+
/error/i.test(String(row?.Msg_type ?? '')) || /error/i.test(String(row?.Msg_text ?? '')));
|
|
1322
|
+
if (failures.length > 0) {
|
|
1323
|
+
push('table_integrity', 'error', {
|
|
1324
|
+
sql,
|
|
1325
|
+
raw: failures,
|
|
1326
|
+
reasonCode: 'MYSQL_CHECK_TABLE_ERROR',
|
|
1327
|
+
reason: String(failures[0]?.Msg_text || 'CHECK TABLE 返回错误')
|
|
1328
|
+
}, String(table.name));
|
|
1329
|
+
} else {
|
|
1330
|
+
push('table_integrity', 'healthy', { raw: result }, String(table.name));
|
|
1331
|
+
}
|
|
1332
|
+
} catch (error: any) {
|
|
1333
|
+
push('table_integrity', 'error', { sql, reason: reasonOf(error) }, String(table.name));
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
break;
|
|
1337
|
+
case 'mssql':
|
|
1338
|
+
for (const table of visibleTables) {
|
|
1339
|
+
const name = String(table.name).replace(/'/g, "''");
|
|
1340
|
+
const sql = `DBCC CHECKTABLE('${name}') WITH NO_INFOMSGS`;
|
|
1341
|
+
try {
|
|
1342
|
+
const result = await dataSource.query(sql);
|
|
1343
|
+
push('table_integrity', 'healthy', { raw: result }, String(table.name));
|
|
1344
|
+
} catch (error: any) {
|
|
1345
|
+
push('table_integrity', 'error', { sql, reason: reasonOf(error) }, String(table.name));
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
break;
|
|
1349
|
+
case 'mongodb':
|
|
1350
|
+
for (const table of visibleTables) {
|
|
1351
|
+
try {
|
|
1352
|
+
const nativeDb = (dataSource.driver as any)?.queryRunner?.databaseConnection?.db?.(databaseName);
|
|
1353
|
+
if (!nativeDb) throw new Error('无法获取 MongoDB 原生数据库句柄');
|
|
1354
|
+
const result = await nativeDb.collection(String(table.name)).validate();
|
|
1355
|
+
const ok = result?.valid !== false && result?.ok !== 0;
|
|
1356
|
+
push('table_integrity', ok ? 'healthy' : 'error', ok ? undefined : { raw: result }, String(table.name));
|
|
1357
|
+
} catch (error: any) {
|
|
1358
|
+
push('table_integrity', 'error', { reason: reasonOf(error) }, String(table.name));
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1363
|
+
} else if (mode === 'index-only') {
|
|
1364
|
+
if (info.kind === 'cockroachdb') {
|
|
1365
|
+
push('unsupported', 'unsupported', {
|
|
1366
|
+
reasonCode: 'COCKROACH_INDEX_VALIDITY_UNSUPPORTED',
|
|
1367
|
+
reason: 'CockroachDB 未提供等价的只读索引有效性检查'
|
|
1368
|
+
});
|
|
1369
|
+
} else {
|
|
1370
|
+
try {
|
|
1371
|
+
const rows = await dataSource.query(`
|
|
1372
|
+
SELECT COUNT(*) AS invalid_indexes
|
|
1373
|
+
FROM pg_index i
|
|
1374
|
+
JOIN pg_class c ON c.oid = i.indrelid
|
|
1375
|
+
JOIN pg_namespace n ON n.oid = c.relnamespace
|
|
1376
|
+
WHERE NOT i.indisvalid
|
|
1377
|
+
AND n.nspname NOT IN ('pg_catalog', 'information_schema')
|
|
1378
|
+
AND c.relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = current_schema())
|
|
1379
|
+
`);
|
|
1380
|
+
const first = Array.isArray(rows) && rows.length ? rows[0] : {};
|
|
1381
|
+
const invalid = Number(first.invalid_indexes ?? first.count ?? 0);
|
|
1382
|
+
push('index_validity', invalid === 0 ? 'healthy' : 'error', { invalidIndexes: invalid });
|
|
1383
|
+
} catch (error: any) {
|
|
1384
|
+
push('index_validity', 'error', { reason: reasonOf(error) });
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
} else {
|
|
1388
|
+
const reasonCode = info.kind === 'clickhouse'
|
|
1389
|
+
? 'CLICKHOUSE_INTEGRITY_UNSUPPORTED'
|
|
1390
|
+
: info.kind === 'oracle'
|
|
1391
|
+
? 'ORACLE_INTEGRITY_UNSUPPORTED'
|
|
1392
|
+
: 'INTEGRITY_UNSUPPORTED';
|
|
1393
|
+
const reason = info.kind === 'clickhouse'
|
|
1394
|
+
? 'ClickHouse 的 CHECK TABLE 不能经当前 SQL 通道执行,暂不提供只读完整性检查'
|
|
1395
|
+
: info.kind === 'oracle'
|
|
1396
|
+
? 'Oracle 结构校验需要额外权限且开销较大,健康检查暂不执行'
|
|
1397
|
+
: '当前数据库类型没有可用的只读完整性检查';
|
|
1398
|
+
push('unsupported', 'unsupported', { reasonCode, reason });
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
const summary = {
|
|
1402
|
+
healthy: checks.filter((check) => check.status === 'healthy').length,
|
|
1403
|
+
error: checks.filter((check) => check.status === 'error').length,
|
|
1404
|
+
unsupported: checks.filter((check) => check.status === 'unsupported').length,
|
|
1405
|
+
skipped: checks.filter((check) => check.status === 'skipped').length
|
|
1406
|
+
};
|
|
1407
|
+
const overallStatus = summary.error > 0
|
|
1408
|
+
? 'error'
|
|
1409
|
+
: summary.unsupported > 0 ? 'unsupported'
|
|
1410
|
+
: summary.skipped > 0 ? 'skipped' : 'healthy';
|
|
1411
|
+
return {
|
|
1412
|
+
dialect: info.kind,
|
|
1413
|
+
mode,
|
|
1414
|
+
integritySupported: mode === 'integrity',
|
|
1415
|
+
checks,
|
|
1416
|
+
summary,
|
|
1417
|
+
overallStatus,
|
|
1418
|
+
truncated: tables.length > maxTables,
|
|
1419
|
+
checkedAt: new Date().toISOString(),
|
|
1420
|
+
durationMs: Date.now() - startedAt
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/** 本进程采集的慢查询(按耗时倒序) */
|
|
1425
|
+
getSlowQueries(connectionId?: string, minDurationMs?: number, limit?: number): any[] {
|
|
1426
|
+
if (!connectionId) throw new Error('Missing connection id');
|
|
1427
|
+
return listSlowQueries({ connectionId, minDurationMs, limit });
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
clearSlowQueries(connectionId?: string): number {
|
|
1431
|
+
if (!connectionId) throw new Error('Missing connection id');
|
|
1432
|
+
return clearSlowQueries(connectionId);
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
/** 只读 EXPLAIN:拒绝写语句和多语句,避免 EXPLAIN ANALYZE 造成副作用 */
|
|
1436
|
+
async explainQuery(connectionId: string, sql: string, databaseName?: string): Promise<any> {
|
|
1437
|
+
if (!isSafeReadOnlySql(sql)) {
|
|
1438
|
+
return {
|
|
1439
|
+
supported: false,
|
|
1440
|
+
reasonCode: 'EXPLAIN_UNSAFE_SQL',
|
|
1441
|
+
reason: '只能分析单条无副作用的 SELECT/WITH/SHOW/EXPLAIN 语句'
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
const dataSource = await this.connectionService.getActiveConnection(connectionId, databaseName);
|
|
1446
|
+
const type = String(dataSource.options.type || '');
|
|
1447
|
+
const info = getDialectInfo(type);
|
|
1448
|
+
const statement = String(sql).trim();
|
|
1449
|
+
const base = { dialect: info.kind, sql: statement };
|
|
1450
|
+
|
|
1451
|
+
if (info.kind === 'mongodb') {
|
|
1452
|
+
return {
|
|
1453
|
+
...base,
|
|
1454
|
+
supported: false,
|
|
1455
|
+
reasonCode: 'EXPLAIN_MONGODB_UNSUPPORTED',
|
|
1456
|
+
reason: 'MongoDB 不支持 SQL EXPLAIN,请使用聚合管道的 explain'
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
let explainSql = '';
|
|
1461
|
+
if (/^EXPLAIN\b/i.test(statement)) {
|
|
1462
|
+
explainSql = statement;
|
|
1463
|
+
} else {
|
|
1464
|
+
switch (info.kind) {
|
|
1465
|
+
case 'mysql':
|
|
1466
|
+
explainSql = `EXPLAIN ${statement}`;
|
|
1467
|
+
break;
|
|
1468
|
+
case 'postgres':
|
|
1469
|
+
case 'cockroachdb':
|
|
1470
|
+
explainSql = `EXPLAIN (FORMAT JSON) ${statement}`;
|
|
1471
|
+
break;
|
|
1472
|
+
case 'sqlite':
|
|
1473
|
+
explainSql = `EXPLAIN QUERY PLAN ${statement}`;
|
|
1474
|
+
break;
|
|
1475
|
+
case 'clickhouse':
|
|
1476
|
+
explainSql = `EXPLAIN ${statement}`;
|
|
1477
|
+
break;
|
|
1478
|
+
default:
|
|
1479
|
+
return {
|
|
1480
|
+
...base,
|
|
1481
|
+
supported: false,
|
|
1482
|
+
reasonCode: 'EXPLAIN_DIALECT_UNSUPPORTED',
|
|
1483
|
+
reason: '当前数据库类型暂未提供安全的 EXPLAIN 通道'
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
try {
|
|
1489
|
+
const plan = await dataSource.query(explainSql);
|
|
1490
|
+
return { ...base, explainSql, supported: true, plan };
|
|
1491
|
+
} catch (error: any) {
|
|
1492
|
+
const reason = error?.message ? String(error.message).split('\n')[0] : String(error);
|
|
1493
|
+
return { ...base, explainSql, supported: false, reasonCode: 'EXPLAIN_FAILED', reason };
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/** 资源指标:只取允许的只读指标,无权限/无等价物时逐项降级 */
|
|
1498
|
+
async getResourceMetrics(connectionId: string, databaseName?: string): Promise<any> {
|
|
1499
|
+
const dataSource = await this.connectionService.getActiveConnection(connectionId, databaseName);
|
|
1500
|
+
const type = String(dataSource.options.type || '');
|
|
1501
|
+
const info = getDialectInfo(type);
|
|
1502
|
+
const service = this.getDatabaseService(type);
|
|
1503
|
+
const dbName = databaseName || String((dataSource.options as any).database || '');
|
|
1504
|
+
const metric = (value: any, supported: boolean, reason?: string, reasonCode?: string) => ({
|
|
1505
|
+
value: supported ? value : null,
|
|
1506
|
+
supported,
|
|
1507
|
+
...(supported ? {} : {
|
|
1508
|
+
reasonCode: reasonCode || 'METRIC_UNAVAILABLE',
|
|
1509
|
+
reason: reason || '当前数据库类型未提供该指标'
|
|
1510
|
+
})
|
|
1511
|
+
});
|
|
1512
|
+
const firstNumber = (rows: any, keys: string[]): number => {
|
|
1513
|
+
if (!Array.isArray(rows) || rows.length === 0) return 0;
|
|
1514
|
+
const row = rows[0] || {};
|
|
1515
|
+
for (const key of keys) {
|
|
1516
|
+
if (row[key] !== undefined && row[key] !== null) return Number(row[key]) || 0;
|
|
1517
|
+
}
|
|
1518
|
+
const values = Object.values(row);
|
|
1519
|
+
return Number(values[0]) || 0;
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
let databaseSizeBytes = metric(null, false, '数据库大小不可用', 'METRIC_DATABASE_SIZE_UNAVAILABLE');
|
|
1523
|
+
try {
|
|
1524
|
+
databaseSizeBytes = metric(Number(await service.getDatabaseSize(dataSource, dbName)) || 0, true);
|
|
1525
|
+
} catch (error: any) {
|
|
1526
|
+
databaseSizeBytes = metric(null, false, error?.message ? String(error.message).split('\n')[0] : String(error), 'METRIC_QUERY_FAILED');
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
let activeConnections = metric(null, false, '当前数据库类型未提供连接数指标', 'METRIC_ACTIVE_CONNECTIONS_UNSUPPORTED');
|
|
1530
|
+
try {
|
|
1531
|
+
let value: number | null = null;
|
|
1532
|
+
switch (info.kind) {
|
|
1533
|
+
case 'mysql': {
|
|
1534
|
+
const rows = await dataSource.query("SHOW STATUS LIKE 'Threads_connected'");
|
|
1535
|
+
const row = Array.isArray(rows) ? rows.find((item: any) => item?.Variable_name === 'Threads_connected') || rows[0] : null;
|
|
1536
|
+
value = row ? Number(row.Value ?? row.value ?? Object.values(row)[0]) || 0 : 0;
|
|
1537
|
+
break;
|
|
1538
|
+
}
|
|
1539
|
+
case 'postgres':
|
|
1540
|
+
case 'cockroachdb':
|
|
1541
|
+
value = firstNumber(await dataSource.query('SELECT COUNT(*) AS active FROM pg_stat_activity'), ['active']);
|
|
1542
|
+
break;
|
|
1543
|
+
case 'mssql':
|
|
1544
|
+
value = firstNumber(await dataSource.query('SELECT COUNT(*) AS active FROM sys.dm_exec_sessions'), ['active']);
|
|
1545
|
+
break;
|
|
1546
|
+
case 'oracle':
|
|
1547
|
+
value = firstNumber(await dataSource.query('SELECT COUNT(*) AS active FROM v$session'), ['active']);
|
|
1548
|
+
break;
|
|
1549
|
+
case 'clickhouse':
|
|
1550
|
+
value = firstNumber(await dataSource.query('SELECT COUNT() AS active FROM system.processes'), ['active']);
|
|
1551
|
+
break;
|
|
1552
|
+
case 'mongodb': {
|
|
1553
|
+
const nativeDb = (dataSource.driver as any)?.queryRunner?.databaseConnection?.db?.(dbName);
|
|
1554
|
+
if (!nativeDb) throw new Error('无法获取 MongoDB 原生数据库句柄');
|
|
1555
|
+
const status = await nativeDb.admin().serverStatus();
|
|
1556
|
+
value = Number(status?.connections?.current) || 0;
|
|
1557
|
+
break;
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
if (value !== null) activeConnections = metric(value, true);
|
|
1561
|
+
} catch (error: any) {
|
|
1562
|
+
activeConnections = metric(null, false, error?.message ? String(error.message).split('\n')[0] : String(error), 'METRIC_QUERY_FAILED');
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
const unavailable = '该指标需要数据库侧系统视图或额外权限,当前未提供';
|
|
1566
|
+
return {
|
|
1567
|
+
dialect: info.kind,
|
|
1568
|
+
collectedAt: new Date().toISOString(),
|
|
1569
|
+
activeConnections,
|
|
1570
|
+
databaseSizeBytes,
|
|
1571
|
+
diskUsedBytes: databaseSizeBytes,
|
|
1572
|
+
cpuPercent: metric(null, false, unavailable, 'METRIC_SYSTEM_VIEW_REQUIRED'),
|
|
1573
|
+
memoryUsedBytes: metric(null, false, unavailable, 'METRIC_SYSTEM_VIEW_REQUIRED'),
|
|
1574
|
+
networkBytesPerSec: metric(null, false, unavailable, 'METRIC_SYSTEM_VIEW_REQUIRED'),
|
|
1575
|
+
notes: ['指标来自当前服务进程可见的只读查询;不支持或未授权的项目会明确降级']
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1184
1579
|
/**
|
|
1185
1580
|
* 导出表数据到 SQL 文件
|
|
1186
1581
|
*/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 导出任务进度注册表。
|
|
3
|
+
*
|
|
4
|
+
* 导出接口沿用原有「一次请求返回文件路径」的同步契约,客户端在 options 中带 jobId,
|
|
5
|
+
* 轮询 /api/database/getExportProgress 获取批次进度。这里的状态只存活于当前进程,
|
|
6
|
+
* 任务结束后保留一小段时间供客户端拿到终态。
|
|
7
|
+
*/
|
|
8
|
+
export type ExportJobStatus = 'running' | 'completed' | 'failed';
|
|
9
|
+
export interface ExportProgressInfo {
|
|
10
|
+
jobId: string;
|
|
11
|
+
status: ExportJobStatus;
|
|
12
|
+
/** 已扫描的实际行数(按每批返回的行数累加,不是 OFFSET 的近似值) */
|
|
13
|
+
rows: number;
|
|
14
|
+
/** scanning / writing / done / error */
|
|
15
|
+
phase: string;
|
|
16
|
+
message?: string;
|
|
17
|
+
path?: string;
|
|
18
|
+
startedAt: number;
|
|
19
|
+
updatedAt: number;
|
|
20
|
+
}
|
|
21
|
+
/** 本地 jobId → 远程代理任务,用于把进度轮询转发到真正执行导出的远程服务。 */
|
|
22
|
+
interface ExportJobRoute {
|
|
23
|
+
proxyConnId: string;
|
|
24
|
+
remoteConnId: string;
|
|
25
|
+
remoteJobId: string;
|
|
26
|
+
createdAt: number;
|
|
27
|
+
}
|
|
28
|
+
/** 写盘阶段由调用方在 finally 中停止;心跳只刷新 updatedAt,不虚增行数。 */
|
|
29
|
+
export declare function startExportHeartbeat(jobId: string | undefined, phase?: string): () => void;
|
|
30
|
+
export declare function startExportJob(jobId?: string): void;
|
|
31
|
+
/** 方言每处理完一批数据调用一次;jobId 为空时是普通调用,不产生任何开销。 */
|
|
32
|
+
export declare function reportExportRows(jobId: string | undefined, rows: number, phase?: string): void;
|
|
33
|
+
/** 按本批实际返回行数累加,避免用 OFFSET 推算导致最后一批行数虚高。 */
|
|
34
|
+
export declare function addExportRows(jobId: string | undefined, delta: number, phase?: string): void;
|
|
35
|
+
export declare function finishExportJob(jobId: string | undefined, status: 'completed' | 'failed', extra?: {
|
|
36
|
+
path?: string;
|
|
37
|
+
message?: string;
|
|
38
|
+
}): void;
|
|
39
|
+
export declare function getExportProgress(jobId?: string): ExportProgressInfo | null;
|
|
40
|
+
export declare function linkExportJob(localJobId: string, route: Omit<ExportJobRoute, 'createdAt'>): void;
|
|
41
|
+
export declare function getExportJobRoute(localJobId?: string): ExportJobRoute | null;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=export-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-progress.d.ts","sourceRoot":"","sources":["../../../../server/service/database/export-progress.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEjE,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,+CAA+C;AAC/C,UAAU,cAAc;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AA4BD,mDAAmD;AACnD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,SAAY,GAAG,MAAM,IAAI,CAS7F;AAED,wBAAgB,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAKnD;AAED,6CAA6C;AAC7C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,SAAa,GAAG,IAAI,CAOlG;AAED,2CAA2C;AAC3C,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAAa,GAAG,IAAI,CAOhG;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,WAAW,GAAG,QAAQ,EAC9B,KAAK,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1C,IAAI,CASN;AAED,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAI3E;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,GAAG,IAAI,CAEhG;AAED,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAG5E"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 导出任务进度注册表。
|
|
4
|
+
*
|
|
5
|
+
* 导出接口沿用原有「一次请求返回文件路径」的同步契约,客户端在 options 中带 jobId,
|
|
6
|
+
* 轮询 /api/database/getExportProgress 获取批次进度。这里的状态只存活于当前进程,
|
|
7
|
+
* 任务结束后保留一小段时间供客户端拿到终态。
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.startExportHeartbeat = startExportHeartbeat;
|
|
11
|
+
exports.startExportJob = startExportJob;
|
|
12
|
+
exports.reportExportRows = reportExportRows;
|
|
13
|
+
exports.addExportRows = addExportRows;
|
|
14
|
+
exports.finishExportJob = finishExportJob;
|
|
15
|
+
exports.getExportProgress = getExportProgress;
|
|
16
|
+
exports.linkExportJob = linkExportJob;
|
|
17
|
+
exports.getExportJobRoute = getExportJobRoute;
|
|
18
|
+
const jobs = new Map();
|
|
19
|
+
const routes = new Map();
|
|
20
|
+
const JOB_TTL_MS = 30 * 60 * 1000;
|
|
21
|
+
/** 大表导出可能超过 30 分钟;运行中的任务不能被 TTL/容量清理误删。 */
|
|
22
|
+
const RUNNING_JOB_TTL_MS = 24 * 60 * 60 * 1000;
|
|
23
|
+
const MAX_JOBS = 200;
|
|
24
|
+
const HEARTBEAT_INTERVAL_MS = 5000;
|
|
25
|
+
function pruneExpired(now) {
|
|
26
|
+
for (const [id, job] of jobs) {
|
|
27
|
+
const ttl = job.status === 'running' ? RUNNING_JOB_TTL_MS : JOB_TTL_MS;
|
|
28
|
+
if (now - job.updatedAt > ttl)
|
|
29
|
+
jobs.delete(id);
|
|
30
|
+
}
|
|
31
|
+
for (const [id, route] of routes) {
|
|
32
|
+
if (now - route.createdAt > RUNNING_JOB_TTL_MS || !jobs.has(id))
|
|
33
|
+
routes.delete(id);
|
|
34
|
+
}
|
|
35
|
+
if (jobs.size > MAX_JOBS) {
|
|
36
|
+
const sorted = [...jobs.values()].sort((a, b) => a.updatedAt - b.updatedAt);
|
|
37
|
+
const removable = sorted.filter((job) => job.status !== 'running');
|
|
38
|
+
for (const job of removable.slice(0, jobs.size - MAX_JOBS)) {
|
|
39
|
+
jobs.delete(job.jobId);
|
|
40
|
+
routes.delete(job.jobId);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** 写盘阶段由调用方在 finally 中停止;心跳只刷新 updatedAt,不虚增行数。 */
|
|
45
|
+
function startExportHeartbeat(jobId, phase = 'writing') {
|
|
46
|
+
if (!jobId)
|
|
47
|
+
return () => undefined;
|
|
48
|
+
const timer = setInterval(() => {
|
|
49
|
+
const job = jobs.get(jobId);
|
|
50
|
+
if (job && job.status === 'running')
|
|
51
|
+
job.updatedAt = Date.now();
|
|
52
|
+
else
|
|
53
|
+
clearInterval(timer);
|
|
54
|
+
}, HEARTBEAT_INTERVAL_MS);
|
|
55
|
+
timer.unref?.();
|
|
56
|
+
return () => clearInterval(timer);
|
|
57
|
+
}
|
|
58
|
+
function startExportJob(jobId) {
|
|
59
|
+
if (!jobId)
|
|
60
|
+
return;
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
pruneExpired(now);
|
|
63
|
+
jobs.set(jobId, { jobId, status: 'running', rows: 0, phase: 'scanning', startedAt: now, updatedAt: now });
|
|
64
|
+
}
|
|
65
|
+
/** 方言每处理完一批数据调用一次;jobId 为空时是普通调用,不产生任何开销。 */
|
|
66
|
+
function reportExportRows(jobId, rows, phase = 'scanning') {
|
|
67
|
+
if (!jobId)
|
|
68
|
+
return;
|
|
69
|
+
const job = jobs.get(jobId);
|
|
70
|
+
if (!job || job.status !== 'running')
|
|
71
|
+
return;
|
|
72
|
+
job.rows = Math.max(job.rows, rows);
|
|
73
|
+
if (phase)
|
|
74
|
+
job.phase = phase;
|
|
75
|
+
job.updatedAt = Date.now();
|
|
76
|
+
}
|
|
77
|
+
/** 按本批实际返回行数累加,避免用 OFFSET 推算导致最后一批行数虚高。 */
|
|
78
|
+
function addExportRows(jobId, delta, phase = 'scanning') {
|
|
79
|
+
if (!jobId || delta <= 0)
|
|
80
|
+
return;
|
|
81
|
+
const job = jobs.get(jobId);
|
|
82
|
+
if (!job || job.status !== 'running')
|
|
83
|
+
return;
|
|
84
|
+
job.rows += delta;
|
|
85
|
+
if (phase)
|
|
86
|
+
job.phase = phase;
|
|
87
|
+
job.updatedAt = Date.now();
|
|
88
|
+
}
|
|
89
|
+
function finishExportJob(jobId, status, extra) {
|
|
90
|
+
if (!jobId)
|
|
91
|
+
return;
|
|
92
|
+
const job = jobs.get(jobId);
|
|
93
|
+
if (!job)
|
|
94
|
+
return;
|
|
95
|
+
job.status = status;
|
|
96
|
+
job.phase = status === 'completed' ? 'done' : 'error';
|
|
97
|
+
if (extra?.path)
|
|
98
|
+
job.path = extra.path;
|
|
99
|
+
if (extra?.message)
|
|
100
|
+
job.message = extra.message;
|
|
101
|
+
job.updatedAt = Date.now();
|
|
102
|
+
}
|
|
103
|
+
function getExportProgress(jobId) {
|
|
104
|
+
if (!jobId)
|
|
105
|
+
return null;
|
|
106
|
+
pruneExpired(Date.now());
|
|
107
|
+
return jobs.get(jobId) || null;
|
|
108
|
+
}
|
|
109
|
+
function linkExportJob(localJobId, route) {
|
|
110
|
+
routes.set(localJobId, { ...route, createdAt: Date.now() });
|
|
111
|
+
}
|
|
112
|
+
function getExportJobRoute(localJobId) {
|
|
113
|
+
if (!localJobId)
|
|
114
|
+
return null;
|
|
115
|
+
return routes.get(localJobId) || null;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=export-progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-progress.js","sourceRoot":"","sources":["../../../../server/service/database/export-progress.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAoDH,oDASC;AAED,wCAKC;AAGD,4CAOC;AAGD,sCAOC;AAED,0CAaC;AAED,8CAIC;AAED,sCAEC;AAED,8CAGC;AA7FD,MAAM,IAAI,GAAG,IAAI,GAAG,EAA8B,CAAC;AACnD,MAAM,MAAM,GAAG,IAAI,GAAG,EAA0B,CAAC;AACjD,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAClC,2CAA2C;AAC3C,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/C,MAAM,QAAQ,GAAG,GAAG,CAAC;AACrB,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,SAAS,YAAY,CAAC,GAAW;IAC/B,KAAK,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QAC7B,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAU,CAAC;QACvE,IAAI,GAAG,GAAG,GAAG,CAAC,SAAS,GAAG,GAAG;YAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QACjC,IAAI,GAAG,GAAG,KAAK,CAAC,SAAS,GAAG,kBAAkB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,MAAM,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