Commit 8d82021
committed
fix(cli): eliminate 5-minute invisible stall on 'codegraph index' by dropping and recreating the DB file instead of row-by-row DELETE
- Add CodeGraph.resetDb(): close DB, unlink the file (including -shm/-wal), then re-initialize a fresh empty database and rebuild all internal components (orchestrator, resolver, graphManager, traverser, contextBuilder)
- Replace both cg.clear() calls in the index subcommand (quiet and normal modes) with cg.resetDb()
- clear() executes DELETE FROM on 4 tables (nodes, edges, files, unresolved_refs) inside a transaction — on a 20GB DB with 10M+ rows this takes 5+ minutes before the progress bar is even created
- resetDb() deletes the DB file in milliseconds, giving the same result (empty DB) without the invisible stall1 parent 5cea5f1 commit 8d82021
2 files changed
Lines changed: 33 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
631 | | - | |
632 | | - | |
633 | | - | |
| 631 | + | |
634 | 632 | | |
635 | 633 | | |
636 | 634 | | |
| |||
640 | 638 | | |
641 | 639 | | |
642 | 640 | | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
649 | 645 | | |
650 | 646 | | |
651 | 647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
1133 | 1134 | | |
1134 | 1135 | | |
1135 | 1136 | | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
1136 | 1164 | | |
1137 | 1165 | | |
1138 | 1166 | | |
| |||
0 commit comments