Skip to content

Commit

Permalink
Revert "inject flip into io path to simulate io error and stuck io (#416
Browse files Browse the repository at this point in the history
)" (#425)

since we already have flip injections for all IO issue in IOManager level, no need to add more injection in homestore level
  • Loading branch information
JacksonYao287 authored May 15, 2024
1 parent 27a51b6 commit cd8a565
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 64 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "6.4.7"
version = "6.4.6"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
65 changes: 2 additions & 63 deletions src/lib/device/virtual_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,6 @@ SISL_LOGGING_DECL(device)

namespace homestore {

#ifdef _PRERELEASE
#define SYNC_FLIP_INJECTION(IO_TYPE) \
if (iomgr_flip::instance()->test_flip("IO_TYPE_failure")) { return std::make_error_code(std::errc::io_error); } \
if (iomgr_flip::instance()->test_flip("IO_TYPE_stuck")) { \
std::this_thread::sleep_for(std::chrono::hours(24 * 365 * 100)); /* Sleep for 100 years */ \
return std::make_error_code(std::errc::resource_unavailable_try_again); \
}

#define ASYNC_FLIP_INJECTION(IO_TYPE) \
if (iomgr_flip::instance()->test_flip("IO_TYPE_failure")) { \
return folly::makeFuture< std::error_code >(std::make_error_code(std::errc::io_error)); \
} \
if (iomgr_flip::instance()->test_flip("IO_TYPE_stuck")) { \
std::this_thread::sleep_for(std::chrono::hours(24 * 365 * 100)); /* Sleep for 100 years */ \
return folly::makeFuture< std::error_code >(std::make_error_code(std::errc::resource_unavailable_try_again)); \
}
#endif

static std::shared_ptr< BlkAllocator > create_blk_allocator(blk_allocator_type_t btype, uint32_t vblock_size,
uint32_t ppage_sz, uint32_t align_sz, uint64_t size,
bool is_auto_recovery, uint32_t unique_id, bool is_init) {
Expand Down Expand Up @@ -334,10 +316,6 @@ folly::Future< std::error_code > VirtualDev::async_write(const char* buf, uint32
bool part_of_batch) {
HS_DBG_ASSERT_EQ(bid.is_multi(), false, "async_write needs individual pieces of blkid - not MultiBlkid");

#ifdef _PRERELEASE
ASYNC_FLIP_INJECTION(blk_write)
#endif

Chunk* chunk;
uint64_t const dev_offset = to_dev_offset(bid, &chunk);
if (sisl_unlikely(dev_offset == INVALID_DEV_OFFSET)) {
Expand All @@ -356,10 +334,6 @@ folly::Future< std::error_code > VirtualDev::async_write(const char* buf, uint32

folly::Future< std::error_code > VirtualDev::async_write(const char* buf, uint32_t size, cshared< Chunk >& chunk,
uint64_t offset_in_chunk) {
#ifdef _PRERELEASE
ASYNC_FLIP_INJECTION(blk_write)
#endif

if (sisl_unlikely(!is_chunk_available(chunk))) {
return folly::makeFuture< std::error_code >(std::make_error_code(std::errc::resource_unavailable_try_again));
}
Expand All @@ -378,10 +352,6 @@ folly::Future< std::error_code > VirtualDev::async_writev(const iovec* iov, cons
bool part_of_batch) {
HS_DBG_ASSERT_EQ(bid.is_multi(), false, "async_writev needs individual pieces of blkid - not MultiBlkid");

#ifdef _PRERELEASE
ASYNC_FLIP_INJECTION(blk_write)
#endif

Chunk* chunk;
uint64_t const dev_offset = to_dev_offset(bid, &chunk);
if (sisl_unlikely(dev_offset == INVALID_DEV_OFFSET)) {
Expand All @@ -400,9 +370,6 @@ folly::Future< std::error_code > VirtualDev::async_writev(const iovec* iov, cons

folly::Future< std::error_code > VirtualDev::async_writev(const iovec* iov, const int iovcnt, cshared< Chunk >& chunk,
uint64_t offset_in_chunk) {
#ifdef _PRERELEASE
ASYNC_FLIP_INJECTION(blk_write)
#endif
if (sisl_unlikely(!is_chunk_available(chunk))) {
return folly::makeFuture< std::error_code >(std::make_error_code(std::errc::resource_unavailable_try_again));
}
Expand All @@ -421,9 +388,7 @@ folly::Future< std::error_code > VirtualDev::async_writev(const iovec* iov, cons
////////////////////////// sync write section //////////////////////////////////
std::error_code VirtualDev::sync_write(const char* buf, uint32_t size, BlkId const& bid) {
HS_DBG_ASSERT_EQ(bid.is_multi(), false, "sync_write needs individual pieces of blkid - not MultiBlkid");
#ifdef _PRERELEASE
SYNC_FLIP_INJECTION(blk_write)
#endif

Chunk* chunk;
uint64_t const dev_offset = to_dev_offset(bid, &chunk);
if (sisl_unlikely(dev_offset == INVALID_DEV_OFFSET)) {
Expand All @@ -434,9 +399,6 @@ std::error_code VirtualDev::sync_write(const char* buf, uint32_t size, BlkId con

std::error_code VirtualDev::sync_write(const char* buf, uint32_t size, cshared< Chunk >& chunk,
uint64_t offset_in_chunk) {
#ifdef _PRERELEASE
SYNC_FLIP_INJECTION(blk_write)
#endif
if (sisl_unlikely(!is_chunk_available(chunk))) {
return std::make_error_code(std::errc::resource_unavailable_try_again);
}
Expand All @@ -445,9 +407,7 @@ std::error_code VirtualDev::sync_write(const char* buf, uint32_t size, cshared<

std::error_code VirtualDev::sync_writev(const iovec* iov, int iovcnt, BlkId const& bid) {
HS_DBG_ASSERT_EQ(bid.is_multi(), false, "sync_writev needs individual pieces of blkid - not MultiBlkid");
#ifdef _PRERELEASE
SYNC_FLIP_INJECTION(blk_write)
#endif

Chunk* chunk;
uint64_t const dev_offset = to_dev_offset(bid, &chunk);
if (sisl_unlikely(dev_offset == INVALID_DEV_OFFSET)) {
Expand All @@ -466,9 +426,6 @@ std::error_code VirtualDev::sync_writev(const iovec* iov, int iovcnt, BlkId cons

std::error_code VirtualDev::sync_writev(const iovec* iov, int iovcnt, cshared< Chunk >& chunk,
uint64_t offset_in_chunk) {
#ifdef _PRERELEASE
SYNC_FLIP_INJECTION(blk_write)
#endif
if (sisl_unlikely(!is_chunk_available(chunk))) {
return std::make_error_code(std::errc::resource_unavailable_try_again);
}
Expand All @@ -490,9 +447,6 @@ std::error_code VirtualDev::sync_writev(const iovec* iov, int iovcnt, cshared< C
folly::Future< std::error_code > VirtualDev::async_read(char* buf, uint64_t size, BlkId const& bid,
bool part_of_batch) {
HS_DBG_ASSERT_EQ(bid.is_multi(), false, "async_read needs individual pieces of blkid - not MultiBlkid");
#ifdef _PRERELEASE
ASYNC_FLIP_INJECTION(blk_read)
#endif

Chunk* pchunk;
uint64_t const dev_offset = to_dev_offset(bid, &pchunk);
Expand All @@ -505,9 +459,6 @@ folly::Future< std::error_code > VirtualDev::async_read(char* buf, uint64_t size
folly::Future< std::error_code > VirtualDev::async_readv(iovec* iovs, int iovcnt, uint64_t size, BlkId const& bid,
bool part_of_batch) {
HS_DBG_ASSERT_EQ(bid.is_multi(), false, "async_readv needs individual pieces of blkid - not MultiBlkid");
#ifdef _PRERELEASE
ASYNC_FLIP_INJECTION(blk_read)
#endif

Chunk* pchunk;
uint64_t const dev_offset = to_dev_offset(bid, &pchunk);
Expand All @@ -520,9 +471,6 @@ folly::Future< std::error_code > VirtualDev::async_readv(iovec* iovs, int iovcnt
////////////////////////////////////////// sync read section ////////////////////////////////////////////
std::error_code VirtualDev::sync_read(char* buf, uint32_t size, BlkId const& bid) {
HS_DBG_ASSERT_EQ(bid.is_multi(), false, "sync_read needs individual pieces of blkid - not MultiBlkid");
#ifdef _PRERELEASE
SYNC_FLIP_INJECTION(blk_read)
#endif

Chunk* chunk;
uint64_t const dev_offset = to_dev_offset(bid, &chunk);
Expand All @@ -533,9 +481,6 @@ std::error_code VirtualDev::sync_read(char* buf, uint32_t size, BlkId const& bid
}

std::error_code VirtualDev::sync_read(char* buf, uint32_t size, cshared< Chunk >& chunk, uint64_t offset_in_chunk) {
#ifdef _PRERELEASE
SYNC_FLIP_INJECTION(blk_read)
#endif
if (sisl_unlikely(!is_chunk_available(chunk))) {
return std::make_error_code(std::errc::resource_unavailable_try_again);
}
Expand All @@ -544,9 +489,6 @@ std::error_code VirtualDev::sync_read(char* buf, uint32_t size, cshared< Chunk >

std::error_code VirtualDev::sync_readv(iovec* iov, int iovcnt, BlkId const& bid) {
HS_DBG_ASSERT_EQ(bid.is_multi(), false, "sync_readv needs individual pieces of blkid - not MultiBlkid");
#ifdef _PRERELEASE
SYNC_FLIP_INJECTION(blk_read)
#endif

Chunk* chunk;
uint64_t const dev_offset = to_dev_offset(bid, &chunk);
Expand All @@ -565,9 +507,6 @@ std::error_code VirtualDev::sync_readv(iovec* iov, int iovcnt, BlkId const& bid)
}

std::error_code VirtualDev::sync_readv(iovec* iov, int iovcnt, cshared< Chunk >& chunk, uint64_t offset_in_chunk) {
#ifdef _PRERELEASE
SYNC_FLIP_INJECTION(blk_read)
#endif
if (sisl_unlikely(!is_chunk_available(chunk))) {
return std::make_error_code(std::errc::resource_unavailable_try_again);
}
Expand Down

0 comments on commit cd8a565

Please sign in to comment.