提交 753d4d50 编写于 作者: L Levi Tamasi 提交者: Facebook GitHub Bot

Support using GetEntity as a verification method in the non-batched stress tests (#11144)

Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/11144

Test Plan: Ran a simple blackbox crash test.

Reviewed By: akankshamahajan15

Differential Revision: D42791464

Pulled By: ltamasi

fbshipit-source-id: 8eb6e62f0bc47f709816136ff3ded0a41d04fab8
上级 a82021c3
...@@ -51,6 +51,7 @@ class NonBatchedOpsStressTest : public StressTest { ...@@ -51,6 +51,7 @@ class NonBatchedOpsStressTest : public StressTest {
enum class VerificationMethod { enum class VerificationMethod {
kIterator, kIterator,
kGet, kGet,
kGetEntity,
kMultiGet, kMultiGet,
kGetMergeOperands, kGetMergeOperands,
// Add any new items above kNumberOfMethods // Add any new items above kNumberOfMethods
...@@ -105,7 +106,6 @@ class NonBatchedOpsStressTest : public StressTest { ...@@ -105,7 +106,6 @@ class NonBatchedOpsStressTest : public StressTest {
VerificationAbort(shared, static_cast<int>(cf), i, VerificationAbort(shared, static_cast<int>(cf), i,
iter->value(), iter->columns(), iter->value(), iter->columns(),
expected_columns); expected_columns);
break;
} }
from_db = iter->value().ToString(); from_db = iter->value().ToString();
...@@ -146,6 +146,45 @@ class NonBatchedOpsStressTest : public StressTest { ...@@ -146,6 +146,45 @@ class NonBatchedOpsStressTest : public StressTest {
/* msg_prefix */ "Get verification", s, /* msg_prefix */ "Get verification", s,
/* strict */ true); /* strict */ true);
if (!from_db.empty()) {
PrintKeyValue(static_cast<int>(cf), static_cast<uint32_t>(i),
from_db.data(), from_db.size());
}
}
} else if (method == VerificationMethod::kGetEntity) {
for (int64_t i = start; i < end; ++i) {
if (thread->shared->HasVerificationFailedYet()) {
break;
}
const std::string key = Key(i);
PinnableWideColumns columns;
Status s =
db_->GetEntity(options, column_families_[cf], key, &columns);
const WideColumns& columns_from_db = columns.columns();
std::string from_db;
if (s.ok()) {
if (!columns_from_db.empty() &&
columns_from_db[0].name() == kDefaultWideColumnName) {
from_db = columns_from_db[0].value().ToString();
}
const WideColumns expected_columns =
GenerateExpectedWideColumns(GetValueBase(from_db), from_db);
if (columns_from_db != expected_columns) {
VerificationAbort(shared, static_cast<int>(cf), i, from_db,
columns_from_db, expected_columns);
}
}
VerifyOrSyncValue(static_cast<int>(cf), i, options, shared, from_db,
/* msg_prefix */ "GetEntity verification", s,
/* strict */ true);
if (!from_db.empty()) { if (!from_db.empty()) {
PrintKeyValue(static_cast<int>(cf), static_cast<uint32_t>(i), PrintKeyValue(static_cast<int>(cf), static_cast<uint32_t>(i),
from_db.data(), from_db.size()); from_db.data(), from_db.size());
...@@ -1416,6 +1455,7 @@ class NonBatchedOpsStressTest : public StressTest { ...@@ -1416,6 +1455,7 @@ class NonBatchedOpsStressTest : public StressTest {
if (shared->HasVerificationFailedYet()) { if (shared->HasVerificationFailedYet()) {
return false; return false;
} }
// compare value_from_db with the value in the shared state // compare value_from_db with the value in the shared state
uint32_t value_base = shared->Get(cf, key); uint32_t value_base = shared->Get(cf, key);
if (value_base == SharedState::UNKNOWN_SENTINEL) { if (value_base == SharedState::UNKNOWN_SENTINEL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册