Skip to content

Commit

Permalink
Return injected error when injecting empty result and corrupted bytes…
Browse files Browse the repository at this point in the history
… read error (#13369)

Summary:
**Context/Summary:**

archang19 found the place in code where no injected error status is returned on effectively injected error (empty result or corrupted bytes). I can't find a good argument for doing so. In these cases where such empty result and corrupted result is not expected, the file system should return error (< 0). Our fault injection framework should align with that to simulate fault returned by file system.

Pull Request resolved: #13369

Test Plan: Monitor stress test

Reviewed By: archang19

Differential Revision: D69136015

Pulled By: hx235

fbshipit-source-id: 6ee7a7bd5e0aa19837e4dfd73817d4a9d5af76f9
  • Loading branch information
hx235 authored and facebook-github-bot committed Feb 5, 2025
1 parent 7774a4d commit 864964b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utilities/fault_injection_fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,7 @@ IOStatus FaultInjectionTestFS::MaybeInjectThreadLocalReadError(
msg << "empty result";
ctx->message = msg.str();
ret_fault_injected = true;
ret = IOStatus::IOError(ctx->message);
} else if (!direct_io && Random::GetTLSInstance()->OneIn(7) &&
scratch != nullptr && result->data() == scratch) {
assert(result);
Expand All @@ -1430,6 +1431,7 @@ IOStatus FaultInjectionTestFS::MaybeInjectThreadLocalReadError(
msg << "corrupt last byte";
ctx->message = msg.str();
ret_fault_injected = true;
ret = IOStatus::IOError(ctx->message);
} else {
msg << "error result multiget single";
ctx->message = msg.str();
Expand Down

0 comments on commit 864964b

Please sign in to comment.