Add range reads to server_bench
All checks were successful
Tests / 64 bit versions total: 8097, passed: 8097
Tests / Debug total: 8095, passed: 8095
Tests / SIMD fallback total: 8097, passed: 8097
Tests / Release [clang] total: 8097, passed: 8097
Clang |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / gcc total: 8097, passed: 8097
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [clang,aarch64] total: 5366, passed: 5366
Tests / Coverage total: 5414, passed: 5414
Code Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 97.67% (3149/3224)
* Branch Coverage: 42.26% (19259/45578)
* Complexity Density: 0.00
* Lines of Code: 3224
#### Quality Gates Summary
Output truncated.
weaselab/conflict-set/pipeline/head This commit looks good
All checks were successful
Tests / 64 bit versions total: 8097, passed: 8097
Tests / Debug total: 8095, passed: 8095
Tests / SIMD fallback total: 8097, passed: 8097
Tests / Release [clang] total: 8097, passed: 8097
Clang |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / gcc total: 8097, passed: 8097
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [clang,aarch64] total: 5366, passed: 5366
Tests / Coverage total: 5414, passed: 5414
Code Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 97.67% (3149/3224)
* Branch Coverage: 42.26% (19259/45578)
* Complexity Density: 0.00
* Lines of Code: 3224
#### Quality Gates Summary
Output truncated.
weaselab/conflict-set/pipeline/head This commit looks good
This commit is contained in:
@@ -66,13 +66,14 @@ template <class... Ts> std::string tupleKey(const Ts &...ts) {
|
||||
|
||||
constexpr int kTotalKeyRange = 1'000'000'000;
|
||||
constexpr int kWindowSize = 1'000'000;
|
||||
constexpr int kNumKeys = 10;
|
||||
constexpr int kNumReadKeysPerTx = 10;
|
||||
constexpr int kNumWriteKeysPerTx = 5;
|
||||
|
||||
void workload(weaselab::ConflictSet *cs) {
|
||||
int64_t version = kWindowSize;
|
||||
for (;; transactions.fetch_add(1, std::memory_order_relaxed)) {
|
||||
std::vector<int64_t> keyIndices;
|
||||
for (int i = 0; i < kNumKeys; ++i) {
|
||||
for (int i = 0; i < std::max(kNumReadKeysPerTx, kNumWriteKeysPerTx); ++i) {
|
||||
keyIndices.push_back(rand() % kTotalKeyRange);
|
||||
}
|
||||
std::sort(keyIndices.begin(), keyIndices.end());
|
||||
@@ -80,7 +81,7 @@ void workload(weaselab::ConflictSet *cs) {
|
||||
constexpr std::string_view fullString =
|
||||
"this is a string, where a prefix of it is used as an element of the "
|
||||
"tuple forming the key";
|
||||
for (int i = 0; i < kNumKeys; ++i) {
|
||||
for (int i = 0; i < int(keyIndices.size()); ++i) {
|
||||
keys.push_back(
|
||||
tupleKey(0x100, keyIndices[i] / fullString.size(),
|
||||
fullString.substr(0, keyIndices[i] % fullString.size())));
|
||||
@@ -90,21 +91,22 @@ void workload(weaselab::ConflictSet *cs) {
|
||||
std::vector<weaselab::ConflictSet::ReadRange> reads;
|
||||
std::vector<weaselab::ConflictSet::WriteRange> writes;
|
||||
std::vector<weaselab::ConflictSet::Result> results;
|
||||
for (int i = 0; i < kNumKeys; ++i) {
|
||||
for (int i = 0; i < kNumWriteKeysPerTx; ++i) {
|
||||
writes.push_back({{(const uint8_t *)keys[i].data(), int(keys[i].size())},
|
||||
{nullptr, 0}});
|
||||
}
|
||||
reads.push_back({{(const uint8_t *)keys[0].data(), int(keys[0].size())},
|
||||
{(const uint8_t *)keys[1].data(), int(keys[1].size())},
|
||||
version - kWindowSize});
|
||||
static_assert(kNumReadKeysPerTx >= 3);
|
||||
for (int i = 2; i < kNumReadKeysPerTx; ++i) {
|
||||
reads.push_back({{(const uint8_t *)keys[i].data(), int(keys[i].size())},
|
||||
{nullptr, 0},
|
||||
version - kWindowSize});
|
||||
}
|
||||
results.resize(reads.size());
|
||||
|
||||
cs->check(reads.data(), results.data(), reads.size());
|
||||
bool ok = true;
|
||||
for (auto result : results) {
|
||||
ok &= result == weaselab::ConflictSet::Commit;
|
||||
}
|
||||
cs->addWrites(writes.data(), ok ? writes.size() : 0, version);
|
||||
cs->addWrites(writes.data(), writes.size(), version);
|
||||
cs->setOldestVersion(version - kWindowSize);
|
||||
++version;
|
||||
}
|
||||
|
Reference in New Issue
Block a user