Commit ad47f53
committed
MB-51373: Inspect and correct Item objects created by KVStore
MB-52793 exposed a bug in the handing of deletes which have a body
(for System XATTRS). The root cause of that bug has been addressed
under that bug, however the problem remains that /previous/ versions
of KV-Engine could have written invalid deleted documents to disk,
which could be encountered after an (offline) upgrade.
Create a function that Couch/Magma-KVStore should call when
they have created an Item from the underlying stored data.
The function inspects the Item for datatype anomalies and if
found logs and corrects the Item preventing exceptions
occurring further up the stack.
In this case we check for an Item with no value, but a datatype,
which in the case of datatype=xattr can cause faults in xattr
inspection code.
Also adds a regression test which verifies that the sanitiztion of
such items is correctly triggered when reading documents from disk in
the various ways we access them.
Change-Id: I235af07a1973c4af35301e17223e624a2cb5acf0
Reviewed-on: https://review.couchbase.org/c/kv_engine/+/177217
Reviewed-by: Trond Norbye <[email protected]>
Reviewed-by: Jim Walker <[email protected]>
Well-Formed: Restriction Checker
Tested-by: Build Bot <[email protected]>1 parent 8855aeb commit ad47f53
File tree
6 files changed
+202
-9
lines changed- engines/ep
- src
- couch-kvstore
- magma-kvstore
- tests/module_tests
6 files changed
+202
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
141 | 146 | | |
142 | 147 | | |
143 | 148 | | |
144 | 149 | | |
145 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
146 | 156 | | |
147 | 157 | | |
148 | 158 | | |
149 | 159 | | |
150 | 160 | | |
151 | | - | |
152 | | - | |
| 161 | + | |
153 | 162 | | |
154 | 163 | | |
155 | 164 | | |
| |||
159 | 168 | | |
160 | 169 | | |
161 | 170 | | |
| 171 | + | |
| 172 | + | |
162 | 173 | | |
163 | 174 | | |
164 | 175 | | |
| |||
843 | 854 | | |
844 | 855 | | |
845 | 856 | | |
846 | | - | |
| 857 | + | |
847 | 858 | | |
848 | 859 | | |
849 | 860 | | |
| |||
870 | 881 | | |
871 | 882 | | |
872 | 883 | | |
873 | | - | |
| 884 | + | |
874 | 885 | | |
875 | 886 | | |
876 | 887 | | |
| |||
1952 | 1963 | | |
1953 | 1964 | | |
1954 | 1965 | | |
1955 | | - | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
1956 | 1970 | | |
1957 | | - | |
| 1971 | + | |
1958 | 1972 | | |
1959 | 1973 | | |
1960 | 1974 | | |
| |||
2015 | 2029 | | |
2016 | 2030 | | |
2017 | 2031 | | |
2018 | | - | |
2019 | 2032 | | |
2020 | 2033 | | |
2021 | 2034 | | |
| |||
2053 | 2066 | | |
2054 | 2067 | | |
2055 | 2068 | | |
2056 | | - | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
2057 | 2073 | | |
2058 | 2074 | | |
2059 | 2075 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
713 | 714 | | |
714 | 715 | | |
715 | 716 | | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
926 | 927 | | |
927 | 928 | | |
928 | 929 | | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
929 | 952 | | |
930 | 953 | | |
931 | 954 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1267 | 1267 | | |
1268 | 1268 | | |
1269 | 1269 | | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
1270 | 1274 | | |
1271 | 1275 | | |
1272 | 1276 | | |
| |||
Lines changed: 97 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5996 | 5996 | | |
5997 | 5997 | | |
5998 | 5998 | | |
| 5999 | + | |
| 6000 | + | |
| 6001 | + | |
| 6002 | + | |
| 6003 | + | |
| 6004 | + | |
| 6005 | + | |
| 6006 | + | |
| 6007 | + | |
| 6008 | + | |
| 6009 | + | |
| 6010 | + | |
| 6011 | + | |
| 6012 | + | |
| 6013 | + | |
| 6014 | + | |
| 6015 | + | |
| 6016 | + | |
| 6017 | + | |
| 6018 | + | |
| 6019 | + | |
| 6020 | + | |
| 6021 | + | |
| 6022 | + | |
| 6023 | + | |
| 6024 | + | |
| 6025 | + | |
| 6026 | + | |
| 6027 | + | |
| 6028 | + | |
| 6029 | + | |
| 6030 | + | |
| 6031 | + | |
| 6032 | + | |
| 6033 | + | |
| 6034 | + | |
| 6035 | + | |
| 6036 | + | |
| 6037 | + | |
| 6038 | + | |
| 6039 | + | |
| 6040 | + | |
| 6041 | + | |
| 6042 | + | |
| 6043 | + | |
| 6044 | + | |
| 6045 | + | |
| 6046 | + | |
| 6047 | + | |
| 6048 | + | |
| 6049 | + | |
| 6050 | + | |
| 6051 | + | |
| 6052 | + | |
| 6053 | + | |
| 6054 | + | |
| 6055 | + | |
| 6056 | + | |
| 6057 | + | |
| 6058 | + | |
| 6059 | + | |
| 6060 | + | |
| 6061 | + | |
| 6062 | + | |
| 6063 | + | |
| 6064 | + | |
| 6065 | + | |
| 6066 | + | |
| 6067 | + | |
| 6068 | + | |
| 6069 | + | |
| 6070 | + | |
| 6071 | + | |
| 6072 | + | |
| 6073 | + | |
| 6074 | + | |
| 6075 | + | |
| 6076 | + | |
| 6077 | + | |
| 6078 | + | |
| 6079 | + | |
| 6080 | + | |
| 6081 | + | |
| 6082 | + | |
| 6083 | + | |
| 6084 | + | |
| 6085 | + | |
| 6086 | + | |
| 6087 | + | |
| 6088 | + | |
| 6089 | + | |
| 6090 | + | |
| 6091 | + | |
| 6092 | + | |
| 6093 | + | |
| 6094 | + | |
| 6095 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
402 | 412 | | |
0 commit comments