@colbymchenry/codegraph-win32-arm64 1.4.1 → 1.6.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/bin/codegraph.cmd +1 -1
- package/lib/dist/bin/codegraph.js +206 -44
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/context/formatter.d.ts +7 -1
- package/lib/dist/context/formatter.d.ts.map +1 -1
- package/lib/dist/context/formatter.js +12 -6
- package/lib/dist/context/formatter.js.map +1 -1
- package/lib/dist/context/index.d.ts +12 -0
- package/lib/dist/context/index.d.ts.map +1 -1
- package/lib/dist/context/index.js +101 -25
- package/lib/dist/context/index.js.map +1 -1
- package/lib/dist/db/index.d.ts +179 -0
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +368 -7
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +25 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +234 -5
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +687 -53
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +16 -3
- package/lib/dist/db/sqlite-adapter.d.ts +3 -1
- package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/lib/dist/db/sqlite-adapter.js +22 -4
- package/lib/dist/db/sqlite-adapter.js.map +1 -1
- package/lib/dist/db/wal-valve.d.ts +15 -2
- package/lib/dist/db/wal-valve.d.ts.map +1 -1
- package/lib/dist/db/wal-valve.js +88 -6
- package/lib/dist/db/wal-valve.js.map +1 -1
- package/lib/dist/directory.d.ts +29 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +52 -0
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/function-ref.d.ts.map +1 -1
- package/lib/dist/extraction/function-ref.js +6 -0
- package/lib/dist/extraction/function-ref.js.map +1 -1
- package/lib/dist/extraction/generated-detection.d.ts +48 -12
- package/lib/dist/extraction/generated-detection.d.ts.map +1 -1
- package/lib/dist/extraction/generated-detection.js +176 -11
- package/lib/dist/extraction/generated-detection.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +101 -2
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +138 -3
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +518 -94
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/kernel/decode.d.ts +9 -0
- package/lib/dist/extraction/kernel/decode.d.ts.map +1 -0
- package/lib/dist/extraction/kernel/decode.js +162 -0
- package/lib/dist/extraction/kernel/decode.js.map +1 -0
- package/lib/dist/extraction/kernel/index.d.ts +64 -0
- package/lib/dist/extraction/kernel/index.d.ts.map +1 -0
- package/lib/dist/extraction/kernel/index.js +279 -0
- package/lib/dist/extraction/kernel/index.js.map +1 -0
- package/lib/dist/extraction/kernel/layout.d.ts +101 -0
- package/lib/dist/extraction/kernel/layout.d.ts.map +1 -0
- package/lib/dist/extraction/kernel/layout.js +104 -0
- package/lib/dist/extraction/kernel/layout.js.map +1 -0
- package/lib/dist/extraction/kernel/loader.d.ts +103 -0
- package/lib/dist/extraction/kernel/loader.d.ts.map +1 -0
- package/lib/dist/extraction/kernel/loader.js +146 -0
- package/lib/dist/extraction/kernel/loader.js.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts +14 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +868 -16
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -1
- package/lib/dist/extraction/languages/erlang.js +58 -22
- package/lib/dist/extraction/languages/erlang.js.map +1 -1
- package/lib/dist/extraction/languages/objc.d.ts.map +1 -1
- package/lib/dist/extraction/languages/objc.js +4 -0
- package/lib/dist/extraction/languages/objc.js.map +1 -1
- package/lib/dist/extraction/languages/rust.d.ts +20 -0
- package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
- package/lib/dist/extraction/languages/rust.js +47 -20
- package/lib/dist/extraction/languages/rust.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +15 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +35 -1
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +35 -1
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/store-worker.d.ts +24 -0
- package/lib/dist/extraction/store-worker.d.ts.map +1 -0
- package/lib/dist/extraction/store-worker.js +139 -0
- package/lib/dist/extraction/store-worker.js.map +1 -0
- package/lib/dist/extraction/store-writer.d.ts +63 -0
- package/lib/dist/extraction/store-writer.d.ts.map +1 -0
- package/lib/dist/extraction/store-writer.js +174 -0
- package/lib/dist/extraction/store-writer.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts +2 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +27 -5
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +257 -56
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts +15 -0
- package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/lib/dist/extraction/wasm-runtime-flags.js +27 -3
- package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/lib/dist/graph/queries.d.ts.map +1 -1
- package/lib/dist/graph/queries.js +2 -0
- package/lib/dist/graph/queries.js.map +1 -1
- package/lib/dist/graph/traversal.js +1 -1
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/index.d.ts +36 -2
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +305 -11
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/beta-signup.d.ts +54 -0
- package/lib/dist/installer/beta-signup.d.ts.map +1 -0
- package/lib/dist/installer/beta-signup.js +178 -0
- package/lib/dist/installer/beta-signup.js.map +1 -0
- package/lib/dist/installer/index.d.ts +4 -3
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +19 -6
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/targets/claude.d.ts.map +1 -1
- package/lib/dist/installer/targets/claude.js +37 -5
- package/lib/dist/installer/targets/claude.js.map +1 -1
- package/lib/dist/installer/targets/codex.d.ts +22 -8
- package/lib/dist/installer/targets/codex.d.ts.map +1 -1
- package/lib/dist/installer/targets/codex.js +65 -48
- package/lib/dist/installer/targets/codex.js.map +1 -1
- package/lib/dist/installer/targets/copilot-cli.d.ts +32 -0
- package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-cli.js +209 -0
- package/lib/dist/installer/targets/copilot-cli.js.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
- package/lib/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js +238 -0
- package/lib/dist/installer/targets/copilot-jetbrains.js.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts +47 -0
- package/lib/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
- package/lib/dist/installer/targets/copilot-vscode.js +219 -0
- package/lib/dist/installer/targets/copilot-vscode.js.map +1 -0
- package/lib/dist/installer/targets/registry.d.ts.map +1 -1
- package/lib/dist/installer/targets/registry.js +6 -0
- package/lib/dist/installer/targets/registry.js.map +1 -1
- package/lib/dist/installer/targets/toml.d.ts +6 -5
- package/lib/dist/installer/targets/toml.d.ts.map +1 -1
- package/lib/dist/installer/targets/toml.js +99 -20
- package/lib/dist/installer/targets/toml.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +5 -5
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +1 -1
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +6 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +54 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +10 -0
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +51 -3
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +9 -6
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +10 -8
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +3 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +45 -3
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/explore-dedup.d.ts +137 -0
- package/lib/dist/mcp/explore-dedup.d.ts.map +1 -0
- package/lib/dist/mcp/explore-dedup.js +236 -0
- package/lib/dist/mcp/explore-dedup.js.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts +289 -0
- package/lib/dist/mcp/explore-diagnostics.d.ts.map +1 -0
- package/lib/dist/mcp/explore-diagnostics.js +558 -0
- package/lib/dist/mcp/explore-diagnostics.js.map +1 -0
- package/lib/dist/mcp/explore-session-state.d.ts +217 -0
- package/lib/dist/mcp/explore-session-state.d.ts.map +1 -0
- package/lib/dist/mcp/explore-session-state.js +322 -0
- package/lib/dist/mcp/explore-session-state.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +24 -0
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +67 -6
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +3 -1
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +6 -1
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/server-instructions.d.ts +2 -2
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +8 -3
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +16 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +36 -13
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts +276 -10
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +2425 -237
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/project-config.d.ts +23 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +39 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +582 -138
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +54 -10
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +287 -167
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cooperative-yield.d.ts +10 -2
- package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -1
- package/lib/dist/resolution/cooperative-yield.js +6 -4
- package/lib/dist/resolution/cooperative-yield.js.map +1 -1
- package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/go.js +29 -6
- package/lib/dist/resolution/frameworks/go.js.map +1 -1
- package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/swift.js +11 -1
- package/lib/dist/resolution/frameworks/swift.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +2 -3
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +184 -9
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +87 -2
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +731 -134
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/memory-budget.d.ts +48 -0
- package/lib/dist/resolution/memory-budget.d.ts.map +1 -0
- package/lib/dist/resolution/memory-budget.js +162 -0
- package/lib/dist/resolution/memory-budget.js.map +1 -0
- package/lib/dist/resolution/name-matcher.d.ts +42 -1
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +681 -99
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/path-aliases.d.ts +6 -4
- package/lib/dist/resolution/path-aliases.d.ts.map +1 -1
- package/lib/dist/resolution/path-aliases.js +125 -17
- package/lib/dist/resolution/path-aliases.js.map +1 -1
- package/lib/dist/resolution/resolver-pool.d.ts +106 -0
- package/lib/dist/resolution/resolver-pool.d.ts.map +1 -0
- package/lib/dist/resolution/resolver-pool.js +344 -0
- package/lib/dist/resolution/resolver-pool.js.map +1 -0
- package/lib/dist/resolution/resolver-worker.d.ts +17 -0
- package/lib/dist/resolution/resolver-worker.d.ts.map +1 -0
- package/lib/dist/resolution/resolver-worker.js +141 -0
- package/lib/dist/resolution/resolver-worker.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +3 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/search/identifier-segments.d.ts +10 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -1
- package/lib/dist/search/identifier-segments.js +29 -0
- package/lib/dist/search/identifier-segments.js.map +1 -1
- package/lib/dist/search/query-paths.d.ts +57 -0
- package/lib/dist/search/query-paths.d.ts.map +1 -0
- package/lib/dist/search/query-paths.js +298 -0
- package/lib/dist/search/query-paths.js.map +1 -0
- package/lib/dist/search/query-utils.d.ts +1 -1
- package/lib/dist/search/query-utils.d.ts.map +1 -1
- package/lib/dist/search/query-utils.js +13 -3
- package/lib/dist/search/query-utils.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +47 -1
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +127 -8
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/types.d.ts +61 -3
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +27 -1
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/ui/color.d.ts +21 -0
- package/lib/dist/ui/color.d.ts.map +1 -0
- package/lib/dist/ui/color.js +42 -0
- package/lib/dist/ui/color.js.map +1 -0
- package/lib/dist/ui/glyphs.d.ts +35 -10
- package/lib/dist/ui/glyphs.d.ts.map +1 -1
- package/lib/dist/ui/glyphs.js +59 -12
- package/lib/dist/ui/glyphs.js.map +1 -1
- package/lib/dist/ui/shimmer-progress.d.ts.map +1 -1
- package/lib/dist/ui/shimmer-progress.js +78 -4
- package/lib/dist/ui/shimmer-progress.js.map +1 -1
- package/lib/dist/ui/shimmer-worker.js +25 -17
- package/lib/dist/ui/shimmer-worker.js.map +1 -1
- package/lib/dist/ui/types.d.ts +0 -2
- package/lib/dist/ui/types.d.ts.map +1 -1
- package/lib/dist/upgrade/index.d.ts +7 -0
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +18 -5
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/kernel/codegraph-kernel.node +0 -0
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +6 -1
- package/package.json +6 -2
package/lib/dist/db/index.d.ts
CHANGED
|
@@ -6,6 +6,20 @@
|
|
|
6
6
|
import { SqliteDatabase, SqliteBackend } from './sqlite-adapter';
|
|
7
7
|
import { SchemaVersion } from '../types';
|
|
8
8
|
export { SqliteDatabase, SqliteBackend } from './sqlite-adapter';
|
|
9
|
+
/**
|
|
10
|
+
* WAL size past which `healOversizedWal` (run at every `open`) checkpoints and
|
|
11
|
+
* truncates the file, and to which `journal_size_limit` clips the WAL after any
|
|
12
|
+
* resetting checkpoint. A SIGKILL'd process (the #850 liveness watchdog, OOM,
|
|
13
|
+
* crash) can leave an arbitrarily large WAL behind — a whole deferred-sync
|
|
14
|
+
* run's worth (#1248) — and before #1431 no later session ever shrank it: the
|
|
15
|
+
* file just grew, killed session after killed session, until the disk filled
|
|
16
|
+
* (25.6 GB observed). 64 MB is far above anything a healthy open ever sees
|
|
17
|
+
* (a clean close deletes the WAL) yet small enough to cap the leak.
|
|
18
|
+
* Override with `CODEGRAPH_WAL_HEAL_MB` (also feeds `journal_size_limit`).
|
|
19
|
+
*/
|
|
20
|
+
export declare const WAL_HEAL_THRESHOLD_BYTES: number;
|
|
21
|
+
/** Resolve the heal threshold from the env override (MB); invalid ⇒ 64 MB. */
|
|
22
|
+
export declare function resolveWalHealBytes(envVal: string | undefined): number;
|
|
9
23
|
/**
|
|
10
24
|
* Database connection wrapper with lifecycle management
|
|
11
25
|
*/
|
|
@@ -31,6 +45,129 @@ export declare class DatabaseConnection {
|
|
|
31
45
|
* Open an existing database
|
|
32
46
|
*/
|
|
33
47
|
static open(dbPath: string): DatabaseConnection;
|
|
48
|
+
/**
|
|
49
|
+
* FTS maintenance triggers dropped/recreated around a bulk load.
|
|
50
|
+
* Names must match schema.sql.
|
|
51
|
+
*/
|
|
52
|
+
private static readonly FTS_TRIGGER_NAMES;
|
|
53
|
+
/**
|
|
54
|
+
* Enter bulk-load mode: drop the per-row FTS sync triggers so mass node
|
|
55
|
+
* inserts skip per-row tokenization. MUST be paired with endBulkNodeLoad()
|
|
56
|
+
* (use try/finally); a crash inside the window is healed on the next open().
|
|
57
|
+
* The window is DB-wide (triggers are schema objects), which is safe because
|
|
58
|
+
* endBulkNodeLoad() rebuilds nodes_fts from the nodes table wholesale — any
|
|
59
|
+
* row written by anyone during the window is captured by the rebuild.
|
|
60
|
+
*/
|
|
61
|
+
beginBulkNodeLoad(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Leave bulk-load mode: rebuild the whole FTS index from the nodes table in
|
|
64
|
+
* one pass (far cheaper than per-row trigger firings), then recreate the
|
|
65
|
+
* triggers by re-running schema.sql (idempotent — everything in it is
|
|
66
|
+
* IF NOT EXISTS).
|
|
67
|
+
*/
|
|
68
|
+
endBulkNodeLoad(): void;
|
|
69
|
+
/**
|
|
70
|
+
* NON-UNIQUE secondary indexes maintained per-row during the parse phase's
|
|
71
|
+
* bulk inserts — the store-architecture arc's first lever (plan §4d: dubbo's
|
|
72
|
+
* parse-loop wall is 94% store-writer busy, and the #1320 post-mortem showed
|
|
73
|
+
* statement batching and sorted inserts are ~zero on this path because
|
|
74
|
+
* B-TREE MAINTENANCE is the floor). A fresh init writes every row of
|
|
75
|
+
* nodes/unresolved_refs/files exactly once and reads none of them until
|
|
76
|
+
* resolution, so the parse window can drop all of these and rebuild each in
|
|
77
|
+
* one table scan afterwards — the same measured trade as the resolution
|
|
78
|
+
* phase's edge-index window (2.8s → 1.1s inserting, ~0.3s recreating).
|
|
79
|
+
* Primary keys and UNIQUE constraints stay (upserts and OR-IGNORE dedup
|
|
80
|
+
* conflict on them).
|
|
81
|
+
*/
|
|
82
|
+
private static readonly BULK_PARSE_INDEX_NAMES;
|
|
83
|
+
/**
|
|
84
|
+
* Enter bulk-parse-load mode (FRESH-INIT ONLY — the caller gates on a fresh
|
|
85
|
+
* DB, because an incremental index deletes per-file rows mid-phase and needs
|
|
86
|
+
* the file_path indexes): drop every parse-lane secondary index, including
|
|
87
|
+
* the four non-unique edge indexes (parse inserts contains-edges too; the
|
|
88
|
+
* UNIQUE identity index stays for INSERT OR IGNORE dedup, and its `source`
|
|
89
|
+
* prefix keeps source-keyed reads indexed, as in the edge window). MUST be
|
|
90
|
+
* paired with endBulkParseLoad(); a crash inside the window is healed on the
|
|
91
|
+
* next DatabaseConnection open (schema.sql re-applies CREATE INDEX IF NOT
|
|
92
|
+
* EXISTS).
|
|
93
|
+
*/
|
|
94
|
+
beginBulkParseLoad(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Leave bulk-parse-load mode: recreate everything the window dropped, one
|
|
97
|
+
* table scan per index, with a yield between statements (same
|
|
98
|
+
* liveness-watchdog rationale as endBulkEdgeLoad — at kernel scale each
|
|
99
|
+
* build is a long synchronous scan). The edge indexes are rebuilt here too,
|
|
100
|
+
* so paths that never enter the resolution phase's own bulk-edge window
|
|
101
|
+
* (small runs) are left with a complete schema; the batched resolver's
|
|
102
|
+
* beginBulkEdgeLoad simply re-drops them (DROP IF EXISTS — idempotent).
|
|
103
|
+
*/
|
|
104
|
+
endBulkParseLoad(): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* unresolved_refs secondary indexes NOT read by the batched resolution
|
|
107
|
+
* loop. The loop pages pending refs by keyset (`status='pending' AND id>?`
|
|
108
|
+
* — the status index + PK), deletes resolved rows by id, and parks failures
|
|
109
|
+
* with a status UPDATE; every other ref index serves SYNC-time paths
|
|
110
|
+
* (per-file re-index deletes, name-keyed retry, failed-tail heal). Each
|
|
111
|
+
* per-batch DELETE maintains all of them — the biggest single main-thread
|
|
112
|
+
* stage on the dubbo profile (deletes 1.2s of a 5.4s resolution phase) —
|
|
113
|
+
* so the batched loop drops them and rebuilds at the end, where the table
|
|
114
|
+
* holds only the surviving FAILED refs (resolved rows are gone), making
|
|
115
|
+
* the recreate near-free.
|
|
116
|
+
*/
|
|
117
|
+
private static readonly BULK_REF_INDEX_NAMES;
|
|
118
|
+
/**
|
|
119
|
+
* Enter bulk-ref mode for the batched resolution loop — see
|
|
120
|
+
* BULK_REF_INDEX_NAMES. MUST be paired with endBulkRefLoad(); a crash
|
|
121
|
+
* inside the window heals on the next open (schema.sql re-applies
|
|
122
|
+
* CREATE INDEX IF NOT EXISTS).
|
|
123
|
+
*/
|
|
124
|
+
beginBulkRefLoad(): void;
|
|
125
|
+
/** Leave bulk-ref mode: recreate each index in one scan (yield between). */
|
|
126
|
+
endBulkRefLoad(): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Names of the NON-UNIQUE edge indexes dropped for a bulk edge load.
|
|
129
|
+
* idx_edges_identity deliberately stays: INSERT OR IGNORE's dedup conflicts
|
|
130
|
+
* on it (#1034), and its leftmost column is `source`, so the source-keyed
|
|
131
|
+
* reads resolution makes mid-window (supertype walks over
|
|
132
|
+
* `implements`/`extends`) keep an index via its prefix — verified with
|
|
133
|
+
* EXPLAIN QUERY PLAN. Target-keyed and kind-keyed reads (traversal,
|
|
134
|
+
* synthesis) happen only after endBulkEdgeLoad().
|
|
135
|
+
*/
|
|
136
|
+
private static readonly BULK_EDGE_INDEX_NAMES;
|
|
137
|
+
/**
|
|
138
|
+
* Enter bulk-edge-load mode: drop the non-unique edge indexes so the mass
|
|
139
|
+
* INSERT OR IGNORE stream pays one B-tree (the identity index) instead of
|
|
140
|
+
* five — measured 2.8s → 1.1s inserting a 224k-edge resolution set, with
|
|
141
|
+
* recreation costing ~0.3s. MUST be paired with endBulkEdgeLoad(); a crash
|
|
142
|
+
* inside the window is healed on the next DatabaseConnection open (schema.sql
|
|
143
|
+
* re-applies CREATE INDEX IF NOT EXISTS).
|
|
144
|
+
*/
|
|
145
|
+
beginBulkEdgeLoad(): void;
|
|
146
|
+
/**
|
|
147
|
+
* Leave bulk-edge-load mode: recreate the dropped indexes in one pass each
|
|
148
|
+
* over the (now fully loaded) edges table — far cheaper than maintaining
|
|
149
|
+
* them per-insert. DDL is extracted from schema.sql so it cannot drift.
|
|
150
|
+
*
|
|
151
|
+
* Async with a yield BETWEEN the four CREATE INDEX statements: each build is
|
|
152
|
+
* a synchronous scan of the whole edges table (~20s apiece at Linux-kernel
|
|
153
|
+
* scale, 79s total measured), and running them back-to-back is a single
|
|
154
|
+
* event-loop stall longer than the #850 liveness watchdog's 60s window — a
|
|
155
|
+
* daemon-triggered re-index would be SIGKILLed right after doing the work.
|
|
156
|
+
* One yield per statement keeps every stall to a single index build, which
|
|
157
|
+
* stays inside the window.
|
|
158
|
+
*/
|
|
159
|
+
endBulkEdgeLoad(): Promise<void>;
|
|
160
|
+
/** Recreate the FTS triggers + rebuild if a bulk-load window never closed. */
|
|
161
|
+
private healBulkNodeLoad;
|
|
162
|
+
/** Recreate every secondary index a killed bulk parse/ref/edge window may leave dropped. */
|
|
163
|
+
private healBulkSecondaryIndexes;
|
|
164
|
+
/**
|
|
165
|
+
* Recreate the FTS sync triggers from schema.sql — extracted from the file
|
|
166
|
+
* rather than duplicated here so the DDL cannot drift from the schema.
|
|
167
|
+
* (Re-execing the whole schema is not an option: it contains data INSERTs
|
|
168
|
+
* that are not idempotent, e.g. schema_versions.)
|
|
169
|
+
*/
|
|
170
|
+
private recreateFtsTriggers;
|
|
34
171
|
/**
|
|
35
172
|
* Get the underlying database instance
|
|
36
173
|
*/
|
|
@@ -73,6 +210,9 @@ export declare class DatabaseConnection {
|
|
|
73
210
|
* journal mode, in-memory DB, or no write since the last checkpoint+reset).
|
|
74
211
|
*/
|
|
75
212
|
getWalSizeBytes(): number;
|
|
213
|
+
/** Size of the main DB file in bytes (0 for in-memory/unknown) — the WAL
|
|
214
|
+
* valve scales its fold caps with it (resolveWalValveMb). */
|
|
215
|
+
getDbFileSizeBytes(): number;
|
|
76
216
|
/** Current `wal_autocheckpoint` interval in pages (0 = disabled). */
|
|
77
217
|
getWalAutocheckpoint(): number;
|
|
78
218
|
/**
|
|
@@ -106,6 +246,45 @@ export declare class DatabaseConnection {
|
|
|
106
246
|
log: number;
|
|
107
247
|
checkpointed: number;
|
|
108
248
|
} | null>;
|
|
249
|
+
/**
|
|
250
|
+
* `PRAGMA wal_checkpoint(TRUNCATE)` — same off-thread pattern as PASSIVE,
|
|
251
|
+
* but on success the WAL FILE is chopped to zero. A completed passive
|
|
252
|
+
* backfill bounds the un-checkpointed backlog, yet the FILE only stops
|
|
253
|
+
* growing when a commit finds ZERO readers holding WAL marks — rare while
|
|
254
|
+
* pool workers cycle, so at kernel scale a fully-backfilled WAL still
|
|
255
|
+
* accreted the phase's whole write volume on disk (§7a.1: 22GB). The valve
|
|
256
|
+
* calls this exactly at a parked barrier (writer parked, pool drained,
|
|
257
|
+
* backfill complete) where the no-reader condition is guaranteed rather
|
|
258
|
+
* than lucky. The worker sets a short busy_timeout so a racing reader
|
|
259
|
+
* degrades this to a no-op (busy=1) instead of a stall.
|
|
260
|
+
*/
|
|
261
|
+
checkpointWalTruncate(): Promise<{
|
|
262
|
+
busy: number;
|
|
263
|
+
log: number;
|
|
264
|
+
checkpointed: number;
|
|
265
|
+
} | null>;
|
|
266
|
+
/**
|
|
267
|
+
* Shrink a leftover oversized WAL (#1431). A SIGKILL'd session — the #850
|
|
268
|
+
* liveness watchdog, OOM, a crash — leaves its WAL on disk, the next session
|
|
269
|
+
* appends to the same file, and (pre-#1431) nothing ever truncated it:
|
|
270
|
+
* PASSIVE checkpoints fold frames but keep the file at its high-water mark,
|
|
271
|
+
* and the one shrinking path (a clean last-connection close) is exactly what
|
|
272
|
+
* the killed world never takes. Unbounded growth until the disk fills.
|
|
273
|
+
*
|
|
274
|
+
* Called fire-and-forget from every `open()`: cost is one statSync when the
|
|
275
|
+
* WAL is small (the overwhelmingly common case). Past the threshold it runs
|
|
276
|
+
* the off-thread PASSIVE fold then TRUNCATE — both on worker connections
|
|
277
|
+
* with a busy_timeout, so a racing writer degrades this to a no-op that the
|
|
278
|
+
* next open retries rather than a stall.
|
|
279
|
+
*/
|
|
280
|
+
healOversizedWal(): Promise<{
|
|
281
|
+
healed: boolean;
|
|
282
|
+
beforeBytes: number;
|
|
283
|
+
afterBytes: number;
|
|
284
|
+
}>;
|
|
285
|
+
private walHeal;
|
|
286
|
+
private runWalHeal;
|
|
287
|
+
private checkpointWal;
|
|
109
288
|
/**
|
|
110
289
|
* Optimize database (vacuum and analyze)
|
|
111
290
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,kBAAkB,CAAC;AAGjF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"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"}
|
package/lib/dist/db/index.js
CHANGED
|
@@ -38,7 +38,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
};
|
|
39
39
|
})();
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.DATABASE_FILENAME = exports.DatabaseConnection = void 0;
|
|
41
|
+
exports.DATABASE_FILENAME = exports.DatabaseConnection = exports.WAL_HEAL_THRESHOLD_BYTES = void 0;
|
|
42
|
+
exports.resolveWalHealBytes = resolveWalHealBytes;
|
|
42
43
|
exports.getDatabasePath = getDatabasePath;
|
|
43
44
|
exports.removeDatabaseFiles = removeDatabaseFiles;
|
|
44
45
|
const sqlite_adapter_1 = require("./sqlite-adapter");
|
|
@@ -68,6 +69,34 @@ function configureConnection(db) {
|
|
|
68
69
|
db.pragma('cache_size = -64000'); // 64 MB page cache
|
|
69
70
|
db.pragma('temp_store = MEMORY'); // temp tables in memory
|
|
70
71
|
db.pragma('mmap_size = 268435456'); // 256 MB memory-mapped I/O
|
|
72
|
+
// Without a journal_size_limit the -wal file never shrinks below its
|
|
73
|
+
// high-water mark while a connection lives: checkpoints fold frames back but
|
|
74
|
+
// leave the file at full size, so one giant deferred-sync WAL stays giant
|
|
75
|
+
// forever. With the limit set, any checkpoint that resets the WAL truncates
|
|
76
|
+
// the file back down. Killed-process leftovers are handled separately by
|
|
77
|
+
// healOversizedWal() at open. (#1431)
|
|
78
|
+
db.pragma(`journal_size_limit = ${exports.WAL_HEAL_THRESHOLD_BYTES}`);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* WAL size past which `healOversizedWal` (run at every `open`) checkpoints and
|
|
82
|
+
* truncates the file, and to which `journal_size_limit` clips the WAL after any
|
|
83
|
+
* resetting checkpoint. A SIGKILL'd process (the #850 liveness watchdog, OOM,
|
|
84
|
+
* crash) can leave an arbitrarily large WAL behind — a whole deferred-sync
|
|
85
|
+
* run's worth (#1248) — and before #1431 no later session ever shrank it: the
|
|
86
|
+
* file just grew, killed session after killed session, until the disk filled
|
|
87
|
+
* (25.6 GB observed). 64 MB is far above anything a healthy open ever sees
|
|
88
|
+
* (a clean close deletes the WAL) yet small enough to cap the leak.
|
|
89
|
+
* Override with `CODEGRAPH_WAL_HEAL_MB` (also feeds `journal_size_limit`).
|
|
90
|
+
*/
|
|
91
|
+
exports.WAL_HEAL_THRESHOLD_BYTES = resolveWalHealBytes(process.env.CODEGRAPH_WAL_HEAL_MB);
|
|
92
|
+
/** Resolve the heal threshold from the env override (MB); invalid ⇒ 64 MB. */
|
|
93
|
+
function resolveWalHealBytes(envVal) {
|
|
94
|
+
if (envVal !== undefined && envVal !== '') {
|
|
95
|
+
const n = Number(envVal);
|
|
96
|
+
if (Number.isFinite(n) && n > 0)
|
|
97
|
+
return Math.floor(n * 1024 * 1024);
|
|
98
|
+
}
|
|
99
|
+
return 64 * 1024 * 1024;
|
|
71
100
|
}
|
|
72
101
|
/**
|
|
73
102
|
* Database connection wrapper with lifecycle management
|
|
@@ -129,8 +158,254 @@ class DatabaseConnection {
|
|
|
129
158
|
if (currentVersion < migrations_1.CURRENT_SCHEMA_VERSION) {
|
|
130
159
|
(0, migrations_1.runMigrations)(db, currentVersion);
|
|
131
160
|
}
|
|
161
|
+
// Self-heal a bulk-load window that never closed (crash between
|
|
162
|
+
// beginBulkNodeLoad and endBulkNodeLoad): the FTS triggers are missing and
|
|
163
|
+
// nodes_fts is stale. Rebuild + recreate so search stays in sync.
|
|
164
|
+
conn.healBulkNodeLoad();
|
|
165
|
+
conn.healBulkSecondaryIndexes();
|
|
166
|
+
// Self-heal a killed session's leftover oversized WAL (#1431) — one
|
|
167
|
+
// statSync when healthy, off-thread checkpoint+truncate when not.
|
|
168
|
+
void conn.healOversizedWal();
|
|
132
169
|
return conn;
|
|
133
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* FTS maintenance triggers dropped/recreated around a bulk load.
|
|
173
|
+
* Names must match schema.sql.
|
|
174
|
+
*/
|
|
175
|
+
static FTS_TRIGGER_NAMES = ['nodes_ai', 'nodes_ad', 'nodes_au'];
|
|
176
|
+
/**
|
|
177
|
+
* Enter bulk-load mode: drop the per-row FTS sync triggers so mass node
|
|
178
|
+
* inserts skip per-row tokenization. MUST be paired with endBulkNodeLoad()
|
|
179
|
+
* (use try/finally); a crash inside the window is healed on the next open().
|
|
180
|
+
* The window is DB-wide (triggers are schema objects), which is safe because
|
|
181
|
+
* endBulkNodeLoad() rebuilds nodes_fts from the nodes table wholesale — any
|
|
182
|
+
* row written by anyone during the window is captured by the rebuild.
|
|
183
|
+
*/
|
|
184
|
+
beginBulkNodeLoad() {
|
|
185
|
+
for (const t of DatabaseConnection.FTS_TRIGGER_NAMES) {
|
|
186
|
+
this.db.exec(`DROP TRIGGER IF EXISTS ${t}`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Leave bulk-load mode: rebuild the whole FTS index from the nodes table in
|
|
191
|
+
* one pass (far cheaper than per-row trigger firings), then recreate the
|
|
192
|
+
* triggers by re-running schema.sql (idempotent — everything in it is
|
|
193
|
+
* IF NOT EXISTS).
|
|
194
|
+
*/
|
|
195
|
+
endBulkNodeLoad() {
|
|
196
|
+
this.db.exec(`INSERT INTO nodes_fts(nodes_fts) VALUES('rebuild')`);
|
|
197
|
+
this.recreateFtsTriggers();
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* NON-UNIQUE secondary indexes maintained per-row during the parse phase's
|
|
201
|
+
* bulk inserts — the store-architecture arc's first lever (plan §4d: dubbo's
|
|
202
|
+
* parse-loop wall is 94% store-writer busy, and the #1320 post-mortem showed
|
|
203
|
+
* statement batching and sorted inserts are ~zero on this path because
|
|
204
|
+
* B-TREE MAINTENANCE is the floor). A fresh init writes every row of
|
|
205
|
+
* nodes/unresolved_refs/files exactly once and reads none of them until
|
|
206
|
+
* resolution, so the parse window can drop all of these and rebuild each in
|
|
207
|
+
* one table scan afterwards — the same measured trade as the resolution
|
|
208
|
+
* phase's edge-index window (2.8s → 1.1s inserting, ~0.3s recreating).
|
|
209
|
+
* Primary keys and UNIQUE constraints stay (upserts and OR-IGNORE dedup
|
|
210
|
+
* conflict on them).
|
|
211
|
+
*/
|
|
212
|
+
static BULK_PARSE_INDEX_NAMES = [
|
|
213
|
+
'idx_nodes_kind',
|
|
214
|
+
'idx_nodes_name',
|
|
215
|
+
'idx_nodes_qualified_name',
|
|
216
|
+
'idx_nodes_file_path',
|
|
217
|
+
'idx_nodes_language',
|
|
218
|
+
'idx_nodes_file_line',
|
|
219
|
+
'idx_nodes_lower_name',
|
|
220
|
+
'idx_unresolved_from_node',
|
|
221
|
+
'idx_unresolved_name',
|
|
222
|
+
'idx_unresolved_file_path',
|
|
223
|
+
'idx_unresolved_from_name',
|
|
224
|
+
'idx_unresolved_status',
|
|
225
|
+
'idx_unresolved_failed_tail',
|
|
226
|
+
'idx_files_language',
|
|
227
|
+
'idx_files_modified_at',
|
|
228
|
+
];
|
|
229
|
+
/**
|
|
230
|
+
* Enter bulk-parse-load mode (FRESH-INIT ONLY — the caller gates on a fresh
|
|
231
|
+
* DB, because an incremental index deletes per-file rows mid-phase and needs
|
|
232
|
+
* the file_path indexes): drop every parse-lane secondary index, including
|
|
233
|
+
* the four non-unique edge indexes (parse inserts contains-edges too; the
|
|
234
|
+
* UNIQUE identity index stays for INSERT OR IGNORE dedup, and its `source`
|
|
235
|
+
* prefix keeps source-keyed reads indexed, as in the edge window). MUST be
|
|
236
|
+
* paired with endBulkParseLoad(); a crash inside the window is healed on the
|
|
237
|
+
* next DatabaseConnection open (schema.sql re-applies CREATE INDEX IF NOT
|
|
238
|
+
* EXISTS).
|
|
239
|
+
*/
|
|
240
|
+
beginBulkParseLoad() {
|
|
241
|
+
for (const idx of DatabaseConnection.BULK_PARSE_INDEX_NAMES) {
|
|
242
|
+
this.db.exec(`DROP INDEX IF EXISTS ${idx}`);
|
|
243
|
+
}
|
|
244
|
+
this.beginBulkEdgeLoad();
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Leave bulk-parse-load mode: recreate everything the window dropped, one
|
|
248
|
+
* table scan per index, with a yield between statements (same
|
|
249
|
+
* liveness-watchdog rationale as endBulkEdgeLoad — at kernel scale each
|
|
250
|
+
* build is a long synchronous scan). The edge indexes are rebuilt here too,
|
|
251
|
+
* so paths that never enter the resolution phase's own bulk-edge window
|
|
252
|
+
* (small runs) are left with a complete schema; the batched resolver's
|
|
253
|
+
* beginBulkEdgeLoad simply re-drops them (DROP IF EXISTS — idempotent).
|
|
254
|
+
*/
|
|
255
|
+
async endBulkParseLoad() {
|
|
256
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
257
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
258
|
+
for (const idx of DatabaseConnection.BULK_PARSE_INDEX_NAMES) {
|
|
259
|
+
const m = schema.match(new RegExp(`CREATE INDEX IF NOT EXISTS ${idx}\\b[^;]*;`));
|
|
260
|
+
if (!m)
|
|
261
|
+
throw new Error(`schema.sql: parse index ${idx} not found for bulk-load recreation`);
|
|
262
|
+
this.db.exec(m[0]);
|
|
263
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
264
|
+
}
|
|
265
|
+
await this.endBulkEdgeLoad();
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* unresolved_refs secondary indexes NOT read by the batched resolution
|
|
269
|
+
* loop. The loop pages pending refs by keyset (`status='pending' AND id>?`
|
|
270
|
+
* — the status index + PK), deletes resolved rows by id, and parks failures
|
|
271
|
+
* with a status UPDATE; every other ref index serves SYNC-time paths
|
|
272
|
+
* (per-file re-index deletes, name-keyed retry, failed-tail heal). Each
|
|
273
|
+
* per-batch DELETE maintains all of them — the biggest single main-thread
|
|
274
|
+
* stage on the dubbo profile (deletes 1.2s of a 5.4s resolution phase) —
|
|
275
|
+
* so the batched loop drops them and rebuilds at the end, where the table
|
|
276
|
+
* holds only the surviving FAILED refs (resolved rows are gone), making
|
|
277
|
+
* the recreate near-free.
|
|
278
|
+
*/
|
|
279
|
+
static BULK_REF_INDEX_NAMES = [
|
|
280
|
+
'idx_unresolved_from_node',
|
|
281
|
+
'idx_unresolved_name',
|
|
282
|
+
'idx_unresolved_file_path',
|
|
283
|
+
'idx_unresolved_from_name',
|
|
284
|
+
'idx_unresolved_failed_tail',
|
|
285
|
+
];
|
|
286
|
+
/**
|
|
287
|
+
* Enter bulk-ref mode for the batched resolution loop — see
|
|
288
|
+
* BULK_REF_INDEX_NAMES. MUST be paired with endBulkRefLoad(); a crash
|
|
289
|
+
* inside the window heals on the next open (schema.sql re-applies
|
|
290
|
+
* CREATE INDEX IF NOT EXISTS).
|
|
291
|
+
*/
|
|
292
|
+
beginBulkRefLoad() {
|
|
293
|
+
for (const idx of DatabaseConnection.BULK_REF_INDEX_NAMES) {
|
|
294
|
+
this.db.exec(`DROP INDEX IF EXISTS ${idx}`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
/** Leave bulk-ref mode: recreate each index in one scan (yield between). */
|
|
298
|
+
async endBulkRefLoad() {
|
|
299
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
300
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
301
|
+
for (const idx of DatabaseConnection.BULK_REF_INDEX_NAMES) {
|
|
302
|
+
const m = schema.match(new RegExp(`CREATE INDEX IF NOT EXISTS ${idx}\\b[^;]*;`));
|
|
303
|
+
if (!m)
|
|
304
|
+
throw new Error(`schema.sql: ref index ${idx} not found for bulk-load recreation`);
|
|
305
|
+
this.db.exec(m[0]);
|
|
306
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Names of the NON-UNIQUE edge indexes dropped for a bulk edge load.
|
|
311
|
+
* idx_edges_identity deliberately stays: INSERT OR IGNORE's dedup conflicts
|
|
312
|
+
* on it (#1034), and its leftmost column is `source`, so the source-keyed
|
|
313
|
+
* reads resolution makes mid-window (supertype walks over
|
|
314
|
+
* `implements`/`extends`) keep an index via its prefix — verified with
|
|
315
|
+
* EXPLAIN QUERY PLAN. Target-keyed and kind-keyed reads (traversal,
|
|
316
|
+
* synthesis) happen only after endBulkEdgeLoad().
|
|
317
|
+
*/
|
|
318
|
+
static BULK_EDGE_INDEX_NAMES = [
|
|
319
|
+
'idx_edges_kind',
|
|
320
|
+
'idx_edges_source_kind',
|
|
321
|
+
'idx_edges_target_kind',
|
|
322
|
+
'idx_edges_provenance',
|
|
323
|
+
];
|
|
324
|
+
/**
|
|
325
|
+
* Enter bulk-edge-load mode: drop the non-unique edge indexes so the mass
|
|
326
|
+
* INSERT OR IGNORE stream pays one B-tree (the identity index) instead of
|
|
327
|
+
* five — measured 2.8s → 1.1s inserting a 224k-edge resolution set, with
|
|
328
|
+
* recreation costing ~0.3s. MUST be paired with endBulkEdgeLoad(); a crash
|
|
329
|
+
* inside the window is healed on the next DatabaseConnection open (schema.sql
|
|
330
|
+
* re-applies CREATE INDEX IF NOT EXISTS).
|
|
331
|
+
*/
|
|
332
|
+
beginBulkEdgeLoad() {
|
|
333
|
+
for (const idx of DatabaseConnection.BULK_EDGE_INDEX_NAMES) {
|
|
334
|
+
this.db.exec(`DROP INDEX IF EXISTS ${idx}`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Leave bulk-edge-load mode: recreate the dropped indexes in one pass each
|
|
339
|
+
* over the (now fully loaded) edges table — far cheaper than maintaining
|
|
340
|
+
* them per-insert. DDL is extracted from schema.sql so it cannot drift.
|
|
341
|
+
*
|
|
342
|
+
* Async with a yield BETWEEN the four CREATE INDEX statements: each build is
|
|
343
|
+
* a synchronous scan of the whole edges table (~20s apiece at Linux-kernel
|
|
344
|
+
* scale, 79s total measured), and running them back-to-back is a single
|
|
345
|
+
* event-loop stall longer than the #850 liveness watchdog's 60s window — a
|
|
346
|
+
* daemon-triggered re-index would be SIGKILLed right after doing the work.
|
|
347
|
+
* One yield per statement keeps every stall to a single index build, which
|
|
348
|
+
* stays inside the window.
|
|
349
|
+
*/
|
|
350
|
+
async endBulkEdgeLoad() {
|
|
351
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
352
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
353
|
+
for (const idx of DatabaseConnection.BULK_EDGE_INDEX_NAMES) {
|
|
354
|
+
const m = schema.match(new RegExp(`CREATE INDEX IF NOT EXISTS ${idx}\\b[^;]*;`));
|
|
355
|
+
if (!m)
|
|
356
|
+
throw new Error(`schema.sql: edge index ${idx} not found for bulk-load recreation`);
|
|
357
|
+
this.db.exec(m[0]);
|
|
358
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
/** Recreate the FTS triggers + rebuild if a bulk-load window never closed. */
|
|
362
|
+
healBulkNodeLoad() {
|
|
363
|
+
const row = this.db
|
|
364
|
+
.prepare(`SELECT count(*) AS c FROM sqlite_master WHERE type = 'trigger' AND name IN ('nodes_ai','nodes_ad','nodes_au')`)
|
|
365
|
+
.get();
|
|
366
|
+
if ((row?.c ?? 0) >= DatabaseConnection.FTS_TRIGGER_NAMES.length)
|
|
367
|
+
return;
|
|
368
|
+
this.endBulkNodeLoad();
|
|
369
|
+
}
|
|
370
|
+
/** Recreate every secondary index a killed bulk parse/ref/edge window may leave dropped. */
|
|
371
|
+
healBulkSecondaryIndexes() {
|
|
372
|
+
const names = [...new Set([
|
|
373
|
+
...DatabaseConnection.BULK_PARSE_INDEX_NAMES,
|
|
374
|
+
...DatabaseConnection.BULK_REF_INDEX_NAMES,
|
|
375
|
+
...DatabaseConnection.BULK_EDGE_INDEX_NAMES,
|
|
376
|
+
])];
|
|
377
|
+
const placeholders = names.map(() => '?').join(',');
|
|
378
|
+
const row = this.db
|
|
379
|
+
.prepare(`SELECT count(*) AS c FROM sqlite_master WHERE type = 'index' AND name IN (${placeholders})`)
|
|
380
|
+
.get(...names);
|
|
381
|
+
if ((row?.c ?? 0) >= names.length)
|
|
382
|
+
return;
|
|
383
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
384
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
385
|
+
for (const idx of names) {
|
|
386
|
+
const m = schema.match(new RegExp(`CREATE INDEX IF NOT EXISTS ${idx}\\b[^;]*;`));
|
|
387
|
+
if (!m)
|
|
388
|
+
throw new Error(`schema.sql: index ${idx} not found for crash recovery`);
|
|
389
|
+
this.db.exec(m[0]);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Recreate the FTS sync triggers from schema.sql — extracted from the file
|
|
394
|
+
* rather than duplicated here so the DDL cannot drift from the schema.
|
|
395
|
+
* (Re-execing the whole schema is not an option: it contains data INSERTs
|
|
396
|
+
* that are not idempotent, e.g. schema_versions.)
|
|
397
|
+
*/
|
|
398
|
+
recreateFtsTriggers() {
|
|
399
|
+
const schemaPath = path.join(__dirname, 'schema.sql');
|
|
400
|
+
const schema = fs.readFileSync(schemaPath, 'utf-8');
|
|
401
|
+
const triggerDdls = schema.match(/CREATE TRIGGER IF NOT EXISTS nodes_a[idu]\b[\s\S]*?END;/g);
|
|
402
|
+
if (!triggerDdls || triggerDdls.length !== DatabaseConnection.FTS_TRIGGER_NAMES.length) {
|
|
403
|
+
throw new Error(`schema.sql: expected ${DatabaseConnection.FTS_TRIGGER_NAMES.length} nodes FTS triggers, found ${triggerDdls?.length ?? 0}`);
|
|
404
|
+
}
|
|
405
|
+
for (const ddl of triggerDdls) {
|
|
406
|
+
this.db.exec(ddl);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
134
409
|
/**
|
|
135
410
|
* Get the underlying database instance
|
|
136
411
|
*/
|
|
@@ -211,6 +486,18 @@ class DatabaseConnection {
|
|
|
211
486
|
return 0;
|
|
212
487
|
}
|
|
213
488
|
}
|
|
489
|
+
/** Size of the main DB file in bytes (0 for in-memory/unknown) — the WAL
|
|
490
|
+
* valve scales its fold caps with it (resolveWalValveMb). */
|
|
491
|
+
getDbFileSizeBytes() {
|
|
492
|
+
if (!this.dbPath || this.dbPath === ':memory:')
|
|
493
|
+
return 0;
|
|
494
|
+
try {
|
|
495
|
+
return fs.statSync(this.dbPath).size;
|
|
496
|
+
}
|
|
497
|
+
catch {
|
|
498
|
+
return 0;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
214
501
|
/** Current `wal_autocheckpoint` interval in pages (0 = disabled). */
|
|
215
502
|
getWalAutocheckpoint() {
|
|
216
503
|
const v = this.db.pragma('wal_autocheckpoint', { simple: true });
|
|
@@ -246,9 +533,72 @@ class DatabaseConnection {
|
|
|
246
533
|
* never run inline on the main thread).
|
|
247
534
|
*/
|
|
248
535
|
async checkpointWalPassive() {
|
|
536
|
+
return this.checkpointWal('PASSIVE');
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* `PRAGMA wal_checkpoint(TRUNCATE)` — same off-thread pattern as PASSIVE,
|
|
540
|
+
* but on success the WAL FILE is chopped to zero. A completed passive
|
|
541
|
+
* backfill bounds the un-checkpointed backlog, yet the FILE only stops
|
|
542
|
+
* growing when a commit finds ZERO readers holding WAL marks — rare while
|
|
543
|
+
* pool workers cycle, so at kernel scale a fully-backfilled WAL still
|
|
544
|
+
* accreted the phase's whole write volume on disk (§7a.1: 22GB). The valve
|
|
545
|
+
* calls this exactly at a parked barrier (writer parked, pool drained,
|
|
546
|
+
* backfill complete) where the no-reader condition is guaranteed rather
|
|
547
|
+
* than lucky. The worker sets a short busy_timeout so a racing reader
|
|
548
|
+
* degrades this to a no-op (busy=1) instead of a stall.
|
|
549
|
+
*/
|
|
550
|
+
async checkpointWalTruncate() {
|
|
551
|
+
return this.checkpointWal('TRUNCATE');
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Shrink a leftover oversized WAL (#1431). A SIGKILL'd session — the #850
|
|
555
|
+
* liveness watchdog, OOM, a crash — leaves its WAL on disk, the next session
|
|
556
|
+
* appends to the same file, and (pre-#1431) nothing ever truncated it:
|
|
557
|
+
* PASSIVE checkpoints fold frames but keep the file at its high-water mark,
|
|
558
|
+
* and the one shrinking path (a clean last-connection close) is exactly what
|
|
559
|
+
* the killed world never takes. Unbounded growth until the disk fills.
|
|
560
|
+
*
|
|
561
|
+
* Called fire-and-forget from every `open()`: cost is one statSync when the
|
|
562
|
+
* WAL is small (the overwhelmingly common case). Past the threshold it runs
|
|
563
|
+
* the off-thread PASSIVE fold then TRUNCATE — both on worker connections
|
|
564
|
+
* with a busy_timeout, so a racing writer degrades this to a no-op that the
|
|
565
|
+
* next open retries rather than a stall.
|
|
566
|
+
*/
|
|
567
|
+
async healOversizedWal() {
|
|
568
|
+
const beforeBytes = this.getWalSizeBytes();
|
|
569
|
+
if (beforeBytes <= exports.WAL_HEAL_THRESHOLD_BYTES) {
|
|
570
|
+
return { healed: false, beforeBytes, afterBytes: beforeBytes };
|
|
571
|
+
}
|
|
572
|
+
// Single-flight: open() fires this fire-and-forget and callers may also
|
|
573
|
+
// invoke it explicitly. Two concurrent passes DEFEAT each other — each
|
|
574
|
+
// checkpoint worker sees the other as a busy reader and no-ops — so share
|
|
575
|
+
// one in-flight pass instead of racing.
|
|
576
|
+
this.walHeal ??= this.runWalHeal(beforeBytes).finally(() => { this.walHeal = null; });
|
|
577
|
+
return this.walHeal;
|
|
578
|
+
}
|
|
579
|
+
walHeal = null;
|
|
580
|
+
async runWalHeal(beforeBytes) {
|
|
581
|
+
// A racing reader/writer (another session healing the same file, a query
|
|
582
|
+
// pool warming up) degrades a checkpoint pass to a busy no-op — retry a
|
|
583
|
+
// few times before leaving the rest to the next open.
|
|
584
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
585
|
+
if (attempt > 0)
|
|
586
|
+
await new Promise((r) => setTimeout(r, 300));
|
|
587
|
+
await this.checkpointWalPassive();
|
|
588
|
+
await this.checkpointWalTruncate();
|
|
589
|
+
if (this.getWalSizeBytes() <= exports.WAL_HEAL_THRESHOLD_BYTES)
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
const afterBytes = this.getWalSizeBytes();
|
|
593
|
+
if (process.env.CODEGRAPH_WAL_VALVE_DEBUG) {
|
|
594
|
+
console.error(`[wal-heal] oversized WAL at open: ${Math.round(beforeBytes / (1024 * 1024))}MB -> ${Math.round(afterBytes / (1024 * 1024))}MB`);
|
|
595
|
+
}
|
|
596
|
+
return { healed: afterBytes < beforeBytes, beforeBytes, afterBytes };
|
|
597
|
+
}
|
|
598
|
+
async checkpointWal(mode) {
|
|
249
599
|
if (!this.dbPath || this.dbPath === ':memory:') {
|
|
250
600
|
try {
|
|
251
|
-
const row = this.db.prepare(
|
|
601
|
+
const row = this.db.prepare(`PRAGMA wal_checkpoint(${mode})`).get();
|
|
252
602
|
return row ? { busy: Number(row.busy), log: Number(row.log), checkpointed: Number(row.checkpointed) } : null;
|
|
253
603
|
}
|
|
254
604
|
catch {
|
|
@@ -260,13 +610,18 @@ class DatabaseConnection {
|
|
|
260
610
|
const workerSource = `
|
|
261
611
|
const { workerData, parentPort } = require('node:worker_threads');
|
|
262
612
|
let row = null;
|
|
613
|
+
let err = null;
|
|
263
614
|
try {
|
|
264
615
|
const { DatabaseSync } = require('node:sqlite');
|
|
265
616
|
const db = new DatabaseSync(workerData.dbPath);
|
|
266
|
-
|
|
617
|
+
const mode = workerData.mode === 'TRUNCATE' ? 'TRUNCATE' : 'PASSIVE';
|
|
618
|
+
try {
|
|
619
|
+
if (mode === 'TRUNCATE') db.exec('PRAGMA busy_timeout = 2000');
|
|
620
|
+
row = db.prepare('PRAGMA wal_checkpoint(' + mode + ')').get();
|
|
621
|
+
} catch (e) { err = String(e && e.message || e); }
|
|
267
622
|
try { db.close(); } catch {}
|
|
268
|
-
} catch {}
|
|
269
|
-
parentPort.postMessage({ row });
|
|
623
|
+
} catch (e) { err = err || String(e && e.message || e); }
|
|
624
|
+
parentPort.postMessage({ row, err });
|
|
270
625
|
`;
|
|
271
626
|
return await new Promise((resolve) => {
|
|
272
627
|
let settled = false;
|
|
@@ -277,8 +632,14 @@ class DatabaseConnection {
|
|
|
277
632
|
resolve(row ? { busy: Number(row.busy), log: Number(row.log), checkpointed: Number(row.checkpointed) } : null);
|
|
278
633
|
};
|
|
279
634
|
try {
|
|
280
|
-
const worker = new Worker(workerSource, { eval: true, workerData: { dbPath: this.dbPath } });
|
|
281
|
-
worker.once('message', (m) => {
|
|
635
|
+
const worker = new Worker(workerSource, { eval: true, workerData: { dbPath: this.dbPath, mode } });
|
|
636
|
+
worker.once('message', (m) => {
|
|
637
|
+
if (m?.err && process.env.CODEGRAPH_WAL_VALVE_DEBUG) {
|
|
638
|
+
console.error(`[wal-valve] checkpoint worker (${mode}): ${m.err}`);
|
|
639
|
+
}
|
|
640
|
+
void worker.terminate();
|
|
641
|
+
finish(m?.row ?? null);
|
|
642
|
+
});
|
|
282
643
|
worker.once('error', () => { void worker.terminate(); finish(null); });
|
|
283
644
|
worker.once('exit', () => finish(null));
|
|
284
645
|
}
|