gitnexus 1.6.6-rc.142 → 1.6.6-rc.144
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.
|
@@ -15,25 +15,6 @@
|
|
|
15
15
|
* from the same Database is the officially supported concurrency pattern.
|
|
16
16
|
*/
|
|
17
17
|
import lbug from '@ladybugdb/core';
|
|
18
|
-
/**
|
|
19
|
-
* Probe whether a Windows FTS extension binary is locally installed under
|
|
20
|
-
* ~/.lbdb/extension/<any-version>/win_amd64/fts/. Returns true on the first
|
|
21
|
-
* version dir whose libfts.lbug_extension exists on disk; false if the
|
|
22
|
-
* extension root is missing or contains no FTS binary.
|
|
23
|
-
*
|
|
24
|
-
* Gates the Windows skip-FTS-load guard below so we only skip the load
|
|
25
|
-
* when no extension binary is present. When at least one binary exists,
|
|
26
|
-
* loadFTSExtension is called with policy: 'load-only' — LadybugDB resolves
|
|
27
|
-
* LOAD EXTENSION fts to its version-specific path internally, and the
|
|
28
|
-
* ExtensionManager's tryLoad try/catch handles version-mismatch errors
|
|
29
|
-
* cleanly without ever attempting dlopen of a stale binary. The install
|
|
30
|
-
* path that the #1199/#1217 SIGSEGV documented is never exercised at
|
|
31
|
-
* query time.
|
|
32
|
-
*
|
|
33
|
-
* Exported so unit tests can exercise the probe directly against a
|
|
34
|
-
* temp-dir plus spied `os.homedir()` — see lbug-pool-win-fts-probe.test.ts.
|
|
35
|
-
*/
|
|
36
|
-
export declare function hasLocalWinFtsExtension(): Promise<boolean>;
|
|
37
18
|
/**
|
|
38
19
|
* Listeners notified when a pool entry is torn down (LRU eviction, idle
|
|
39
20
|
* timeout, explicit close). Used by upper layers (e.g. the BM25 search
|
|
@@ -15,49 +15,10 @@
|
|
|
15
15
|
* from the same Database is the officially supported concurrency pattern.
|
|
16
16
|
*/
|
|
17
17
|
import fs from 'fs/promises';
|
|
18
|
-
import os from 'os';
|
|
19
|
-
import path from 'path';
|
|
20
18
|
import lbug from '@ladybugdb/core';
|
|
21
19
|
import { isReadOnlyDbError, loadFTSExtension } from './lbug-adapter.js';
|
|
22
20
|
import { createLbugDatabase, isWalCorruptionError, toNativeSafePath, WAL_RECOVERY_SUGGESTION, } from './lbug-config.js';
|
|
23
21
|
import { isMissingFsError, isMissingShadowSidecarError, isReadOnlyShadowReplayError, preflightLbugSidecars, quarantineWalForMissingShadow, renameFailureMessage, statIfExists, } from './sidecar-recovery.js';
|
|
24
|
-
/**
|
|
25
|
-
* Probe whether a Windows FTS extension binary is locally installed under
|
|
26
|
-
* ~/.lbdb/extension/<any-version>/win_amd64/fts/. Returns true on the first
|
|
27
|
-
* version dir whose libfts.lbug_extension exists on disk; false if the
|
|
28
|
-
* extension root is missing or contains no FTS binary.
|
|
29
|
-
*
|
|
30
|
-
* Gates the Windows skip-FTS-load guard below so we only skip the load
|
|
31
|
-
* when no extension binary is present. When at least one binary exists,
|
|
32
|
-
* loadFTSExtension is called with policy: 'load-only' — LadybugDB resolves
|
|
33
|
-
* LOAD EXTENSION fts to its version-specific path internally, and the
|
|
34
|
-
* ExtensionManager's tryLoad try/catch handles version-mismatch errors
|
|
35
|
-
* cleanly without ever attempting dlopen of a stale binary. The install
|
|
36
|
-
* path that the #1199/#1217 SIGSEGV documented is never exercised at
|
|
37
|
-
* query time.
|
|
38
|
-
*
|
|
39
|
-
* Exported so unit tests can exercise the probe directly against a
|
|
40
|
-
* temp-dir plus spied `os.homedir()` — see lbug-pool-win-fts-probe.test.ts.
|
|
41
|
-
*/
|
|
42
|
-
export async function hasLocalWinFtsExtension() {
|
|
43
|
-
try {
|
|
44
|
-
const extRoot = path.join(os.homedir(), '.lbdb', 'extension');
|
|
45
|
-
const versions = await fs.readdir(extRoot);
|
|
46
|
-
for (const v of versions) {
|
|
47
|
-
try {
|
|
48
|
-
await fs.stat(path.join(extRoot, v, 'win_amd64', 'fts', 'libfts.lbug_extension'));
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
/* missing for this version, keep looking */
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
/* no .lbdb/extension dir */
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
22
|
const pool = new Map();
|
|
62
23
|
const poolCloseListeners = new Set();
|
|
63
24
|
/**
|
|
@@ -522,28 +483,7 @@ async function doInitLbug(repoId, dbPath) {
|
|
|
522
483
|
// install; analyze owns extension installation. If LOAD fails, search
|
|
523
484
|
// features degrade gracefully and the user-facing query path proceeds.
|
|
524
485
|
if (!shared.ftsLoaded) {
|
|
525
|
-
|
|
526
|
-
// *install* — the @ladybugdb/core out-of-process installer hits an unhandled
|
|
527
|
-
// error path that signals SIGSEGV instead of throwing (see #1199, #1217).
|
|
528
|
-
// The previous unconditional skip was over-broad: it also disabled FTS on
|
|
529
|
-
// hosts where the binary was already on disk and only needed LOAD, leaving
|
|
530
|
-
// BM25 silently degraded with no error path (see #1690).
|
|
531
|
-
//
|
|
532
|
-
// Probe ~/.lbdb/extension/*/win_amd64/fts/ first. If any binary is on disk
|
|
533
|
-
// we run loadFTSExtension(..., 'load-only'); the install path is never
|
|
534
|
-
// exercised, and LadybugDB's version-specific resolution + ExtensionManager
|
|
535
|
-
// try/catch handle stale/zero-byte siblings cleanly (verified empirically
|
|
536
|
-
// on Win10 + Node 22.19 + gitnexus 1.6.5 + @ladybugdb/core 0.16.1). With
|
|
537
|
-
// no binary at all, we fall back to the upstream skip so install-time
|
|
538
|
-
// SIGSEGV continues to be avoided.
|
|
539
|
-
if (process.platform === 'win32') {
|
|
540
|
-
shared.ftsLoaded = (await hasLocalWinFtsExtension())
|
|
541
|
-
? await loadFTSExtension(available[0], { policy: 'load-only' })
|
|
542
|
-
: true;
|
|
543
|
-
}
|
|
544
|
-
else {
|
|
545
|
-
shared.ftsLoaded = await loadFTSExtension(available[0], { policy: 'load-only' });
|
|
546
|
-
}
|
|
486
|
+
shared.ftsLoaded = await loadFTSExtension(available[0], { policy: 'load-only' });
|
|
547
487
|
}
|
|
548
488
|
// Register pool entry only after all connections are pre-warmed and FTS is
|
|
549
489
|
// loaded. Concurrent executeQuery calls see either "not initialized"
|
|
@@ -599,16 +539,8 @@ export async function initLbugWithDb(repoId, existingDb, dbPath) {
|
|
|
599
539
|
// Load FTS extension if not already loaded on this Database.
|
|
600
540
|
// policy: 'load-only' — same contract as initLbug above; the read pool
|
|
601
541
|
// must not block on a network install during query execution.
|
|
602
|
-
// Windows guard: same probe-then-load policy as doInitLbug above.
|
|
603
542
|
if (!shared.ftsLoaded) {
|
|
604
|
-
|
|
605
|
-
shared.ftsLoaded = (await hasLocalWinFtsExtension())
|
|
606
|
-
? await loadFTSExtension(available[0], { policy: 'load-only' })
|
|
607
|
-
: true;
|
|
608
|
-
}
|
|
609
|
-
else {
|
|
610
|
-
shared.ftsLoaded = await loadFTSExtension(available[0], { policy: 'load-only' });
|
|
611
|
-
}
|
|
543
|
+
shared.ftsLoaded = await loadFTSExtension(available[0], { policy: 'load-only' });
|
|
612
544
|
}
|
|
613
545
|
pool.set(repoId, {
|
|
614
546
|
db: existingDb,
|
package/package.json
CHANGED
|
@@ -33,7 +33,7 @@ const PLATFORM_LOGIC = [
|
|
|
33
33
|
'test/unit/resolve-invocation.test.ts',
|
|
34
34
|
'test/unit/platform-capabilities.test.ts',
|
|
35
35
|
'test/unit/worker-pool-windows-quarantine.test.ts',
|
|
36
|
-
'test/unit/lbug-pool-
|
|
36
|
+
'test/unit/lbug-pool-fts-load.test.ts',
|
|
37
37
|
'test/unit/repo-manager.test.ts',
|
|
38
38
|
'test/unit/repo-manager-finalize-invariant.test.ts',
|
|
39
39
|
'test/unit/hooks.test.ts',
|