Fix a few bugs in db_stress fault injection (#6693)

Summary:
Fix the following issues -
1. Output parsing error in db_crashtest.py
2. Memory leak on exit
3. False alarm on filter block read error
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6693

Test Plan: asan_crash

Reviewed By: cheng-chang

Differential Revision: D20990399

Pulled By: anand1976

fbshipit-source-id: 178ee0dd7c69a4bc5db698379db0dedb29281699
main
anand76 5 years ago committed by Facebook GitHub Bot
parent eeb3cf3f58
commit 79c838eb0f
  1. 2
      table/block_based/full_filter_block.cc
  2. 8
      test_util/fault_injection_test_fs.h
  3. 3
      tools/db_crashtest.py

@ -164,6 +164,7 @@ bool FullFilterBlockReader::MayMatch(
const Status s =
GetOrReadFilterBlock(no_io, get_context, lookup_context, &filter_block);
if (!s.ok()) {
TEST_SYNC_POINT("FilterReadError");
return true;
}
@ -221,6 +222,7 @@ void FullFilterBlockReader::MayMatch(
const Status s = GetOrReadFilterBlock(no_io, range->begin()->get_context,
lookup_context, &filter_block);
if (!s.ok()) {
TEST_SYNC_POINT("FilterReadError");
return;
}

@ -165,7 +165,8 @@ class FaultInjectionTestFS : public FileSystemWrapper {
: FileSystemWrapper(base),
filesystem_active_(true),
filesystem_writable_(false),
thread_local_error_(new ThreadLocalPtr(nullptr)) {}
thread_local_error_(
new ThreadLocalPtr(DeleteThreadLocalErrorContext)) {}
virtual ~FaultInjectionTestFS() {}
const char* Name() const override { return "FaultInjectionTestFS"; }
@ -299,6 +300,11 @@ class FaultInjectionTestFS : public FileSystemWrapper {
ctx->count = 0;
}
static void DeleteThreadLocalErrorContext(void *p) {
ErrorContext* ctx = static_cast<ErrorContext*>(p);
delete ctx;
}
// Inject an error. For a READ operation, a status of IOError(), a
// corruption in the contents of scratch, or truncation of slice
// are the types of error with equal probability. For OPEN,

@ -453,7 +453,8 @@ def whitebox_crash_main(args, unknown_args):
stdoutdata = stdoutdata.lower()
errorcount = (stdoutdata.count('error') -
stdoutdata.count('got errors 0 times'))
stdoutdata.count('got errors 0 times') -
stdoutdata.count('got expected errors 0 times'))
print("#times error occurred in output is " + str(errorcount) + "\n")
if (errorcount > 0):

Loading…
Cancel
Save