Commit 61e5493
committed
semcode: Guard against compaction hang with many fragments
LanceDB compaction encounters a pathological case when a table
accumulates thousands of small fragments. The compact operation
enters a CPU loop where the main thread spins at 100% CPU
utilization while worker threads remain idle. Any table
subjected to many small appends without intervening compaction
can reach this state.
A check now examines fragment count before compaction proceeds.
When fragment count exceeds 500, compaction is skipped and a
warning directs the user to rebuild the database with --clear.
This threshold prevents the hang condition while allowing normal
compaction for tables with moderate fragmentation. Prune, index,
and checkout operations remain unaffected; only the compact step
is gated by this fragment limit.
Fixes: 4a16e15 ("semcode-index: optimize database periodically during long-running indexing")
Signed-off-by: Chuck Lever <cel@kernel.org>1 parent 16c30d4 commit 61e5493
1 file changed
Lines changed: 43 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1016 | 1016 | | |
1017 | 1017 | | |
1018 | 1018 | | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
1026 | | - | |
1027 | | - | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
1028 | 1062 | | |
1029 | 1063 | | |
1030 | 1064 | | |
| |||
0 commit comments