You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ParquetMetaData memory size is not reported accurately when encryption is enabled #8472
Expected behavior ParquetMetaData::memory_size should report its actually heap allocation size (by implementing the HeapSize trait for FileDecryptor and all its subfields
How to get the size of something a user might pass in. HeapSize is private, so we can't add it to the bounds on KeyRetriever, and it seems weird to add heap_size to the trait.
I got a bit lost trying to understand what's actually stored in there too. If it's important to have the memory usage be accurate, we could change FileDecryptor to only store the key bytes and create the RingGcmBlockDecryptor on demand? We might just want to check the performance overhead on a file that uses uniform encryption, but I think it should be negligible.
Handling the KeyRetriever seems tricky. It's possible that the same retriever could be shared across multiple files, so even if we knew the size of the KeyRetriever it might not be correct to add it to the memory used by each file. Although at least in our parquet-key-management crate we do currently create a new KeyRetriever instance per file, and this holds an Arc to some state that's shared between retriever instances.
Maybe it's fine to add a new heap_size method to the trait and have a default implementation that returns 0, and document that if a user creates a retriever per file and needs accurate memory accounting, they should implement this?
I think being as accurate as we can be (even if there is known missing accounting, like for KeyRetriever) would be an improvement, even if it isn't entirely accurate
Maybe we can leave a comment or something with a caveat about its accuracy
Activity
etseidl commentedon Oct 9, 2025
So I've tried running down this rabbit hole, and hit two roadblocks. One is
arrow-rs/parquet/src/encryption/ciphers.rs
Lines 37 to 39 in 209eafa
I have no idea how to handle the
LessSafeKey.Similarly
arrow-rs/parquet/src/encryption/decrypt.rs
Lines 275 to 278 in 209eafa
How to get the size of something a user might pass in.
HeapSizeis private, so we can't add it to the bounds onKeyRetriever, and it seems weird to addheap_sizeto the trait.@rok or @adamreeve any ideas?
adamreeve commentedon Oct 10, 2025
I got a bit lost trying to understand what's actually stored in there too. If it's important to have the memory usage be accurate, we could change
FileDecryptorto only store the key bytes and create theRingGcmBlockDecryptoron demand? We might just want to check the performance overhead on a file that uses uniform encryption, but I think it should be negligible.Handling the
KeyRetrieverseems tricky. It's possible that the same retriever could be shared across multiple files, so even if we knew the size of theKeyRetrieverit might not be correct to add it to the memory used by each file. Although at least in ourparquet-key-managementcrate we do currently create a new KeyRetriever instance per file, and this holds an Arc to some state that's shared between retriever instances.Maybe it's fine to add a new
heap_sizemethod to the trait and have a default implementation that returns 0, and document that if a user creates a retriever per file and needs accurate memory accounting, they should implement this?alamb commentedon Oct 16, 2025
I think being as accurate as we can be (even if there is known missing accounting, like for
KeyRetriever) would be an improvement, even if it isn't entirely accurateMaybe we can leave a comment or something with a caveat about its accuracy
adamreeve commentedon Oct 17, 2025
OK I can have a go at adding what we can account for, unless you've already made a start on this @etseidl?
etseidl commentedon Oct 17, 2025
Thanks @adamreeve. If it will help I can point you to the branch I started.
adamreeve commentedon Oct 17, 2025
Sure, that would be useful thanks!
etseidl commentedon Oct 17, 2025
https://github.com/etseidl/arrow-rs/tree/parquet_meta_heapsize
I wasn't quite sure how to account for the HashMap either...that's likely an underestimate as well.
[Parquet] Account for FileDecryptor in ParquetMetaData heap size calc…
alamb commentedon Nov 19, 2025
label_issue.pyautomatically added labels {'parquet'} from #8671alamb commentedon Nov 19, 2025
label_issue.pyautomatically added labels {'performance'} from #8574