mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-13 08:25:26 +00:00
I was writing tests for RAM usage estimation of LiveVersionMap and found a couple issues: - The BytesRef objects used as uids were oversized since they were created via `new BytesRef(CharSequence)` which creates a `byte[]` whose size is 3x the length of the provided char sequence. Given that our uids are most of times ASCII sequences, this is a waste of memory. - `VersionValue` was using `translogLocation.size` instead of `translogLocation.ramBytesUsed()` for RAM estimation, which is completely unrelated to the memory footprint of the `Translog.Location` object. In particular, the latter issue could cause RAM usage estimation to be significantly overestimated, especially on large documents. I also added tests for ram accounting.