fix: support utf8mb4 across MySQL and MariaDB
This commit is contained in:
1 parent
cce17c5fa4
commit
d34894c9cd
28 files changed
+224
-121
No files matched your search
@@ -157,18 +157,17 @@ func (it itHTTP) race(t *testing.T, first, second webRequest, firstStatus, secon
|
||||
|
||||
func (it itHTTP) waitForUserLock(t *testing.T, ctx context.Context, result <-chan *httptest.ResponseRecorder) {
|
||||
t.Helper()
|
||||
it.waitForLock(t, ctx, result, "user row lock", "SELECT EXISTS (SELECT 1 FROM performance_schema.data_lock_waits w "+
|
||||
"JOIN performance_schema.data_locks l ON l.ENGINE = w.ENGINE AND l.ENGINE_LOCK_ID = w.REQUESTING_ENGINE_LOCK_ID "+
|
||||
"WHERE l.OBJECT_SCHEMA = ? AND l.OBJECT_NAME = ?)", it.database.name, it.database.prefix+"webui_users")
|
||||
it.waitForLock(t, ctx, result, "user row lock", func() (bool, error) {
|
||||
return it.database.rowLockWaiting(ctx, "webui_users")
|
||||
})
|
||||
}
|
||||
|
||||
func (it itHTTP) waitForLock(t *testing.T, ctx context.Context, result <-chan *httptest.ResponseRecorder, lock, query string, args ...any) {
|
||||
func (it itHTTP) waitForLock(t *testing.T, ctx context.Context, result <-chan *httptest.ResponseRecorder, lock string, observe func() (bool, error)) {
|
||||
t.Helper()
|
||||
tick := time.NewTicker(20 * time.Millisecond)
|
||||
tick := time.NewTicker(itLockPollInterval)
|
||||
defer tick.Stop()
|
||||
for {
|
||||
var waiting bool
|
||||
err := it.database.root.QueryRowContext(ctx, query, args...).Scan(&waiting)
|
||||
waiting, err := observe()
|
||||
if err != nil {
|
||||
t.Fatalf("observe %s: %v", lock, err)
|
||||
}
|
||||
@@ -378,8 +377,14 @@ func TestIntegrationZoneCreationDelegationRace(t *testing.T) {
|
||||
go func() { a <- it.do(ctx, first) }()
|
||||
it.waitForUserLock(t, ctx, a)
|
||||
go func() { b <- it.do(ctx, second) }()
|
||||
it.waitForLock(t, ctx, b, "zone named lock", "SELECT EXISTS (SELECT 1 FROM performance_schema.metadata_locks "+
|
||||
"WHERE OBJECT_TYPE = 'USER LEVEL LOCK' AND OBJECT_NAME = ? AND LOCK_STATUS = 'PENDING')", tables.zoneLockName(zone))
|
||||
it.waitForLock(t, ctx, b, "zone named lock", func() (bool, error) {
|
||||
var waiting bool
|
||||
// Each fixture has a separate database account. The only named
|
||||
// lock wait for that account here is on this zone.
|
||||
err := it.database.root.QueryRowContext(ctx, "SELECT EXISTS (SELECT 1 FROM information_schema.PROCESSLIST "+
|
||||
"WHERE USER = ? AND LOWER(STATE) = 'user lock')", it.database.appUser).Scan(&waiting)
|
||||
return waiting, err
|
||||
})
|
||||
if err := gate.Commit(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user