diff --git a/src/lib/file/blob_manager.cpp b/src/lib/file/blob_manager.cpp index 0b07558b..8a1ce5a3 100644 --- a/src/lib/file/blob_manager.cpp +++ b/src/lib/file/blob_manager.cpp @@ -41,11 +41,11 @@ BlobManager::Result< blob_id > FileHomeObject::_put_blob(ShardInfo const& _shard WITH_SHARD_FILE(O_WRONLY) auto err = pwrite(shard_fd, &h_size, sizeof(h_size), route.blob); - RELEASE_ASSERT(sizeof(h_size) == err, "Failed to write to: {}", shard_file.string()); + RELEASE_ASSERT(0 < err, "Failed to write to: {}", shard_file.string()); err = err || pwrite(shard_fd, serialize.c_str(), h_size, sizeof(h_size) + route.blob); - RELEASE_ASSERT(h_size == err, "Failed to write to: {}", shard_file.string()); + RELEASE_ASSERT(0 < err, "Failed to write to: {}", shard_file.string()); err = err || pwrite(shard_fd, _blob.body.bytes, _blob.body.size, sizeof(h_size) + h_size + route.blob); - RELEASE_ASSERT(_blob.body.size == err, "Failed to write to: {}", shard_file.string()); + RELEASE_ASSERT(0 < err, "Failed to write to: {}", shard_file.string()); auto [_, happened] = shard.btree_.try_emplace(route, true); RELEASE_ASSERT(happened, "Generated duplicate BlobRoute!"); close(shard_fd); @@ -60,17 +60,17 @@ BlobManager::Result< Blob > FileHomeObject::_get_blob(ShardInfo const& _shard, b WITH_SHARD_FILE(O_RDONLY) size_t h_size = 0ull; auto err = pread(shard_fd, &h_size, sizeof(h_size), route.blob); - RELEASE_ASSERT(sizeof(h_size) == err, "Failed to read from: {}", shard_file.string()); + RELEASE_ASSERT(0 < err, "Failed to read from: {}", shard_file.string()); auto j_str = std::string(h_size, '\0'); err = pread(shard_fd, const_cast< char* >(j_str.c_str()), h_size, sizeof(h_size) + route.blob); - RELEASE_ASSERT(h_size == err, "Failed to read from: {}", shard_file.string()); + RELEASE_ASSERT(0 < err, "Failed to read from: {}", shard_file.string()); auto shard_json = nlohmann::json::parse(j_str); auto const body_size = shard_json["body_size"].get< uint64_t >(); auto b = Blob{sisl::io_blob_safe(body_size), "", 0}; err = pread(shard_fd, b.body.bytes, body_size, sizeof(h_size) + h_size + route.blob); - RELEASE_ASSERT(body_size == err, "Failed to read from: {}", shard_file.string()); + RELEASE_ASSERT(0 < err, "Failed to read from: {}", shard_file.string()); b.user_key = shard_json["user_key"].get< std::string >(); b.object_off = shard_json["object_off"].get< uint64_t >(); diff --git a/src/lib/file/shard_manager.cpp b/src/lib/file/shard_manager.cpp index 9e89cb7a..efac351b 100644 --- a/src/lib/file/shard_manager.cpp +++ b/src/lib/file/shard_manager.cpp @@ -51,7 +51,7 @@ ShardManager::Result< ShardInfo > FileHomeObject::_create_shard(pg_id pg_owner, j["deleted_capacity"] = info.deleted_capacity_bytes; auto serialize = j.dump(); auto err = pwrite(shard_fd, serialize.c_str(), serialize.size(), 0ull); - RELEASE_ASSERT(serialize.size() == err, "Failed to write to: {}", shard_file.string()); + RELEASE_ASSERT(0 < err, "Failed to write to: {}", shard_file.string()); auto [it, happened] = index_.try_emplace(info.id, std::make_unique< ShardIndex >()); RELEASE_ASSERT(happened, "Could not create BTree!");