Commit dc12bf9
fix: remove dangling embedding entries
There is no FK from the queue table to the source table, or from the
embedding table to the source table. As a result, we can have "dangling"
entries in both the queue table and the embedding table. These occur
because of a race condition between deleting a source table row, and the
processing of the embeddings for that row.
To "clean up" dangling embeddings, we insert a queue row when a source
table row is deleted. This queue row is dangling.
When a dangling queue row is identified, we use the PK values of the
queue row to remove all associated embeddings (if present).
Co-authored-by: Jascha <[email protected]>1 parent 5d24e16 commit dc12bf9
File tree
5 files changed
+587
-3
lines changed- projects/pgai
- db/sql/idempotent
- pgai
- data
- vectorizer
- tests/vectorizer
- cassettes
- cli
5 files changed
+587
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
| 589 | + | |
589 | 590 | | |
590 | 591 | | |
591 | 592 | | |
| |||
599 | 600 | | |
600 | 601 | | |
601 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
602 | 607 | | |
603 | 608 | | |
604 | 609 | | |
| |||
637 | 642 | | |
638 | 643 | | |
639 | 644 | | |
| 645 | + | |
| 646 | + | |
640 | 647 | | |
641 | 648 | | |
642 | 649 | | |
| |||
674 | 681 | | |
675 | 682 | | |
676 | 683 | | |
| 684 | + | |
677 | 685 | | |
678 | 686 | | |
679 | 687 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2909 | 2909 | | |
2910 | 2910 | | |
2911 | 2911 | | |
| 2912 | + | |
2912 | 2913 | | |
2913 | 2914 | | |
2914 | 2915 | | |
| |||
2922 | 2923 | | |
2923 | 2924 | | |
2924 | 2925 | | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
2925 | 2930 | | |
2926 | 2931 | | |
2927 | 2932 | | |
| |||
2960 | 2965 | | |
2961 | 2966 | | |
2962 | 2967 | | |
| 2968 | + | |
| 2969 | + | |
2963 | 2970 | | |
2964 | 2971 | | |
2965 | 2972 | | |
| |||
2997 | 3004 | | |
2998 | 3005 | | |
2999 | 3006 | | |
| 3007 | + | |
3000 | 3008 | | |
3001 | 3009 | | |
3002 | 3010 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
638 | 638 | | |
639 | 639 | | |
640 | 640 | | |
641 | | - | |
| 641 | + | |
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
656 | 667 | | |
657 | 668 | | |
658 | 669 | | |
| |||
1174 | 1185 | | |
1175 | 1186 | | |
1176 | 1187 | | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
1177 | 1191 | | |
1178 | 1192 | | |
1179 | 1193 | | |
1180 | 1194 | | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
1181 | 1237 | | |
1182 | | - | |
| 1238 | + | |
1183 | 1239 | | |
1184 | 1240 | | |
1185 | 1241 | | |
| |||
0 commit comments