Skip to content

Commit c7de33c

Browse files
committed
Strict Serializability Verifier may incorrectly handle blind writes when witnessed before the writing operation ACKs
patch by Benedict; reviewed by Alex Petrov for CASSANDRA-20905
1 parent bf2c1c1 commit c7de33c

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "modules/accord"]
22
path = modules/accord
3-
url = https://github.com/apache/cassandra-accord.git
4-
branch = trunk
3+
url = https://github.com/belliottsmith/cassandra-accord.git
4+
branch = 20905-ssverifier

modules/accord

test/simulator/main/org/apache/cassandra/simulator/paxos/HistoryValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
public interface HistoryValidator
2424
{
25-
Checker witness(int start, int end);
25+
Checker witness(Object witnessedBy, int start, int end);
2626

2727
void print(@Nullable Integer pk);
2828

test/simulator/main/org/apache/cassandra/simulator/paxos/LinearizabilityValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public LinearizabilityValidator(int[] primaryKeys)
3737
}
3838

3939
@Override
40-
public Checker witness(int start, int end)
40+
public Checker witness(Object witnessedBy, int start, int end)
4141
{
4242
return new Checker()
4343
{

test/simulator/main/org/apache/cassandra/simulator/paxos/LoggingHistoryValidator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ public LoggingHistoryValidator(HistoryValidator delegate)
3535
}
3636

3737
@Override
38-
public Checker witness(int start, int end)
38+
public Checker witness(Object witnessedBy, int start, int end)
3939
{
4040
StringBuilder sb = new StringBuilder();
4141
sb.append("Witness(start=").append(start).append(", end=").append(end).append(")\n");
42-
Checker sub = delegate.witness(start, end);
42+
Checker sub = delegate.witness(witnessedBy, start, end);
4343
return new Checker()
4444
{
4545
@Override

test/simulator/main/org/apache/cassandra/simulator/paxos/PairOfSequencesAccordSimulation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void verify(Observation outcome)
203203
IntHashSet seen = new IntHashSet();
204204
//TODO if there isn't a value then we get empty read, which then doesn't make it into the QueryResult
205205
// given the fact that we always run with the partitions defined this should be fine
206-
try (HistoryValidator.Checker checker = validator.witness(outcome.start, outcome.end))
206+
try (HistoryValidator.Checker checker = validator.witness(outcome, outcome.start, outcome.end))
207207
{
208208
while (result.hasNext())
209209
{

test/simulator/main/org/apache/cassandra/simulator/paxos/StrictSerializabilityValidator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public StrictSerializabilityValidator(int[] primaryKeys)
4343
}
4444

4545
@Override
46-
public Checker witness(int start, int end)
46+
public Checker witness(Object witnessedBy, int start, int end)
4747
{
4848
verifier.begin();
4949
return new Checker()
@@ -63,7 +63,7 @@ public void write(int pk, int id, boolean success)
6363
@Override
6464
public void close()
6565
{
66-
convertHistoryViolation(() -> verifier.apply("", start, end));
66+
convertHistoryViolation(() -> verifier.apply(witnessedBy, start, end));
6767
}
6868
};
6969
}

test/simulator/test/org/apache/cassandra/simulator/paxos/HistoryValidatorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ private static void txn(HistoryValidator validator, Observation ob, Event... eve
326326
{
327327
String type = events.length == 1 ? "single" : "multiple";
328328
logger.info("[Validator={}, Observation=({}, {}, {})] Validating {} {}}", validator.getClass().getSimpleName(), ob.id, ob.start, ob.end, type, events);
329-
try (HistoryValidator.Checker check = validator.witness(ob.start, ob.end))
329+
try (HistoryValidator.Checker check = validator.witness(ob, ob.start, ob.end))
330330
{
331331
for (Event e : events)
332332
e.process(ob, check);
@@ -477,7 +477,7 @@ void write(int pk, int id, boolean success)
477477

478478
void process(HistoryValidator validator)
479479
{
480-
try (HistoryValidator.Checker check = validator.witness(start, end))
480+
try (HistoryValidator.Checker check = validator.witness("", start, end))
481481
{
482482
for (Operation a : actions)
483483
a.check(check);

0 commit comments

Comments
 (0)