github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/sstable/testdata/readahead (about) 1 reset 2 ---- 3 4 read 5 2048, 16 6 ---- 7 readahead: 0 8 numReads: 1 9 size: 65536 10 prevSize: 0 11 limit: 0 12 13 read 14 2096, 16 15 ---- 16 readahead: 0 17 numReads: 2 18 size: 65536 19 prevSize: 0 20 limit: 0 21 22 read 23 2112, 16 24 ---- 25 readahead: 65536 26 numReads: 3 27 size: 131072 28 prevSize: 65536 29 limit: 67648 30 31 read 32 8000, 16 33 ---- 34 readahead: 0 35 numReads: 4 36 size: 131072 37 prevSize: 65536 38 limit: 67648 39 40 read 41 8016, 16 42 ---- 43 readahead: 0 44 numReads: 5 45 size: 131072 46 prevSize: 65536 47 limit: 67648 48 49 # The new limit is 2112 + 65536 = 67648. 50 # Since the next read will end at 67646 + 1 = 67647, 51 # it doesn't yet trigger a readahead. 52 53 read 54 67646, 1 55 ---- 56 readahead: 0 57 numReads: 6 58 size: 131072 59 prevSize: 65536 60 limit: 67648 61 62 read 63 67646, 2 64 ---- 65 readahead: 131072 66 numReads: 7 67 size: 262144 68 prevSize: 131072 69 limit: 198718 70 71 read 72 16192, 16 73 ---- 74 readahead: 0 75 numReads: 1 76 size: 65536 77 prevSize: 0 78 limit: 16208 79 80 read 81 16193, 16 82 ---- 83 readahead: 0 84 numReads: 2 85 size: 65536 86 prevSize: 0 87 limit: 16208 88 89 # The next read is too far ahead to benefit from readahead 90 # (i.e. 540497 > 16208 (limit) + (512 << 10) (maxReadaheadSize)) 91 # numReads should get reset to 1. 92 93 read 94 540497, 16 95 ---- 96 readahead: 0 97 numReads: 1 98 size: 65536 99 prevSize: 0 100 limit: 540513 101 102 read 103 7980, 16 104 ---- 105 readahead: 0 106 numReads: 1 107 size: 65536 108 prevSize: 0 109 limit: 7996 110 111 read 112 0, 16 113 ---- 114 readahead: 0 115 numReads: 1 116 size: 65536 117 prevSize: 0 118 limit: 16 119 120 # Sizes should start from initial (64kb) again. 121 122 read 123 7780, 16 124 ---- 125 readahead: 0 126 numReads: 2 127 size: 65536 128 prevSize: 0 129 limit: 16 130 131 read 132 7680, 16 133 ---- 134 readahead: 65536 135 numReads: 3 136 size: 131072 137 prevSize: 65536 138 limit: 73216 139 140 read 141 7780, 16 142 ---- 143 readahead: 0 144 numReads: 4 145 size: 131072 146 prevSize: 65536 147 limit: 73216 148 149 read 150 7880, 16 151 ---- 152 readahead: 0 153 numReads: 5 154 size: 131072 155 prevSize: 65536 156 limit: 73216 157 158 read 159 7980, 16 160 ---- 161 readahead: 0 162 numReads: 6 163 size: 131072 164 prevSize: 65536 165 limit: 73216 166 167 read 168 73416, 16 169 ---- 170 readahead: 131072 171 numReads: 7 172 size: 262144 173 prevSize: 131072 174 limit: 204488 175 176 read 177 204488, 16 178 ---- 179 readahead: 262144 180 numReads: 8 181 size: 262144 182 prevSize: 262144 183 limit: 466632 184 185 # The readahead size should not increase beyond the max (256kb) 186 187 read 188 466632, 16 189 ---- 190 readahead: 262144 191 numReads: 9 192 size: 262144 193 prevSize: 262144 194 limit: 728776 195 196 # A cache read pushes the limit further ahead without issuing a readahead. 197 198 cache-read 199 728770, 16 200 ---- 201 readahead: 0 202 numReads: 9 203 size: 262144 204 prevSize: 262144 205 limit: 728786 206 207 read 208 728780, 16 209 ---- 210 readahead: 262144 211 numReads: 10 212 size: 262144 213 prevSize: 262144 214 limit: 990924 215 216 # An out-of-order cache read still resets readahead state. 217 218 cache-read 219 1200, 16 220 ---- 221 readahead: 0 222 numReads: 1 223 size: 65536 224 prevSize: 0 225 limit: 1216