- Notifications
You must be signed in to change notification settings - Fork28
Commite41955f
committed
Fix bugs in gin_fuzzy_search_limit processing.
entryGetItem()'s three code paths each contained bugs associatedwith filtering the entries for gin_fuzzy_search_limit.The posting-tree path failed to advance "advancePast" after havingdecided to filter an item. If we ran out of items on the currentpage and needed to advance to the next, what would actually happenis that entryLoadMoreItems() would re-load the same page. Eventually,the random dropItem() test would accept one of the same items it'dpreviously rejected, and we'd move on --- but it could take awhilewith small gin_fuzzy_search_limit. To add insult to injury, thiscase would inevitably cause entryLoadMoreItems() to decide it neededto re-descend from the root, making things even slower.The posting-list path failed to implement gin_fuzzy_search_limitfiltering at all, so that all entries in the posting list wouldbe returned.The bitmap-result path used a "gotitem" variable that it failed toupdate in the one place where it'd actually make a difference, ieat the one "continue" statement. I think this was unreachable inpractice, because if we'd looped around then it shouldn't be thecase that the entries on the new page are before advancePast.Still, the "gotitem" variable was contributing nothing to eitherclarity or correctness, so get rid of it.Refactor all three loops so that the termination conditions aremore alike and less unreadable.The code coverage report showed that we had no coverage at all forthe re-descend-from-root code path in entryLoadMoreItems(), whichseems like a very bad thing, so add a test case that exercises it.We also had exactly no coverage for gin_fuzzy_search_limit, so add asimplistic test case that at least hits those code paths a little bit.Back-patch to all supported branches.Adé Heyward and Tom LaneDiscussion:https://postgr.es/m/CAEknJCdS-dE1Heddptm7ay2xTbSeADbkaQ8bU2AXRCVC2LdtKQ@mail.gmail.com1 parentc0885c4 commite41955f
3 files changed
+86
-12
lines changedLines changed: 32 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
813 | 813 |
| |
814 | 814 |
| |
815 | 815 |
| |
816 |
| - | |
817 | 816 |
| |
818 |
| - | |
| 817 | + | |
819 | 818 |
| |
820 | 819 |
| |
821 | 820 |
| |
| |||
864 | 863 |
| |
865 | 864 |
| |
866 | 865 |
| |
867 |
| - | |
868 | 866 |
| |
869 | 867 |
| |
870 | 868 |
| |
| |||
877 | 875 |
| |
878 | 876 |
| |
879 | 877 |
| |
880 |
| - | |
| 878 | + | |
881 | 879 |
| |
882 | 880 |
| |
883 | 881 |
| |
| |||
894 | 892 |
| |
895 | 893 |
| |
896 | 894 |
| |
897 |
| - | |
898 |
| - | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
899 | 900 |
| |
900 | 901 |
| |
901 | 902 |
| |
902 | 903 |
| |
903 | 904 |
| |
904 | 905 |
| |
905 | 906 |
| |
906 |
| - | |
| 907 | + | |
907 | 908 |
| |
908 | 909 |
| |
909 | 910 |
| |
| |||
913 | 914 |
| |
914 | 915 |
| |
915 | 916 |
| |
916 |
| - | |
917 |
| - | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
918 | 926 |
| |
919 | 927 |
| |
920 | 928 |
| |
921 | 929 |
| |
922 |
| - | |
| 930 | + | |
923 | 931 |
| |
924 | 932 |
| |
925 | 933 |
| |
| |||
935 | 943 |
| |
936 | 944 |
| |
937 | 945 |
| |
938 |
| - | |
939 |
| - | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
940 | 960 |
| |
941 | 961 |
| |
942 | 962 |
| |
|
Lines changed: 38 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
38 | 76 |
| |
39 | 77 |
| |
40 | 78 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
38 | 54 |
| |
39 | 55 |
| |
40 | 56 |
| |
|
0 commit comments
Comments
(0)