Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dynamic growth to lmdb (#6231)
Description --- Added dynamic growth size to LMBD, where it will grow with the configured size as well an optional shortfall size that could not be written. This is especially relevant during block sync of many full blocks where the output SMT has grown very large. Motivation and Context --- Block sync did not work with many full blocks. ```rust 2024-03-25 07:27:14.304496100 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 5 time(s) in this transaction) 2024-03-25 07:27:14.317099900 [lmdb] DEBUG (\node_05\esmeralda\data/base_node\db) LMDB MB, mapsize was grown from 1616 MB to 1632 MB, increased by 16 MB 2024-03-25 07:27:14.319843700 [c::bn::block_sync] WARN Chain storage error: DB transaction was too large (3 operations) 2024-03-25 07:27:14.319864400 [c::bn::block_sync] WARN Block sync failed: No more sync peers available: Block sync failed 2024-03-25 07:27:14.319969400 [c::cs::database] INFO Rewinding headers from height 6325 to 1627 ``` How Has This Been Tested? --- System-level archival sync-from-scratch test on esmeralda after a coin-split and transaction stress test. Before the fix, blocks #1544 to #1584. Multiple resizes for the same set of write operations was required, with the final one resulting in block sync failure. ```rust 2024-03-25 07:19:35.346281600 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 1 time(s) in this transaction) 2024-03-25 07:19:35.654103900 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 2 time(s) in this transaction) 2024-03-25 07:19:35.952783600 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 3 time(s) in this transaction) 2024-03-25 07:19:41.198100900 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 1 time(s) in this transaction) 2024-03-25 07:19:41.519953900 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 2 time(s) in this transaction) 2024-03-25 07:19:41.827079500 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 3 time(s) in this transaction) 2024-03-25 07:19:42.136522700 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 4 time(s) in this transaction) 2024-03-25 07:20:29.331297000 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 1 time(s) in this transaction) 2024-03-25 07:20:29.755442600 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 2 time(s) in this transaction) 2024-03-25 07:20:30.119457000 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 3 time(s) in this transaction) 2024-03-25 07:20:30.491588200 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 4 time(s) in this transaction) 2024-03-25 07:20:30.868365300 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 5 time(s) in this transaction) ``` After the fix, blocks #1544 to #1584. Only a single resize each time for a set of write operations was required. ```rust 2024-03-25 16:40:28.814566400 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 1 time(s) in this transaction) 2024-03-25 16:42:05.167759000 [c::cs::lmdb_db::lmdb_db] INFO Database resize required (resized 1 time(s) in this transaction) ``` What process can a PR reviewer use to test or verify this change? --- Code review <!-- Checklist --> <!-- 1. Is the title of your PR in the form that would make nice release notes? The title, excluding the conventional commit tag, will be included exactly as is in the CHANGELOG, so please think about it carefully. --> Breaking Changes --- - [x] None - [ ] Requires data directory on base node to be deleted - [ ] Requires hard fork - [ ] Other - Please specify <!-- Does this include a breaking change? If so, include this line as a footer --> <!-- BREAKING CHANGE: Description what the user should do, e.g. delete a database, resync the chain -->
- Loading branch information