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
This commit is contained in:
parent
eeb3cf3f58
commit
79c838eb0f
@ -164,6 +164,7 @@ bool FullFilterBlockReader::MayMatch(
|
|||||||
const Status s =
|
const Status s =
|
||||||
GetOrReadFilterBlock(no_io, get_context, lookup_context, &filter_block);
|
GetOrReadFilterBlock(no_io, get_context, lookup_context, &filter_block);
|
||||||
if (!s.ok()) {
|
if (!s.ok()) {
|
||||||
|
TEST_SYNC_POINT("FilterReadError");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +222,7 @@ void FullFilterBlockReader::MayMatch(
|
|||||||
const Status s = GetOrReadFilterBlock(no_io, range->begin()->get_context,
|
const Status s = GetOrReadFilterBlock(no_io, range->begin()->get_context,
|
||||||
lookup_context, &filter_block);
|
lookup_context, &filter_block);
|
||||||
if (!s.ok()) {
|
if (!s.ok()) {
|
||||||
|
TEST_SYNC_POINT("FilterReadError");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,8 @@ class FaultInjectionTestFS : public FileSystemWrapper {
|
|||||||
: FileSystemWrapper(base),
|
: FileSystemWrapper(base),
|
||||||
filesystem_active_(true),
|
filesystem_active_(true),
|
||||||
filesystem_writable_(false),
|
filesystem_writable_(false),
|
||||||
thread_local_error_(new ThreadLocalPtr(nullptr)) {}
|
thread_local_error_(
|
||||||
|
new ThreadLocalPtr(DeleteThreadLocalErrorContext)) {}
|
||||||
virtual ~FaultInjectionTestFS() {}
|
virtual ~FaultInjectionTestFS() {}
|
||||||
|
|
||||||
const char* Name() const override { return "FaultInjectionTestFS"; }
|
const char* Name() const override { return "FaultInjectionTestFS"; }
|
||||||
@ -299,6 +300,11 @@ class FaultInjectionTestFS : public FileSystemWrapper {
|
|||||||
ctx->count = 0;
|
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
|
// Inject an error. For a READ operation, a status of IOError(), a
|
||||||
// corruption in the contents of scratch, or truncation of slice
|
// corruption in the contents of scratch, or truncation of slice
|
||||||
// are the types of error with equal probability. For OPEN,
|
// are the types of error with equal probability. For OPEN,
|
||||||
|
@ -453,7 +453,8 @@ def whitebox_crash_main(args, unknown_args):
|
|||||||
|
|
||||||
stdoutdata = stdoutdata.lower()
|
stdoutdata = stdoutdata.lower()
|
||||||
errorcount = (stdoutdata.count('error') -
|
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")
|
print("#times error occurred in output is " + str(errorcount) + "\n")
|
||||||
|
|
||||||
if (errorcount > 0):
|
if (errorcount > 0):
|
||||||
|
Loading…
Reference in New Issue
Block a user