Read persistent action caches larger than a Java byte array #32320
Can we test the contract, not the implementation details? i.e., verify that we're able to successfully parse more than 2GB worth of data? (Hopefully we can do so in a way that isn't terribly slow.)
Requested changes.
I checked the parse contract with a generated stream that repeats a valid encoded 1 MiB value and puts a tombstone after 2 GiB. The parent rejected the 2,148,544,540-byte input as too long. The PR reader consumed all 2,049 values, read the final tombstone and EOF, and closed the stream with -Xmx128m. The fixture uses a shared encoded record buffer, so it does not need a 2 GiB disk file.
-zbarskybot
I believe you haven't uploaded the commit where these changes were made.
Honestly, I think we're better off using a BufferedInputStream unconditionally to simplify. (readAllBytes uses a 16KB buffer, so it's actually less efficient.)
Please move the 64 * 1024 into a class-level constant.
After unifying the under/over 2GB code paths, we can use a try-with-resources to avoid having to close manually.
Requested changes.
tjgq
dzbarsky
Read persistent action caches of any size through a 64 KiB
BufferedInputStream.MapCodecreads entries in file order, detects EOF with a read, and closes the stream with try-with-resources. The on-disk format is unchanged.MapCodecTestdecodes more than 2 GiB of valid records from a bounded in-memory fixture and verifies the final tombstone. It also covers corrupt entries and stream closure when header validation fails.