frappe_docker/overrides/compose.mariadb.yaml
1060778506 73689ccf9b
QueryDeadlockError (1020) on fresh Docker install with MariaDB 11 when Insights is installed
## Environment

- Frappe version: v15.101.3 (latest)
- Insights version: 3.3.1
- MariaDB: 11.8 (official docker image)
- Deployment: Docker (custom image based on frappe/bench)
- Transaction isolation: REPEATABLE-READ (default)

## Steps to Reproduce

1. Fresh Docker deployment
2. Install Insights
3. Login for the first time
4. System automatically creates User → Contact
5. Background job `create_contact` runs
6. Error occurs

## Error

QueryDeadlockError: (1020, "Record has changed since last read in table 'tabContact'")

Traceback attached below.

## Observation

- If Insights is NOT installed → no error
- If database isolation level is changed to READ-COMMITTED → no error

## Suspected Cause

Insights hooks on Contact insert/update may be triggering additional DB reads/writes within the same transaction, which conflicts with MariaDB 11 default REPEATABLE READ isolation.

## Question

Should Insights defer its hooks using enqueue_after_commit=True or after_commit mechanism to avoid transaction conflicts under default MariaDB settings?
2026-03-02 20:54:37 +08:00

32 lines
798 B
YAML

services:
configurator:
environment:
DB_HOST: db
DB_PORT: "3306"
depends_on:
db:
condition: service_healthy
db:
image: mariadb:11.8
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 5s
interval: 5s
timeout: 5s
retries: 5
restart: unless-stopped
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake
- --skip-innodb-read-only-compressed # Temporary fix for MariaDB 10.6
- --transaction-isolation=READ-COMMITTED
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-123}
MARIADB_AUTO_UPGRADE: 1
volumes:
- db-data:/var/lib/mysql
volumes:
db-data: