tsdb/chunks: preallocate at least some space on non-Windows systems (#9581)

To avoid potential chunk corruption read, which I am not sure why is
happening.

Closes #9561.

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
This commit is contained in:
Mateusz Gozdek 2021-11-09 09:17:00 +01:00 committed by GitHub
parent c564984daa
commit b319b14431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,5 +17,6 @@
package chunks package chunks
// HeadChunkFilePreallocationSize is the size to which the m-map file should be preallocated when a new file is cut. // HeadChunkFilePreallocationSize is the size to which the m-map file should be preallocated when a new file is cut.
// Windows needs pre-allocations while the other OS does not. // Windows needs pre-allocations while the other OS does not. But we observed that a 0 pre-allocation causes unit tests to flake.
var HeadChunkFilePreallocationSize int64 // This small allocation for non-Windows OSes removes the flake.
var HeadChunkFilePreallocationSize int64 = MinWriteBufferSize * 2