How to Fix MySQL Error 3804 (ER_PAGE_TRACKING_CANNOT_PURGE)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see mysql error 3804 when you try to purge page tracking data during a clone job. Wait for the active clone job to finish, then run the purge action again. MySQL uses the symbol ER_PAGE_TRACKING_CANNOT_PURGE and SQLSTATE HY000 for this failure. The engine returns the message: Cannot purge data when concurrent clone is in progress. Try later. This block is a built-in safety rule inside the storage engine. It protects your backup and replica data from getting corrupted while files copy over t

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You see mysql error 3804 when you try to purge page tracking data during a clone job. Wait for the active clone job to finish, then run the purge action again.

MySQL uses the symbol ER_PAGE_TRACKING_CANNOT_PURGE and SQLSTATE HY000 for this failure. The engine returns the message: Cannot purge data when concurrent clone is in progress. Try later. This block is a built-in safety rule inside the storage engine. It protects your backup and replica data from getting corrupted while files copy over the network.

What causes mysql error 3804 in the storage engine

MySQL tracks modified data pages so backup tools can run fast incremental copies. The storage engine records every changed page ID in a dedicated tracking log. Meanwhile, the clone plugin copies physical data pages from a donor server to a recipient. During a clone job, the plugin relies on page tracking to catch new writes.

If an admin or backup script tries to purge tracking logs, the engine blocks it. Purging those logs during a clone would erase the list of changed pages. The recipient server would miss recent writes and end up with broken data. So, MySQL halts the purge request and throws mysql error 3804 to protect the clone.

This conflict often happens when automated backup jobs overlap with replica provisioning. A cron job might try to clean up old tracking data on a set schedule. At the same time, an operator or scaling script might spin up a new replica. When both actions hit the donor node at once, the purge request fails.

How to check and fix the failure in production

First, check the status of active clone tasks on the donor database server. You can query the performance schema tables that monitor current clone progress and state. Look for any clone process that is still copying data pages or waiting on network transfer. Do not kill the clone process just to force a log purge.

Wait for the clone state to show that the transfer is complete. Once the clone finishes, the engine releases its lock on the page tracking system. You can then run the purge request again, and it will succeed right away. The engine will clear out the old tracking files and free up disk space.

MySQL Access Governance + Data Lineage Tracking: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If a clone job is stuck due to a dropped network link, verify the recipient host. Wait for the database timeout to clear the dead clone task before purging. Never grant broad superuser permissions to backup scripts to bypass engine locks. Keep backup roles restricted to only the permissions needed for tracking and reading data.

How to prevent clone and backup conflicts

You can stop this error from coming back by spacing out your maintenance tasks. Check your backup schedules and see when incremental page tracking cleanups run. Make sure your team does not trigger manual clone jobs during those cleanup windows. If you use auto-scaling scripts, add a check for active backup locks before cloning.

Goodretry logic in your backup tool also solves the problem without manual work. Set up your cleanup script to catch error code 3804 and pause for a few minutes. After the wait, the script can check the clone status and try the purge again. This simple pause keeps your logs clean while letting new replicas build safely.

Check MySQL queries and results on the wire

MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.

Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.

Frequently asked questions

Does mysql error 3804 mean my database is corrupted?

No, this error does not mean your data is broken. The engine blocked a cleanup task to keep an active clone job safe and consistent.

Will stopping the page tracking purge hurt my active queries?

No, regular read and write queries from your app will keep running fine. The failed purge only leaves a few tracking files on disk until you try again.

How long should I wait before trying the purge again?

Wait until the active clone operation finishes copying all data to the new server. Check the clone status table in the performance schema to see when it completes.

The query runs. The emails stay hidden.