fix: replace named locks with Galera-compatible row locks
This commit is contained in:
1 parent
ee07866d1c
commit
65d16c2fc6
22 files changed
+314
-365
No files matched your search
+3
-4
@@ -845,7 +845,7 @@ func TestPagePathCleaning(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestZoneTxLockReleaseFailureKeepsTheCommittedChange(t *testing.T) {
|
||||
func TestDelegationGrantCommitsWithZoneLock(t *testing.T) {
|
||||
token, tokenHash, err := newSessionToken(strings.NewReader(strings.Repeat("k", 32)))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -855,8 +855,7 @@ func TestZoneTxLockReleaseFailureKeepsTheCommittedChange(t *testing.T) {
|
||||
}
|
||||
session := append(userValues(1, "admin", roleAdmin), tokenHash, int64(1), webNow, webNow, webNow.Add(time.Hour), "192.0.2.1", "test")
|
||||
db, st := newFakeDB(t, fdbRules(
|
||||
fdbRule{"SELECT GET_LOCK", fdbResponse{rows: fdbRow(int64(1))}},
|
||||
fdbRule{"SELECT RELEASE_LOCK", fdbResponse{err: errors.New("connection lost")}},
|
||||
fdbRule{"webui_locks", fdbResponse{rowsAffected: 1}},
|
||||
fdbRule{"x.`token_hash` = ?", fdbResponse{rows: [][]driver.Value{session}}},
|
||||
fdbRule{"ORDER BY u.`id` FOR UPDATE", fdbResponse{rows: [][]driver.Value{userValues(1, "admin", roleAdmin)}}},
|
||||
fdbRule{"SELECT 1 FROM `coredns_records`", fdbResponse{rows: fdbRow(int64(1))}},
|
||||
@@ -888,7 +887,7 @@ func TestZoneTxLockReleaseFailureKeepsTheCommittedChange(t *testing.T) {
|
||||
if audits != 1 || grants != 1 || st.commits != 1 || st.rollbacks != 0 {
|
||||
t.Fatalf("audits %d grants %d commits %d rollbacks %d", audits, grants, st.commits, st.rollbacks)
|
||||
}
|
||||
if !strings.Contains(logs.String(), "named lock release failed, discarding the connection") || !strings.Contains(logs.String(), `msg="change committed" operation=delegation_grant`) {
|
||||
if !strings.Contains(logs.String(), "zone lock acquired") || !strings.Contains(logs.String(), `msg="change committed" operation=delegation_grant`) {
|
||||
t.Fatal(logs.String())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user