Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve fault injection to MultiRead #8937

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert
  • Loading branch information
siying committed Sep 20, 2021
commit b2ddd37ca13386f61d26b3b2a2d6575009b7e23a
11 changes: 1 addition & 10 deletions table/block_based/block_based_table_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "cache/sharded_cache.h"
#include "db/dbformat.h"
#include "db/pinned_iterators_manager.h"
#include "db_stress_tool/db_stress_common.h"
#include "file/file_prefetch_buffer.h"
#include "file/file_util.h"
#include "file/random_access_file_reader.h"
Expand Down Expand Up @@ -66,7 +65,6 @@
#include "util/crc32c.h"
#include "util/stop_watch.h"
#include "util/string_util.h"
#include "utilities/fault_injection_fs.h"

namespace ROCKSDB_NAMESPACE {

Expand Down Expand Up @@ -1775,9 +1773,6 @@ void BlockBasedTable::RetrieveMultipleBlocks(
"truncated block read from " + rep_->file->file_name() +
" offset " + ToString(handle.offset()) + ", expected " +
ToString(req.len) + " bytes, got " + ToString(req.result.size()));
if (fault_fs_guard) {
fault_fs_guard->AddThreadLocalMessage("size mismatch");
}
}
}

Expand Down Expand Up @@ -1813,9 +1808,6 @@ void BlockBasedTable::RetrieveMultipleBlocks(
s = ROCKSDB_NAMESPACE::VerifyBlockChecksum(
footer.checksum(), data + req_offset, handle.size(),
rep_->file->file_name(), handle.offset());
if (!s.ok() && fault_fs_guard) {
fault_fs_guard->AddThreadLocalMessage("checksum mismatch");
}
TEST_SYNC_POINT_CALLBACK("RetrieveMultipleBlocks:VerifyChecksum", &s);
}
} else if (!use_shared_buffer) {
Expand Down Expand Up @@ -1872,8 +1864,7 @@ void BlockBasedTable::RetrieveMultipleBlocks(
continue;
}
}
}
if (s.ok()) {

CompressionType compression_type =
raw_block_contents.get_compression_type();
BlockContents contents;
Expand Down
15 changes: 5 additions & 10 deletions tools/db_crashtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
random.choice(
["none", "snappy", "zlib", "bzip2", "lz4", "lz4hc", "xpress",
"zstd"]),
"checksum_type" : lambda: random.choice(["kCRC32c"]),
# "checksum_type" : lambda: random.choice(["kCRC32c", "kxxHash", "kxxHash64"]),
"checksum_type" : lambda: random.choice(["kCRC32c", "kxxHash", "kxxHash64"]),
"compression_max_dict_bytes": lambda: 16384 * random.randint(0, 1),
"compression_zstd_max_train_bytes": lambda: 65536 * random.randint(0, 1),
# Disabled compression_parallel_threads as the feature is not stable
Expand Down Expand Up @@ -78,7 +77,7 @@
"max_bytes_for_level_base": 10485760,
"max_key": 100000000,
"max_write_buffer_number": 3,
"mmap_read": 0,
"mmap_read": lambda: random.randint(0, 1),
"nooverwritepercent": 1,
"open_files": lambda : random.choice([-1, -1, 100, 500000]),
"optimize_filters_for_memory": lambda: random.randint(0, 1),
Expand Down Expand Up @@ -113,7 +112,7 @@
"writepercent": 35,
"format_version": lambda: random.choice([2, 3, 4, 5, 5]),
"index_block_restart_interval": lambda: random.choice(range(1, 16)),
"use_multiget" : 1,
"use_multiget" : lambda: random.randint(0, 1),
"periodic_compaction_seconds" :
lambda: random.choice([0, 0, 1, 2, 10, 100, 1000]),
"compaction_ttl" : lambda: random.choice([0, 0, 1, 2, 10, 100, 1000]),
Expand Down Expand Up @@ -141,7 +140,7 @@
"continuous_verification_interval" : 0,
"max_key_len": 3,
"key_len_percent_dist": "1,30,69",
"read_fault_one_in": lambda: random.choice([10, 32]),
"read_fault_one_in": lambda: random.choice([0, 32, 1000]),
"open_metadata_write_fault_one_in": lambda: random.choice([0, 0, 8]),
"open_write_fault_one_in": lambda: random.choice([0, 0, 16]),
"open_read_fault_one_in": lambda: random.choice([0, 0, 32]),
Expand Down Expand Up @@ -513,17 +512,13 @@ def blackbox_crash_main(args, unknown_args):
print(outs)
print('stderr:')
print(errs)
sys.exit(1)
sys.exit(2)

for line in errs.split('\n'):
if line != '' and not line.startswith('WARNING'):
print('stderr has error message:')
print('***' + line + '***')

if "Didn't get expected error" in errs:
print('See verification failures')
sys.exit(1)

time.sleep(1) # time to stabilize before the next run

if args.test_best_efforts_recovery:
Expand Down