mirror of https://github.com/facebook/rocksdb.git
Add Transaction::PutEntity to the stress tests (#12688)
Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/12688 As a first step of covering the wide-column transaction APIs, the patch adds `PutEntity` to the optimistic and pessimistic transaction stress tests (for the latter, only when the WriteCommitted policy is utilized). Other APIs and the multi-operation transaction test will be covered by subsequent PRs. Reviewed By: jaykorean Differential Revision: D57675781 fbshipit-source-id: bfe062ec5f6ab48641cd99a70f239ce4aa39299c
This commit is contained in:
parent
733150f6aa
commit
db0960800a
|
@ -617,8 +617,21 @@ void StressTest::PreloadDbAndReopenAsReadOnly(int64_t number_of_keys,
|
||||||
|
|
||||||
if (FLAGS_use_put_entity_one_in > 0 &&
|
if (FLAGS_use_put_entity_one_in > 0 &&
|
||||||
(value_base % FLAGS_use_put_entity_one_in) == 0) {
|
(value_base % FLAGS_use_put_entity_one_in) == 0) {
|
||||||
s = db_->PutEntity(write_opts, cfh, key,
|
if (!FLAGS_use_txn) {
|
||||||
GenerateWideColumns(value_base, v));
|
if (FLAGS_use_attribute_group) {
|
||||||
|
s = db_->PutEntity(write_opts, key,
|
||||||
|
GenerateAttributeGroups({cfh}, value_base, v));
|
||||||
|
} else {
|
||||||
|
s = db_->PutEntity(write_opts, cfh, key,
|
||||||
|
GenerateWideColumns(value_base, v));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
s = ExecuteTransaction(
|
||||||
|
write_opts, /*thread=*/nullptr, [&](Transaction& txn) {
|
||||||
|
return txn.PutEntity(cfh, key,
|
||||||
|
GenerateWideColumns(value_base, v));
|
||||||
|
});
|
||||||
|
}
|
||||||
} else if (FLAGS_use_merge) {
|
} else if (FLAGS_use_merge) {
|
||||||
if (!FLAGS_use_txn) {
|
if (!FLAGS_use_txn) {
|
||||||
if (FLAGS_user_timestamp_size > 0) {
|
if (FLAGS_user_timestamp_size > 0) {
|
||||||
|
|
|
@ -301,11 +301,11 @@ int db_stress_tool(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FLAGS_use_put_entity_one_in > 0 &&
|
if (FLAGS_use_put_entity_one_in > 0 &&
|
||||||
(FLAGS_use_full_merge_v1 || FLAGS_use_txn || FLAGS_test_multi_ops_txns ||
|
(FLAGS_use_full_merge_v1 || FLAGS_test_multi_ops_txns ||
|
||||||
FLAGS_user_timestamp_size > 0)) {
|
FLAGS_user_timestamp_size > 0)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Wide columns are incompatible with V1 Merge, transactions, and "
|
"Wide columns are incompatible with V1 Merge, the multi-op "
|
||||||
"user-defined timestamps\n");
|
"transaction test, and user-defined timestamps\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1483,12 +1483,18 @@ class NonBatchedOpsStressTest : public StressTest {
|
||||||
|
|
||||||
if (FLAGS_use_put_entity_one_in > 0 &&
|
if (FLAGS_use_put_entity_one_in > 0 &&
|
||||||
(value_base % FLAGS_use_put_entity_one_in) == 0) {
|
(value_base % FLAGS_use_put_entity_one_in) == 0) {
|
||||||
if (FLAGS_use_attribute_group) {
|
if (!FLAGS_use_txn) {
|
||||||
s = db_->PutEntity(write_opts, k,
|
if (FLAGS_use_attribute_group) {
|
||||||
GenerateAttributeGroups({cfh}, value_base, v));
|
s = db_->PutEntity(write_opts, k,
|
||||||
|
GenerateAttributeGroups({cfh}, value_base, v));
|
||||||
|
} else {
|
||||||
|
s = db_->PutEntity(write_opts, cfh, k,
|
||||||
|
GenerateWideColumns(value_base, v));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
s = db_->PutEntity(write_opts, cfh, k,
|
s = ExecuteTransaction(write_opts, thread, [&](Transaction& txn) {
|
||||||
GenerateWideColumns(value_base, v));
|
return txn.PutEntity(cfh, k, GenerateWideColumns(value_base, v));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (FLAGS_use_timed_put_one_in > 0 &&
|
} else if (FLAGS_use_timed_put_one_in > 0 &&
|
||||||
((value_base + kLargePrimeForCommonFactorSkew) %
|
((value_base + kLargePrimeForCommonFactorSkew) %
|
||||||
|
|
|
@ -493,8 +493,6 @@ txn_params = {
|
||||||
# pipeline write is not currnetly compatible with WritePrepared txns
|
# pipeline write is not currnetly compatible with WritePrepared txns
|
||||||
"enable_pipelined_write": 0,
|
"enable_pipelined_write": 0,
|
||||||
"create_timestamped_snapshot_one_in": random.choice([0, 20]),
|
"create_timestamped_snapshot_one_in": random.choice([0, 20]),
|
||||||
# PutEntity in transactions is not yet implemented
|
|
||||||
"use_put_entity_one_in": 0,
|
|
||||||
# Should not be used with TransactionDB which uses snapshot.
|
# Should not be used with TransactionDB which uses snapshot.
|
||||||
"inplace_update_support": 0,
|
"inplace_update_support": 0,
|
||||||
# TimedPut is not supported in transaction
|
# TimedPut is not supported in transaction
|
||||||
|
@ -508,8 +506,6 @@ optimistic_txn_params = {
|
||||||
"occ_validation_policy": random.randint(0, 1),
|
"occ_validation_policy": random.randint(0, 1),
|
||||||
"share_occ_lock_buckets": random.randint(0, 1),
|
"share_occ_lock_buckets": random.randint(0, 1),
|
||||||
"occ_lock_bucket_count": lambda: random.choice([10, 100, 500]),
|
"occ_lock_bucket_count": lambda: random.choice([10, 100, 500]),
|
||||||
# PutEntity in transactions is not yet implemented
|
|
||||||
"use_put_entity_one_in": 0,
|
|
||||||
# Should not be used with OptimisticTransactionDB which uses snapshot.
|
# Should not be used with OptimisticTransactionDB which uses snapshot.
|
||||||
"inplace_update_support": 0,
|
"inplace_update_support": 0,
|
||||||
# TimedPut is not supported in transaction
|
# TimedPut is not supported in transaction
|
||||||
|
@ -801,6 +797,9 @@ def finalize_and_sanitize(src_params):
|
||||||
if dest_params.get("use_txn") == 1 and dest_params.get("txn_write_policy", 0) != 0:
|
if dest_params.get("use_txn") == 1 and dest_params.get("txn_write_policy", 0) != 0:
|
||||||
dest_params["sync_fault_injection"] = 0
|
dest_params["sync_fault_injection"] = 0
|
||||||
dest_params["manual_wal_flush_one_in"] = 0
|
dest_params["manual_wal_flush_one_in"] = 0
|
||||||
|
# Wide-column pessimistic transaction APIs are initially supported for
|
||||||
|
# WriteCommitted only
|
||||||
|
dest_params["use_put_entity_one_in"] = 0
|
||||||
# Wide column stress tests require FullMergeV3
|
# Wide column stress tests require FullMergeV3
|
||||||
if dest_params["use_put_entity_one_in"] != 0:
|
if dest_params["use_put_entity_one_in"] != 0:
|
||||||
dest_params["use_full_merge_v1"] = 0
|
dest_params["use_full_merge_v1"] = 0
|
||||||
|
|
Loading…
Reference in New Issue