Commit 40f4f32
Cleanup rdb_hexdump (#1442)
Summary:
Currently, `rdb_hexdump` has a third argument `maxsize` with a default value of 0,
meaning unlimited output length, and there is also a `RDB_MAX_HEXDUMP` constant
for the callers to use. However, only a part of the callers use it, the rest use
the default or something else altogether (i.e. `FN_REFLEN`)
Change as follows:
- Default to `RDB_MAX_HEXDUMP` `maxsize` instead of unlimited. This should cover
all the reasonable cases, and prevent runaway dumping in the case of corrupted
`data_len` values.
- Bump `RDB_MAX_HEXDUMP_LEN` from 1000 to 7000. This way it can dump any MyRocks
key (3072 byte maximum). Make it `constexpr`.
Minor cleanups:
- Where `std::string` is used as an input for `rdb_hexdump`, pass its buffer
through `data()`, not through `c_str()`, because it's used as a sized buffer
and not as a zero-terminated C string
- Mark `rdb_hexdump` as `nodiscard`, make its constants `constexpr`, remove
redundant `const` from by-value parameters.
Pull Request resolved: #1442
Differential Revision: D55594025
fbshipit-source-id: d0480781 parent 9d620d1 commit 40f4f32
File tree
7 files changed
+125
-129
lines changed- mysql-test/suite/rocksdb/r
- storage/rocksdb
7 files changed
+125
-129
lines changedLines changed: 98 additions & 98 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6645 | 6645 | | |
6646 | 6646 | | |
6647 | 6647 | | |
6648 | | - | |
| 6648 | + | |
6649 | 6649 | | |
6650 | 6650 | | |
6651 | 6651 | | |
| |||
11484 | 11484 | | |
11485 | 11485 | | |
11486 | 11486 | | |
11487 | | - | |
11488 | | - | |
| 11487 | + | |
11489 | 11488 | | |
11490 | 11489 | | |
11491 | 11490 | | |
11492 | 11491 | | |
11493 | | - | |
11494 | | - | |
| 11492 | + | |
11495 | 11493 | | |
11496 | 11494 | | |
11497 | 11495 | | |
11498 | 11496 | | |
11499 | | - | |
11500 | | - | |
| 11497 | + | |
11501 | 11498 | | |
11502 | 11499 | | |
11503 | 11500 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
| 192 | + | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1764 | 1764 | | |
1765 | 1765 | | |
1766 | 1766 | | |
1767 | | - | |
| 1767 | + | |
1768 | 1768 | | |
1769 | 1769 | | |
1770 | 1770 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2191 | 2191 | | |
2192 | 2192 | | |
2193 | 2193 | | |
2194 | | - | |
2195 | | - | |
| 2194 | + | |
| 2195 | + | |
2196 | 2196 | | |
2197 | 2197 | | |
2198 | 2198 | | |
| |||
2300 | 2300 | | |
2301 | 2301 | | |
2302 | 2302 | | |
2303 | | - | |
2304 | | - | |
2305 | | - | |
2306 | | - | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
2307 | 2307 | | |
2308 | 2308 | | |
2309 | 2309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
231 | 232 | | |
232 | | - | |
233 | | - | |
| 233 | + | |
| 234 | + | |
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
156 | 155 | | |
157 | 156 | | |
158 | 157 | | |
| |||
340 | 339 | | |
341 | 340 | | |
342 | 341 | | |
343 | | - | |
344 | | - | |
345 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
346 | 345 | | |
347 | 346 | | |
348 | 347 | | |
| |||
0 commit comments