add info for vm.max_map_count incorrectly set. (#17727) (#17730)

(cherry picked from commit 81bafd9daf)

Co-authored-by: Jeff Washington (jwash) <75863576+jeffwashington@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2021-06-04 05:02:13 +00:00
committed by GitHub
parent 893df9b277
commit 58dd6dc227

View File

@ -305,7 +305,14 @@ impl AppendVec {
let file_size = std::fs::metadata(&path)?.len();
AppendVec::sanitize_len_and_size(current_len, file_size as usize)?;
let map = unsafe { MmapMut::map_mut(&data)? };
let map = unsafe {
let result = MmapMut::map_mut(&data);
if result.is_err() {
// for vm.max_map_count, error is: {code: 12, kind: Other, message: "Cannot allocate memory"}
info!("memory map error: {:?}. This may be because vm.max_map_count is not set correctly.", result);
}
result?
};
let new = AppendVec {
path: path.as_ref().to_path_buf(),