Commits


Dimitri Vorona authored and Wes McKinney committed 2657f9d77c4
ARROW-2701: [C++] Make MemoryMappedFile resizable redux This is an adjusted version of the [previous PR](https://github.com/apache/arrow/pull/2134). The following problems were addressed: * `MemoryMap` doesn't differentiate between `size_` and `capacity_` or `Resize` and `Reserve`. I still keep them, so I can inherit from `ResizableBuffer` to show the intent, but it might as well be changed back to `MutableBuffer` with a generic `Resize` method with a cleaner signature * Before resizing, I acquire the `resize_lock` and check the `use_count` of the `MemoryMap`. If there are active slices, meaning readers holding a reference to this map, the resizing fails. * For this to work, the readers have to acquire the same lock, or else they can change the `use_count` while we aren't looking. This means, that the readers can't create slices concurrently, which may not be as bad, since slicing doesn't block that long, but it's not nice. It's worse for the `memcpy`ing `ReadAt`. A `shared_mutex` would solve this problem. * I removed any automatic resizing * 1ba892 fixes a bug, where you could write past the end using `WriteAt`. I can open a separate PR for it As I said, I'm not very happy with the implementation, but it works and seems safe to me. Author: Dimitri Vorona <vorona@in.tum.de> Closes #2205 from alendit/resizable_mmap_basic and squashes the following commits: 86349138 <Dimitri Vorona> Make MemoryMappedFile resizable on linux