thread->shared->Get(rand_column_families[0], rand_keys[0]);
int injected_error_count = 0;
- if (fault_fs_guard && !SharedState::ignore_read_error) {
+ if (fault_fs_guard) {
injected_error_count = GetMinInjectedErrorCount(
fault_fs_guard->GetAndResetInjectedThreadLocalErrorCount(
FaultInjectionIOType::kRead),
fault_fs_guard->GetAndResetInjectedThreadLocalErrorCount(
FaultInjectionIOType::kMetadataRead));
- if (injected_error_count > 0 && (s.ok() || s.IsNotFound())) {
+ if (!SharedState::ignore_read_error && injected_error_count > 0 &&
+ (s.ok() || s.IsNotFound())) {
// Grab mutex so multiple thread don't try to print the
// stack trace at the same time
MutexLock l(thread->shared->GetMutex());
}
db_->MultiGet(readoptionscopy, cfh, num_keys, keys.data(), values.data(),
statuses.data());
- if (fault_fs_guard && !SharedState::ignore_read_error) {
+ if (fault_fs_guard) {
injected_error_count = GetMinInjectedErrorCount(
fault_fs_guard->GetAndResetInjectedThreadLocalErrorCount(
FaultInjectionIOType::kRead),
stat_nok_nfound++;
}
}
- if (stat_nok_nfound < injected_error_count) {
+ if (!SharedState::ignore_read_error &&
+ stat_nok_nfound < injected_error_count) {
// Grab mutex so multiple thread don't try to print the
// stack trace at the same time
MutexLock l(shared->GetMutex());
thread->shared->Get(column_family, key);
int injected_error_count = 0;
- if (fault_fs_guard && !SharedState::ignore_read_error) {
+ if (fault_fs_guard) {
injected_error_count = GetMinInjectedErrorCount(
fault_fs_guard->GetAndResetInjectedThreadLocalErrorCount(
FaultInjectionIOType::kRead),
fault_fs_guard->GetAndResetInjectedThreadLocalErrorCount(
FaultInjectionIOType::kMetadataRead));
- if (injected_error_count > 0 && (s.ok() || s.IsNotFound())) {
+ if (!SharedState::ignore_read_error && injected_error_count > 0 &&
+ (s.ok() || s.IsNotFound())) {
// Grab mutex so multiple thread don't try to print the
// stack trace at the same time
MutexLock l(thread->shared->GetMutex());
}
}
- if (stat_nok_nfound < injected_error_count) {
+ if (!SharedState::ignore_read_error &&
+ stat_nok_nfound < injected_error_count) {
// Grab mutex so multiple threads don't try to print the
// stack trace at the same time
assert(thread->shared);
db_->MultiGetEntity(read_opts_copy, num_keys, key_slices.data(),
results.data());
- if (fault_fs_guard && !SharedState::ignore_read_error) {
+ if (fault_fs_guard) {
verify_expected_errors(
[&](size_t i) { return results[i][0].status(); });
}
db_->MultiGetEntity(read_opts_copy, cfh, num_keys, key_slices.data(),
results.data(), statuses.data());
- if (fault_fs_guard && !SharedState::ignore_read_error) {
+ if (fault_fs_guard) {
verify_expected_errors([&](size_t i) { return statuses[i]; });
}
MaybeUseOlderTimestampForRangeScan(thread, read_ts_str, read_ts_slice,
ro_copy);
- std::unique_ptr<Iterator> iter(db_->NewIterator(ro_copy, cfh));
-
- uint64_t count = 0;
- Status s;
-
if (fault_fs_guard) {
fault_fs_guard->GetAndResetInjectedThreadLocalErrorCount(
FaultInjectionIOType::kRead);
SharedState::ignore_read_error = false;
}
+ std::unique_ptr<Iterator> iter(db_->NewIterator(ro_copy, cfh));
+
+ uint64_t count = 0;
+ Status s;
+
for (iter->Seek(prefix); iter->Valid() && iter->key().starts_with(prefix);
iter->Next()) {
++count;
}
int injected_error_count = 0;
- if (fault_fs_guard && !SharedState::ignore_read_error) {
+ if (fault_fs_guard) {
injected_error_count = GetMinInjectedErrorCount(
fault_fs_guard->GetAndResetInjectedThreadLocalErrorCount(
FaultInjectionIOType::kRead),
fault_fs_guard->GetAndResetInjectedThreadLocalErrorCount(
FaultInjectionIOType::kMetadataRead));
- if (injected_error_count > 0 && s.ok()) {
+ if (!SharedState::ignore_read_error && injected_error_count > 0 &&
+ s.ok()) {
// Grab mutex so multiple thread don't try to print the
// stack trace at the same time
MutexLock l(thread->shared->GetMutex());
} else if (injected_error_count > 0 && IsRetryableInjectedError(s)) {
fprintf(stdout, "TestPrefixScan error: %s\n", s.ToString().c_str());
} else {
+ fprintf(stderr, "TestPrefixScan is retryable error? %s\n",
+ IsRetryableInjectedError(s) ? "true" : "false");
+ fprintf(stderr, "TestPrefixScan injected_error_count: %d\n",
+ injected_error_count);
fprintf(stderr, "TestPrefixScan error: %s\n", s.ToString().c_str());
thread->shared->SetVerificationFailure();
}