Skip to content

Instantly share code, notes, and snippets.

@mdcallag
Created February 15, 2022 18:42
Show Gist options
  • Save mdcallag/0b3cffc10f01b345e244a44ada0f09a2 to your computer and use it in GitHub Desktop.
Save mdcallag/0b3cffc10f01b345e244a44ada0f09a2 to your computer and use it in GitHub Desktop.
diff tools/db_bench_tool.cc db_bench_tool.cc.fillseq
--- tools/db_bench_tool.cc 2022-02-15 10:42:01.071748970 -0800
+++ db_bench_tool.cc.fillseq 2022-02-14 14:33:55.101778301 -0800
@@ -3115,6 +3115,7 @@
if (port::kLittleEndian) {
for (int i = 0; i < bytes_to_fill; ++i) {
pos[i] = (prefix >> ((bytes_to_fill - i - 1) << 3)) & 0xFF;
+ printf("shift %d for i=%d to %ld\n", ((bytes_to_fill - i - 1) << 3), i, (prefix >> ((bytes_to_fill - i - 1) << 3)));
}
} else {
memcpy(pos, static_cast<void*>(&prefix), bytes_to_fill);
@@ -3124,7 +3125,9 @@
memset(pos + 8, '0', prefix_size_ - 8);
}
pos += prefix_size_;
+ printf("prefix,key = %lu %lu\n", prefix, v);
}
+ // { *pos = 'c'; pos++; }
int bytes_to_fill = std::min(key_size_ - static_cast<int>(pos - start), 8);
if (port::kLittleEndian) {
@@ -3293,7 +3296,7 @@
method = &Benchmark::WriteUniqueRandomDeterministic;
}
} else if (name == "fillseq") {
- fresh_db = true;
+ // fresh_db = true;
method = &Benchmark::WriteSeq;
} else if (name == "fillbatch") {
fresh_db = true;
@@ -4678,12 +4681,15 @@
RandomShuffle(values_.begin(), values_.end(),
static_cast<uint32_t>(FLAGS_seed));
}
+ // if (mode_ == SEQUENTIAL) { next_ = num_; }
}
uint64_t Next() {
switch (mode_) {
case SEQUENTIAL:
return next_++;
+ // if (next_ > num_) { printf("underflow\n"); abort(); }
+ // return next_--;
case RANDOM:
return rand_->Next() % num_;
case UNIQUE_RANDOM:
[mcallaghan@devvm4924.vll0 ~/loc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment