Explicitly allow writeVersion to be non-decreasing
Some checks failed
Tests / Clang total: 1162, passed: 1162
Clang |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / SIMD fallback total: 1162, passed: 1162
Tests / Release [gcc] total: 1162, passed: 1162
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 868, passed: 868
Tests / Coverage total: 872, passed: 872
weaselab/conflict-set/pipeline/head There was a failure building this commit

Instead of strictly increasing.
This commit is contained in:
2024-04-22 14:15:44 -07:00
parent ea76e04cda
commit aa5dbb2887
2 changed files with 10 additions and 10 deletions

View File

@@ -523,7 +523,7 @@ template <class ConflictSetImpl> struct TestDriver {
explicit TestDriver(const uint8_t *data, size_t size)
: arbitrary({data, size}) {}
int64_t writeVersion = 0;
int64_t writeVersion = 1000;
int64_t oldestVersion = 0;
ConflictSetImpl cs{oldestVersion};
ReferenceImpl refImpl{oldestVersion};
@@ -545,7 +545,7 @@ template <class ConflictSetImpl> struct TestDriver {
{
int numPointWrites = arbitrary.bounded(100);
int numRangeWrites = arbitrary.bounded(100);
int64_t v = ++writeVersion;
int64_t v = (writeVersion += arbitrary.bounded(10));
auto *writes =
new (arena) ConflictSet::WriteRange[numPointWrites + numRangeWrites];
auto keys = set<std::string_view>(arena);
@@ -605,8 +605,8 @@ template <class ConflictSetImpl> struct TestDriver {
refImpl.addWrites(writes, numPointWrites + numRangeWrites, v);
oldestVersion = std::max<int64_t>(writeVersion - arbitrary.bounded(10),
oldestVersion);
oldestVersion =
std::min(writeVersion - 10, oldestVersion + arbitrary.bounded(10));
cs.setOldestVersion(oldestVersion);
refImpl.setOldestVersion(oldestVersion);
}

View File

@@ -71,12 +71,12 @@ struct __attribute__((__visibility__("default"))) ConflictSet {
/** `writes` must be sorted ascending, and must not have adjacent or
* overlapping ranges. Reads intersecting writes where readVersion <
* `writeVersion` will result in `Conflict` (or `TooOld`, eventually).
* `writeVersion` must be greater than every write version in all previous
* calls to `addWrites` */
* `writeVersion` must be greater than or equal to all previous write
* versions. */
void addWrites(const WriteRange *writes, int count, int64_t writeVersion);
/** Reads where readVersion < oldestVersion will result in `TooOld`. Must be
* greater than any previous oldestVersion */
* greater than or equal to all previous oldest versions. */
void setOldestVersion(int64_t oldestVersion);
/** Reads where readVersion < oldestVersion will result in `TooOld`. There are
@@ -160,14 +160,14 @@ void ConflictSet_check(const ConflictSet *cs,
/** `writes` must be sorted ascending, and must not have adjacent or
* overlapping ranges. Reads intersecting writes where readVersion <
* `writeVersion` will result in `Conflict` (or `TooOld`, eventually).
* `writeVersion` must be greater than all write versions in all previous
* calls to `addWrites` */
* `writeVersion` must be greater than or equal to all previous write versions.
*/
void ConflictSet_addWrites(ConflictSet *cs,
const ConflictSet_WriteRange *writes, int count,
int64_t writeVersion);
/** Reads where readVersion < oldestVersion will result in `TooOld`. Must be
* greater than any previous oldestVersion */
* greater than or equal to all previous oldest versions. */
void ConflictSet_setOldestVersion(ConflictSet *cs, int64_t oldestVersion);
/** Reads where readVersion < oldestVersion will result in `TooOld`. There are