Skip to content

Commit

Permalink
upsert overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Mar 31, 2023
1 parent d3f2ed1 commit a067d3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions e2e/newenemy/newenemy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ func attemptFnsForProbeFns(vulnerableMax int, vulnerableProbe, protectedProbe pr
var attempts int
for protected {
protected, attempts = protectedProbe(count)
// if the number of attempts doesn't match the count, that means
// the test has requests a reset for some reason.
if attempts < count {
continue
}
// // if the number of attempts doesn't match the count, that means
// // the test has requests a reset for some reason.
// if attempts < count {
// continue
// }
require.True(t, protected, "protection is enabled, but newenemy detected")
require.Equal(t, count, attempts)
t.Logf("spicedb is protected after %d attempts", count)
Expand Down Expand Up @@ -295,6 +295,9 @@ func iterationsForHighConfidence(samples []int) (iterations int) {
if *maxIterations != 0 && *maxIterations < iterations {
iterations = *maxIterations
}
if iterations < 50 {
iterations = 50
}
return
}

Expand Down
4 changes: 2 additions & 2 deletions internal/datastore/crdb/crdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ func (cds *crdbDatastore) ReadWriteTx(
// Touching the transaction key happens last so that the "write intent" for
// the transaction as a whole lands in a range for the affected tuples.
for k := range rwt.overlapKeySet {
if _, err := tx.Exec(ctx, queryTouchTransaction, k); err != nil {
return fmt.Errorf("error writing overlapping keys: %w", err)
if _, err := tx.Exec(ctx, "UPSERT INTO transactions(key) VALUES ($1);", k); err != nil {
return err
}
}

Expand Down

0 comments on commit a067d3f

Please sign in to comment.