diff options
| author | Stefan Boberg <[email protected]> | 2021-05-27 19:16:29 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-05-27 19:16:29 +0200 |
| commit | 4960e5a701295c56fce9a1a105ab5ae5966da48a (patch) | |
| tree | 7588df48224504707a659f36949704f382b43a3c | |
| parent | Moved lock closer to the members it protects for clarity and maybe cache loca... (diff) | |
| download | zen-4960e5a701295c56fce9a1a105ab5ae5966da48a.tar.xz zen-4960e5a701295c56fce9a1a105ab5ae5966da48a.zip | |
Added some more diagnostics to potential file operation errors
| -rw-r--r-- | zenstore/filecas.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp index 64fcb2ffe..2972fbca6 100644 --- a/zenstore/filecas.cpp +++ b/zenstore/filecas.cpp @@ -211,6 +211,11 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize return {.New = false}; } + if ((hRes != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) && (hRes != HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND))) + { + spdlog::warn("Unexpected error code when opening shard file for read: {:#x}", uint32_t(hRes)); + } + auto InternalCreateFile = [&] { return PayloadFile.Create(ShardedPath.c_str(), GENERIC_WRITE, FILE_SHARE_DELETE, CREATE_ALWAYS); }; hRes = InternalCreateFile(); @@ -226,7 +231,7 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize if (FAILED(hRes)) { - throw WindowsException(hRes, "Failed to open shard file"); + throw WindowsException(hRes, "Failed to open shard file '{}'"_format(WideToUtf8(ShardedPath))); } size_t ChunkRemain = ChunkSize; @@ -234,7 +239,7 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize while (ChunkRemain != 0) { - uint32_t ByteCount = uint32_t(std::min<size_t>(1024 * 1024ull, ChunkRemain)); + uint32_t ByteCount = uint32_t(std::min<size_t>(4 * 1024 * 1024ull, ChunkRemain)); PayloadFile.Write(ChunkCursor, ByteCount); |