github.com/cockroachdb/pebble@v1.1.2/objstorage/objstorageprovider/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 expected 2 args: offset, size 153 154 read 155 7980, 16 156 ---- 157 readahead: 0 158 numReads: 4 159 size: 131072 160 prevSize: 65536 161 limit: 73216 162 163 read 164 73416, 16 165 ---- 166 readahead: 131072 167 numReads: 5 168 size: 262144 169 prevSize: 131072 170 limit: 204488 171 172 read 173 204488, 16 174 ---- 175 readahead: 262144 176 numReads: 6 177 size: 262144 178 prevSize: 262144 179 limit: 466632 180 181 # The readahead size should not increase beyond the max (256kb) 182 183 read 184 466632, 16 185 ---- 186 readahead: 262144 187 numReads: 7 188 size: 262144 189 prevSize: 262144 190 limit: 728776 191 192 # A cache read pushes the limit further ahead without issuing a readahead. 193 194 cache-read 195 728770, 16 196 ---- 197 readahead: 0 198 numReads: 7 199 size: 262144 200 prevSize: 262144 201 limit: 728786 202 203 read 204 728780, 16 205 ---- 206 readahead: 262144 207 numReads: 8 208 size: 262144 209 prevSize: 262144 210 limit: 990924 211 212 # An out-of-order cache read still resets readahead state. 213 214 cache-read 215 1200, 16 216 ---- 217 readahead: 0 218 numReads: 1 219 size: 65536 220 prevSize: 0 221 limit: 1216