Tidy
This commit is contained in:
@@ -247,10 +247,10 @@ void lastLeqMulti(Node *root, std::span<Key> keys, Iterator *results) {
|
|||||||
fprintf(file, "\n");
|
fprintf(file, "\n");
|
||||||
for (auto iter = extrema(node, false); iter != nullptr;
|
for (auto iter = extrema(node, false); iter != nullptr;
|
||||||
iter = next(iter, true)) {
|
iter = next(iter, true)) {
|
||||||
fprintf(file, " k_%.*s [label=\"k=%.*s;m=%d;v=%d,r=%d\"];\n", iter->len,
|
fprintf(file, " k_%.*s [label=\"k=\\\"%.*s\\\" m=%d v=%d r=%d\"];\n",
|
||||||
(const char *)(iter + 1), iter->len, (const char *)(iter + 1),
|
iter->len, (const char *)(iter + 1), iter->len,
|
||||||
int(iter->maxVersion), int(iter->pointVersion),
|
(const char *)(iter + 1), int(iter->maxVersion),
|
||||||
int(iter->rangeVersion));
|
int(iter->pointVersion), int(iter->rangeVersion));
|
||||||
}
|
}
|
||||||
for (int i = 0; i < printer.id; ++i) {
|
for (int i = 0; i < printer.id; ++i) {
|
||||||
fprintf(file, " null%d [shape=point];\n", i);
|
fprintf(file, " null%d [shape=point];\n", i);
|
||||||
@@ -357,7 +357,6 @@ struct ConflictSet::Impl {
|
|||||||
Node **current = &root;
|
Node **current = &root;
|
||||||
Node *parent = nullptr;
|
Node *parent = nullptr;
|
||||||
const auto &key = write.begin;
|
const auto &key = write.begin;
|
||||||
bool inserted = false;
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (*current == nullptr) {
|
if (*current == nullptr) {
|
||||||
auto *newNode = createNode(key, parent, write.writeVersion);
|
auto *newNode = createNode(key, parent, write.writeVersion);
|
||||||
@@ -366,7 +365,6 @@ struct ConflictSet::Impl {
|
|||||||
assert(prev != nullptr);
|
assert(prev != nullptr);
|
||||||
assert(prev->rangeVersion <= write.writeVersion);
|
assert(prev->rangeVersion <= write.writeVersion);
|
||||||
newNode->rangeVersion = prev->rangeVersion;
|
newNode->rangeVersion = prev->rangeVersion;
|
||||||
inserted = true;
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// This is the key optimization - setting the max version on the way
|
// This is the key optimization - setting the max version on the way
|
||||||
@@ -382,7 +380,7 @@ struct ConflictSet::Impl {
|
|||||||
current = &((*current)->child[c > 0]);
|
current = &((*current)->child[c > 0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inserted) {
|
|
||||||
auto *n = *current;
|
auto *n = *current;
|
||||||
assert(n != nullptr);
|
assert(n != nullptr);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -405,7 +403,6 @@ struct ConflictSet::Impl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void addWrites(const WriteRange *writes, int count) {
|
void addWrites(const WriteRange *writes, int count) {
|
||||||
for (const auto &w : std::span<const WriteRange>(writes, count)) {
|
for (const auto &w : std::span<const WriteRange>(writes, count)) {
|
||||||
@@ -465,12 +462,13 @@ ConflictSet &ConflictSet::operator=(ConflictSet &&other) noexcept {
|
|||||||
|
|
||||||
#ifdef ENABLE_TESTS
|
#ifdef ENABLE_TESTS
|
||||||
int main(void) {
|
int main(void) {
|
||||||
ConflictSet::Impl cs{0};
|
int64_t writeVersion = 0;
|
||||||
|
ConflictSet::Impl cs{writeVersion};
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
ConflictSet::WriteRange write;
|
ConflictSet::WriteRange write;
|
||||||
write.begin = toKey(i);
|
write.begin = toKey(i);
|
||||||
write.end.len = 0;
|
write.end.len = 0;
|
||||||
write.writeVersion = i;
|
write.writeVersion = ++writeVersion;
|
||||||
cs.addWrites(&write, 1);
|
cs.addWrites(&write, 1);
|
||||||
}
|
}
|
||||||
debugPrintDot(stdout, cs.root);
|
debugPrintDot(stdout, cs.root);
|
||||||
|
Reference in New Issue
Block a user