|
|
|
@ -653,6 +653,10 @@ void StressTest::OperateDb(ThreadState* thread) { |
|
|
|
|
VerificationAbort(shared, "VerifyChecksum status not OK", status); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (thread->rand.OneInOpt(FLAGS_get_property_one_in)) { |
|
|
|
|
TestGetProperty(thread); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
std::vector<int64_t> rand_keys = GenerateKeys(rand_key); |
|
|
|
@ -1428,6 +1432,63 @@ Status StressTest::TestCheckpoint(ThreadState* thread, |
|
|
|
|
return s; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void StressTest::TestGetProperty(ThreadState* thread) const { |
|
|
|
|
std::unordered_set<std::string> levelPropertyNames = { |
|
|
|
|
DB::Properties::kAggregatedTablePropertiesAtLevel, |
|
|
|
|
DB::Properties::kCompressionRatioAtLevelPrefix, |
|
|
|
|
DB::Properties::kNumFilesAtLevelPrefix, |
|
|
|
|
}; |
|
|
|
|
std::unordered_set<std::string> unknownPropertyNames = { |
|
|
|
|
DB::Properties::kEstimateOldestKeyTime, |
|
|
|
|
DB::Properties::kOptionsStatistics, |
|
|
|
|
}; |
|
|
|
|
unknownPropertyNames.insert(levelPropertyNames.begin(), |
|
|
|
|
levelPropertyNames.end()); |
|
|
|
|
|
|
|
|
|
std::string prop; |
|
|
|
|
for (const auto& ppt_name_and_info : InternalStats::ppt_name_to_info) { |
|
|
|
|
bool res = db_->GetProperty(ppt_name_and_info.first, &prop); |
|
|
|
|
if (unknownPropertyNames.find(ppt_name_and_info.first) == |
|
|
|
|
unknownPropertyNames.end()) { |
|
|
|
|
if (!res) { |
|
|
|
|
fprintf(stderr, "Failed to get DB property: %s\n", |
|
|
|
|
ppt_name_and_info.first.c_str()); |
|
|
|
|
thread->shared->SetVerificationFailure(); |
|
|
|
|
} |
|
|
|
|
if (ppt_name_and_info.second.handle_int != nullptr) { |
|
|
|
|
uint64_t prop_int; |
|
|
|
|
if (!db_->GetIntProperty(ppt_name_and_info.first, &prop_int)) { |
|
|
|
|
fprintf(stderr, "Failed to get Int property: %s\n", |
|
|
|
|
ppt_name_and_info.first.c_str()); |
|
|
|
|
thread->shared->SetVerificationFailure(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ROCKSDB_NAMESPACE::ColumnFamilyMetaData cf_meta_data; |
|
|
|
|
db_->GetColumnFamilyMetaData(&cf_meta_data); |
|
|
|
|
int level_size = static_cast<int>(cf_meta_data.levels.size()); |
|
|
|
|
for (int level = 0; level < level_size; level++) { |
|
|
|
|
for (const auto& ppt_name : levelPropertyNames) { |
|
|
|
|
bool res = db_->GetProperty(ppt_name + std::to_string(level), &prop); |
|
|
|
|
if (!res) { |
|
|
|
|
fprintf(stderr, "Failed to get DB property: %s\n", |
|
|
|
|
(ppt_name + std::to_string(level)).c_str()); |
|
|
|
|
thread->shared->SetVerificationFailure(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Test for an invalid property name
|
|
|
|
|
if (thread->rand.OneIn(100)) { |
|
|
|
|
if (db_->GetProperty("rocksdb.invalid_property_name", &prop)) { |
|
|
|
|
fprintf(stderr, "Failed to return false for invalid property name\n"); |
|
|
|
|
thread->shared->SetVerificationFailure(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void StressTest::TestCompactFiles(ThreadState* thread, |
|
|
|
|
ColumnFamilyHandle* column_family) { |
|
|
|
|
ROCKSDB_NAMESPACE::ColumnFamilyMetaData cf_meta_data; |
|
|
|
|