You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 18, 2026. It is now read-only.
The DiskANN extraction is **production-ready**. The extension successfully extracted from libSQL, fully decoupled, tested on all platforms, and packaged for distribution. Benchmark framework exists for validation, and PhotoStructure integration is tracked separately.
All DiskANN source files (`diskann_api.c`, `diskann_blob.c`, etc.) were calling SQLite functions directly without access to the `sqlite3_api` function pointer table required for extensions.
75
75
76
-
**Root Cause:**
77
-
All Node.js SQLite libraries statically link SQLite internally and don't export SQLite API symbols for dynamically loaded extensions. Our extension was built expecting to resolve symbols at runtime.
76
+
**Solution Implemented (see `_done/20260210-extension-loading-fix.md`):**
78
77
79
-
**Makefile currently uses:**
78
+
Created `src/diskann_sqlite.h` that conditionally handles SQLite includes:
80
79
81
-
```makefile
82
-
LDFLAGS = -shared -Wl,--allow-shlib-undefined
80
+
```c
81
+
#ifdef DISKANN_EXTENSION
82
+
#include <sqlite3ext.h>
83
+
#ifdef DISKANN_VTAB_MAIN
84
+
SQLITE_EXTENSION_INIT1 // Only in diskann_vtab.c
85
+
#else
86
+
extern const sqlite3_api_routines *sqlite3_api; // Other files
87
+
#endif
88
+
#else
89
+
#include<sqlite3.h>// Test builds
90
+
#endif
83
91
```
84
92
85
-
This allows undefined symbols but they still can't be resolved at runtime because the host process doesn't export them.
93
+
All source files now include `diskann_sqlite.h` instead of `<sqlite3.h>` directly.
86
94
87
-
### What We Tried
88
-
89
-
1. ✅ **better-sqlite3** - Extension loads but symbols not found
3. ✅ **node:sqlite** - Built-in to Node 22.5+, same symbol issue
95
+
**Status:** ✅ Extension loads successfully in all tested Node.js SQLite libraries
92
96
93
97
### sqlite-vec API Quirks Discovered
94
98
@@ -154,33 +158,27 @@ Based on ann-benchmarks research:
154
158
155
159
Trade-off: DiskANN sacrifices 1-5% recall for 10-200x speedup.
156
160
157
-
## BLOCKER
158
-
159
-
Cannot complete DiskANN benchmarks until extension loading is resolved.
160
-
161
-
**Blocker:** DiskANN extension symbol resolution with Node.js SQLite libraries
161
+
## ~~BLOCKER~~ RESOLVED ✅
162
162
163
-
**Options to unblock:**
163
+
**Previous blocker (OUTDATED):** DiskANN extension symbol resolution with Node.js SQLite libraries
164
164
165
-
1. ✅ **System SQLite (RECOMMENDED)** - Link diskann against system libsqlite3:
166
-
167
-
```bash
168
-
sudoapt-getinstalllibsqlite3-dev
169
-
# UpdateMakefile:LIBS=-lm-lsqlite3
170
-
# Rebuildextension
171
-
```
165
+
**Resolution:** Extension loading issue was **SOLVED** via `src/diskann_sqlite.h` conditional header approach (see `_done/20260210-extension-loading-fix.md`). The extension now loads successfully without linking against system SQLite.
172
166
173
-
2. **Static linking** - Build diskann with SQLite statically linked (duplicates code, not ideal)
167
+
**How it was fixed:**
168
+
- Created `diskann_sqlite.h` that conditionally includes `<sqlite3ext.h>` (extension builds) or `<sqlite3.h>` (test builds)
169
+
- Only `diskann_vtab.c` has `SQLITE_EXTENSION_INIT1`, other files use `extern` declaration
170
+
- All SQLite function calls route through `sqlite3_api` function pointers in extension builds
171
+
- Extension builds with `-DDISKANN_EXTENSION` flag, tests build without it
174
172
175
-
3. **Accept limitation** - Document that benchmarks only work for sqlite-vec, skip diskann
173
+
**Current status:** Extension loads fine. Remaining work is testing/running the benchmarks.
176
174
177
175
**Next session should:**
178
176
179
-
1. Install libsqlite3-dev (requires sudo)
180
-
2. Update Makefile to link against system SQLite
181
-
3. Rebuild extension: `makeclean&&make`
182
-
4. Run full benchmark: `npmrunbench:quick`
183
-
5. Validate recall@k calculations match expectations
177
+
1. ~~Install libsqlite3-dev~~ ❌ NOT NEEDED
178
+
2. ~~Update Makefile~~ ✅ ALREADY DONE
179
+
3. Test DiskANN benchmarks actually run: `cdbenchmarks&&npmrunbench:quick`
180
+
4. Validate recall@k calculations match expectations
181
+
5. Run full benchmark suite and document results
184
182
185
183
## Solutions
186
184
@@ -200,20 +198,9 @@ Cannot complete DiskANN benchmarks until extension loading is resolved.
200
198
201
199
**Status:** ✅ Implemented and working
202
200
203
-
### Option 2: System SQLite Linking (To Implement)
204
-
205
-
**Pros:**
206
-
207
-
- Resolves symbol resolution issue
208
-
- Standard approach for SQLite extensions
209
-
- No duplicate SQLite code
210
-
211
-
**Cons:**
212
-
213
-
- Requires system package installation
214
-
- Different SQLite version than Node libraries
201
+
### ~~Option 2: System SQLite Linking~~ NOT USED
215
202
216
-
**Status:** Blocked - needs sudo access for apt-get
203
+
**Status:** ❌ Not implemented - extension loading was solved via conditional header approach instead (see `_done/20260210-extension-loading-fix.md`)
217
204
218
205
## Tasks
219
206
@@ -282,35 +269,32 @@ Cannot complete DiskANN benchmarks until extension loading is resolved.
282
269
283
270
### Remaining Tasks
284
271
285
-
- [ ] Install libsqlite3-dev (requires sudo)
286
-
- [ ] Update Makefile to link against system SQLite
2. ⏳ Test DiskANN benchmarks - need to verify they run with loaded extension
372
+
3. ⏳ Validate recall@k calculations match expectations
373
+
4. ⏳ Run full benchmark suite (quick/standard/recall-sweep profiles)
374
+
5. ⏳ Document performance comparison results
375
+
6. ⏳ Final review and move to `_done/`
359
376
360
-
**Next engineer:** Start by resolving the blocker (install libsqlite3-dev, update Makefile, rebuild). Everything else is complete and tested.
377
+
**Key insight:** The framework itself is complete and tested (sqlite-vec benchmarks work). The only remaining work is running the DiskANN benchmarks now that extension loading is fixed, and documenting the results.
0 commit comments